TNfcSettingMapper.xml 6.99 KB
Newer Older
吴卿华's avatar
吴卿华 committed
1 2 3 4 5 6 7
<?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.zehong.system.mapper.TNfcSettingMapper">

    <resultMap type="TNfcSetting" id="TNfcSettingResult">
吴卿华's avatar
吴卿华 committed
8
        <result property="recordId"    column="record_id"    />
吴卿华's avatar
吴卿华 committed
9 10 11 12 13 14 15 16
        <result property="nfcId"    column="nfc_id"    />
        <result property="patrolSort"    column="patrol_sort"    />
        <result property="patrolAddress"    column="patrol_address"    />
        <result property="patrolComent"    column="patrol_coment"    />
        <result property="patrolFrequency"    column="patrol_frequency"    />
        <result property="nfcNum"    column="nfc_num"    />
        <result property="createTime"    column="create_time"    />
        <result property="isDel"    column="is_del"    />
吴卿华's avatar
吴卿华 committed
17
        <result property="region"    column="region"    />
吴卿华's avatar
吴卿华 committed
18 19 20
    </resultMap>

    <sql id="selectTNfcSettingVo">
吴卿华's avatar
吴卿华 committed
21
        select nfc_id, patrol_sort, patrol_address, patrol_coment, patrol_frequency, nfc_num, create_time,region, is_del from t_nfc_setting
吴卿华's avatar
吴卿华 committed
22 23 24
    </sql>

    <select id="selectTNfcSettingList" parameterType="TNfcSetting" resultMap="TNfcSettingResult">
吴卿华's avatar
吴卿华 committed
25 26
        select a.*,b.dict_label as nickName from t_nfc_setting a
        left join  sys_dict_data b on a.region=b.dict_value
吴卿华's avatar
吴卿华 committed
27
        <where>
吴卿华's avatar
吴卿华 committed
28 29
            a.is_del='0' and b.dict_type='t_nfc_region'
            <if test="region != null  and region != ''"> and  region = #{region}</if>
