<?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.ruoyi.project.asset.mapper.TLeakagePointsPatrolMapper">
    
    <resultMap type="TLeakagePointsPatrol" id="TLeakagePointsPatrolResult">
        <result property="id"    column="id"    />
        <result property="teamM"    column="team_m"    />
        <result property="checkDateM"    column="check_date_m"    />
        <result property="signM"    column="sign_m"    />
        <result property="teamN"    column="team_n"    />
        <result property="checkDateN"    column="check_date_n"    />
        <result property="signN"    column="sign_n"    />
        <result property="remarks"    column="remarks"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createrCode"    column="creater_code"    />
        <result property="createdate"    column="createdate"    />
        <result property="updaterCode"    column="updater_code"    />
        <result property="updatedate"    column="updatedate"    />
        <result property="deptId"    column="dept_id"    />
    </resultMap>

    <sql id="selectTLeakagePointsPatrolVo">
        select id, team_m, check_date_m, sign_m, team_n, check_date_n, sign_n, remarks, del_flag, creater_code, createdate, updater_code, updatedate, dept_id from t_leakage_points_patrol
    </sql>

    <select id="selectTLeakagePointsPatrolList" parameterType="TLeakagePointsPatrol" resultMap="TLeakagePointsPatrolResult">
        <include refid="selectTLeakagePointsPatrolVo"/>
        <where>  
            <if test="teamM != null  and teamM != ''"> and team_m = #{teamM}</if>
            <if test="checkDateM != null "> and date_format(check_date_m,'%y-%m-%d') = date_format(#{checkDateM},'%y-%m-%d')</if>
            <if test="signM != null  and signM != ''"> and sign_m = #{signM}</if>
            <if test="teamN != null  and teamN != ''"> and team_n = #{teamN}</if>
            <if test="checkDateN != null "> and date_format(check_date_n,'%y-%m-%d') = date_format(#{checkDateN},'%y-%m-%d')</if>
            <if test="signN != null  and signN != ''"> and sign_n = #{signN}</if>
            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
            <if test="createrCode != null  and createrCode != ''"> and creater_code = #{createrCode}</if>
            <if test="createdate != null "> and createdate = #{createdate}</if>
            <if test="updaterCode != null  and updaterCode != ''"> and updater_code = #{updaterCode}</if>
            <if test="updatedate != null "> and updatedate = #{updatedate}</if>
            <if test="deptId != null "> and dept_id = #{deptId}</if>
        </where>
    </select>
    
    <select id="selectTLeakagePointsPatrolById" parameterType="Long" resultMap="TLeakagePointsPatrolResult">
        <include refid="selectTLeakagePointsPatrolVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTLeakagePointsPatrol" parameterType="TLeakagePointsPatrol" useGeneratedKeys="true" keyProperty="id">
        insert into t_leakage_points_patrol
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="teamM != null">team_m,</if>
            <if test="checkDateM != null">check_date_m,</if>
            <if test="signM != null">sign_m,</if>
            <if test="teamN != null">team_n,</if>
            <if test="checkDateN != null">check_date_n,</if>
            <if test="signN != null">sign_n,</if>
            <if test="remarks != null">remarks,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createrCode != null">creater_code,</if>
            <if test="createdate != null">createdate,</if>
            <if test="updaterCode != null">updater_code,</if>
            <if test="updatedate != null">updatedate,</if>
            <if test="deptId != null">dept_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="teamM != null">#{teamM},</if>
            <if test="checkDateM != null">#{checkDateM},</if>
            <if test="signM != null">#{signM},</if>
            <if test="teamN != null">#{teamN},</if>
            <if test="checkDateN != null">#{checkDateN},</if>
            <if test="signN != null">#{signN},</if>
            <if test="remarks != null">#{remarks},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createrCode != null">#{createrCode},</if>
            <if test="createdate != null">#{createdate},</if>
            <if test="updaterCode != null">#{updaterCode},</if>
            <if test="updatedate != null">#{updatedate},</if>
            <if test="deptId != null">#{deptId},</if>
         </trim>
    </insert>

    <update id="updateTLeakagePointsPatrol" parameterType="TLeakagePointsPatrol">
        update t_leakage_points_patrol
        <trim prefix="SET" suffixOverrides=",">
            <if test="teamM != null">team_m = #{teamM},</if>
            <if test="checkDateM != null">check_date_m = #{checkDateM},</if>
            <if test="signM != null">sign_m = #{signM},</if>
            <if test="teamN != null">team_n = #{teamN},</if>
            <if test="checkDateN != null">check_date_n = #{checkDateN},</if>
            <if test="signN != null">sign_n = #{signN},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createrCode != null">creater_code = #{createrCode},</if>
            <if test="createdate != null">createdate = #{createdate},</if>
            <if test="updaterCode != null">updater_code = #{updaterCode},</if>
            <if test="updatedate != null">updatedate = #{updatedate},</if>
            <if test="deptId != null">dept_id = #{deptId},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTLeakagePointsPatrolById" parameterType="Long">
        delete from t_leakage_points_patrol where id = #{id}
    </delete>

    <delete id="deleteTLeakagePointsPatrolByIds" parameterType="String">
        delete from t_leakage_points_patrol where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>