Browse Source

小程序 企业相关

master
DX 2 months ago
parent
commit
5c8f158aac
  1. 44
      yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml

44
yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml

@ -0,0 +1,44 @@
<?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.taskinfo.TaskInfoMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="selectMyPage" resultType="cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO">
SELECT
t.*,
count(ei.task_id),
SUM(CASE WHEN il.status = 2 THEN 1 ELSE 0 END) AS status_2_count
FROM task_info t
left join enterprise_inspections ei on t.id = ei.task_id
left join inspections_log il on ei.id = il.inspections_id
left join enterprises e on e.id = ei.enterprise_id
WHERE
t.deleted = 0 and ei.deleted = 0 and il.deleted = 0 GROUP BY t.id
<if test="userId != null and userId != ''">
AND t.user_id = #{userId}
</if>
<if test="deptId != null and deptId != ''">
AND e.department_id = #{deptId}
</if>
# ORDER BY t.create_time DESC
# LIMIT #{offset}, #{rows}
</select>
<select id="selectPageByEnterpriseId" resultType="cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO">
SELECT
t.*
FROM task_info t
left join enterprise_inspections ei on t.id = ei.task_id
WHERE
t.deleted = 0 and ei.deleted = 0 and ei.enterprise_id = #{reqVO.enterpriseId}
GROUP BY t.id
ORDER BY t.create_time DESC
</select>
</mapper>
Loading…
Cancel
Save