<?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.bonus.sgzb.material.mapper.ScrapAuditorSetMapper">
    <insert id="insertScrapAuditorSet" parameterType="com.bonus.sgzb.material.domain.ScrapAuditorSet">
        insert into scrap_auditor_set(task_id,dept_id,user_id,company_id,audit_time)
        values(#{taskId},#{deptId},#{userId},#{companyId},#{auditTime})
    </insert>
    <update id="updateStatus" parameterType="com.bonus.sgzb.material.domain.ScrapAuditorSet">
        update scrap_auditor_set
        <set>
            <if test="userId != null">user_id = #{userId},</if>
            <if test="status != null">status = #{status},</if>
            <if test="auditTime != null">audit_time = #{auditTime},</if>
            <if test="reasonRejection != null">reason_rejection = #{reasonRejection},</if>
        </set>
        where task_id = #{taskId} and  dept_id = #{deptId}
    </update>
    <select id="selectScrapAuditListByTaskId" resultType="com.bonus.sgzb.material.domain.ScrapAuditorSet">
        select sas.*, d.dept_name as deptName from scrap_auditor_set sas
                 left join sys_dept d on d.dept_id = sas.dept_id
                 where task_id = #{taskId}
    </select>
</mapper>