| | |
| | | <?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"> |
| | | <?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.ycl.platform.mapper.CalculateRecordMapper"> |
| | | |
| | | <resultMap type="com.ycl.platform.domain.entity.CalculateRecord" id="CalculateRecordResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="date" column="date" /> |
| | | <result property="ruleId" column="rule_id" /> |
| | | <result property="unitId" column="unit_id" /> |
| | | <result property="totalAmount" column="total_amount" /> |
| | | <result property="deductAmount" column="deduct_amount" /> |
| | | <result property="score" column="score" /> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ycl.platform.domain.vo.CalculateRecordVO"> |
| | | <result column="id" property="id" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="rule_id" property="ruleId" /> |
| | | <result column="rule_name" property="ruleName" /> |
| | | <result column="deduct_category" property="deductCategory" /> |
| | | <result column="rule_condition" property="ruleCondition" /> |
| | | <result column="rule_desc" property="ruleDesc" /> |
| | | <result column="deduct_money" property="deductMoney" /> |
| | | <result column="score" property="score" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectCalculateRecordVo"> |
| | | select id, date, rule_id, unit_id, total_amount, deduct_amount, score from t_calculate_record |
| | | </sql> |
| | | |
| | | <select id="selectCalculateRecordList" resultMap="CalculateRecordResult"> |
| | | <include refid="selectCalculateRecordVo"/> |
| | | <where> |
| | | <if test="date != null "> and date = #{date}</if> |
| | | <if test="ruleId != null "> and rule_id = #{ruleId}</if> |
| | | <if test="unitId != null "> and unit_id = #{unitId}</if> |
| | | <if test="totalAmount != null "> and total_amount = #{totalAmount}</if> |
| | | <if test="deductAmount != null "> and deduct_amount = #{deductAmount}</if> |
| | | <if test="score != null "> and score = #{score}</if> |
| | | </where> |
| | | <select id="getByContractId" resultMap="BaseResultMap"> |
| | | SELECT |
| | | tcr.id, |
| | | tcr.create_time, |
| | | tcr.deduct_money, |
| | | tcr.score, |
| | | tcr.rule_id, |
| | | tcru.rule_name, |
| | | tcru.deduct_category, |
| | | tcru.rule_desc, |
| | | tcru.rule_condition |
| | | FROM |
| | | t_calculate_record tcr |
| | | INNER JOIN t_calculate_rule tcru ON tcr.rule_id = tcru.id AND tcr.contract_id = #{contractId} |
| | | WHERE |
| | | tcru.deleted = 0 AND tcr.deleted = 0 |
| | | </select> |
| | | |
| | | <select id="selectCalculateRecordById" resultMap="CalculateRecordResult"> |
| | | <include refid="selectCalculateRecordVo"/> |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertCalculateRecord" parameterType="CalculateRecord"> |
| | | insert into t_calculate_record |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="date != null">date,</if> |
| | | <if test="ruleId != null">rule_id,</if> |
| | | <if test="unitId != null">unit_id,</if> |
| | | <if test="totalAmount != null">total_amount,</if> |
| | | <if test="deductAmount != null">deduct_amount,</if> |
| | | <if test="score != null">score,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id},</if> |
| | | <if test="date != null">#{date},</if> |
| | | <if test="ruleId != null">#{ruleId},</if> |
| | | <if test="unitId != null">#{unitId},</if> |
| | | <if test="totalAmount != null">#{totalAmount},</if> |
| | | <if test="deductAmount != null">#{deductAmount},</if> |
| | | <if test="score != null">#{score},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateCalculateRecord"> |
| | | update t_calculate_record |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="date != null">date = #{date},</if> |
| | | <if test="ruleId != null">rule_id = #{ruleId},</if> |
| | | <if test="unitId != null">unit_id = #{unitId},</if> |
| | | <if test="totalAmount != null">total_amount = #{totalAmount},</if> |
| | | <if test="deductAmount != null">deduct_amount = #{deductAmount},</if> |
| | | <if test="score != null">score = #{score},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteCalculateRecordById" > |
| | | delete from t_calculate_record where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteCalculateRecordByIds" > |
| | | delete from t_calculate_record where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | </mapper> |
| | | </mapper> |