yujian
2019-01-22 88b54772dbcf5ecab1e2316e4e4626ac901b8908
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
<?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.activity.RecommendActivityImgMapper">
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.bus.activity.RecommendActivityImg">
        <id column="ai_id" property="id" jdbcType="BIGINT" />
        <result column="ai_img" property="img" jdbcType="VARCHAR" />
        <result column="ai_orderby" property="orderBy" jdbcType="INTEGER" />
        <result column="ai_img_height" property="imgHeight" jdbcType="INTEGER" />
        <result column="ai_img_width" property="imgWidth" jdbcType="INTEGER" />
        <association property="recommendActivity" column="ai_activity_id"
            resultMap="com.yeshi.fanli.dao.mybatis.activity.RecommendActivityMapper.BaseResultMap" />
 
    </resultMap>
    <sql id="Base_Column_List">ai_id,ai_activity_id as
        ar_id,ai_img,ai_orderby,ai_activity_id,ai_img_height,ai_img_width
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_activity_img where ai_id = #{id,jdbcType=BIGINT}
    </select>
    <select id="getImgByActivityId" resultType="java.lang.String"
        parameterType="java.lang.Long">select ai_img from yeshi_ec_activity_img where
        ai_activity_id = #{0} order by ai_orderby
    </select>
    
    <select id="getImgWithAndHeightByActivityId" resultType="java.lang.String"
        parameterType="java.lang.Long">select concat(ai_img_width,'#',ai_img_height) from yeshi_ec_activity_img where
        ai_activity_id = #{0} order by ai_orderby
    </select>
    
    
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_activity_img where ai_id = #{id,jdbcType=BIGINT}
    </delete>
    <delete id="batchDeleteByActivityid" parameterType="int">
        <!-- 批量删除 -->
        delete from yeshi_ec_activity_img where ai_activity_id in
        <foreach item="arids" collection="array" open="(" separator=","
            close=")">#{arids}</foreach>
    </delete>
    <insert id="insert"
        parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivityImg"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_activity_img
        (ai_id,ai_activity_id,ai_img,ai_orderby,ai_img_height,ai_img_width)
        values
        (#{id,jdbcType=BIGINT},#{recommendActivity.id,jdbcType=BIGINT},#{img,jdbcType=VARCHAR},#{orderBy,jdbcType=INTEGER},#{imgHeight,jdbcType=INTEGER},#{imgWidth,jdbcType=INTEGER})
    </insert>
    <insert id="insertSelective"
        parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivityImg"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_activity_img
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">ai_id,</if>
            <if test="recommendActivity != null">ai_activity_id,</if>
            <if test="img != null">ai_img,</if>
            <if test="orderBy != null">ai_orderby,</if>
            <if test="imgHeight != null">ai_img_height,</if>
            <if test="imgWidth != null">ai_img_width,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="recommendActivity != null">#{recommendActivity.id,jdbcType=BIGINT},</if>
            <if test="img != null">#{img,jdbcType=VARCHAR},</if>
            <if test="orderBy != null">#{orderBy,jdbcType=INTEGER},</if>
            <if test="imgHeight != null">#{imgHeight,jdbcType=INTEGER},</if>
            <if test="imgWidth != null">#{imgWidth,jdbcType=INTEGER}</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey"
        parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivityImg">update yeshi_ec_activity_img set ai_activity_id =
        #{recommendActivity.id,jdbcType=BIGINT},ai_img =
        #{img,jdbcType=VARCHAR},ai_orderby = #{orderBy,jdbcType=INTEGER}
        ,ai_img_height =#{imgHeight,jdbcType=INTEGER} ,ai_img_width
        =#{imgWidth,jdbcType=INTEGER} where ai_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective"
        parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivityImg">
        update yeshi_ec_activity_img
        <set>
            <if test="recommendActivity != null">ai_activity_id=#{recommendActivity.id,jdbcType=BIGINT},
            </if>
            <if test="img != null">ai_img=#{img,jdbcType=VARCHAR},</if>
            <if test="orderBy != null">ai_orderby=#{orderBy,jdbcType=INTEGER},</if>
            <if test="id !=null">ai_id =#{id,jdbcType=BIGINT},</if>
            <if test="imgHeight !=null">ai_img_height =#{imgHeight,jdbcType=INTEGER},</if>
            <if test="imgWidth !=null">ai_img_width =#{imgWidth,jdbcType=INTEGER},</if>
        </set>
        where ai_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>