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

    <select id="selectSHyglEquitiesList" parameterType="pd" resultType="pd">
        select * from s_hygl_equities where 1=1
        <if test="benefitUniqueIdentifier !=null and benefitUniqueIdentifier !='' ">
            and benefitUniqueIdentifier = #{benefitUniqueIdentifier}
        </if>
        <if test="benefitName !=null and benefitName !='' ">
            and benefitName = #{benefitName}
        </if>
        <if test="benefitDescription !=null and benefitDescription !='' ">
            and benefitDescription = #{benefitDescription}
        </if>
        <if test="benefitPurpose !=null and benefitPurpose !='' ">
            and benefitPurpose = #{benefitPurpose}
        </if>
        <if test="benefitType !=null and benefitType !='' ">
            and benefitType = #{benefitType}
        </if>
        <if test="benefitStatus !=null and benefitStatus !='' ">
            and benefitStatus = #{benefitStatus}
        </if>
        <if test="benefitDetails !=null and benefitDetails !='' ">
            and benefitDetails = #{benefitDetails}
        </if>
        <if test="totalStock !=null and totalStock !='' ">
            and totalStock = #{totalStock}
        </if>
        <if test="remainingStock !=null and remainingStock !='' ">
            and remainingStock = #{remainingStock}
        </if>
        <if test="auditStatus !=null and auditStatus !='' ">
            and auditStatus = #{auditStatus}
        </if>
        <if test="createdByUsername !=null and createdByUsername !='' ">
            and createdByUsername = #{createdByUsername}
        </if>
        <if test="creationTime !=null and creationTime !='' ">
            and creationTime = #{creationTime}
        </if>
        <if test="operationLog !=null and operationLog !='' ">
            and operationLog = #{operationLog}
        </if>
    </select>


    <update id="updateSHyglEquities" parameterType="pd" >
        update s_hygl_equities
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="benefitUniqueIdentifier !=null and benefitUniqueIdentifier !='' ">
            benefitUniqueIdentifier = #{benefitUniqueIdentifier},
        </if>
        <if test="benefitName !=null and benefitName !='' ">
            benefitName = #{benefitName},
        </if>
        <if test="benefitDescription !=null and benefitDescription !='' ">
            benefitDescription = #{benefitDescription},
        </if>
        <if test="benefitPurpose !=null and benefitPurpose !='' ">
            benefitPurpose = #{benefitPurpose},
        </if>
        <if test="benefitType !=null and benefitType !='' ">
            benefitType = #{benefitType},
        </if>
        <if test="benefitStatus !=null and benefitStatus !='' ">
            benefitStatus = #{benefitStatus},
        </if>
        <if test="benefitDetails !=null and benefitDetails !='' ">
            benefitDetails = #{benefitDetails},
        </if>
        <if test="totalStock !=null and totalStock !='' ">
            totalStock = #{totalStock},
        </if>
        <if test="remainingStock !=null and remainingStock !='' ">
            remainingStock = #{remainingStock},
        </if>
        <if test="auditStatus !=null and auditStatus !='' ">
            auditStatus = #{auditStatus},
        </if>
        <if test="createdByUsername !=null and createdByUsername !='' ">
            createdByUsername = #{createdByUsername},
        </if>
        <if test="creationTime !=null and creationTime !='' ">
            creationTime = #{creationTime},
        </if>
        <if test="operationLog !=null and operationLog !='' ">
            operationLog = #{operationLog},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="benefitUniqueIdentifier !=null and benefitUniqueIdentifier !='' ">
            benefitUniqueIdentifier,
        </if>
        <if test="benefitName !=null and benefitName !='' ">
            benefitName,
        </if>
        <if test="benefitDescription !=null and benefitDescription !='' ">
            benefitDescription,
        </if>
        <if test="benefitPurpose !=null and benefitPurpose !='' ">
            benefitPurpose,
        </if>
        <if test="benefitType !=null and benefitType !='' ">
            benefitType,
        </if>
        <if test="benefitStatus !=null and benefitStatus !='' ">
            benefitStatus,
        </if>
        <if test="benefitDetails !=null and benefitDetails !='' ">
            benefitDetails,
        </if>
        <if test="totalStock !=null and totalStock !='' ">
            totalStock,
        </if>
        <if test="remainingStock !=null and remainingStock !='' ">
            remainingStock,
        </if>
        <if test="auditStatus !=null and auditStatus !='' ">
            auditStatus,
        </if>
        <if test="createdByUsername !=null and createdByUsername !='' ">
            createdByUsername,
        </if>
        <if test="creationTime !=null and creationTime !='' ">
            creationTime,
        </if>
        <if test="operationLog !=null and operationLog !='' ">
            operationLog,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="benefitUniqueIdentifier !=null and benefitUniqueIdentifier !='' ">
             #{benefitUniqueIdentifier},
        </if>
        <if test="benefitName !=null and benefitName !='' ">
             #{benefitName},
        </if>
        <if test="benefitDescription !=null and benefitDescription !='' ">
             #{benefitDescription},
        </if>
        <if test="benefitPurpose !=null and benefitPurpose !='' ">
             #{benefitPurpose},
        </if>
        <if test="benefitType !=null and benefitType !='' ">
             #{benefitType},
        </if>
        <if test="benefitStatus !=null and benefitStatus !='' ">
             #{benefitStatus},
        </if>
        <if test="benefitDetails !=null and benefitDetails !='' ">
             #{benefitDetails},
        </if>
        <if test="totalStock !=null and totalStock !='' ">
             #{totalStock},
        </if>
        <if test="remainingStock !=null and remainingStock !='' ">
             #{remainingStock},
        </if>
        <if test="auditStatus !=null and auditStatus !='' ">
             #{auditStatus},
        </if>
        <if test="createdByUsername !=null and createdByUsername !='' ">
             #{createdByUsername},
        </if>
        <if test="creationTime !=null and creationTime !='' ">
             #{creationTime},
        </if>
        <if test="operationLog !=null and operationLog !='' ">
             #{operationLog},
        </if>
        </trim>

    </insert>

</mapper>
