package com.njcn.process.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
import com.njcn.process.pojo.param.RStatProblemAndWorkOrderParam;
import com.njcn.process.pojo.po.RStatWorkOrderDetailPO;
import com.njcn.process.pojo.vo.RStatWorkOrderDetailVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 
 * Description:
 * 接口文档访问地址：http://serverIP:port/swagger-ui.html
 * Date: 2023/2/1  14:13【需求编号】
 *
 * @author clam
 * @version V1.0.0
 */
public interface RStatWorkOrderDetailMapper extends MppBaseMapper<RStatWorkOrderDetailPO> {
    @Select ({"<script>",
            "SELECT\n" +
            "\ta.*, b.problem_describe\n" +
            "FROM\n" +
            "\tr_stat_work_order_detail a\n" +
            "INNER JOIN r_stat_distribution_problem b ON a.problem_no = b.problem_no\n" +
            "WHERE 1=1 \n" +
            "<when test='temp.problemType!=null and temp.problemType!=\"\"'>",
            "\t AND a.two_business_type = #{temp.problemType}\n" +
                    "</when>",
                    "<when test='temp.occurTime!=null and temp.occurTime!=\"\"'>",
            "AND DATE_FORMAT(b.occur_time, '%Y%m%d') = #{temp.occurTime}\n" +
                    "</when>",
                    "<when test='temp.workOrderStatus!=null and temp.workOrderStatus!=\"\"'>",
            "AND a.work_order_status = #{temp.workOrderStatus}\n" +
                    "</when>",
                    "<when test='temp.problemNo!=null and temp.problemNo!=\"\"'>",
            "AND a.problem_no = #{temp.problemNo}",
            "</when>",
            "</script>"})
    Page<RStatWorkOrderDetailVO> getPageVo(Page<RStatWorkOrderDetailVO> returnpage,@Param("temp")  RStatProblemAndWorkOrderParam rStatProblemAndWorkOrderParam);
}