<?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.da.dangan.mapper.DaPicturesRecardMapper">
    
    <resultMap type="DaPicturesRecard" id="DaPicturesRecardResult">
        <result property="id"    column="id"    />
        <result property="picName"    column="pic_name"    />
        <result property="picUrl"    column="pic_url"    />
        <result property="wlsjId"    column="wlsj_id"    />
        <result property="wlsjPath"    column="wlsj_path"    />
        <result property="muId"    column="mu_id"    />
        <result property="muPath"    column="mu_path"    />
        <result property="recognize"    column="recognize"    />
        <result property="remark"    column="remark"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectDaPicturesRecardVo">
        select id, pic_name, pic_url, wlsj_id, wlsj_path, mu_id, mu_path, recognize, remark, create_by, create_time, update_by, update_time from da_pictures_recard
    </sql>

    <select id="selectDaPicturesRecardList" parameterType="DaPicturesRecard" resultMap="DaPicturesRecardResult">
        <include refid="selectDaPicturesRecardVo"/>
        <where>  
            <if test="picName != null  and picName != ''"> and pic_name like concat('%', #{picName}, '%')</if>
            <if test="picUrl != null  and picUrl != ''"> and pic_url = #{picUrl}</if>
            <if test="wlsjId != null "> and wlsj_id = #{wlsjId}</if>
            <if test="wlsjPath != null  and wlsjPath != ''"> and wlsj_path = #{wlsjPath}</if>
            <if test="muId != null "> and mu_id = #{muId}</if>
            <if test="muPath != null  and muPath != ''"> and mu_path = #{muPath}</if>
            <if test="recognize != null  and recognize != ''"> and recognize = #{recognize}</if>
        </where>
    </select>
    
    <select id="selectDaPicturesRecardById" parameterType="Long" resultMap="DaPicturesRecardResult">
        <include refid="selectDaPicturesRecardVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertDaPicturesRecard" parameterType="DaPicturesRecard" useGeneratedKeys="true" keyProperty="id">
        insert into da_pictures_recard
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="picName != null and picName != ''">pic_name,</if>
            <if test="picUrl != null and picUrl != ''">pic_url,</if>
            <if test="wlsjId != null">wlsj_id,</if>
            <if test="wlsjPath != null">wlsj_path,</if>
            <if test="muId != null">mu_id,</if>
            <if test="muPath != null">mu_path,</if>
            <if test="recognize != null">recognize,</if>
            <if test="remark != null">remark,</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>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="picName != null and picName != ''">#{picName},</if>
            <if test="picUrl != null and picUrl != ''">#{picUrl},</if>
            <if test="wlsjId != null">#{wlsjId},</if>
            <if test="wlsjPath != null">#{wlsjPath},</if>
            <if test="muId != null">#{muId},</if>
            <if test="muPath != null">#{muPath},</if>
            <if test="recognize != null">#{recognize},</if>
            <if test="remark != null">#{remark},</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>
         </trim>
    </insert>

    <update id="updateDaPicturesRecard" parameterType="DaPicturesRecard">
        update da_pictures_recard
        <trim prefix="SET" suffixOverrides=",">
            <if test="picName != null and picName != ''">pic_name = #{picName},</if>
            <if test="picUrl != null and picUrl != ''">pic_url = #{picUrl},</if>
            <if test="wlsjId != null">wlsj_id = #{wlsjId},</if>
            <if test="wlsjPath != null">wlsj_path = #{wlsjPath},</if>
            <if test="muId != null">mu_id = #{muId},</if>
            <if test="muPath != null">mu_path = #{muPath},</if>
            <if test="recognize != null">recognize = #{recognize},</if>
            <if test="remark != null">remark = #{remark},</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>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteDaPicturesRecardById" parameterType="Long">
        delete from da_pictures_recard where id = #{id}
    </delete>

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