| | |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ycl.platform.mapper.CalculateRuleMapper"> |
| | | |
| | | <resultMap type="com.ycl.platform.domain.entity.CalculateRule" id="CalculateRuleResult"> |
| | | <mapper namespace="com.ycl.platform.mapper.DefaultRuleMapper"> |
| | | |
| | | <resultMap type="com.ycl.platform.domain.entity.CalculateRule" id="DefaultRuleResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="name" column="name" /> |
| | | <result property="templateId" column="template_id" /> |
| | | <result property="ruleName" column="rule_name" /> |
| | | <result property="parentId" column="parent_id" /> |
| | | <result property="unitId" column="unit_id" /> |
| | | <result property="value" column="value" /> |
| | | <result property="description" column="description" /> |
| | | <result property="deductCategory" column="deduct_category" /> |
| | | <result property="deductWay" column="deduct_way" /> |
| | | <result property="ruleDesc" column="rule_desc" /> |
| | | <result property="ruleStatus" column="rule_status" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="deleted" column="deleted" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectCalculateRuleVo"> |
| | | select id, name, template_id, parent_id, unit_id, value, description from t_calculate_rule |
| | | <sql id="selectDefaultRuleVo"> |
| | | select id, rule_name, parent_id, deduct_category, deduct_way, rule_desc, rule_status, create_time, update_time, deleted from t_calculate_rule |
| | | </sql> |
| | | |
| | | <select id="selectCalculateRuleList" resultMap="CalculateRuleResult"> |
| | | <include refid="selectCalculateRuleVo"/> |
| | | <where> |
| | | <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> |
| | | <if test="templateId != null "> and template_id = #{templateId}</if> |
| | | <if test="parentId != null "> and parent_id = #{parentId}</if> |
| | | <if test="unitId != null "> and unit_id = #{unitId}</if> |
| | | <if test="value != null "> and value = #{value}</if> |
| | | <if test="description != null and description != ''"> and description = #{description}</if> |
| | | <select id="selectDefaultRuleList" resultMap="DefaultRuleResult"> |
| | | <include refid="selectDefaultRuleVo"/> |
| | | <where> |
| | | <if test="ruleName != null and ruleName != ''"> and rule_name like concat('%', #{ruleName}, '%')</if> |
| | | <if test="deductCategory != null "> and deduct_category = #{deductCategory}</if> |
| | | <if test="ruleStatus != null and ruleStatus != ''"> and rule_status = #{ruleStatus}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectCalculateRuleById" resultMap="CalculateRuleResult"> |
| | | <include refid="selectCalculateRuleVo"/> |
| | | |
| | | <select id="selectDefaultRuleById" resultMap="DefaultRuleResult"> |
| | | <include refid="selectDefaultRuleVo"/> |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertCalculateRule" useGeneratedKeys="true" keyProperty="id"> |
| | | |
| | | <insert id="insertDefaultRule" useGeneratedKeys="true" keyProperty="id"> |
| | | insert into t_calculate_rule |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="name != null">name,</if> |
| | | <if test="templateId != null">template_id,</if> |
| | | <if test="ruleName != null and ruleName != ''">rule_name,</if> |
| | | <if test="parentId != null">parent_id,</if> |
| | | <if test="unitId != null">unit_id,</if> |
| | | <if test="value != null">value,</if> |
| | | <if test="description != null">description,</if> |
| | | <if test="deductCategory != null">deduct_category,</if> |
| | | <if test="deductWay != null">deduct_way,</if> |
| | | <if test="ruleDesc != null">rule_desc,</if> |
| | | <if test="ruleStatus != null">rule_status,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="deleted != null">deleted,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="name != null">#{name},</if> |
| | | <if test="templateId != null">#{templateId},</if> |
| | | <if test="ruleName != null and ruleName != ''">#{ruleName},</if> |
| | | <if test="parentId != null">#{parentId},</if> |
| | | <if test="unitId != null">#{unitId},</if> |
| | | <if test="value != null">#{value},</if> |
| | | <if test="description != null">#{description},</if> |
| | | <if test="deductCategory != null">#{deductCategory},</if> |
| | | <if test="deductWay != null">#{deductWay},</if> |
| | | <if test="ruleDesc != null">#{ruleDesc},</if> |
| | | <if test="ruleStatus != null">#{ruleStatus},</if> |
| | | <if test="createTime != null">#{createTime},</if> |
| | | <if test="updateTime != null">#{updateTime},</if> |
| | | <if test="deleted != null">#{deleted},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateCalculateRule"> |
| | | <update id="updateDefaultRule" > |
| | | update t_calculate_rule |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="name != null">name = #{name},</if> |
| | | <if test="templateId != null">template_id = #{templateId},</if> |
| | | <if test="ruleName != null and ruleName != ''">rule_name = #{ruleName},</if> |
| | | <if test="parentId != null">parent_id = #{parentId},</if> |
| | | <if test="unitId != null">unit_id = #{unitId},</if> |
| | | <if test="value != null">value = #{value},</if> |
| | | <if test="description != null">description = #{description},</if> |
| | | <if test="deductCategory != null">deduct_category = #{deductCategory},</if> |
| | | <if test="deductWay != null">deduct_way = #{deductWay},</if> |
| | | <if test="ruleDesc != null">rule_desc = #{ruleDesc},</if> |
| | | <if test="ruleStatus != null">rule_status = #{ruleStatus},</if> |
| | | <if test="createTime != null">create_time = #{createTime},</if> |
| | | <if test="updateTime != null">update_time = #{updateTime},</if> |
| | | <if test="deleted != null">deleted = #{deleted},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteCalculateRuleById" parameterType="Long"> |
| | | <delete id="deleteDefaultRuleById" > |
| | | delete from t_calculate_rule where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteCalculateRuleByIds" parameterType="String"> |
| | | delete from t_calculate_rule where id in |
| | | <delete id="deleteDefaultRuleByIds" > |
| | | delete from t_calculate_rule where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | </mapper> |
| | | </mapper> |