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
<?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.help.HelpClassMapper">
   <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.help.HelpClass">
    <id column="hc_id" property="id" jdbcType="BIGINT"/>
    <result column="hc_name" property="name" jdbcType="VARCHAR"/>
    <result column="hc_picture" property="picture" jdbcType="VARCHAR"/>
    <result column="hc_sort" property="sort" jdbcType="INTEGER"/>
    <result column="hc_show_state" property="showState" jdbcType="INTEGER"/>
    <result column="hc_start_time" property="startTime" jdbcType="TIMESTAMP"/>
    <result column="hc_end_time" property="endTime" jdbcType="TIMESTAMP"/>
    <result column="hc_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="hc_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <sql id="Base_Column_List">hc_id,hc_name,hc_picture,hc_sort,hc_show_state,hc_start_time,hc_end_time,hc_create_time,hc_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_help_class where hc_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_help_class where hc_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.help.HelpClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_help_class (hc_id,hc_name,hc_picture,hc_sort,hc_show_state,hc_start_time,hc_end_time,hc_create_time,hc_update_time) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{sort,jdbcType=INTEGER},#{showState,jdbcType=INTEGER},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.help.HelpClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_help_class
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">hc_id,</if>
      <if test="name != null">hc_name,</if>
      <if test="picture != null">hc_picture,</if>
      <if test="sort != null">hc_sort,</if>
      <if test="showState != null">hc_show_state,</if>
      <if test="startTime != null">hc_start_time,</if>
      <if test="endTime != null">hc_end_time,</if>
      <if test="createTime != null">hc_create_time,</if>
      <if test="updateTime != null">hc_update_time,</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="picture != null">#{picture,jdbcType=VARCHAR},</if>
      <if test="sort != null">#{sort,jdbcType=INTEGER},</if>
      <if test="showState != null">#{showState,jdbcType=INTEGER},</if>
      <if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if>
      <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</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.help.HelpClass">update yeshi_ec_help_class set hc_name = #{name,jdbcType=VARCHAR},hc_picture = #{picture,jdbcType=VARCHAR},hc_sort = #{sort,jdbcType=INTEGER},hc_show_state = #{showState,jdbcType=INTEGER},hc_start_time = #{startTime,jdbcType=TIMESTAMP},hc_end_time = #{endTime,jdbcType=TIMESTAMP},hc_create_time = #{createTime,jdbcType=TIMESTAMP},hc_update_time = #{updateTime,jdbcType=TIMESTAMP} where hc_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.help.HelpClass">update yeshi_ec_help_class
    <set>
      <if test="name != null">hc_name=#{name,jdbcType=VARCHAR},</if>
      <if test="picture != null">hc_picture=#{picture,jdbcType=VARCHAR},</if>
      <if test="sort != null">hc_sort=#{sort,jdbcType=INTEGER},</if>
      <if test="showState != null">hc_show_state=#{showState,jdbcType=INTEGER},</if>
      <if test="startTime != null">hc_start_time=#{startTime,jdbcType=TIMESTAMP},</if>
      <if test="endTime != null">hc_end_time=#{endTime,jdbcType=TIMESTAMP},</if>
      <if test="createTime != null">hc_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">hc_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where hc_id = #{id,jdbcType=BIGINT}
  </update>
  
   <delete id="deleteByPrimaryKeyBatch" parameterType="java.util.List">
    delete from yeshi_ec_help_class WHERE hc_id in
    <foreach collection="list" item="item" open="(" close=")"
        separator=",">#{item}</foreach>
   </delete>
  
   <select id="listQuery" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />  FROM yeshi_ec_help_class
        WHERE 1=1
           <if test='key != null and key != ""'>
                  AND (hc_name like '%${key}%') 
           </if>
           <if test='state != null'>
                  AND hc_show_state = #{state}
           </if>
           ORDER BY hc_sort 
        LIMIT ${start},${count}
   </select>
   
   <select id="countQuery" resultType="java.lang.Long">
        SELECT IFNULL(count(hc_id),0)  FROM yeshi_ec_help_class 
        WHERE 1=1
           <if test='key != null and key != ""'>
                  AND (hc_name like '%${key}%') 
           </if>
           <if test='state != null'>
                  AND hc_show_state = #{state}
           </if>
    </select>
  
   <select id="getMaxOrder" resultType="java.lang.Integer">
        SELECT IFNULL(MAX(hc_sort),0) FROM yeshi_ec_help_class limit 1
   </select>
  
   <select id="getChangeOrder" resultMap="BaseResultMap">
        SELECT  <include refid="Base_Column_List" /> FROM yeshi_ec_help_class
        WHERE 1=1
        <if test="type == -1">
            <![CDATA[and hc_sort < #{sort}]]>  
            order by hc_sort desc
        </if>
        
        <if test="type == 1">
            <![CDATA[and hc_sort > #{sort} ]]>  
            order by hc_sort 
        </if>
        limit 1
   </select>
   
   <select id="getClassByState" resultMap="BaseResultMap">
        SELECT hc_id,hc_name,hc_picture FROM yeshi_ec_help_class
        WHERE  hc_show_state = #{state}  
            AND IF(hc_start_time IS NULL,TRUE, hc_start_time<![CDATA[<=]]>NOW())
              AND IF(hc_end_time IS NULL,TRUE, hc_end_time >=NOW())
           ORDER BY hc_sort 
   </select>
   
    <select id="getProvidedClass" resultMap="BaseResultMap">
        SELECT hc_id,hc_name,hc_picture  FROM yeshi_ec_help_class
           ORDER BY hc_sort 
   </select>
   
</mapper>