admin
2019-11-23 51a4ff5d777028d52a19c314a99f796334cb7b51
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 
<mapper namespace="com.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsMapper">
    <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.shop.BanLiShopGoods">
        <id column="sg_id" property="id" jdbcType="BIGINT" />
        <result column="sg_title" property="title" jdbcType="VARCHAR" />
        <result column="sg_sales_count" property="salesCount" jdbcType="BIGINT" />
        <result column="sg_picture" property="picture" jdbcType="VARCHAR" />
        <result column="sg_desc" property="desc" jdbcType="VARCHAR" />
        <result column="sg_charge_type" property="chargeType" jdbcType="VARCHAR" />
        <result column="sg_state" property="state" jdbcType="INTEGER" />
        <result column="sg_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="sg_update_time" property="updateTime" jdbcType="TIMESTAMP" />
        <result column="sg_weight" property="weight" jdbcType="INTEGER" />
        <result column="so_square_picture" property="squarePicture"
            jdbcType="VARCHAR" />
        <association property="goodsClass" column="sg_class_id"
            javaType="com.yeshi.fanli.entity.shop.BanLiShopGoodsClass">
            <id column="sg_class_id" property="id" jdbcType="BIGINT" />
        </association>
    </resultMap>
    <resultMap id="BaseResultDetailMap" type="com.yeshi.fanli.entity.shop.BanLiShopGoods">
        <id column="sg_id" property="id" jdbcType="BIGINT" />
        <result column="sg_title" property="title" jdbcType="VARCHAR" />
        <result column="sg_sales_count" property="salesCount" jdbcType="BIGINT" />
        <result column="sg_picture" property="picture" jdbcType="VARCHAR" />
        <result column="sg_desc" property="desc" jdbcType="VARCHAR" />
        <result column="sg_charge_type" property="chargeType" jdbcType="VARCHAR" />
        <result column="sg_state" property="state" jdbcType="INTEGER" />
        <result column="sg_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="sg_update_time" property="updateTime" jdbcType="TIMESTAMP" />
        <result column="sg_weight" property="weight" jdbcType="INTEGER" />
        <result column="so_square_picture" property="squarePicture"
            jdbcType="VARCHAR" />
        <association property="goodsClass" column="sg_class_id"
            javaType="com.yeshi.fanli.entity.shop.BanLiShopGoodsClass"
            select="com.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsClassMapper.selectByPrimaryKey" />
        <collection property="setsList" column="sg_id"
            select="com.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsSetsMapper.listDetailByGoodsId" />
        <collection property="imgList" column="sg_id"
            select="com.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsImgMapper.listByGoodsId" />
    </resultMap>
    <sql id="Base_Column_List">sg_id,sg_title,sg_class_id,sg_sales_count,sg_picture,sg_desc,sg_charge_type,sg_state,sg_create_time,sg_update_time,sg_weight,so_square_picture
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_shop_goods where sg_id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectDetailByPrimaryKey" resultMap="BaseResultDetailMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_shop_goods where sg_id = #{0}
    </select>
    <select id="listGoods" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_shop_goods where 1=1
        <if test="key != null and key != ''">
            and sg_title like '%${key}%'
        </if>
        <if test="state!=null">and sg_state=#{state}</if>
        order by sg_weight desc limit #{start},#{count}
    </select>
    <select id="countGoods" resultType="java.lang.Long">
        select count(*) from yeshi_ec_shop_goods where 1=1 
        <if test="key != null and key != ''">
            and sg_title like '%${key}%'
        </if>
        <if test="state!=null">and sg_state=#{state}</if>
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_shop_goods where sg_id = #{id,jdbcType=BIGINT}</delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoods"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_shop_goods
        (sg_id,sg_title,sg_class_id,sg_sales_count,sg_picture,sg_desc,sg_charge_type,sg_state,sg_create_time,sg_update_time,sg_weight,so_square_picture)
        values
        (#{id,jdbcType=BIGINT},#{title,jdbcType=VARCHAR},#{goodsClass.id,jdbcType=BIGINT},#{salesCount,jdbcType=BIGINT},#{picture,jdbcType=VARCHAR},#{desc,jdbcType=VARCHAR},#{chargeType,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{weight,jdbcType=INTEGER},#{squarePicture,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoods"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_shop_goods
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">sg_id,</if>
            <if test="title != null">sg_title,</if>
            <if test="goodsClass != null">sg_class_id,</if>
            <if test="salesCount != null">sg_sales_count,</if>
            <if test="picture != null">sg_picture,</if>
            <if test="desc != null">sg_desc,</if>
            <if test="chargeType != null">sg_charge_type,</if>
            <if test="state != null">sg_state,</if>
            <if test="createTime != null">sg_create_time,</if>
            <if test="updateTime != null">sg_update_time,</if>
            <if test="weight != null">sg_weight,</if>
            <if test="squarePicture != null">so_square_picture,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="title != null">#{title,jdbcType=VARCHAR},</if>
            <if test="goodsClass != null">#{goodsClass.id,jdbcType=BIGINT},</if>
            <if test="salesCount != null">#{salesCount,jdbcType=BIGINT},</if>
            <if test="picture != null">#{picture,jdbcType=VARCHAR},</if>
            <if test="desc != null">#{desc,jdbcType=VARCHAR},</if>
            <if test="chargeType != null">#{chargeType,jdbcType=VARCHAR},</if>
            <if test="state != null">#{state,jdbcType=INTEGER},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="weight != null">#{weight,jdbcType=INTEGER}</if>
            <if test="squarePicture != null">#{squarePicture,jdbcType=VARCHAR}</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoods">update
        yeshi_ec_shop_goods set sg_title =
        #{title,jdbcType=VARCHAR},sg_class_id =
        #{goodsClass.id,jdbcType=BIGINT},sg_sales_count =
        #{salesCount,jdbcType=BIGINT},sg_picture =
        #{picture,jdbcType=VARCHAR},sg_desc =
        #{desc,jdbcType=VARCHAR},sg_charge_type =
        #{chargeType,jdbcType=VARCHAR},sg_state =
        #{state,jdbcType=INTEGER},sg_create_time =
        #{createTime,jdbcType=TIMESTAMP},sg_update_time =
        #{updateTime,jdbcType=TIMESTAMP} ,sg_weight
        =#{weight,jdbcType=INTEGER} ,so_square_picture
        =#{squarePicture,jdbcType=VARCHAR} where sg_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoods">
        update yeshi_ec_shop_goods
        <set>
            <if test="title != null">sg_title=#{title,jdbcType=VARCHAR},</if>
            <if test="goodsClass != null">sg_class_id=#{goodsClass.id,jdbcType=BIGINT},</if>
            <if test="salesCount != null">sg_sales_count=#{salesCount,jdbcType=BIGINT},</if>
            <if test="picture != null">sg_picture=#{picture,jdbcType=VARCHAR},</if>
            <if test="desc != null">sg_desc=#{desc,jdbcType=VARCHAR},</if>
            <if test="chargeType != null">sg_charge_type=#{chargeType,jdbcType=VARCHAR},</if>
            <if test="state != null">sg_state=#{state,jdbcType=INTEGER},</if>
            <if test="createTime != null">sg_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">sg_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="weight !=null">sg_weight =#{weight,jdbcType=INTEGER},</if>
            <if test="squarePicture !=null">so_square_picture =#{squarePicture,jdbcType=VARCHAR},
            </if>
        </set>
        where sg_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>