| | |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ycl.platform.domain.vo.CalculateReportVO"> |
| | | <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="which_month" property="whichMonth" /> |
| | | <result column="update_by" property="updateBy" /> |
| | | <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="which_month" property="whichMonth"/> |
| | | <result column="update_by" property="updateBy"/> |
| | | </resultMap> |
| | | |
| | | <select id="page" resultMap="BaseResultMap"> |
| | | SELECT |
| | | tyu.unit_name, |
| | | tc.name, |
| | | tcr.id, |
| | | tcr.deduct_money, |
| | | tcr.create_time, |
| | | tcr.update_time, |
| | | tcr.calculate_time |
| | | tyu.unit_name, |
| | | tc.name, |
| | | tcr.id, |
| | | tcr.deduct_money, |
| | | tcr.create_time, |
| | | tcr.update_time, |
| | | tcr.calculate_time, |
| | | tcr.which_year, |
| | | tcr.which_month |
| | | 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 |
| | | 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 |
| | | 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> |
| | | </where> |
| | | </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"/> |
| | | <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" |
| | | select="selectRecordByContractId"/> |
| | | </resultMap> |
| | | |
| | | <select id="selectRuleByContractId" resultType="com.ycl.platform.domain.vo.CalculateMoneyRuleVO"> |
| | | SELECT id, |
| | | description, |
| | | score_condition as scoreCondition |
| | | FROM t_calculate_money_rule |
| | | WHERE contract_id = #{contractId} |
| | | AND deleted = 0 |
| | | </select> |
| | | |
| | | <select id="selectRecordByContractId" resultType="com.ycl.platform.domain.vo.CalculateRecordVO"> |
| | | SELECT |
| | | id, |
| | | create_time as createTime, |
| | | score, |
| | | deduct_money as deductMoney |
| | | FROM |
| | | t_calculate_record |
| | | WHERE |
| | | contract_id = #{contractId} AND deleted = 0 |
| | | </select> |
| | | |
| | | <select id="getById" resultMap="DetailResultMap"> |
| | | SELECT tyu.unit_name, |
| | | tc.name, |
| | | tcr.id, |
| | | tcr.contract_id, |
| | | tcr.deduct_money, |
| | | tcr.create_time, |
| | | tcr.update_time, |
| | | tcr.calculate_time |
| | | 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 tcr.id = #{id} |
| | | </select> |
| | | |
| | | </mapper> |