lanan-system/dl-module-base/src/main/resources/mapper/order/RepairOrderInfoMapper.xml

71 lines
3.4 KiB
XML
Raw Normal View History

2024-09-23 15:24:09 +08:00
<?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">
2024-09-25 19:53:01 +08:00
<mapper namespace="cn.iocoder.yudao.module.order.mapper.RepairOrderInfoMapper">
2024-09-23 15:24:09 +08:00
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
2024-09-23 21:26:18 +08:00
<select id="queryListPage" resultType="cn.iocoder.yudao.module.order.vo.RepairOrderInfoRespVO">
2024-09-23 15:24:09 +08:00
SELECT
roi.*
FROM
repair_order_info roi
<where>
roi.deleted = 0
<if test="entity.orderNo != null and entity.orderNo != ''">
and roi.order_no like concat('%', #{entity.orderNo}, '%')
</if>
<if test="entity.goodsTitle != null and entity.goodsTitle != ''">
2024-09-24 15:12:38 +08:00
and roi.goods_title like concat('%', #{entity.goodsTitle}, '%')
2024-09-23 15:24:09 +08:00
</if>
<if test="entity.goodsType != null and entity.goodsType != ''">
and roi.goods_type = #{entity.goodsType}
</if>
<if test="entity.cusName != null and entity.cusName != ''">
and roi.cus_name like concat('%', #{entity.cusName}, '%')
</if>
<if test="entity.orderStatus != null and entity.orderStatus != ''">
and roi.order_status = #{entity.orderStatus}
</if>
2024-09-24 15:12:38 +08:00
<if test="entity.payType != null and entity.payType != ''">
and roi.pay_type = #{entity.payType}
</if>
2024-09-23 15:24:09 +08:00
</where>
2024-09-24 15:12:38 +08:00
order by roi.create_time desc
2024-09-23 15:24:09 +08:00
</select>
2024-09-23 18:21:48 +08:00
2024-09-23 21:26:18 +08:00
<select id="getOrderPageByStatus" resultType="cn.iocoder.yudao.module.order.vo.RepairOrderInfoRespVO">
2024-09-23 18:21:48 +08:00
select roi.*,drt.tickets_work_status as status from repair_order_info roi left join dl_repair_tickets drt on
roi.goods_id = drt.id
where roi.deleted = '0'
<if test="map.userId != null and map.userId != ''">
and roi.user_id = #{map.userId}
</if>
<if test="map.status != null and map.status != ''">
<choose>
<when test="map.status != '00'">
2024-09-24 20:54:24 +08:00
and drt.tickets_work_status = #{map.status}
2024-09-23 18:21:48 +08:00
</when>
<when test="map.status == '00'">
2024-09-24 20:54:24 +08:00
and roi.comment_time is null and roi.order_status = '1'
2024-09-23 18:21:48 +08:00
</when>
</choose>
</if>
order by roi.create_time desc
</select>
2024-09-25 19:39:08 +08:00
<select id="census" resultType="cn.iocoder.yudao.module.order.vo.RepairOrderCensusVO">
SELECT
-- 统计已入账和未入账的数量
SUM(CASE WHEN order_status = '1' THEN pay_money ELSE 0 END) AS credited,
SUM(CASE WHEN order_status = '0' THEN goods_price ELSE 0 END) AS notCredited,
-- 统计已入账的细分情况
SUM(CASE WHEN order_status = '1' AND pay_type = '01' THEN pay_money ELSE 0 END) AS onlinePay,
SUM(CASE WHEN order_status = '1' AND pay_type = '02' THEN pay_money ELSE 0 END) AS cashPay,
SUM(CASE WHEN order_status = '1' AND pay_type = '03' THEN pay_money ELSE 0 END) AS signedPay
FROM repair_order_info;
</select>
2024-09-23 15:24:09 +08:00
</mapper>