12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.xjrsoft.module.personnel.mapper.BasePersonnelLabourCapitalMapper">
- <select id="getMonthPage" parameterType="com.xjrsoft.module.personnel.dto.BasePersonnelLabourCapitalMonthPageDto" resultType="com.xjrsoft.module.personnel.vo.BasePersonnelLabourCapitalMonthPageVo">
- SELECT
- t.id,
- YEAR(t.date_of_issue),
- MONTH(t.date_of_issue),
- t1.name,
- d.name as dept,
- t1.amount_to as amount,
- t1.extend_json as pendingJson
- FROM
- base_personnel_labour_capital t
- LEFT JOIN base_personnel_labour_capital_data t1 ON t1.labour_capital_id = t.id
- LEFT JOIN xjr_user u ON t1.job_number = u.user_name
- LEFT JOIN wf_teacher_depart w ON u.id = w.create_user_id
- LEFT JOIN xjr_department d ON w.dept_name = d.id
- WHERE t.delete_mark = 0
- <if test="dto.year != null and dto.month != null">
- and YEAR(t.date_of_issue) = #{dto.year}
- and MONTH(t.date_of_issue) = #{dto.month}
- </if>
- </select>
- <select id="getYearPage" parameterType="com.xjrsoft.module.personnel.dto.BasePersonnelLabourCapitalYearPageDto" resultType="com.xjrsoft.module.personnel.vo.BasePersonnelLabourCapitalYearPageVo">
- <if test="dto.year != null and dto.project != null">
- SELECT
- t.id,
- t.name,
- t1.name as project,
- d.name as dept,
- month(t1.date_of_issue) as month,
- t.amount_to as amount,
- SUM(t.amount_to) OVER (PARTITION BY t.create_user_id, MONTH(t1.date_of_issue)) as monthAmount,
- (SELECT SUM(amount_to) FROM base_personnel_labour_capital_data WHERE name = t.name) as yearAmount
- from base_personnel_labour_capital_data t
- LEFT JOIN base_personnel_labour_capital t1 ON t.labour_capital_id = t1.id
- LEFT JOIN xjr_user u ON t.job_number = u.user_name
- LEFT JOIN wf_teacher_depart w ON u.id = w.create_user_id
- LEFT JOIN xjr_department d ON w.dept_name = d.id
- LEFT JOIN base_personnel_labour_capital_title bp ON bp.labour_capital_id = t.id
- WHERE
- t.delete_mark = 0
- and YEAR(t1.date_of_issue) = #{dto.year}
- and t1.name = #{dto.project}
- </if>
- </select>
- </mapper>
- <!-- SELECT-->
- <!-- t.id, t1.name, YEAR(DATE(t.date_of_issue)) as issue_year, d.name as dept, t1.amount_to,-->
- <!-- (SELECT JSON_OBJECTAGG(bp.name, JSON_UNQUOTE(JSON_EXTRACT(t1.extend_json, CONCAT('$."', bp.column_number, '"'))))-->
- <!-- FROM base_personnel_labour_capital_title bp-->
- <!-- WHERE bp.labour_capital_id = t.id) as dict-->
- <!-- FROM base_personnel_labour_capital t-->
- <!-- LEFT JOIN base_personnel_labour_capital_data t1 ON t1.labour_capital_id = t.id-->
- <!-- LEFT JOIN xjr_user u ON t1.job_number = u.user_name-->
- <!-- LEFT JOIN wf_teacher_depart w ON u.id = w.create_user_id-->
- <!-- LEFT JOIN xjr_department d ON w.dept_name = d.id-->
- <!-- WHERE t.delete_mark = 0-->
- <!-- AND MONTH(DATE(t.date_of_issue)) = '1';-->
|