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
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
<?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.homemodule.SpecialMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.homemodule.Special">
    <id column="b_id" property="id" jdbcType="BIGINT"/>
    <result column="b_name" property="name" jdbcType="VARCHAR"/>
    <result column="b_card" property="card" jdbcType="VARCHAR"/>
    <result column="b_card_id" property="cardId" jdbcType="BIGINT"/>
    <result column="b_main_picture" property="picture" jdbcType="VARCHAR"/>
    <result column="b_sub_picture" property="subPicture" jdbcType="VARCHAR"/>
    <result column="b_params" property="params" jdbcType="VARCHAR"/>
    <result column="b_orderby" property="orderby" jdbcType="INTEGER"/>
    <result column="b_state" property="state" jdbcType="BIGINT"/>
    <result column="b_show_type" property="showType" jdbcType="VARCHAR"/>
    <result column="b_remark" property="remark" jdbcType="VARCHAR"/>
    <result column="b_createtime" property="createtime" jdbcType="TIMESTAMP"/>
    <result column="b_updatetime" property="updatetime" jdbcType="TIMESTAMP"/>
    <association property="jumpDetail" column="b_jumpid" 
         select="com.yeshi.fanli.dao.mybatis.common.JumpDetailV2Mapper.selectByPrimaryKey"> 
    </association>
  </resultMap>
  <sql id="Base_Column_List">b_id,b_name,b_card,b_card_id,b_main_picture,b_sub_picture,b_jumpid,b_params,b_orderby,b_state,b_show_type,b_remark,b_createtime,b_updatetime</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_special where b_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_special where b_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.homemodule.Special" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_special (b_id,b_name,b_card,b_card_id,b_main_picture,b_sub_picture,b_jumpid,b_params,b_orderby,b_state,b_show_type,b_remark,b_createtime,b_updatetime) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{card,jdbcType=VARCHAR},#{cardId,jdbcType=BIGINT},#{picture,jdbcType=VARCHAR},#{subPicture,jdbcType=VARCHAR},#{jumpDetail.id,jdbcType=BIGINT},#{params,jdbcType=VARCHAR},#{orderby,jdbcType=INTEGER},#{state,jdbcType=BIGINT},#{showType,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR},#{createtime,jdbcType=TIMESTAMP},#{updatetime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.Special" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_special
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">b_id,</if>
      <if test="name != null">b_name,</if>
      <if test="card != null">b_card,</if>
      <if test="cardId != null">b_card_id,</if>
      <if test="picture != null">b_main_picture,</if>
      <if test="subPicture != null">b_sub_picture,</if>
      <if test="jumpDetail != null">b_jumpid,</if>
      <if test="params != null">b_params,</if>
      <if test="orderby != null">b_orderby,</if>
      <if test="state != null">b_state,</if>
      <if test="showType != null">b_show_type,</if>
      <if test="remark != null">b_remark,</if>
      <if test="createtime != null">b_createtime,</if>
      <if test="updatetime != null">b_updatetime,</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="card != null">#{card,jdbcType=VARCHAR},</if>
      <if test="cardId != null">#{cardId,jdbcType=BIGINT},</if>
      <if test="picture != null">#{picture,jdbcType=VARCHAR},</if>
      <if test="subPicture != null">#{subPicture,jdbcType=VARCHAR},</if>
      <if test="jumpDetail != null">#{jumpDetail.id,jdbcType=BIGINT},</if>
      <if test="params != null">#{params,jdbcType=VARCHAR},</if>
      <if test="orderby != null">#{orderby,jdbcType=INTEGER},</if>
      <if test="state != null">#{state,jdbcType=BIGINT},</if>
      <if test="showType != null">#{showType,jdbcType=VARCHAR},</if>
      <if test="remark != null">#{remark,jdbcType=VARCHAR},</if>
      <if test="createtime != null">#{createtime,jdbcType=TIMESTAMP},</if>
      <if test="updatetime != null">#{updatetime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.homemodule.Special">update yeshi_ec_special set b_name = #{name,jdbcType=VARCHAR},b_card = #{card,jdbcType=VARCHAR},b_card_id = #{cardId,jdbcType=BIGINT},b_main_picture = #{picture,jdbcType=VARCHAR},b_sub_picture = #{subPicture,jdbcType=VARCHAR},b_jumpid = #{jumpDetail.id,jdbcType=BIGINT},b_params = #{params,jdbcType=VARCHAR},b_orderby = #{orderby,jdbcType=INTEGER},b_state = #{state,jdbcType=BIGINT},b_show_type = #{showType,jdbcType=VARCHAR},b_remark = #{remark,jdbcType=VARCHAR},b_createtime = #{createtime,jdbcType=TIMESTAMP},b_updatetime = #{updatetime,jdbcType=TIMESTAMP} where b_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.Special">update yeshi_ec_special
    <set>
      <if test="name != null">b_name=#{name,jdbcType=VARCHAR},</if>
      <if test="card != null">b_card=#{card,jdbcType=VARCHAR},</if>
      <if test="cardId != null">b_card_id=#{cardId,jdbcType=BIGINT},</if>
      <if test="picture != null">b_main_picture=#{picture,jdbcType=VARCHAR},</if>
      <if test="subPicture != null">b_sub_picture=#{subPicture,jdbcType=VARCHAR},</if>
      <if test="jumpDetail != null">b_jumpid=#{jumpDetail.id,jdbcType=BIGINT},</if>
      <if test="params != null">b_params=#{params,jdbcType=VARCHAR},</if>
      <if test="orderby != null">b_orderby=#{orderby,jdbcType=INTEGER},</if>
      <if test="state != null">b_state=#{state,jdbcType=BIGINT},</if>
      <if test="showType != null">b_show_type=#{showType,jdbcType=VARCHAR},</if>
      <if test="remark != null">b_remark=#{remark,jdbcType=VARCHAR},</if>
      <if test="createtime != null">b_createtime=#{createtime,jdbcType=TIMESTAMP},</if>
      <if test="updatetime != null">b_updatetime=#{updatetime,jdbcType=TIMESTAMP},</if>
    </set> where b_id = #{id,jdbcType=BIGINT}
  </update>
  
    <delete id="deleteBatchByPrimaryKey" parameterType="java.util.List">
        delete from yeshi_ec_special WHERE b_id in
        <foreach collection="list" item="item" open="(" close=")"
            separator=",">#{item}</foreach>
    </delete>
    
    <delete id="deleteBatchByCardID" parameterType="java.util.List">
        delete from yeshi_ec_special WHERE b_card_id in
        <foreach collection="list" item="item" open="(" close=")"
            separator=",">#{item}</foreach>
    </delete>
  
  <select id="queryByListPrimaryKey" parameterType="java.util.List" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />  FROM yeshi_ec_special
        WHERE b_id in
        <foreach collection="list" item="item" open="(" close=")"
            separator=",">#{item}</foreach>
   </select>
   
   <select id="queryByListCardID" parameterType="java.util.List" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />  FROM yeshi_ec_special
        WHERE b_card_id in
        <foreach collection="list" item="item" open="(" close=")"
            separator=",">#{item}</foreach>
   </select>
   
   <select id="listQueryByCard" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" /> FROM  `yeshi_ec_special` pp 
        WHERE pp.`b_card_id` = #{cardId}
           <if test='key != null and key != ""'>
                  AND b_name like '%${key}%' 
           </if>
        ORDER BY pp.b_orderby 
        LIMIT ${start},${count}
   </select>
   
   <select id="countlistQueryByCard" resultType="java.lang.Long">
        SELECT IFNULL(count(b_id),0) FROM  `yeshi_ec_special` pp 
        WHERE pp.`b_card_id` = #{cardId}
           <if test='key != null and key != ""'>
                  AND b_name like '%${key}%' 
           </if>
   </select>
  
   <select id="getMaxOrderByCard" resultType="java.lang.Integer">
        SELECT IFNULL(MAX(pp.b_orderby),0) FROM yeshi_ec_special pp 
        WHERE pp.`b_card_id` = #{cardId}
   </select>
  
   <select id="getOrderByCardID" resultMap="BaseResultMap">
        SELECT  <include refid="Base_Column_List" /> FROM yeshi_ec_special 
        WHERE b_card_id = #{cardId}
        <if test="type == -1">
            <![CDATA[and b_orderby < #{order}]]>  
            order by b_orderby desc
        </if>
        
        <if test="type == 1">
            <![CDATA[and b_orderby > #{order} ]]>  
            order by b_orderby 
        </if>
   </select>
   
   <select id="listBySystemAndCard" resultMap="BaseResultMap">
        SELECT p.* FROM `yeshi_ec_special` p LEFT JOIN `yeshi_ec_special_card` c ON  p.`b_card_id` = c.`cd_id`
        LEFT JOIN `yeshi_ec_super_special_card` s ON  s.`sp_special_cid` = c.`cd_id`
        WHERE p.`b_state` = 0 AND c.`cd_state` = 0 
              AND c.`cd_card` = #{card} AND s.`sp_system_id` = #{systemId}
        ORDER BY p.`b_orderby`
   </select>
   
</mapper>