<?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.zjrs.ggfw.portal.entity.VRsWbBjListForGrMapper">

    <select id="getBjListGr" parameterType="com.zjrs.ggfw.portal.dto.SxblQueryDTO" resultType="com.zjrs.ggfw.portal.po.VRsWbBjListForGr">
        SELECT A.*,B.LQR as "lqr",B.LQRQ as "lqrq",B.BZ as "bz",
        C.ORDERSTATUS as "orderstatus",C.EXPRESSNBR as "expressnbr"
        FROM V_RS_WB_BJ_LIST_GR A LEFT JOIN
        RS_SLXX_JGLQ B ON A.SLLSH = B.SLLSH
        LEFT JOIN RS_SLXX_EMS_ORDER C ON A.SLLSH = C.SLLSH
        WHERE A.YHID = #{dto.yhid}
        <if test="dto.sxmc != null and dto.sxmc != ''">
            and A.sxmc LIKE '%'||#{dto.sxmc}||'%'
        </if>
        <if test="dto.sqrqq != null and dto.sqrqq != ''">
            and A.sqsj &gt;= #{dto.sqrqq} ||' 00:00:00'
        </if>
        <if test="dto.sqrqz != null and dto.sqrqz != ''">
            and A.sqsj &lt;= #{dto.sqrqz} ||' 23:59:59'
        </if>
        order by A.zhxgsj DESC
    </select>
</mapper>
