admin
2020-05-20 98b1a0affd69bbe63223c21fdd2c404e8bedfccb
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<?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.BanLiShopGoodsSetsMapper">
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.shop.BanLiShopGoodsSets">
        <id column="sgs_id" property="id" jdbcType="BIGINT" />
        <result column="sgs_name" property="name" jdbcType="VARCHAR" />
        <result column="sgs_original_price" property="originalPrice"
            jdbcType="DECIMAL" />
        <result column="sgs_zk_price" property="zkPrice" jdbcType="DECIMAL" />
        <result column="sgs_sales_count" property="salesCount"
            jdbcType="BIGINT" />
        <result column="sgs_stock" property="stock" jdbcType="INTEGER" />
        <result column="sgs_charge_fulu_num" property="chargeFuLuNum"
            jdbcType="VARCHAR" />
        <result column="sgs_create_time" property="createTime"
            jdbcType="TIMESTAMP" />
        <result column="sgs_update_time" property="updateTime"
            jdbcType="TIMESTAMP" />
        <result column="sgs_weight" property="weight" jdbcType="INTEGER" />
        <result column="sgs_sub_name" property="subName" jdbcType="VARCHAR" />
        <result column="sgs_state" property="state" jdbcType="INTEGER" />
        <association property="goods" column="sgs_goods_id"
            javaType="com.yeshi.fanli.entity.shop.BanLiShopGoods">
            <id column="sgs_goods_id" property="id" jdbcType="BIGINT" />
        </association>
 
    </resultMap>
    <resultMap id="BaseResultDetailMap"
        type="com.yeshi.fanli.entity.shop.BanLiShopGoodsSets">
        <id column="sgs_id" property="id" jdbcType="BIGINT" />
        <result column="sgs_name" property="name" jdbcType="VARCHAR" />
        <result column="sgs_original_price" property="originalPrice"
            jdbcType="DECIMAL" />
        <result column="sgs_zk_price" property="zkPrice" jdbcType="DECIMAL" />
        <result column="sgs_sales_count" property="salesCount"
            jdbcType="BIGINT" />
        <result column="sgs_stock" property="stock" jdbcType="INTEGER" />
        <result column="sgs_charge_fulu_num" property="chargeFuLuNum"
            jdbcType="VARCHAR" />
        <result column="sgs_create_time" property="createTime"
            jdbcType="TIMESTAMP" />
        <result column="sgs_update_time" property="updateTime"
            jdbcType="TIMESTAMP" />
        <result column="sgs_weight" property="weight" jdbcType="INTEGER" />
        <result column="sgs_sub_name" property="subName" jdbcType="VARCHAR" />
        <result column="sgs_state" property="state" jdbcType="INTEGER" />
        <association property="goods" column="sgs_goods_id"
            javaType="com.yeshi.fanli.entity.shop.BanLiShopGoods">
            <id column="sgs_goods_id" property="id" jdbcType="BIGINT" />
        </association>
        <collection property="payList" column="sgs_id"
            ofType="com.yeshi.fanli.entity.shop.BanLiShopGoodsSetsPay"
            select="com.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsSetsPayMapper.listByGoodsSetId" />
    </resultMap>
    <sql id="Base_Column_List">sgs_id,sgs_name,sgs_goods_id,sgs_original_price,sgs_zk_price,sgs_sales_count,sgs_stock,sgs_charge_fulu_num,sgs_create_time,sgs_update_time,sgs_weight,sgs_sub_name,sgs_state
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_shop_goods_set where sgs_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_set where sgs_id = #{0}
    </select>
    <select id="listDetailByGoodsId" resultMap="BaseResultDetailMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_shop_goods_set where sgs_goods_id = #{0}
    </select>
    <select id="countByGoodsId" resultType="java.lang.Long"
        parameterType="java.lang.Long">select count(*) from yeshi_ec_shop_goods_set where
        sgs_goods_id = #{0}
    </select>
    <select id="listByGoodsId" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_shop_goods_set where sgs_goods_id = #{0}
    </select>
    
    <select id="listQuery" resultMap="BaseResultMap">
        select    <include refid="Base_Column_List" /> from yeshi_ec_shop_goods_set 
        where 1=1 <if test="key != null and key != ''">AND sgs_name like '%${key}%'</if>
            <if test="goodsId != null">AND sgs_goods_id = #{goodsId}</if>
        order by sgs_weight desc 
        limit #{start},#{count}
    </select>
 
    <select id="countQuery" resultType="java.lang.Long">
        select count(sgs_id) from yeshi_ec_shop_goods_set 
        where 1=1 <if test="key != null and key != ''">AND sgs_name like '%${key}%'</if>
             <if test="goodsId != null">AND sgs_goods_id = #{goodsId}</if>
    </select>
    
    
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_shop_goods_set where sgs_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsSets"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_shop_goods_set
        (sgs_id,sgs_name,sgs_goods_id,sgs_original_price,sgs_zk_price,sgs_sales_count,sgs_stock,sgs_charge_fulu_num,sgs_create_time,sgs_update_time,sgs_weight,sgs_sub_name,sgs_state)
        values
        (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{goods.id,jdbcType=BIGINT},#{originalPrice,jdbcType=DECIMAL},#{zkPrice,jdbcType=DECIMAL},#{salesCount,jdbcType=BIGINT},#{stock,jdbcType=INTEGER},#{chargeFuLuNum,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{weight,jdbcType=INTEGER},#{subName,jdbcType=VARCHAR},#{state,jdbcType=INTEGER})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsSets"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_shop_goods_set
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">sgs_id,</if>
            <if test="name != null">sgs_name,</if>
            <if test="goods != null">sgs_goods_id,</if>
            <if test="originalPrice != null">sgs_original_price,</if>
            <if test="zkPrice != null">sgs_zk_price,</if>
            <if test="salesCount != null">sgs_sales_count,</if>
            <if test="stock != null">sgs_stock,</if>
            <if test="chargeFuLuNum != null">sgs_charge_fulu_num,</if>
            <if test="createTime != null">sgs_create_time,</if>
            <if test="updateTime != null">sgs_update_time,</if>
            <if test="weight != null">sgs_weight,</if>
            <if test="subName != null">sgs_sub_name,</if>
            <if test="state != null">sgs_state,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="name != null">#{name,jdbcType=VARCHAR},</if>
            <if test="goods != null">#{goods.id,jdbcType=BIGINT},</if>
            <if test="originalPrice != null">#{originalPrice,jdbcType=DECIMAL},</if>
            <if test="zkPrice != null">#{zkPrice,jdbcType=DECIMAL},</if>
            <if test="salesCount != null">#{salesCount,jdbcType=BIGINT},</if>
            <if test="stock != null">#{stock,jdbcType=INTEGER},</if>
            <if test="chargeFuLuNum != null">#{chargeFuLuNum,jdbcType=VARCHAR},</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="subName != null">#{subName,jdbcType=VARCHAR},</if>
            <if test="state != null">#{state,jdbcType=INTEGER}</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsSets">update
        yeshi_ec_shop_goods_set set sgs_name =
        #{name,jdbcType=VARCHAR},sgs_goods_id =
        #{goods.id,jdbcType=BIGINT},sgs_original_price =
        #{originalPrice,jdbcType=DECIMAL},sgs_zk_price =
        #{zkPrice,jdbcType=DECIMAL},sgs_sales_count =
        #{salesCount,jdbcType=BIGINT},sgs_stock =
        #{stock,jdbcType=INTEGER},sgs_charge_fulu_num =
        #{chargeFuLuNum,jdbcType=VARCHAR},sgs_create_time =
        #{createTime,jdbcType=TIMESTAMP},sgs_update_time =
        #{updateTime,jdbcType=TIMESTAMP} ,sgs_weight
        =#{weight,jdbcType=INTEGER} ,sgs_sub_name =#{subName,jdbcType=VARCHAR}
        ,sgs_state =#{state,jdbcType=INTEGER} where sgs_id =
        #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsSets">
        update yeshi_ec_shop_goods_set
        <set>
            <if test="name != null">sgs_name=#{name,jdbcType=VARCHAR},</if>
            <if test="goods != null">sgs_goods_id=#{goods.id,jdbcType=BIGINT},</if>
            <if test="originalPrice != null">sgs_original_price=#{originalPrice,jdbcType=DECIMAL},
            </if>
            <if test="zkPrice != null">sgs_zk_price=#{zkPrice,jdbcType=DECIMAL},</if>
            <if test="salesCount != null">sgs_sales_count=#{salesCount,jdbcType=BIGINT},</if>
            <if test="stock != null">sgs_stock=#{stock,jdbcType=INTEGER},</if>
            <if test="chargeFuLuNum != null">sgs_charge_fulu_num=#{chargeFuLuNum,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">sgs_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">sgs_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="weight !=null">sgs_weight =#{weight,jdbcType=INTEGER},</if>
            <if test="subName !=null">sgs_sub_name =#{subName,jdbcType=VARCHAR},</if>
            <if test="state !=null">sgs_state =#{state,jdbcType=INTEGER},</if>
        </set>
        where sgs_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>