<?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.xingxi.web.controller.master.product.mapper.ProdPicVoMapper">
    <resultMap type="ProdPicVo" id="ProdPicResult">
        <result property="id"                   column="id"                 />
        <result property="prodId"               column="prodId"             />
        <result property="picUrl"               column="picUrl"             />
        <result property="sort"                 column="sort"               />
    </resultMap>

    <sql id="selectProdPicVo">
        select m_prod_pic.id
             , m_prod_pic.prodId
             , m_prod_pic.picUrl
             , m_prod_pic.sort
        from m_prod_pic
    </sql>

    <select id="selectProdPicVoList" parameterType="ProdPicVo" resultMap="ProdPicResult">
        <include refid="selectProdPicVo"/>
        <where>
            <if test="id != null "> and m_prod_pic.id = #{id}</if>
            <if test="prodId != null "> and m_prod_pic.prodId = #{prodId}</if>
            <if test="delFlag != null  and delFlag != ''"> and m_prod_pic.delFlag = #{delFlag}</if>
        </where>
        order by m_prod_pic.sort
    </select>

    <update id="logicDeleteProdPicByCondition" parameterType="ProdPic">
        update m_prod_pic
        <trim prefix="SET" suffixOverrides=",">
            delFlag = '1',
            <if test="updateUser != null">updateUser = #{updateUser},</if>
            <if test="updateTime != null">updateTime = #{updateTime},</if>
        </trim>
        <where>
            <if test="id != null "> and id = #{id}</if>
            <if test="prodId != null "> and prodId = #{prodId}</if>
            <if test="sort != null "> and sort = #{sort}</if>
        </where>
    </update>
</mapper>