<?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="SDtpSjdcQualityInspectionTaskMapper" >
    <!-- 通用查询映射结果 -->

    <select id="selectSDtpSjdcQualityInspectionTaskList" parameterType="pd" resultType="pd">
        select * from s_dtp_sjdc_quality_inspection_task where 1=1
        <if test="id !=null and id !='' ">
            and id = #{id}
        </if>
        <if test="chainId !=null and chainId !='' ">
            and chainId = #{chainId}
        </if>
        <if test="chainName !=null and chainName !='' ">
            and chainName = #{chainName}
        </if>
        <if test="storeName !=null and storeName !='' ">
            and storeName = #{storeName}
        </if>
        <if test="inspectionUser !=null and inspectionUser !='' ">
            and inspectionUser = #{inspectionUser}
        </if>
        <if test="taskName !=null and taskName !='' ">
            and taskName = #{taskName}
        </if>
        <if test="inspectionTime !=null and inspectionTime !='' ">
            and inspectionTime = #{inspectionTime}
        </if>
        <if test="inspectionProcess !=null and inspectionProcess !='' ">
            and inspectionProcess = #{inspectionProcess}
        </if>
        <if test="inspectionScore !=null and inspectionScore !='' ">
            and inspectionScore = #{inspectionScore}
        </if>
        <if test="minInspectionScore != null and minInspectionScore!='' and maxInspectionScore != null and maxInspectionScore!=''">
            and inspectionScore between #{minInspectionScore} and #{maxInspectionScore}
        </if>
        <if test="inspectionStatus !=null and inspectionStatus !='' ">
            and inspectionStatus = #{inspectionStatus}
        </if>
        <if test="createdAt !=null and createdAt !='' ">
            and createdAt = #{createdAt}
        </if>
        <if test="beginTime != null and beginTime!='' and endTime != null and endTime!=''">
            and createdAt between #{beginTime} and #{endTime}
        </if>
        <if test="updatedAt !=null and updatedAt !='' ">
            and updatedAt = #{updatedAt}
        </if>
    </select>


    <update id="updateSDtpSjdcQualityInspectionTask" parameterType="pd" >
        update s_dtp_sjdc_quality_inspection_task
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="chainId !=null and chainId !='' ">
            chainId = #{chainId},
        </if>
        <if test="chainName !=null and chainName !='' ">
            chainName = #{chainName},
        </if>
        <if test="storeName !=null and storeName !='' ">
            storeName = #{storeName},
        </if>
        <if test="inspectionUser !=null and inspectionUser !='' ">
            inspectionUser = #{inspectionUser},
        </if>
        <if test="taskName !=null and taskName !='' ">
            taskName = #{taskName},
        </if>
        <if test="inspectionTime !=null and inspectionTime !='' ">
            inspectionTime = #{inspectionTime},
        </if>
        <if test="inspectionProcess !=null and inspectionProcess !='' ">
            inspectionProcess = #{inspectionProcess},
        </if>
        <if test="inspectionScore !=null and inspectionScore !='' ">
            inspectionScore = #{inspectionScore},
        </if>
        <if test="inspectionStatus !=null and inspectionStatus !='' ">
            inspectionStatus = #{inspectionStatus},
        </if>
        <if test="createdAt !=null and createdAt !='' ">
            createdAt = #{createdAt},
        </if>
        <if test="updatedAt !=null and updatedAt !='' ">
            updatedAt = #{updatedAt},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

    <delete id="SDtpSjdcQualityInspectionTaskRemove" parameterType="pd">
        <if test="ids != null">
            delete from s_dtp_sjdc_quality_inspection_task where
            <if test="ids != null">
                id in(${ids})
            </if>
        </if>
    </delete>

    <insert id="addSDtpSjdcQualityInspectionTask" parameterType="pd" >

        insert into s_dtp_sjdc_quality_inspection_task
        <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">

        <if test="chainId !=null and chainId !='' ">
            chainId,
        </if>
        <if test="chainName !=null and chainName !='' ">
            chainName,
        </if>
        <if test="storeName !=null and storeName !='' ">
            storeName,
        </if>
        <if test="inspectionUser !=null and inspectionUser !='' ">
            inspectionUser,
        </if>
        <if test="taskName !=null and taskName !='' ">
            taskName,
        </if>
        <if test="inspectionTime !=null and inspectionTime !='' ">
            inspectionTime,
        </if>
        <if test="inspectionProcess !=null and inspectionProcess !='' ">
            inspectionProcess,
        </if>
        <if test="inspectionScore !=null and inspectionScore !='' ">
            inspectionScore,
        </if>
        <if test="inspectionStatus !=null and inspectionStatus !='' ">
            inspectionStatus,
        </if>
        <if test="createdAt !=null and createdAt !='' ">
            createdAt,
        </if>
        <if test="updatedAt !=null and updatedAt !='' ">
            updatedAt,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="chainId !=null and chainId !='' ">
             #{chainId},
        </if>
        <if test="chainName !=null and chainName !='' ">
             #{chainName},
        </if>
        <if test="storeName !=null and storeName !='' ">
             #{storeName},
        </if>
        <if test="inspectionUser !=null and inspectionUser !='' ">
             #{inspectionUser},
        </if>
        <if test="taskName !=null and taskName !='' ">
             #{taskName},
        </if>
        <if test="inspectionTime !=null and inspectionTime !='' ">
             #{inspectionTime},
        </if>
        <if test="inspectionProcess !=null and inspectionProcess !='' ">
             #{inspectionProcess},
        </if>
        <if test="inspectionScore !=null and inspectionScore !='' ">
             #{inspectionScore},
        </if>
        <if test="inspectionStatus !=null and inspectionStatus !='' ">
             #{inspectionStatus},
        </if>
        <if test="createdAt !=null and createdAt !='' ">
             #{createdAt},
        </if>
        <if test="updatedAt !=null and updatedAt !='' ">
             #{updatedAt},
        </if>
        </trim>

    </insert>

</mapper>
