| | |
| | | <result column="latestDeductMoney" property="latestDeductMoney"/> |
| | | </resultMap> |
| | | |
| | | <select id="page" resultMap="BaseResultMap"> |
| | | <!-- <select id="page" resultMap="BaseResultMap">--> |
| | | <!-- SELECT--> |
| | | <!-- tcr.contract_id,--> |
| | | <!-- tyu.unit_name,--> |
| | | <!-- tc.name,--> |
| | | <!-- tcr.id,--> |
| | | <!-- tcr.status,--> |
| | | <!-- tcr.deduct_money,--> |
| | | <!-- tcr.create_time,--> |
| | | <!-- tcr.update_time,--> |
| | | <!-- tcr.calculate_time,--> |
| | | <!-- tcr.latest_time,--> |
| | | <!-- (SELECT a.deduct_money FROM (SELECT deduct_money,which_year, which_month FROM t_calculate_record WHERE contract_id = tcr.contract_id ORDER BY which_year, which_month DESC limit 1) a) as latestDeductMoney--> |
| | | <!-- FROM--> |
| | | <!-- t_calculate_report tcr--> |
| | | <!-- INNER JOIN t_contract tc ON tcr.contract_id = tc.id--> |
| | | <!-- INNER JOIN t_yw_unit tyu ON tyu.id = tc.unit_id--> |
| | | <!-- <where>--> |
| | | <!-- AND tcr.deleted = 0 AND tc.deleted = 0 AND tyu.deleted = 0--> |
| | | <!-- <if test="query.unitName != null and query.unitName != '' ">--> |
| | | <!-- AND tyu.unit_name like concat('%', #{query.unitName}, '%')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="query.unitId != null">--> |
| | | <!-- AND tyu.id = #{query.unitId}--> |
| | | <!-- </if>--> |
| | | <!-- </where>--> |
| | | <!-- </select>--> |
| | | <select id="page" resultType="com.ycl.platform.domain.vo.CalculateReportVO"> |
| | | SELECT |
| | | tcr.contract_id, |
| | | tyu.unit_name, |
| | | tc.name, |
| | | tcr.id, |
| | | tcr.status, |
| | | tcr.deduct_money, |
| | | tcr.create_time, |
| | | tcr.update_time, |
| | | tcr.calculate_time, |
| | | tcr.latest_time, |
| | | (SELECT a.deduct_money FROM (SELECT deduct_money,which_year, which_month FROM t_calculate_record WHERE contract_id = tcr.contract_id ORDER BY which_year, which_month DESC limit 1) a) as latestDeductMoney |
| | | tcr.id, |
| | | tcr.contract_id, |
| | | tyu.unit_name, |
| | | tc.name as contractName, |
| | | tcr.which_year, |
| | | SUM(tcr.deduct_money) AS deductMoney, |
| | | MAX(tcr.create_time) AS latest_time, |
| | | ( |
| | | SELECT deduct_money |
| | | FROM t_calculate_record |
| | | WHERE contract_id = tcr.contract_id |
| | | AND which_year = tcr.which_year |
| | | ORDER BY which_month DESC |
| | | LIMIT 1 |
| | | ) AS latestDeductMoney |
| | | FROM |
| | | t_calculate_report tcr |
| | | t_calculate_record tcr |
| | | INNER JOIN t_contract tc ON tcr.contract_id = tc.id |
| | | INNER JOIN t_yw_unit tyu ON tyu.id = tc.unit_id |
| | | <where> |
| | | AND tcr.deleted = 0 AND tc.deleted = 0 AND tyu.deleted = 0 |
| | | <if test="query.unitName != null and query.unitName != '' "> |
| | | AND tyu.unit_name like concat('%', #{query.unitName}, '%') |
| | | </if> |
| | | <if test="query.unitId != null"> |
| | | AND tyu.id = #{query.unitId} |
| | | <if test="query.status!=null and query.status !=''"> |
| | | AND tcr.status = #{query.status} |
| | | </if> |
| | | </where> |
| | | group by contract_id,which_year |
| | | </select> |
| | | |
| | | <resultMap id="DetailResultMap" type="com.ycl.platform.domain.vo.CalculateReportDetailVO"> |
| | | <result column="id" property="id"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="unit_name" property="unitName"/> |
| | | <result column="name" property="contractName"/> |
| | | <result column="contract_id" property="contractId"/> |
| | | <result column="calculate_time" property="calculateTime"/> |
| | | <result column="deduct_money" property="deductMoney"/> |
| | | <result column="which_year" property="whichYear"/> |
| | | <result column="status" property="status"/> |
| | | <collection property="ruleList" column="contract_id" ofType="com.ycl.platform.domain.vo.CalculateMoneyRuleVO" |
| | | select="selectRuleByContractId"/> |
| | | <collection property="recordList" column="contract_id" ofType="com.ycl.platform.domain.vo.CalculateRecordVO" |
| | | <collection property="recordList" column="{contractId=contract_id, whichYear=which_year}" ofType="com.ycl.platform.domain.vo.CalculateRecordVO" |
| | | select="selectRecordByContractId"/> |
| | | </resultMap> |
| | | |
| | |
| | | score, |
| | | deduct_money as deductMoney, |
| | | which_year as whichYear, |
| | | which_month as whichMonth |
| | | which_month as whichMonth, |
| | | status |
| | | FROM |
| | | t_calculate_record |
| | | WHERE |
| | | contract_id = #{contractId} AND deleted = 0 |
| | | contract_id = #{contractId} AND which_year = #{whichYear} AND deleted = 0 |
| | | ORDER BY |
| | | create_time DESC |
| | | |
| | | create_time |
| | | </select> |
| | | |
| | | <select id="getById" resultMap="DetailResultMap"> |
| | |
| | | tc.name, |
| | | tcr.id, |
| | | tcr.contract_id, |
| | | tcr.deduct_money, |
| | | tcr.create_time, |
| | | tcr.update_time, |
| | | tcr.calculate_time, |
| | | tcr.status |
| | | FROM t_calculate_report tcr |
| | | tcr.which_year |
| | | FROM t_calculate_record tcr |
| | | INNER JOIN t_contract tc ON tcr.contract_id = tc.id |
| | | INNER JOIN t_yw_unit tyu ON tyu.id = tc.unit_id |
| | | WHERE tcr.id = #{id} |
| | | WHERE tcr.contract_id = #{query.contractId} AND tcr.which_year = #{query.whichYear} |
| | | limit 1 |
| | | </select> |
| | | |
| | | <select id="exportData" resultType="com.ycl.platform.domain.excel.CalculateExport"> |