package com.hfkj.dao;

import com.hfkj.entity.GoodsMsg;
import com.hfkj.entity.GoodsMsgExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;

/**
 * 
 * 代码由工具生成,请勿修改!!!
 * 如果需要扩展请在其父类进行扩展
 * 
 **/
@Repository
public interface GoodsMsgMapper extends GoodsMsgMapperExt {
    @SelectProvider(type=GoodsMsgSqlProvider.class, method="countByExample")
    long countByExample(GoodsMsgExample example);

    @DeleteProvider(type=GoodsMsgSqlProvider.class, method="deleteByExample")
    int deleteByExample(GoodsMsgExample example);

    @Delete({
        "delete from goods_msg",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into goods_msg (goods_type, goods_type_name, ",
        "goods_type_parent, goods_type_parent_name, ",
        "sale_num, `type`, goods_brand_name, ",
        "goods_brand, goods_label, ",
        "goods_explain, title, ",
        "list_img, banner_img, ",
        "detail_img, `status`, ",
        "create_time, update_time, ",
        "mer_id, mer_name, ext_1, ",
        "ext_2, ext_3)",
        "values (#{goodsType,jdbcType=BIGINT}, #{goodsTypeName,jdbcType=VARCHAR}, ",
        "#{goodsTypeParent,jdbcType=BIGINT}, #{goodsTypeParentName,jdbcType=VARCHAR}, ",
        "#{saleNum,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{goodsBrandName,jdbcType=VARCHAR}, ",
        "#{goodsBrand,jdbcType=BIGINT}, #{goodsLabel,jdbcType=VARCHAR}, ",
        "#{goodsExplain,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, ",
        "#{listImg,jdbcType=VARCHAR}, #{bannerImg,jdbcType=VARCHAR}, ",
        "#{detailImg,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
        "#{merId,jdbcType=BIGINT}, #{merName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
        "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(GoodsMsg record);

    @InsertProvider(type=GoodsMsgSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insertSelective(GoodsMsg record);

    @SelectProvider(type=GoodsMsgSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="goods_type", property="goodsType", jdbcType=JdbcType.BIGINT),
        @Result(column="goods_type_name", property="goodsTypeName", jdbcType=JdbcType.VARCHAR),
        @Result(column="goods_type_parent", property="goodsTypeParent", jdbcType=JdbcType.BIGINT),
        @Result(column="goods_type_parent_name", property="goodsTypeParentName", jdbcType=JdbcType.VARCHAR),
        @Result(column="sale_num", property="saleNum", jdbcType=JdbcType.INTEGER),
        @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
        @Result(column="goods_brand_name", property="goodsBrandName", jdbcType=JdbcType.VARCHAR),
        @Result(column="goods_brand", property="goodsBrand", jdbcType=JdbcType.BIGINT),
        @Result(column="goods_label", property="goodsLabel", jdbcType=JdbcType.VARCHAR),
        @Result(column="goods_explain", property="goodsExplain", jdbcType=JdbcType.VARCHAR),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="list_img", property="listImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="banner_img", property="bannerImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="detail_img", property="detailImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT),
        @Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
    })
    List<GoodsMsg> selectByExample(GoodsMsgExample example);

    @Select({
        "select",
        "id, goods_type, goods_type_name, goods_type_parent, goods_type_parent_name, ",
        "sale_num, `type`, goods_brand_name, goods_brand, goods_label, goods_explain, ",
        "title, list_img, banner_img, detail_img, `status`, create_time, update_time, ",
        "mer_id, mer_name, ext_1, ext_2, ext_3",
        "from goods_msg",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="goods_type", property="goodsType", jdbcType=JdbcType.BIGINT),
        @Result(column="goods_type_name", property="goodsTypeName", jdbcType=JdbcType.VARCHAR),
        @Result(column="goods_type_parent", property="goodsTypeParent", jdbcType=JdbcType.BIGINT),
        @Result(column="goods_type_parent_name", property="goodsTypeParentName", jdbcType=JdbcType.VARCHAR),
        @Result(column="sale_num", property="saleNum", jdbcType=JdbcType.INTEGER),
        @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
        @Result(column="goods_brand_name", property="goodsBrandName", jdbcType=JdbcType.VARCHAR),
        @Result(column="goods_brand", property="goodsBrand", jdbcType=JdbcType.BIGINT),
        @Result(column="goods_label", property="goodsLabel", jdbcType=JdbcType.VARCHAR),
        @Result(column="goods_explain", property="goodsExplain", jdbcType=JdbcType.VARCHAR),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="list_img", property="listImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="banner_img", property="bannerImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="detail_img", property="detailImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT),
        @Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
    })
    GoodsMsg selectByPrimaryKey(Long id);

    @UpdateProvider(type=GoodsMsgSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") GoodsMsg record, @Param("example") GoodsMsgExample example);

    @UpdateProvider(type=GoodsMsgSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") GoodsMsg record, @Param("example") GoodsMsgExample example);

    @UpdateProvider(type=GoodsMsgSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(GoodsMsg record);

    @Update({
        "update goods_msg",
        "set goods_type = #{goodsType,jdbcType=BIGINT},",
          "goods_type_name = #{goodsTypeName,jdbcType=VARCHAR},",
          "goods_type_parent = #{goodsTypeParent,jdbcType=BIGINT},",
          "goods_type_parent_name = #{goodsTypeParentName,jdbcType=VARCHAR},",
          "sale_num = #{saleNum,jdbcType=INTEGER},",
          "`type` = #{type,jdbcType=INTEGER},",
          "goods_brand_name = #{goodsBrandName,jdbcType=VARCHAR},",
          "goods_brand = #{goodsBrand,jdbcType=BIGINT},",
          "goods_label = #{goodsLabel,jdbcType=VARCHAR},",
          "goods_explain = #{goodsExplain,jdbcType=VARCHAR},",
          "title = #{title,jdbcType=VARCHAR},",
          "list_img = #{listImg,jdbcType=VARCHAR},",
          "banner_img = #{bannerImg,jdbcType=VARCHAR},",
          "detail_img = #{detailImg,jdbcType=VARCHAR},",
          "`status` = #{status,jdbcType=INTEGER},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "mer_id = #{merId,jdbcType=BIGINT},",
          "mer_name = #{merName,jdbcType=VARCHAR},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(GoodsMsg record);
}