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
<?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.BanLiShopGoodsImgMapper">
    <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.shop.BanLiShopGoodsImg">
        <id column="sgi_id" property="id" jdbcType="BIGINT" />
        <result column="sgi_url" property="url" jdbcType="VARCHAR" />
        <result column="sgi_url_md5" property="urlMD5" jdbcType="VARCHAR" />
        <result column="sgi_create_time" property="createTime"
            jdbcType="TIMESTAMP" />
        <result column="sgi_weight" property="weight" jdbcType="INTEGER" />
        <association property="goods" column="sgi_goods_id"
            javaType="com.yeshi.fanli.entity.shop.BanLiShopGoods">
            <id column="sgi_goods_id" property="id" jdbcType="BIGINT" />
        </association>
 
    </resultMap>
    <sql id="Base_Column_List">sgi_id,sgi_goods_id,sgi_url,sgi_url_md5,sgi_create_time,sgi_weight
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_shop_goods_imgs where sgi_id = #{id,jdbcType=BIGINT}
    </select>
    <select id="listByGoodsId" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_shop_goods_imgs where sgi_goods_id = #{0}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_shop_goods_imgs where sgi_id = #{id,jdbcType=BIGINT}</delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsImg"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_shop_goods_imgs
        (sgi_id,sgi_goods_id,sgi_url,sgi_url_md5,sgi_create_time,sgi_weight)
        values
        (#{id,jdbcType=BIGINT},#{goods.id,jdbcType=BIGINT},#{url,jdbcType=VARCHAR},#{urlMD5,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{weight,jdbcType=INTEGER})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsImg"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_shop_goods_imgs
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">sgi_id,</if>
            <if test="goods != null">sgi_goods_id,</if>
            <if test="url != null">sgi_url,</if>
            <if test="urlMD5 != null">sgi_url_md5,</if>
            <if test="createTime != null">sgi_create_time,</if>
            <if test="weight != null">sgi_weight,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="goods != null">#{goods.id,jdbcType=BIGINT},</if>
            <if test="url != null">#{url,jdbcType=VARCHAR},</if>
            <if test="urlMD5 != null">#{urlMD5,jdbcType=VARCHAR},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="weight != null">#{weight,jdbcType=INTEGER}</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsImg">update
        yeshi_ec_shop_goods_imgs set sgi_goods_id =
        #{goods.id,jdbcType=BIGINT},sgi_url =
        #{url,jdbcType=VARCHAR},sgi_url_md5 =
        #{urlMD5,jdbcType=VARCHAR},sgi_create_time =
        #{createTime,jdbcType=TIMESTAMP} ,sgi_weight
        =#{weight,jdbcType=INTEGER} where sgi_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsImg">
        update yeshi_ec_shop_goods_imgs
        <set>
            <if test="goods != null">sgi_goods_id=#{goods.id,jdbcType=BIGINT},</if>
            <if test="url != null">sgi_url=#{url,jdbcType=VARCHAR},</if>
            <if test="urlMD5 != null">sgi_url_md5=#{urlMD5,jdbcType=VARCHAR},</if>
            <if test="createTime != null">sgi_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="weight !=null">sgi_weight =#{weight,jdbcType=INTEGER},</if>
        </set>
        where sgi_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>