liuxiaolong
2019-05-09 0d1d88cdb668e75ea8609417ac18ae19947e9525
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
<?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="cn.com.basic.security.entity.SeDuty">
    <resultMap id="BaseResultMap" type="cn.com.basic.security.entity.SeDuty">
        <id column="id" property="id" jdbcType="VARCHAR" />
        <result column="content" property="content" jdbcType="VARCHAR" />
        <result column="starttime" property="starttime" jdbcType="VARCHAR" />
        <result column="endtime" property="endtime" jdbcType="VARCHAR" />
        <result column="color" property="color" jdbcType="VARCHAR" />
        <result column="userid" property="userid" jdbcType="VARCHAR" />
        <result column="is_valid" property="isValid" jdbcType="TINYINT" />
        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
        <result column="update_user_id" property="updateUserId" jdbcType="VARCHAR" />
        <result column="allday" property="allday" jdbcType="VARCHAR" />
        <result column="personnelid" property="personnelid" jdbcType="VARCHAR" />
    </resultMap>
 
    <sql id="Base_Column_List">
        id, content, starttime, endtime, color, userid,is_valid , update_time ,
        update_user_id,allday,personnelid
    </sql>
 
    <select id="selectById" resultMap="BaseResultMap" parameterType="java.lang.String">
        select
        <include refid="Base_Column_List" />
        from se_duty
        where id = #{id,jdbcType=VARCHAR}
    </select>
 
    <select id="selectAll" resultType="cn.com.basic.security.entity.SeDuty"
        parameterType="cn.com.basic.security.entity.SeDuty">
        select
        d.id, d.content, d.starttime, d.endtime, d.color, d.userid, p.name username
        from se_duty d
        join se_personnel p on d.personnelid = p.id where d.is_valid = 1
        order by starttime desc
    </select>
 
    <select id="select" resultType="cn.com.basic.security.entity.SeDuty"
        parameterType="cn.com.basic.security.entity.SeDuty">
        select
        d.id, d.content, d.starttime, d.endtime, d.color, d.userid, p.name
        username,d.allday
        from se_duty d
        join se_personnel p on d.personnelid = p.id where 1 = 1
        <if test="isValid != null">
            and d.is_valid = #{isValid,jdbcType=TINYINT}
        </if>
        order by starttime desc
    </select>
 
    <delete id="deleteById" parameterType="java.lang.String">
        delete from se_duty
        where id = #{id,jdbcType=VARCHAR}
    </delete>
 
    <insert id="insert" parameterType="cn.com.basic.security.entity.SeDuty">
        insert into se_duty (id, content, starttime,
        endtime, color, userid,is_valid,update_time,update_user_id,allday
        ,personnelid)
        values (#{id,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR},
        #{starttime,jdbcType=VARCHAR},
        #{endtime,jdbcType=VARCHAR}, #{color,jdbcType=VARCHAR}, #{userid,jdbcType=VARCHAR},#{isValid,jdbcType=TINYINT},#{updateTime,jdbcType=TIMESTAMP},
        #{updateUserId,jdbcType=VARCHAR},#{allday,jdbcType=VARCHAR},#{personnelid,jdbcType=VARCHAR}
        )
    </insert>
 
    <update id="updateByIdSelective" parameterType="cn.com.basic.security.entity.SeDuty">
        update se_duty
        <set>
            <if test="content != null">
                content = #{content,jdbcType=VARCHAR},
            </if>
            <if test="starttime != null">
                starttime = #{starttime,jdbcType=VARCHAR},
            </if>
            <if test="endtime != null">
                endtime = #{endtime,jdbcType=VARCHAR},
            </if>
            <if test="color != null">
                color = #{color,jdbcType=VARCHAR},
            </if>
            <if test="userid != null">
                userid = #{userid,jdbcType=VARCHAR},
            </if>
            <if test="allday != null">
                allday = #{allday,jdbcType=VARCHAR},
            </if>
            <if test="isValid != null">
                is_valid = #{isValid,jdbcType=TINYINT},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateUserId != null">
                update_user_id = #{updateUserId,jdbcType=VARCHAR},
            </if>
            <if test="personnelid != null">
                personnelid = #{personnelid,jdbcType=VARCHAR},
            </if>
        </set>
        where id = #{id,jdbcType=VARCHAR}
    </update>
 
    <update id="updateById" parameterType="cn.com.basic.security.entity.SeDuty">
        update se_duty
        set content = #{content,jdbcType=VARCHAR},
        starttime = #{starttime,jdbcType=VARCHAR},
        endtime = #{endtime,jdbcType=VARCHAR},
        color = #{color,jdbcType=VARCHAR},
        userid = #{userid,jdbcType=VARCHAR},
        personnelid = #{personnelid,jdbcType=VARCHAR}
        where id = #{id,jdbcType=VARCHAR}
    </update>
</mapper>