BasePersonnelLabourCapitalMapper.xml 3.5 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. t1.labour_capital_id
  16. FROM
  17. base_personnel_labour_capital t
  18. LEFT JOIN base_personnel_labour_capital_data t1 ON t1.labour_capital_id = t.id
  19. LEFT JOIN xjr_user u ON t1.job_number = u.user_name
  20. LEFT JOIN xjr_user_dept_relation w ON u.id = w.user_id
  21. LEFT JOIN xjr_department d ON w.dept_id = d.id
  22. WHERE t.delete_mark = 0 and t.category = #{dto.category}
  23. <if test="dto.year != null and dto.month != null">
  24. and YEAR(t.date_of_issue) = #{dto.year}
  25. and MONTH(t.date_of_issue) = #{dto.month}
  26. and t1.job_number = #{dto.jobNumber}
  27. </if>
  28. </select>
  29. <select id="getYearPage" parameterType="com.xjrsoft.module.personnel.dto.BasePersonnelLabourCapitalYearPageDto" resultType="com.xjrsoft.module.personnel.vo.BasePersonnelLabourCapitalYearPageVo">
  30. SELECT
  31. t.id,
  32. t.name,
  33. t1.name as project,
  34. d.name as dept,
  35. month(t1.date_of_issue) as month,
  36. t.amount_to as amount,
  37. SUM(replace(t.amount_to,',','')) OVER (PARTITION BY t.create_user_id, MONTH(t1.date_of_issue)) as monthAmount,
  38. (SELECT SUM(REPLACE(amount_to,',','')) FROM base_personnel_labour_capital_data WHERE NAME = t.name AND job_number = t.job_number AND delete_mark = 0) AS yearAmount
  39. from base_personnel_labour_capital_data t
  40. LEFT JOIN base_personnel_labour_capital t1 ON t.labour_capital_id = t1.id
  41. LEFT JOIN xjr_user u ON t.job_number = u.user_name
  42. LEFT JOIN xjr_user_dept_relation w ON u.id = w.user_id
  43. LEFT JOIN xjr_department d ON w.dept_id = d.id
  44. LEFT JOIN base_personnel_labour_capital_title bp ON bp.labour_capital_id = t.id
  45. WHERE
  46. t.delete_mark = 0 and t.category = #{dto.category}
  47. and YEAR(t1.date_of_issue) = #{dto.year}
  48. and t.job_number = #{dto.jobNumber}
  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';-->