<?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.oa.mapper.CmcPriceRemarkMapper">
    
    <resultMap type="CmcPriceRemark" id="CmcPriceRemarkResult">
        <result property="priceRemarkId"    column="price_remark_id"    />
        <result property="workType"    column="work_type"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectCmcPriceRemarkVo">
        select price_remark_id, work_type, remark from cmc_price_remark
    </sql>

    <select id="selectCmcPriceRemarkList" parameterType="CmcPriceRemark" resultMap="CmcPriceRemarkResult">
        <include refid="selectCmcPriceRemarkVo"/>
        <where>  
            <if test="workType != null  and workType != ''"> and work_type = #{workType}</if>
        </where>
    </select>
    
    <select id="selectCmcPriceRemarkByPriceRemarkId" parameterType="Long" resultMap="CmcPriceRemarkResult">
        <include refid="selectCmcPriceRemarkVo"/>
        where price_remark_id = #{priceRemarkId}
    </select>
        
    <insert id="insertCmcPriceRemark" parameterType="CmcPriceRemark">
        insert into cmc_price_remark
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="priceRemarkId != null">price_remark_id,</if>
            <if test="workType != null">work_type,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="priceRemarkId != null">#{priceRemarkId},</if>
            <if test="workType != null">#{workType},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateCmcPriceRemark" parameterType="CmcPriceRemark">
        update cmc_price_remark
        <trim prefix="SET" suffixOverrides=",">
            <if test="workType != null">work_type = #{workType},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where price_remark_id = #{priceRemarkId}
    </update>

    <delete id="deleteCmcPriceRemarkByPriceRemarkId" parameterType="Long">
        delete from cmc_price_remark where price_remark_id = #{priceRemarkId}
    </delete>

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