PmWorkContentMapper.xml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.usky.iot.mapper.PmWorkContentMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.usky.iot.domain.PmWorkContent">
  6. <id column="id" property="id"/>
  7. <result column="report_id" property="reportId"/>
  8. <result column="project_id" property="projectId"/>
  9. <result column="project_name" property="projectName"/>
  10. <result column="submitter_id" property="submitterId"/>
  11. <result column="work_content" property="workContent"/>
  12. <result column="work_time" property="workTime"/>
  13. <result column="create_by" property="createBy"/>
  14. <result column="create_time" property="createTime"/>
  15. <result column="update_by" property="updateBy"/>
  16. <result column="update_time" property="updateTime"/>
  17. <result column="dept_id" property="deptId"/>
  18. <result column="tenant_id" property="tenantId"/>
  19. </resultMap>
  20. <select id="workTimeCount" resultType="com.usky.iot.service.vo.PmProjectWorkTimeVo">
  21. SELECT pc.project_name, SUM(pc.work_time) as workTime
  22. FROM pm_work_content pc
  23. JOIN pm_work_report pr ON pc.report_id = pr.id
  24. WHERE pr.submitter_id = #{userId}
  25. AND pr.report_date BETWEEN #{startTime} AND #{endTime}
  26. AND pr.tenant_id = #{tenantId}
  27. GROUP BY pc.project_name
  28. </select>
  29. <select id="workHourStatisticExport" resultType="com.usky.iot.service.vo.WorkTimeExportVO">
  30. SELECT pr.report_date AS reportDate, pr.create_by AS userName, pc.project_name AS projectName, pc.work_time AS
  31. workTime, pc.work_content AS workContent, u.nick_name AS fullName
  32. FROM pm_work_content pc
  33. JOIN sys_user u ON pc.submitter_id = u.user_id
  34. JOIN pm_work_report pr ON pc.report_id = pr.id
  35. <if test="projectId != null and projectId != 0">
  36. AND pr.id = #{projectId}
  37. </if>
  38. <if test="userIds != null">
  39. AND pr.submitter_id IN
  40. <foreach collection="userIds" item="userId" open="(" separator="," close=")">
  41. #{userId}
  42. </foreach>
  43. </if>
  44. <if test="startDate != null and startDate != ''"><!-- 开始时间检索 -->
  45. and date_format(pr.report_date,'%y%m%d') >= date_format(#{startDate},'%y%m%d')
  46. </if>
  47. <if test="endDate != null and endDate != ''"><!-- 结束时间检索 -->
  48. and date_format(pr.report_date,'%y%m%d') &lt;= date_format(#{endDate},'%y%m%d')
  49. </if>
  50. <!-- 数据范围过滤 -->
  51. ${params.dataScope}
  52. ORDER BY pr.report_date DESC
  53. </select>
  54. </mapper>