<?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.Installationcost.mapper.MesInfoInstallationcostMapper">
    
    <resultMap type="MesInfoInstallationcost" id="MesInfoInstallationcostResult">
        <result property="id"    column="id"    />
        <result property="taskno"    column="taskno"    />
        <result property="value"    column="value"    />
    </resultMap>

    <sql id="selectMesInfoInstallationcostVo">
        select id, taskno, value from mes_info_installationcost
    </sql>

    <select id="selectMesInfoInstallationcostList" parameterType="MesInfoInstallationcost" resultMap="MesInfoInstallationcostResult">
        <include refid="selectMesInfoInstallationcostVo"/>
        <where>  
            <if test="taskno != null "> and taskno = #{taskno}</if>
            <if test="value != null "> and value = #{value}</if>
        </where>
    </select>
    
    <select id="selectMesInfoInstallationcostById" parameterType="Long" resultMap="MesInfoInstallationcostResult">
        <include refid="selectMesInfoInstallationcostVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertMesInfoInstallationcost" parameterType="MesInfoInstallationcost">
        insert into mes_info_installationcost
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="taskno != null">taskno,</if>
            <if test="value != null">value,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="taskno != null">#{taskno},</if>
            <if test="value != null">#{value},</if>
         </trim>
    </insert>
    <insert id="insertOrUpdateBatchMesInfoInstallationcost" parameterType="java.util.List">
        INSERT INTO mes_info_installationcost (id, taskno, value)
        VALUES
        <foreach collection="list" item="item" separator=",">
            (null, #{item.taskno}, #{item.value})
        </foreach>
        ON DUPLICATE KEY UPDATE
        taskno = VALUES(taskno),
        value = VALUES(value)
    </insert>

    <update id="updateMesInfoInstallationcost" parameterType="MesInfoInstallationcost">
        update mes_info_installationcost
        <trim prefix="SET" suffixOverrides=",">
            <if test="taskno != null">taskno = #{taskno},</if>
            <if test="value != null">value = #{value},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteMesInfoInstallationcostById" parameterType="Long">
        delete from mes_info_installationcost where id = #{id}
    </delete>

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