BasePersonnelLabourCapitalMapper.xml 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.xjrsoft.module.personnel.mapper.BasePersonnelLabourCapitalMapper">
  6. <select id="getMonthPage" parameterType="com.xjrsoft.module.personnel.dto.BasePersonnelLabourCapitalMonthPageDto" resultType="com.xjrsoft.module.personnel.vo.BasePersonnelLabourCapitalMonthPageVo">
  7. SELECT
  8. t.id,
  9. YEAR(t.date_of_issue),
  10. MONTH(t.date_of_issue),
  11. t1.name,
  12. d.name as dept,
  13. t1.amount_to as amount,
  14. t1.extend_json as pendingJson
  15. FROM
  16. base_personnel_labour_capital t
  17. LEFT JOIN base_personnel_labour_capital_data t1 ON t1.labour_capital_id = t.id
  18. LEFT JOIN xjr_user u ON t1.job_number = u.user_name
  19. LEFT JOIN wf_teacher_depart w ON u.id = w.create_user_id
  20. LEFT JOIN xjr_department d ON w.dept_name = d.id
  21. WHERE t.delete_mark = 0
  22. <if test="dto.year != null and dto.month != null">
  23. and YEAR(t.date_of_issue) = #{dto.year}
  24. and MONTH(t.date_of_issue) = #{dto.month}
  25. </if>
  26. </select>
  27. <select id="getYearPage" parameterType="com.xjrsoft.module.personnel.dto.BasePersonnelLabourCapitalYearPageDto" resultType="com.xjrsoft.module.personnel.vo.BasePersonnelLabourCapitalYearPageVo">
  28. <if test="dto.year != null and dto.project != null">
  29. SELECT
  30. t.id,
  31. t.name,
  32. t1.name as project,
  33. d.name as dept,
  34. month(t1.date_of_issue) as month,
  35. t.amount_to as amount,
  36. SUM(t.amount_to) OVER (PARTITION BY t.create_user_id, MONTH(t1.date_of_issue)) as monthAmount,
  37. (SELECT SUM(amount_to) FROM base_personnel_labour_capital_data WHERE name = t.name) as yearAmount
  38. from base_personnel_labour_capital_data t
  39. LEFT JOIN base_personnel_labour_capital t1 ON t.labour_capital_id = t1.id
  40. LEFT JOIN xjr_user u ON t.job_number = u.user_name
  41. LEFT JOIN wf_teacher_depart w ON u.id = w.create_user_id
  42. LEFT JOIN xjr_department d ON w.dept_name = d.id
  43. LEFT JOIN base_personnel_labour_capital_title bp ON bp.labour_capital_id = t.id
  44. WHERE
  45. t.delete_mark = 0
  46. and YEAR(t1.date_of_issue) = #{dto.year}
  47. and t1.name = #{dto.project}
  48. </if>
  49. </select>
  50. </mapper>
  51. <!-- SELECT-->
  52. <!-- t.id, t1.name, YEAR(DATE(t.date_of_issue)) as issue_year, d.name as dept, t1.amount_to,-->
  53. <!-- (SELECT JSON_OBJECTAGG(bp.name, JSON_UNQUOTE(JSON_EXTRACT(t1.extend_json, CONCAT('$."', bp.column_number, '"'))))-->
  54. <!-- FROM base_personnel_labour_capital_title bp-->
  55. <!-- WHERE bp.labour_capital_id = t.id) as dict-->
  56. <!-- FROM base_personnel_labour_capital t-->
  57. <!-- LEFT JOIN base_personnel_labour_capital_data t1 ON t1.labour_capital_id = t.id-->
  58. <!-- LEFT JOIN xjr_user u ON t1.job_number = u.user_name-->
  59. <!-- LEFT JOIN wf_teacher_depart w ON u.id = w.create_user_id-->
  60. <!-- LEFT JOIN xjr_department d ON w.dept_name = d.id-->
  61. <!-- WHERE t.delete_mark = 0-->
  62. <!-- AND MONTH(DATE(t.date_of_issue)) = '1';-->