You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.7 KiB

<?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.qniao.dam.infrastructure.persistent.dao.view.OrderViewDao">
<select id="pageProductByOperator"
resultType="com.qniao.dam.api.query.order.user.response.UserPageOrderByOperatorVo">
select
dao.id as orderId,
dao.order_code,
dao.create_time as orderTime,
dao.user_id,
daa.tid as userPhone,
dao.mi_id,
IFNULL(dami.`name`,dami.nick_name) as miName,
dao.settlement_amount
from da_order as dao
LEFT JOIN da_account as daa on daa.user_id=dao.user_id and daa.type=2 and daa.is_delete=0
LEFT JOIN da_marriage_information as dami on dami.id=dao.mi_id
where dao.is_delete=0
<if test="queryParam.orderCode != null and queryParam.orderCode != '' ">
AND dao.order_code LIKE CONCAT('%', TRIM(#{queryParam.orderCode}), '%')
</if>
<if test="queryParam.orderTimeFrom != null and queryParam.orderTimeTo != null">
and dao.create_time BETWEEN #{queryParam.orderTimeFrom} and #{queryParam.orderTimeTo}
</if>
<if test="queryParam.status != null">
and dao.status = #{queryParam.status}
</if>
ORDER BY dao.create_time desc
</select>
<select id="listOrderItemByOperatorByOrderIds"
resultType="com.qniao.dam.api.query.order.user.response.UserPageOrderItemByOperatorVo">
select
daoi.order_id,
daoi.id as orderItemId,
daoi.main_category,
daoi.sub_category
from da_order_item as daoi
where daoi.is_delete=0
and daoi.order_id in
<foreach collection="orderIdList" item="orderId" open="(" close=")" separator=",">
#{orderId}
</foreach>
</select>
<select id="getOrderStatisticsByOperator"
resultType="com.qniao.dam.api.query.order.user.response.GetOrderStatisticsByOperatorVo">
select
COUNT(1) as totalOrderNum,
IFNULL(SUM(dao.settlement_amount),0) as totalOrderAmount
from da_order as dao
where dao.is_delete=0
<if test="queryParam.orderCode != null and queryParam.orderCode != '' ">
AND dao.order_code LIKE CONCAT('%', TRIM(#{queryParam.orderCode}), '%')
</if>
<if test="queryParam.orderTimeFrom != null and queryParam.orderTimeTo != null">
and dao.create_time BETWEEN #{queryParam.orderTimeFrom} and #{queryParam.orderTimeTo}
</if>
<if test="queryParam.status != null">
and dao.status = #{queryParam.status}
</if>
</select>
</mapper>