<?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.AppCheckImageTypeMapper">
    
    <resultMap type="AppCheckImageType" id="AppCheckImageTypeResult">
        <result property="checkImageTypeId"    column="check_image_type_id"    />
        <result property="checkImageTypeName"    column="check_image_type_name"    />
        <result property="checkImageTypeMax"    column="check_image_type_max"    />
        <result property="checkImageTypeMin"    column="check_image_type_min"    />
        <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="selectAppCheckImageTypeVo">
        select check_image_type_id, check_image_type_name, check_image_type_max, check_image_type_min, create_by, create_time, update_by, update_time, del_flag from app_check_image_type
    </sql>

    <select id="selectAppCheckImageTypeList" parameterType="AppCheckImageType" resultMap="AppCheckImageTypeResult">
        <include refid="selectAppCheckImageTypeVo"/>
        <where>  
            <if test="checkImageTypeName != null  and checkImageTypeName != ''"> and check_image_type_name like concat('%', #{checkImageTypeName}, '%')</if>
            <if test="checkImageTypeMax != null "> and check_image_type_max = #{checkImageTypeMax}</if>
            <if test="checkImageTypeMin != null "> and check_image_type_min = #{checkImageTypeMin}</if>
        </where>
    </select>
    
    <select id="selectAppCheckImageTypeByCheckImageTypeId" parameterType="Long" resultMap="AppCheckImageTypeResult">
        <include refid="selectAppCheckImageTypeVo"/>
        where check_image_type_id = #{checkImageTypeId}
    </select>
    <select id="getAppCheckImageTypeList" resultType="com.ruoyi.model.domain.AppCheckImageType">
        <include refid="selectAppCheckImageTypeVo"/>
    </select>

    <insert id="insertAppCheckImageType" parameterType="AppCheckImageType">
        insert into app_check_image_type
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="checkImageTypeId != null">check_image_type_id,</if>
            <if test="checkImageTypeName != null and checkImageTypeName != ''">check_image_type_name,</if>
            <if test="checkImageTypeMax != null">check_image_type_max,</if>
            <if test="checkImageTypeMin != null">check_image_type_min,</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="checkImageTypeId != null">#{checkImageTypeId},</if>
            <if test="checkImageTypeName != null and checkImageTypeName != ''">#{checkImageTypeName},</if>
            <if test="checkImageTypeMax != null">#{checkImageTypeMax},</if>
            <if test="checkImageTypeMin != null">#{checkImageTypeMin},</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="updateAppCheckImageType" parameterType="AppCheckImageType">
        update app_check_image_type
        <trim prefix="SET" suffixOverrides=",">
            <if test="checkImageTypeName != null and checkImageTypeName != ''">check_image_type_name = #{checkImageTypeName},</if>
            <if test="checkImageTypeMax != null">check_image_type_max = #{checkImageTypeMax},</if>
            <if test="checkImageTypeMin != null">check_image_type_min = #{checkImageTypeMin},</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 check_image_type_id = #{checkImageTypeId}
    </update>

    <delete id="deleteAppCheckImageTypeByCheckImageTypeId" parameterType="Long">
        delete from app_check_image_type where check_image_type_id = #{checkImageTypeId}
    </delete>

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