zn-cloud/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/mapper/financialpayment/FinancialPaymentMapper.xml
aikai 8032c41e6e ```修复:确保财务付款查询按状态和时间正确排序
修正了FinancialPaymentMapper.xml中的排序逻辑,以便按状态升序和结束时间降序正确排序财务付款记录。之前的实现没有考虑状态,导致排序不准确。
```
2024-08-20 14:08:49 +08:00

92 lines
3.8 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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.bpm.dal.mysql.financialpayment.FinancialPaymentMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="getFinancialPaymentPage"
resultType="cn.iocoder.yudao.module.bpm.dal.dataobject.financialpayment.FinancialPaymentDO">
select
a.*,
b.nickname as nickname,
c.name as deptName,
d.nickname as receiveUserNickName
from bpm_financial_payment as a
left join system_users as b on a.user_id = b.id
left join system_dept as c on b.dept_id = c.id
left join system_users as d on a.receive_user_id = d.id
<where>
a.deleted = 0
<if test="vo.deptId != null">
and c.id = #{vo.deptId}
</if>
<if test="vo.nickname != null and vo.nickname != ''">
and b.nickname like concat('%', #{vo.nickname}, '%')
</if>
<if test="vo.processInstanceId != null and vo.processInstanceId != ''">
and a.process_instance_id = #{vo.processInstanceId}
</if>
<if test="vo.type != null">
and a.type = #{vo.type}
</if>
<if test="vo.status != null">
and a.status = #{vo.status}
</if>
<if test="vo.reason != null and vo.reason != ''">
and a.reason like concat('%', #{vo.reason}, '%')
</if>
<if test="vo.receiveType != null">
<if test="vo.receiveType == 1">
and a.receive_user_id is null
</if>
<if test="vo.receiveType == 2">
and a.receive_user_id is not null
</if>
<if test="vo.receiveType == 3">
and a.receive_user_id = #{vo.receiveUserId}
</if>
<if test="vo.receiveType == 4">
and a.receive_user_id != #{vo.receiveUserId}
</if>
</if>
<if test="vo.beginTime != null and vo.beginTime.length > 0">
<if test="vo.beginTime[0] != null">
and a.begin_time &gt;= #{vo.beginTime[0]}
</if>
<if test="vo.beginTime[1] != null">
and a.begin_time &lt;= #{vo.beginTime[1]}
</if>
</if>
<if test="vo.endTime != null and vo.endTime.length > 0">
<if test="vo.endTime[0] != null">
and a.end_time &gt;= #{vo.endTime[0]}
</if>
<if test="vo.endTime[1] != null">
and a.end_time &lt;= #{vo.endTime[1]}
</if>
</if>
</where>
ORDER BY a.status asc,a.end_time DESC
</select>
<select id="getFinancialPayment"
resultType="cn.iocoder.yudao.module.bpm.dal.dataobject.financialpayment.FinancialPaymentDO">
select
a.*,
b.nickname as nickname,
c.name as deptName,
d.nickname as receiveUserNickName
from bpm_financial_payment as a
left join system_users as b on a.user_id = b.id
left join system_dept as c on b.dept_id = c.id
left join system_users as d on a.receive_user_id = d.id
<where>
a.id = #{id}
</where>
</select>
</mapper>