LeaveSheetMapper.xml 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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.management.platform.mapper.LeaveSheetMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.management.platform.entity.LeaveSheet">
  6. <id column="id" property="id" />
  7. <result column="company_id" property="companyId" />
  8. <result column="owner_id" property="ownerId" />
  9. <result column="owner_name" property="ownerName" />
  10. <result column="start_date" property="startDate" />
  11. <result column="end_date" property="endDate" />
  12. <result column="leave_type" property="leaveType" />
  13. <result column="status" property="status" />
  14. <result column="remark" property="remark" />
  15. <result column="operator_id" property="operatorId" />
  16. <result column="time_hours" property="timeHours" />
  17. <result column="time_days" property="timeDays" />
  18. <result column="indate" property="indate" />
  19. <result column="time_type" property="timeType" />
  20. <result column="tel" property="tel" />
  21. <result column="auditor_id" property="auditorId" />
  22. <result column="auditor_name" property="auditorName" />
  23. <result column="auditor_type" property="auditorType" />
  24. <result column="procinst_id" property="procinstId" />
  25. <result column="gmt_finished" property="gmtFinished" />
  26. <result column="cur_audit_setting_id" property="curAuditSettingId" />
  27. </resultMap>
  28. <!-- 通用查询结果列 -->
  29. <sql id="Base_Column_List">
  30. id, company_id, owner_id, owner_name, start_date, end_date, leave_type, status, remark, operator_id, time_hours, time_days, indate, time_type, tel, auditor_id, auditor_name, auditor_type, procinst_id, gmt_finished, cur_audit_setting_id
  31. </sql>
  32. <select id="summaryData" resultMap="BaseResultMap">
  33. select owner_id, owner_name, sum(time_hours) as time_hours, sum(time_days) as time_days from leave_sheet
  34. where start_date &gt;= #{startDate} and end_date &lt;= #{endDate}
  35. <if test="keyword != null and keyword != ''">
  36. and owner_name like '%${keyword}%'
  37. </if>
  38. and company_id = #{companyId}
  39. and status = 0
  40. group by owner_id
  41. </select>
  42. <!-- 查询审核中的请假单信息 -->
  43. <select id="selectApprovalList" resultType="com.management.platform.entity.LeaveSheet">
  44. select * from leave_sheet
  45. where procinst_id is not NULL AND procinst_id is not null and status = 1 and DATEDIFF(NOW(),indate) &lt; 30
  46. </select>
  47. <!-- 查询某段时间内的请假列表 -->
  48. <select id="selectLeave" resultType="com.management.platform.entity.LeaveSheet">
  49. select * from leave_sheet
  50. where company_id = #{companyId} and leave_sheet.status=0
  51. and leave_sheet.start_date &lt;=#{endDate} and leave_sheet.end_date &gt;=#{startDate}
  52. </select>
  53. <!-- 查询某段时间内全部请假的人员信息 -->
  54. <select id="selectLeaveAll" resultType="map">
  55. select leave_sheet.start_date as startDate,leave_sheet.end_date as endDate,leave_sheet.time_hours as hours,user.id as id,user.department_id as departmentId,user.corpwx_userid as userId,user.job_number as jobNumber,user.name as name
  56. from leave_sheet
  57. left join user
  58. on user.id = leave_sheet.owner_id
  59. where user.company_id = #{companyId} and leave_sheet.status=0
  60. and leave_sheet.start_date &lt;=#{endDate} and leave_sheet.end_date &gt;=#{startDate}
  61. <if test="branchDepartment!=null and branchDepartment.size()>0">
  62. and user.department_id in
  63. <foreach collection="branchDepartment" open="(" close=")" item="item" separator=",">
  64. #{item}
  65. </foreach>
  66. </if>
  67. <if test="deptIds!=null and deptIds.size()>0">
  68. and user.department_id in
  69. <foreach collection="deptIds" open="(" item="item" separator="," close=")">
  70. #{item}
  71. </foreach>
  72. </if>
  73. </select>
  74. </mapper>