<?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="cn.iocoder.yudao.module.inspection.mapper.InspectionBatchSettlementOrderMapper">

    <select id="pageVo"
            resultType="cn.iocoder.yudao.module.inspection.entity.InspectionBatchSettlementOrderQueryVo">
        SELECT batch.* , user.nickname AS cashierName
        FROM inspection_batch_settlement_order batch
        LEFT JOIN system_users user ON batch.creator = user.id
        <where>
            <if test="query.accountingConfirm != null">
                AND batch.accounting_confirm != #{query.accountingConfirm}
            </if>
        <if test="query.datetimeRange != null">
            <if test="query.datetimeRange.size() == 2">
                AND batch.create_time BETWEEN CONCAT(#{query.datetimeRange[0]}, ' 00:00:00') AND CONCAT(#{query.datetimeRange[1]}, ' 23:59:59')
            </if>
        </if>
        </where>
    </select>
</mapper>
