<?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.AppCleanItemsMapper">
    
    <resultMap type="AppCleanItems" id="AppCleanItemsResult">
        <result property="cleanItemsId"    column="clean_items_id"    />
        <result property="cleanItemsName"    column="clean_items_name"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="delFlag"    column="del_flag"    />
    </resultMap>

    <sql id="selectAppCleanItemsVo">
        select clean_items_id, clean_items_name, create_by, create_time, update_by, update_time, del_flag from app_clean_items
    </sql>

    <select id="selectAppCleanItemsList" parameterType="AppCleanItems" resultMap="AppCleanItemsResult">
        <include refid="selectAppCleanItemsVo"/>
        <where>  
            <if test="cleanItemsName != null "> and clean_items_name like concat('%', #{cleanItemsName}, '%')</if>
        </where>
    </select>
    
    <select id="selectAppCleanItemsByCleanItemsId" parameterType="Long" resultMap="AppCleanItemsResult">
        <include refid="selectAppCleanItemsVo"/>
        where clean_items_id = #{cleanItemsId}
    </select>
    <select id="getAppCleanItemsList" resultType="com.ruoyi.model.domain.AppCleanItems">
        <include refid="selectAppCleanItemsVo"/>
    </select>

    <insert id="insertAppCleanItems" parameterType="AppCleanItems">
        insert into app_clean_items
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="cleanItemsId != null">clean_items_id,</if>
            <if test="cleanItemsName != null">clean_items_name,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="delFlag != null">del_flag,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="cleanItemsId != null">#{cleanItemsId},</if>
            <if test="cleanItemsName != null">#{cleanItemsName},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="delFlag != null">#{delFlag},</if>
         </trim>
    </insert>

    <update id="updateAppCleanItems" parameterType="AppCleanItems">
        update app_clean_items
        <trim prefix="SET" suffixOverrides=",">
            <if test="cleanItemsName != null">clean_items_name = #{cleanItemsName},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
        </trim>
        where clean_items_id = #{cleanItemsId}
    </update>

    <delete id="deleteAppCleanItemsByCleanItemsId" parameterType="Long">
        delete from app_clean_items where clean_items_id = #{cleanItemsId}
    </delete>

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