<?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.hzya.frame.grpU8.nxproof.pubobjflow.dao.impl.PubObjFlowDaoImpl">
    <resultMap id="get-PubObjFlowEntity-result" type="com.hzya.frame.grpU8.nxproof.pubobjflow.entity.PubObjFlowEntity">
        <result property="modCode" column="modCode" />
        <result property="djlx" column="djlx" />
        <result property="gsdm" column="gsdm" />
        <result property="kjnd" column="kjnd" />
        <result property="djh" column="djh" />
        <result property="flowcode" column="flowcode" />
        <result property="shrs" column="shrs" />
        <result property="shrmc" column="shrmc" />
        <result property="auditFlag" column="auditFlag" />
        <result property="auditAftFlag" column="auditAftFlag" />
        <result property="isaudit" column="isaudit" />
        <result property="pofId" column="pofId" />
    </resultMap>

   <sql id="PubObjFlowEntity_Base_Column_List">
 GSDM,KJND
   </sql>

    <!--获取POF_ID-->
    <select id="PubObjFlowEntity_list_base"  resultMap="get-PubObjFlowEntity-result" parameterType="com.hzya.frame.grpU8.nxproof.pubobjflow.entity.PubObjFlowEntity">
        select NEWID() as pofId
    </select>
    <!--保存 单据保存时使用 直接从未审核变为已审核-->
    <insert id="PubObjFlowEntity_insert" parameterType="com.hzya.frame.grpU8.nxproof.pubobjflow.entity.PubObjFlowEntity">
        insert into pub_obj_flow(
        <if test="pofId != null and pofId !='' "> POF_ID, </if>
        <if test="modCode != null and modCode !='' "> ModCode, </if>
        <if test="djlx != null and djlx !='' "> DJLX, </if>
        <if test="gsdm != null and gsdm !='' "> GSDM, </if>
        <if test="kjnd != null and kjnd !='' "> KJND, </if>
        <if test="shrs != null and shrs !='' "> shr, </if>
        <if test="shrmc != null and shrmc !='' "> shrmc, </if>
        <if test="role != null and role !='' "> role, </if>
        <if test="flowcode != null and flowcode !='' "> flowcode, </if>
        <if test="auditFlag != null and auditFlag !='' "> AUDIT_FLAG, </if>
        <if test="auditAftFlag != null and auditAftFlag !='' "> AUDIT_AFT_FLAG, </if>
        <if test="isaudit != null and isaudit !='' "> ISAUDIT, </if>
        <if test="djh != null and djh !='' "> djh </if>
        )
        values (
        <if test="pofId != null and pofId !='' "> #{pofId}, </if>
        <if test="modCode != null and modCode !='' "> #{modCode}, </if>
        <if test="djlx != null and djlx !='' "> #{djlx}, </if>
        <if test="gsdm != null and gsdm !='' "> #{gsdm}, </if>
        <if test="kjnd != null and kjnd !='' "> #{kjnd}, </if>
        <if test="shrs != null and shrs !='' "> #{shrs}, </if>
        <if test="shrmc != null and shrmc !='' "> #{shrmc}, </if>
        <if test="role != null and role !='' "> #{role}, </if>
        <if test="flowcode != null and flowcode !='' "> #{flowcode}, </if>
        <if test="auditFlag != null and auditFlag !='' "> #{auditFlag}, </if>
        <if test="auditAftFlag != null and auditAftFlag !='' "> #{auditAftFlag}, </if>
        <if test="isaudit != null and isaudit !='' "> #{isaudit}, </if>
        <if test="djh != null and djh !='' "> #{djh} </if>
        )
    </insert>

    <!--删除 单据删除时使用-->
    <delete id="PubObjFlowEntity_delete" parameterType="com.hzya.frame.grpU8.nxproof.pubobjflow.entity.PubObjFlowEntity">
        DELETE
        FROM
            pub_obj_flow
        WHERE
            GSDM = #{gsdm}
          AND KJND = #{kjnd}
          AND ModCode = #{modCode}
          AND DJLX = #{djlx}
          AND DJH = #{djh}
    </delete>

    <!--更新 单据审核时使用-->
    <update id="PubObjFlowEntity_update" parameterType="com.hzya.frame.grpU8.nxproof.pubobjflow.entity.PubObjFlowEntity">
        UPDATE pub_obj_flow
        SET IsAudit = '1'
        WHERE
            GSDM = #{gsdm}
          AND KJND = #{kjnd}
          AND ModCode = #{modCode}
          AND DJLX = #{djlx}
          AND DJH = #{djh}
          AND FLOWCODE = #{flowcode}
          AND AUDIT_FLAG = #{auditFlag}
    </update>
</mapper>
