增加规则配置
This commit is contained in:
@@ -0,0 +1,130 @@
|
||||
<?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.bms.system.mapper.BmsBizRuleMapper">
|
||||
|
||||
<resultMap type="BmsBizRule" id="BmsBizRuleResult">
|
||||
<id property="ruleId" column="rule_id" />
|
||||
<result property="ruleName" column="rule_name" />
|
||||
<result property="ruleType" column="rule_type" />
|
||||
<result property="productCode" column="product_code" />
|
||||
<result property="countryCode" column="country_code" />
|
||||
<result property="customerCode" column="customer_code" />
|
||||
<result property="weightMin" column="weight_min" />
|
||||
<result property="weightMax" column="weight_max" />
|
||||
<result property="weightSource" column="weight_source" />
|
||||
<result property="sideSumMax" column="side_sum_max" />
|
||||
<result property="status" column="status" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectVo">
|
||||
select rule_id, rule_name, rule_type, product_code, country_code, customer_code,
|
||||
weight_min, weight_max, weight_source, side_sum_max,
|
||||
status, remark, create_by, create_time, update_by, update_time, del_flag
|
||||
from biz_rule
|
||||
</sql>
|
||||
|
||||
<select id="selectList" parameterType="BmsBizRule" resultMap="BmsBizRuleResult">
|
||||
<include refid="selectVo"/>
|
||||
<where>
|
||||
del_flag = '0'
|
||||
<if test="ruleName != null and ruleName != ''">
|
||||
and rule_name like concat('%', #{ruleName}, '%')
|
||||
</if>
|
||||
<if test="ruleType != null and ruleType != ''">
|
||||
and rule_type = #{ruleType}
|
||||
</if>
|
||||
<if test="productCode != null and productCode != ''">
|
||||
and product_code = #{productCode}
|
||||
</if>
|
||||
<if test="countryCode != null and countryCode != ''">
|
||||
and country_code = #{countryCode}
|
||||
</if>
|
||||
<if test="customerCode != null and customerCode != ''">
|
||||
and customer_code = #{customerCode}
|
||||
</if>
|
||||
<if test="weightSource != null and weightSource != ''">
|
||||
and weight_source = #{weightSource}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
order by product_code asc, country_code asc, customer_code asc, rule_id desc
|
||||
</select>
|
||||
|
||||
<select id="selectById" parameterType="Long" resultMap="BmsBizRuleResult">
|
||||
<include refid="selectVo"/>
|
||||
where rule_id = #{ruleId} and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectActiveByType" parameterType="String" resultMap="BmsBizRuleResult">
|
||||
<include refid="selectVo"/>
|
||||
where del_flag = '0' and status = '0'
|
||||
and rule_type = #{ruleType}
|
||||
order by
|
||||
(case when product_code is null or product_code = '' then 0 else 1 end
|
||||
+ case when country_code is null or country_code = '' then 0 else 1 end
|
||||
+ case when customer_code is null or customer_code = '' then 0 else 1 end) desc,
|
||||
rule_id asc
|
||||
</select>
|
||||
|
||||
<select id="countByDim" resultType="int">
|
||||
select count(1) from biz_rule
|
||||
where del_flag = '0'
|
||||
and rule_type = #{ruleType}
|
||||
and ifnull(product_code,'') = ifnull(#{productCode},'')
|
||||
and ifnull(country_code,'') = ifnull(#{countryCode},'')
|
||||
and ifnull(customer_code,'') = ifnull(#{customerCode},'')
|
||||
and ((#{weightMin} is null and weight_min is null) or weight_min = #{weightMin})
|
||||
and ((#{weightMax} is null and weight_max is null) or weight_max = #{weightMax})
|
||||
<if test="excludeId != null">and rule_id != #{excludeId}</if>
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="BmsBizRule" useGeneratedKeys="true" keyProperty="ruleId">
|
||||
insert into biz_rule (
|
||||
rule_name, rule_type, product_code, country_code, customer_code, weight_min, weight_max,
|
||||
weight_source, side_sum_max, status, remark, create_by, create_time, del_flag
|
||||
) values (
|
||||
#{ruleName}, #{ruleType}, #{productCode}, #{countryCode}, #{customerCode}, #{weightMin}, #{weightMax},
|
||||
#{weightSource}, #{sideSumMax}, #{status}, #{remark}, #{createBy}, sysdate(), '0'
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="BmsBizRule">
|
||||
update biz_rule
|
||||
<set>
|
||||
<if test="ruleName != null and ruleName != ''">rule_name = #{ruleName},</if>
|
||||
<if test="ruleType != null and ruleType != ''">rule_type = #{ruleType},</if>
|
||||
product_code = #{productCode},
|
||||
country_code = #{countryCode},
|
||||
customer_code = #{customerCode},
|
||||
weight_min = #{weightMin},
|
||||
weight_max = #{weightMax},
|
||||
<if test="weightSource != null and weightSource != ''">weight_source = #{weightSource},</if>
|
||||
side_sum_max = #{sideSumMax},
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where rule_id = #{ruleId} and del_flag = '0'
|
||||
</update>
|
||||
|
||||
<update id="deleteByIds" parameterType="Long">
|
||||
update biz_rule
|
||||
set del_flag = '1',
|
||||
update_time = sysdate()
|
||||
where rule_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<sql id="selectBmsBizAttachmentVo">
|
||||
select attachment_id, biz_type, biz_id, file_name, file_path, file_size, content_type,
|
||||
file_extension, remark, create_by, create_time, update_by, update_time, del_flag
|
||||
from bms_biz_attachment
|
||||
from biz_attachment
|
||||
</sql>
|
||||
|
||||
<select id="selectBmsBizAttachmentById" parameterType="Long" resultMap="BmsBizAttachmentResult">
|
||||
@@ -59,7 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<insert id="insertBmsBizAttachment" parameterType="BmsBizAttachment" useGeneratedKeys="true" keyProperty="attachmentId">
|
||||
insert into bms_biz_attachment (
|
||||
insert into biz_attachment (
|
||||
<if test="bizType != null and bizType != ''">biz_type,</if>
|
||||
<if test="bizId != null">biz_id,</if>
|
||||
<if test="fileName != null and fileName != ''">file_name,</if>
|
||||
@@ -87,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</insert>
|
||||
|
||||
<update id="updateBmsBizAttachment" parameterType="BmsBizAttachment">
|
||||
update bms_biz_attachment
|
||||
update biz_attachment
|
||||
<set>
|
||||
<if test="bizId != null">biz_id = #{bizId},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
@@ -98,7 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</update>
|
||||
|
||||
<update id="deleteBmsBizAttachmentByIds" parameterType="Long">
|
||||
update bms_biz_attachment set del_flag = '2' where attachment_id in
|
||||
update biz_attachment set del_flag = '2' where attachment_id in
|
||||
<foreach collection="array" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
||||
Reference in New Issue
Block a user