<?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.CmcAssessContentWorkMapper">
    
    <resultMap type="CmcAssessContentWork" id="CmcAssessContentWorkResult">
        <result property="workId"    column="work_id"    />
        <result property="workLoad"    column="work_load"    />
    </resultMap>

    <sql id="selectCmcAssessContentWorkVo">
        select work_id, work_load from cmc_assess_content_work
    </sql>

    <select id="selectCmcAssessContentWorkList" parameterType="CmcAssessContentWork" resultMap="CmcAssessContentWorkResult">
        <include refid="selectCmcAssessContentWorkVo"/>
        <where>
            <if test="workLoad != null  and workLoad != ''"> and work_load = #{workLoad}</if>
        </where>
    </select>
    
    <select id="selectCmcAssessContentWorkByWorkId" parameterType="String" resultMap="CmcAssessContentWorkResult">
        <include refid="selectCmcAssessContentWorkVo"/>
        where work_id like concat('%', #{work_id}, '%')
    </select>
        
    <insert id="insertCmcAssessContentWork" parameterType="CmcAssessContentWork">
        insert into cmc_assess_content_work
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="workId != null">work_id,</if>
            <if test="workLoad != null">work_load,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="workId != null">#{workId},</if>
            <if test="workLoad != null">#{workLoad},</if>
         </trim>
    </insert>

    <update id="updateCmcAssessContentWork" parameterType="CmcAssessContentWork">
        update cmc_assess_content_work
        <trim prefix="SET" suffixOverrides=",">
            <if test="workLoad != null">work_load = #{workLoad},</if>
        </trim>
        where work_id = #{workId}
    </update>

    <delete id="deleteCmcAssessContentWorkByWorkId" parameterType="String">
        delete from cmc_assess_content_work where work_id = #{workId}
    </delete>

    <delete id="deleteCmcAssessContentWorkByWorkIds" parameterType="String">
        delete from cmc_assess_content_work where work_id in 
        <foreach item="workId" collection="array" open="(" separator="," close=")">
            #{workId}
        </foreach>
    </delete>
</mapper>