|
@@ -18,18 +18,20 @@
|
|
|
<result column="ask_leave_time" property="askLeaveTime" />
|
|
|
<result column="week_day" property="weekDay" />
|
|
|
<result column="week_day_txt" property="weekDayTxt" />
|
|
|
+ <result column="ot_status" property="otStatus" />
|
|
|
+ <result column="ot_time" property="otTime" />
|
|
|
</resultMap>
|
|
|
|
|
|
<!-- 通用查询结果列 -->
|
|
|
<sql id="Base_Column_List">
|
|
|
- id, create_date, corpwx_userid, start_time, end_time, card_time, work_hours, company_id, wx_corpid, name, outdoor_time, ask_leave_time, week_day, week_day_txt
|
|
|
+ id, create_date, corpwx_userid, start_time, end_time, card_time, work_hours, company_id, wx_corpid, name, outdoor_time, ask_leave_time, week_day, week_day_txt, ot_status, ot_time
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
<select id="getUserDataList" resultType="java.util.HashMap" >
|
|
|
SELECT user.id as userId, department.department_name as departmentName, DATE_FORMAT(a.create_date, '%Y/%m/%d') as createDate,a.start_time as startTime, a.end_time as endTime, a.work_hours as workHours, user.name as username,user.corpwx_userid as corpwxUserid,a.week_day as weekDay,
|
|
|
week_day_txt as weekDayTxt,card_time as cardTime, outdoor_time as outdoorTime, ask_leave_time as askLeaveTime FROM user_corpwx_time a
|
|
|
- LEFT JOIN user ON user.name = a.name AND a.`company_id` = user.`company_id`
|
|
|
+ LEFT JOIN user ON user.name = a.name AND a.`company_id` = user.`company_id`
|
|
|
left join department on department.department_id = user.department_id
|
|
|
WHERE a.create_date BETWEEN #{startDate} AND #{endDate}
|
|
|
AND a.company_id = #{companyId}
|
|
@@ -46,20 +48,20 @@
|
|
|
<select id="getUserDataRatioList" resultType="java.util.HashMap" >
|
|
|
SELECT user.id AS userId, user.`name` as username,department.department_name as departmentName, user.`corpwx_userid` as corpwxUserid, IFNULL(card_time.workHours, 0) as workHours, IFNULL(report_time.projectTime, 0) AS projectTime FROM
|
|
|
user left join department on department.department_id = user.department_id
|
|
|
- LEFT JOIN
|
|
|
+ LEFT JOIN
|
|
|
(SELECT a.corpwx_userid,a.name, SUM(a.work_hours) AS workHours FROM user_corpwx_time a, user b WHERE a.company_id = #{companyId}
|
|
|
AND (a.`corpwx_userid` = b.`corpwx_userid` OR (a.corpwx_userid IS NULL AND a.name = b.name))
|
|
|
- AND (a.`create_date` >= b.`induction_date` OR b.`induction_date` IS NULL)
|
|
|
- AND a.create_date in
|
|
|
- <foreach collection="dateList" item="date" open="(" separator="," close=")">
|
|
|
- #{date}
|
|
|
- </foreach>
|
|
|
- GROUP BY a.`corpwx_userid`,a.name ) card_time
|
|
|
+ AND (a.`create_date` >= b.`induction_date` OR b.`induction_date` IS NULL)
|
|
|
+ AND a.create_date in
|
|
|
+ <foreach collection="dateList" item="date" open="(" separator="," close=")">
|
|
|
+ #{date}
|
|
|
+ </foreach>
|
|
|
+ GROUP BY a.`corpwx_userid`,a.name ) card_time
|
|
|
ON user.name = card_time.name
|
|
|
LEFT JOIN (SELECT r.creator_id, SUM(r.working_time) AS projectTime FROM report r WHERE r.company_id = #{companyId} AND r.create_date in
|
|
|
- <foreach collection="dateList" item="date" open="(" separator="," close=")">
|
|
|
- #{date}
|
|
|
- </foreach> GROUP BY r.`creator_id` ) report_time
|
|
|
+ <foreach collection="dateList" item="date" open="(" separator="," close=")">
|
|
|
+ #{date}
|
|
|
+ </foreach> GROUP BY r.`creator_id` ) report_time
|
|
|
ON report_time.creator_id = user.id
|
|
|
WHERE user.company_id = #{companyId}
|
|
|
<if test="userId != null">
|