<?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="org.dromara.zjk.mapper.ZjkProductSummarizeLogMapper">

    <select id="queryPage" resultType="org.dromara.zjk.domain.vo.ZjkProductSummarizeLogVo">
        SELECT  zp.product_name,zrp.review_time,zps.*
        from zjk_product_summarize_log zps
        INNER JOIN zjk_review_phase zrp on zrp.id = zps.review_id
        INNER JOIN zjk_product zp on zp.id = zrp.item_id
        where zps.del_flag = 0
        <if test="bo.search != null and bo.search!= '' ">
            and (zp.product_Name like '%' || #{bo.search} ||'%' )
        </if>
        <if test="bo.productSummarizeType != null ">
            and zps.product_summarize_type = #{bo.productSummarizeType}
        </if>
        <if test="bo.status != null ">
            and zps.status = #{bo.status}
        </if>
        <if test="bo.startTime != null ">
            and zrp.review_time >= #{bo.startTime}
        </if>
        <if test="bo.endTime != null ">
            and zrp.review_time &lt;= #{bo.endTime}
        </if>
        <if test="bo.remark != null ">
            and (zrp.remark like '%' ||  #{bo.remark} || '%')
        </if>
        <if test="bo.statusList != null and bo.statusList.size > 0 ">
            and  zps.status in
            <foreach collection="bo.statusList" open="(" separator="," close=")" item="status">
                #{status}
            </foreach>
        </if>
    </select>
    <select id="getById" resultType="org.dromara.zjk.domain.vo.ZjkProductSummarizeLogVo">
        select zpsl.*,su.nick_name sub_by,zps.create_time sub_time
            from zjk_product_summarize_log zpsl
            left join zjk_product_summarize zps on zps.id=zpsl.summarize_id
            left join  sys_user  su on zpsl.create_by = su.user_id
        where zpsl.id= #{id}
    </select>
</mapper>
