
新增一个接口用于获取指定部门的所有子部门id列表,并在相关服务中添加实现。同时,对财务支付和工作日志统计功能进行优化,支持多部门查询。 重构财务支付和工作日志统计的查询逻辑,以支持通过部门id列表进行查询,提高查询效率和灵活性。在FinancialPaymentPageReqVO和LogStatisticsDetailsListGroupByUserDTO中添加deptIds字段,用于存放部门id列表。 BREAKING CHANGE: 部门id列表查询功能的引入可能会影响现有的接口调用方式,确保在使用时指定正确的部门id列表。 相关文件修改: - application-local.yaml: 更新数据库连接信息 - DeptApi.java: 新增获取子部门列表接口 - DeptApiImpl.java: 实现新增的子部门列表接口 - FinancialPaymentMapper.xml: 优化部门id查询逻辑- FinancialPaymentPageReqVO.java: 添加deptIds字段 - FinancialPaymentServiceImpl.java: 支持多部门查询 - LogStatisticsDetailsListGroupByUserDTO.java: 添加deptIds字段 - LogStatisticsMapper.xml:优化部门id查询逻辑 - LogStatisticsServiceImpl.java: 支持多部门查询 ```
187 lines
7.2 KiB
XML
187 lines
7.2 KiB
XML
<?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.system.dal.mysql.worklog.LogStatisticsMapper">
|
||
|
||
<!--
|
||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||
-->
|
||
|
||
<select id="getUnSubmittedUser"
|
||
resultType="cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO">
|
||
SELECT a.id,
|
||
a.dept_id
|
||
FROM system_users AS a
|
||
LEFT JOIN work_log_use AS b ON a.id = b.use_user_id
|
||
WHERE
|
||
b.deleted = 0
|
||
and b.form_id = #{formId}
|
||
AND not EXISTS (SELECT id
|
||
FROM work_log_instance_ext
|
||
WHERE form_id = b.form_id
|
||
AND start_user_id = a.id
|
||
AND time = #{thisTime})
|
||
</select>
|
||
<select id="getStatistics"
|
||
resultType="cn.iocoder.yudao.module.system.controller.admin.worklog.vo.statistics.LogStatisticsDetailsVO">
|
||
SELECT
|
||
a.id AS userId,
|
||
a.nickname AS nickname,
|
||
a.avatar AS avatar,
|
||
a.dept_id AS deptId,
|
||
c.`name` AS deptName,
|
||
b.log_instance_ext_id AS logInstanceExtId,
|
||
ifnull(b.`status`,3) AS `status`,
|
||
d.create_time AS createTime
|
||
FROM
|
||
system_users AS a
|
||
LEFT JOIN work_log_statistics AS b ON a.id = b.user_id
|
||
LEFT JOIN system_dept AS c ON a.dept_id = c.id
|
||
LEFT JOIN work_log_instance_ext AS d ON b.log_instance_ext_id = d.id
|
||
<where>
|
||
<if test="formId != null">
|
||
AND b.form_id = #{formId}
|
||
</if>
|
||
<if test="userId != null">
|
||
and a.id = #{userId}
|
||
</if>
|
||
<if test="deptId != null">
|
||
and a.dept_id = #{deptId}
|
||
</if>
|
||
|
||
<if test="dateList != null and dateList.size() > 0">
|
||
AND b.time IN
|
||
<foreach collection="dateList" item="date" open="(" separator="," close=")">
|
||
#{date}
|
||
</foreach>
|
||
</if>
|
||
</where>
|
||
</select>
|
||
<select id="getCurrentStatistics"
|
||
resultType="cn.iocoder.yudao.module.system.controller.admin.worklog.vo.statistics.LogStatisticsDetailsVO">
|
||
SELECT
|
||
a.id AS userId,
|
||
a.nickname AS nickname,
|
||
a.avatar AS avatar,
|
||
a.dept_id AS deptId,
|
||
c.`name` AS deptName,
|
||
IFNULL(d.`status`,3) AS status,
|
||
d.id AS logInstanceExtId,
|
||
d.create_time AS createTime
|
||
FROM
|
||
system_users AS a
|
||
LEFT JOIN work_log_use AS b ON a.id = b.use_user_id
|
||
LEFT JOIN system_dept AS c ON a.dept_id = c.id
|
||
LEFT JOIN ( SELECT
|
||
id,start_user_id,create_time,`status`
|
||
FROM work_log_instance_ext
|
||
WHERE
|
||
form_id = #{formId}
|
||
<if test="dateList != null and dateList.size() > 0">
|
||
AND `time` IN
|
||
<foreach collection="dateList" item="date" open="(" separator="," close=")">
|
||
#{date}
|
||
</foreach>
|
||
</if>) AS d ON d.start_user_id = b.use_user_id
|
||
<where>
|
||
b.deleted = 0
|
||
<if test="formId != null">
|
||
AND b.form_id = #{formId}
|
||
</if>
|
||
</where>
|
||
</select>
|
||
<select id="getMyCurrentStatistics"
|
||
resultType="cn.iocoder.yudao.module.system.service.worklog.dto.LogUseVO">
|
||
SELECT
|
||
a.*,
|
||
IFNULL( b.`status`, 3 ) as status
|
||
FROM
|
||
work_log_use AS a
|
||
LEFT JOIN work_log_statistics AS b ON b.user_id = a.use_user_id
|
||
<if test="dateList != null and dateList.size() > 0">
|
||
AND b.`time` IN
|
||
<foreach collection="dateList" item="date" open="(" separator="," close=")">
|
||
#{date}
|
||
</foreach>
|
||
</if>
|
||
<if test="formId != null">
|
||
AND b.form_id = #{formId}
|
||
</if>
|
||
<where>
|
||
a.deleted = 0
|
||
<if test="userId != null">
|
||
and a.use_user_id = #{userId}
|
||
</if>
|
||
<if test="deptId != null">
|
||
and a.use_user_dept = #{deptId}
|
||
</if>
|
||
</where>
|
||
</select>
|
||
<select id="getNeedWriteHistory"
|
||
resultType="cn.iocoder.yudao.module.system.controller.admin.worklog.vo.statistics.LogStatisticsModelVO">
|
||
SELECT
|
||
b.*,
|
||
IF( a.STATUS = 1, 1, 0 ) AS onTimeNum,
|
||
IF( a.STATUS = 2, 1, 0 ) AS lateNum,
|
||
IF( a.STATUS = 3, 1, 0 ) AS unSubmittedNum,
|
||
a.time,
|
||
c.type,
|
||
a.commit_time_range
|
||
FROM
|
||
work_log_statistics AS a
|
||
LEFT JOIN work_log_form AS b ON a.form_id = b.id
|
||
LEFT JOIN work_log_rule AS c ON a.rule_id = c.id
|
||
<where>
|
||
<if test="dto.formId != null">
|
||
AND a.form_id = #{dto.formId}
|
||
</if>
|
||
<if test="dto.userId != null">
|
||
AND a.user_id = #{dto.userId}
|
||
</if>
|
||
<if test="dateList != null and dateList.size() > 0">
|
||
AND a.time IN
|
||
<foreach collection="dateList" item="date" open="(" separator="," close=")">
|
||
#{date}
|
||
</foreach>
|
||
</if>
|
||
<if test="dto.type != null">
|
||
AND a.type = #{dto.type}
|
||
</if>
|
||
</where>
|
||
</select>
|
||
<select id="getStatisticsGroupByUser"
|
||
resultType="cn.iocoder.yudao.module.system.controller.admin.worklog.vo.statistics.LogStatisticsDetailsVO">
|
||
SELECT
|
||
a.nickname as nickName,
|
||
c.`name` as deptName,
|
||
b.*
|
||
FROM
|
||
system_users AS a
|
||
LEFT JOIN work_log_statistics AS b ON a.id = b.user_id
|
||
LEFT JOIN system_dept AS c ON b.dept_id = c.id
|
||
<where>
|
||
b.deleted = 0
|
||
<if test="dto.dateList != null and dto.dateList.size() > 0">
|
||
and b.time IN
|
||
<foreach collection="dto.dateList" item="date" separator="," open="(" close=")">
|
||
#{date}
|
||
</foreach>
|
||
</if>
|
||
<if test="dto.nickName != null and dto.nickName != ''">
|
||
and c.nickname like concat('%', #{dto.nickName}, '%')
|
||
</if>
|
||
<if test="dto.type != null">
|
||
and b.type = #{dto.type}
|
||
</if>
|
||
<if test="dto.deptIds != null and dto.deptIds.size() > 0">
|
||
AND b.dept_id IN
|
||
<foreach collection="dto.deptIds" item="deptId" open="(" separator="," close=")">
|
||
#{deptId}
|
||
</foreach>
|
||
</if>
|
||
</where>
|
||
</select>
|
||
</mapper>
|