<?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.system.mapper.XysImgMapper">
    
    <resultMap type="XysImg" id="XysImgResult">
        <result property="id"    column="id"    />
        <result property="imgType"    column="img_type"    />
        <result property="imgUrl"    column="img_url"    />
        <result property="imgCat"    column="img_cat"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="remark"    column="remark"    />
        <result property="delFlag"    column="del_flag"    />
    </resultMap>

    <sql id="selectXysImgVo">
        select id, img_type, img_url, img_cat, create_time, create_by, update_time, update_by, remark, del_flag from xys_img
    </sql>

    <select id="selectXysImgList" parameterType="XysImg" resultMap="XysImgResult">
        <include refid="selectXysImgVo"/>
        <where>  
            <if test="imgCat != null "> and img_cat = #{imgCat}</if>
        </where>
    </select>
    
    <select id="selectXysImgById" parameterType="Long" resultMap="XysImgResult">
        <include refid="selectXysImgVo"/>
        where id = #{id}
    </select>

    <insert id="insertXysImg" parameterType="XysImg">
        insert into xys_img
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="imgType != null">img_type,</if>
            <if test="imgUrl != null">img_url,</if>
            <if test="imgCat != null">img_cat,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="remark != null">remark,</if>
            <if test="delFlag != null">del_flag,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="imgType != null">#{imgType},</if>
            <if test="imgUrl != null">#{imgUrl},</if>
            <if test="imgCat != null">#{imgCat},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="remark != null">#{remark},</if>
            <if test="delFlag != null">#{delFlag},</if>
         </trim>
    </insert>

    <update id="updateXysImg" parameterType="XysImg">
        update xys_img
        <trim prefix="SET" suffixOverrides=",">
            <if test="imgType != null">img_type = #{imgType},</if>
            <if test="imgUrl != null">img_url = #{imgUrl},</if>
            <if test="imgCat != null">img_cat = #{imgCat},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteXysImgById" parameterType="Long">
        delete from xys_img where id = #{id}
    </delete>

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