30
            <if test="patrolAddress != null  and patrolAddress != ''"> and patrol_address like concat('%',#{patrolAddress},'%') </if>
吴卿华's avatar
吴卿华 committed
31
            <if test="nfcNum != null  and nfcNum != ''"> and nfc_num = #{nfcNum}</if>
吴卿华's avatar
吴卿华 committed
32 33 34 35 36 37
            <if test="applyWorkStartTime!=null and applyWorkStartTime!=''">
                and a.create_time &gt;= #{applyWorkStartTime}
            </if>
            <if test="applyWorkEndTime!=null and applyWorkEndTime!=''">
               and a.create_time &lt;= #{applyWorkEndTime}
            </if>
吴卿华's avatar
吴卿华 committed
38 39 40 41 42 43 44 45
        </where>
        order  by patrol_sort
    </select>

    <select id="selectTNfcSettingById" parameterType="Long" resultMap="TNfcSettingResult">
        <include refid="selectTNfcSettingVo"/>
        where nfc_id = #{nfcId}
    </select>
zhangjianqian's avatar
zhangjianqian committed
46 47 48 49
    <select id="getInfoByNfcNum" parameterType="java.lang.String" resultMap="TNfcSettingResult">
        <include refid="selectTNfcSettingVo"/>
        where nfc_num = #{nfcNum}
    </select>
吴卿华's avatar
吴卿华 committed
50 51 52 53 54 55 56 57 58 59 60

    <insert id="insertTNfcSetting" parameterType="TNfcSetting" useGeneratedKeys="true" keyProperty="nfcId">
        insert into t_nfc_setting
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="patrolSort != null">patrol_sort,</if>
            <if test="patrolAddress != null">patrol_address,</if>
            <if test="patrolComent != null">patrol_coment,</if>
            <if test="patrolFrequency != null">patrol_frequency,</if>
            <if test="nfcNum != null">nfc_num,</if>
            <if test="createTime != null">create_time,</if>
            <if test="isDel != null">is_del,</if>
吴卿华's avatar
吴卿华 committed
61
            <if test="region != null">region,</if>
吴卿华's avatar
吴卿华 committed
62 63 64 65 66 67 68 69 70
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="patrolSort != null">#{patrolSort},</if>
            <if test="patrolAddress != null">#{patrolAddress},</if>
            <if test="patrolComent != null">#{patrolComent},</if>
            <if test="patrolFrequency != null">#{patrolFrequency},</if>
            <if test="nfcNum != null">#{nfcNum},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="isDel != null">#{isDel},</if>
吴卿华's avatar
吴卿华 committed
71
            <if test="region != null">#{region},</if>
吴卿华's avatar
吴卿华 committed
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
         </trim>
    </insert>

    <update id="updateTNfcSetting" parameterType="TNfcSetting">
        update t_nfc_setting
        <trim prefix="SET" suffixOverrides=",">
            <if test="patrolSort != null">patrol_sort = #{patrolSort},</if>
            <if test="patrolAddress != null">patrol_address = #{patrolAddress},</if>
            <if test="patrolComent != null">patrol_coment = #{patrolComent},</if>
            <if test="patrolFrequency != null">patrol_frequency = #{patrolFrequency},</if>
            <if test="nfcNum != null">nfc_num = #{nfcNum},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="isDel != null">is_del = #{isDel},</if>
        </trim>
        where nfc_id = #{nfcId}
    </update>

    <delete id="deleteTNfcSettingById" parameterType="Long">
        delete from t_nfc_setting where nfc_id = #{nfcId}
    </delete>

吴卿华's avatar
吴卿华 committed
93 94
    <update id="deleteTNfcSettingByIds" parameterType="String">
        update  t_nfc_setting set is_del='1' where nfc_id in
吴卿华's avatar
吴卿华 committed
95 96 97
        <foreach item="nfcId" collection="array" open="(" separator="," close=")">
            #{nfcId}
        </foreach>
吴卿华's avatar
吴卿华 committed
98
    </update>
吴卿华's avatar
吴卿华 committed
99 100 101

    <!--巡检打卡查询列表-->
    <select id="punchClockList" resultType="com.zehong.system.domain.TNfcRecord">
吴卿华's avatar
吴卿华 committed
102
        select a.record_id as recordId,a.is_normal as isNormal,a.remarks as remarks ,a.create_time as createTime,
吴卿华's avatar
吴卿华 committed
103 104 105 106 107 108 109 110
               b.patrol_address as patrolAddress,b.patrol_coment as patrolComent,b.patrol_frequency as patrolFrequency,
			   c.nick_name as nickName,
               d.dict_label as dictLabel
           from t_nfc_record a left join t_nfc_setting b on a.nfc_id=b.nfc_id
		        left join  sys_user  c  on a.create_user=c.user_id
                left join sys_dict_data d on b.region=d.dict_value
        <where>
            b.is_del='0' and d.dict_type='t_nfc_region'
111
            <if test="patrolAddress != null and patrolAddress != ''">
吴卿华's avatar
吴卿华 committed
112 113 114 115 116
                and b.patrol_address like concat('%', #{patrolAddress}, '%')
            </if>
            <if test="region != null and region != ''">
                and b.region=#{region}
            </if>
吴卿华's avatar
吴卿华 committed
117 118 119 120 121 122
            <if test="applyWorkStartTime!=null and applyWorkStartTime!=''">
                and a.create_time &gt;= #{applyWorkStartTime}
            </if>
            <if test="applyWorkEndTime!=null and applyWorkEndTime!=''">
                and a.create_time &lt;= #{applyWorkEndTime}
            </if>
吴卿华's avatar
吴卿华 committed
123 124 125
        </where>
			group by a.create_time desc
    </select>
吴卿华's avatar
吴卿华 committed
126 127 128 129 130

    <!--查询nfc编号是否已经注册-->
    <select id="getNfcNum" resultType="java.lang.Integer">
        select count(nfc_id) from t_nfc_setting  where nfc_num=#{nfcNum}
    </select>
吴卿华's avatar
吴卿华 committed
131 132 133 134 135 136 137 138 139 140 141 142 143 144

    <!--巡检打卡详细信息-->
    <select id="getPunchClockList" resultType="com.zehong.system.domain.TNfcRecord">
        select a.is_normal as isNormal,a.picture,a.remarks as remarks ,a.create_time as createTime,
        b.patrol_address as patrolAddress,b.patrol_coment as patrolComent,b.patrol_frequency as patrolFrequency,
        c.nick_name as nickName,
        d.dict_label as dictLabel
        from t_nfc_record a left join t_nfc_setting b on a.nfc_id=b.nfc_id
        left join  sys_user  c  on a.create_user=c.user_id
        left join sys_dict_data d on b.region=d.dict_value
        where
            b.is_del='0' and d.dict_type='t_nfc_region'
            and a.record_id=#{recordId}
    </select>
吴卿华's avatar
吴卿华 committed
145
</mapper>