LeaveSheetMapper.xml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. group by owner_id
  40. </select>
  41. <!-- 查询审核中的请假单信息 -->
  42. <select id="selectApprovalList" resultType="com.management.platform.entity.LeaveSheet">
  43. select * from leave_sheet
  44. where procinst_id is not NULL AND procinst_id is not null and status = 1 and DATEDIFF(NOW(),indate) &lt; 30
  45. </select>
  46. <!-- 查询某段时间内的请假列表 -->
  47. <select id="selectLeave" resultType="com.management.platform.entity.LeaveSheet">
  48. select * from leave_sheet
  49. where company_id = #{companyId} and leave_sheet.status=0
  50. and leave_sheet.start_date &lt;=#{endDate} and leave_sheet.end_date &gt;=#{startDate}
  51. </select>
  52. <!-- 查询某段时间内全部请假的人员信息 -->
  53. <select id="selectLeaveAll" resultType="map">
  54. 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.wx_openid as wxOpenId,user.job_number as jobNumber,user.name as name
  55. from leave_sheet
  56. left join user
  57. on user.id = leave_sheet.owner_id
  58. where user.company_id = #{companyId} and leave_sheet.status=0
  59. and leave_sheet.start_date &lt;=#{endDate} and leave_sheet.end_date &gt;=#{startDate}
  60. <if test="branchDepartment!=null and branchDepartment.size()>0">
  61. and user.department_id in
  62. <foreach collection="branchDepartment" open="(" close=")" item="item" separator=",">
  63. #{item}
  64. </foreach>
  65. </if>
  66. <if test="deptIds!=null and deptIds.size()>0">
  67. and user.department_id in
  68. <foreach collection="deptIds" open="(" item="item" separator="," close=")">
  69. #{item}
  70. </foreach>
  71. </if>
  72. </select>
  73. </mapper>