123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?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="com.usky.iot.mapper.PmWorkContentMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.usky.iot.domain.PmWorkContent">
- <id column="id" property="id"/>
- <result column="report_id" property="reportId"/>
- <result column="project_id" property="projectId"/>
- <result column="project_name" property="projectName"/>
- <result column="submitter_id" property="submitterId"/>
- <result column="work_content" property="workContent"/>
- <result column="work_time" property="workTime"/>
- <result column="create_by" property="createBy"/>
- <result column="create_time" property="createTime"/>
- <result column="update_by" property="updateBy"/>
- <result column="update_time" property="updateTime"/>
- <result column="dept_id" property="deptId"/>
- <result column="tenant_id" property="tenantId"/>
- </resultMap>
- <select id="workTimeCount" resultType="com.usky.iot.service.vo.PmProjectWorkTimeVo">
- SELECT pc.project_name, SUM(pc.work_time) as workTime
- FROM pm_work_content pc
- JOIN pm_work_report pr ON pc.report_id = pr.id
- WHERE pr.submitter_id = #{userId}
- AND pr.report_date BETWEEN #{startTime} AND #{endTime}
- AND pr.tenant_id = #{tenantId}
- GROUP BY pc.project_name
- </select>
- <select id="workHourStatisticExport" resultType="com.usky.iot.service.vo.WorkTimeExportVO">
- SELECT pr.report_date AS reportDate, pr.create_by AS userName, pc.project_name AS projectName, pc.work_time AS
- workTime, pc.work_content AS workContent, u.nick_name AS fullName
- FROM pm_work_content pc
- JOIN sys_user u ON pc.submitter_id = u.user_id
- JOIN pm_work_report pr ON pc.report_id = pr.id
- <if test="projectId != null and projectId != 0">
- AND pr.id = #{projectId}
- </if>
- <if test="userIds != null">
- AND pr.submitter_id IN
- <foreach collection="userIds" item="userId" open="(" separator="," close=")">
- #{userId}
- </foreach>
- </if>
- <if test="startDate != null and startDate != ''"><!-- 开始时间检索 -->
- and date_format(pr.report_date,'%y%m%d') >= date_format(#{startDate},'%y%m%d')
- </if>
- <if test="endDate != null and endDate != ''"><!-- 结束时间检索 -->
- and date_format(pr.report_date,'%y%m%d') <= date_format(#{endDate},'%y%m%d')
- </if>
- <!-- 数据范围过滤 -->
- ${params.dataScope}
- ORDER BY pr.report_date DESC
- </select>
- </mapper>
|