<?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.sf.service.index.mapper.ApplyListInfoMapper">
    
    <resultMap type="ApplyListInfo" id="ApplyListInfoResult">
        <result property="id"    column="id"    />
        <result property="appCode"    column="app_code"    />
        <result property="appName"    column="app_name"    />
        <result property="appDesc"    column="app_desc"    />
        <result property="picture"    column="picture"    />
        <result property="orderNum"    column="order_num"    />
        <result property="isDelete"    column="is_delete"    />
        <result property="created"    column="created"    />
        <result property="modified"    column="modified"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectApplyListInfoVo">
        select id, app_code, app_name, app_desc, picture, order_num, is_delete, created, modified, create_time, update_time from APPLY_LIST_INFO
    </sql>

    <select id="selectApplyListInfoList" parameterType="ApplyListInfo" resultMap="ApplyListInfoResult">
        <include refid="selectApplyListInfoVo"/>
        <where>
            <if test="appName != null  and appName != ''"> and app_name like concat('%', #{appName}, '%')</if>
        </where>
    </select>
    
    <select id="selectApplyListInfoById" parameterType="Long" resultMap="ApplyListInfoResult">
        <include refid="selectApplyListInfoVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertApplyListInfo" parameterType="ApplyListInfo" useGeneratedKeys="true" keyProperty="id">
        insert into APPLY_LIST_INFO
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="appCode != null and appCode != ''">app_code,</if>
            <if test="appName != null and appName != ''">app_name,</if>
            <if test="appDesc != null and appDesc != ''">app_desc,</if>
            <if test="picture != null">picture,</if>
            <if test="orderNum != null">order_num,</if>
            <if test="isDelete != null">is_delete,</if>
            <if test="created != null">created,</if>
            <if test="modified != null">modified,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="appCode != null and appCode != ''">#{appCode},</if>
            <if test="appName != null and appName != ''">#{appName},</if>
            <if test="appDesc != null and appDesc != ''">#{appDesc},</if>
            <if test="picture != null">#{picture},</if>
            <if test="orderNum != null">#{orderNum},</if>
            <if test="isDelete != null">#{isDelete},</if>
            <if test="created != null">#{created},</if>
            <if test="modified != null">#{modified},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateApplyListInfo" parameterType="ApplyListInfo">
        update APPLY_LIST_INFO
        <trim prefix="SET" suffixOverrides=",">
            <if test="appCode != null and appCode != ''">app_code = #{appCode},</if>
            <if test="appName != null and appName != ''">app_name = #{appName},</if>
            <if test="appDesc != null and appDesc != ''">app_desc = #{appDesc},</if>
            <if test="picture != null">picture = #{picture},</if>
            <if test="orderNum != null">order_num = #{orderNum},</if>
            <if test="isDelete != null">is_delete = #{isDelete},</if>
            <if test="created != null">created = #{created},</if>
            <if test="modified != null">modified = #{modified},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteApplyListInfoById" parameterType="Long">
        delete from APPLY_LIST_INFO where id = #{id}
    </delete>

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