<?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.model.mapper.AddValueServiceMapper">
    
    <resultMap type="AddValueService" id="AddValueServiceResult">
        <result property="addValueServiceId"    column="add_value_service_id"    />
        <result property="addValueServiceInfo"    column="add_value_service_info"    />
        <result property="addValueServiceName"    column="add_value_service_name"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="reamk"    column="reamk"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectAddValueServiceVo">
        select add_value_service_id, add_value_service_info, add_value_service_name, create_by, create_time, del_flag, reamk, update_by, update_time from add_value_service
    </sql>

    <select id="selectAddValueServiceList" parameterType="AddValueService" resultMap="AddValueServiceResult">
        <include refid="selectAddValueServiceVo"/>
        <where>  
            <if test="addValueServiceInfo != null  and addValueServiceInfo != ''"> and add_value_service_info = #{addValueServiceInfo}</if>
            <if test="addValueServiceName != null  and addValueServiceName != ''"> and add_value_service_name like concat('%', #{addValueServiceName}, '%')</if>
            <if test="reamk != null  and reamk != ''"> and reamk = #{reamk}</if>
        </where>
    </select>
    
    <select id="selectAddValueServiceByAddValueServiceId" parameterType="Long" resultMap="AddValueServiceResult">
        <include refid="selectAddValueServiceVo"/>
        where add_value_service_id = #{addValueServiceId}
    </select>
    <select id="getAddValueServiceList" resultType="com.ruoyi.model.domain.AddValueService">
        <include refid="selectAddValueServiceVo"/>
    </select>

    <insert id="insertAddValueService" parameterType="AddValueService">
        insert into add_value_service
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="addValueServiceId != null">add_value_service_id,</if>
            <if test="addValueServiceInfo != null">add_value_service_info,</if>
            <if test="addValueServiceName != null">add_value_service_name,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="reamk != null">reamk,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="addValueServiceId != null">#{addValueServiceId},</if>
            <if test="addValueServiceInfo != null">#{addValueServiceInfo},</if>
            <if test="addValueServiceName != null">#{addValueServiceName},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="reamk != null">#{reamk},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateAddValueService" parameterType="AddValueService">
        update add_value_service
        <trim prefix="SET" suffixOverrides=",">
            <if test="addValueServiceInfo != null">add_value_service_info = #{addValueServiceInfo},</if>
            <if test="addValueServiceName != null">add_value_service_name = #{addValueServiceName},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="reamk != null">reamk = #{reamk},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where add_value_service_id = #{addValueServiceId}
    </update>

    <delete id="deleteAddValueServiceByAddValueServiceId" parameterType="Long">
        delete from add_value_service where add_value_service_id = #{addValueServiceId}
    </delete>

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