forked from rongchao/epmet-cloud-rizhao
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
127 lines
4.9 KiB
127 lines
4.9 KiB
<?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.epmet.dao.PointAdditiveRuleDao">
|
|
|
|
<resultMap type="com.epmet.entity.PointAdditiveRuleEntity" id="pointAdditiveRuleMap">
|
|
<result property="id" column="ID"/>
|
|
<result property="customerId" column="CUSTOMER_ID"/>
|
|
<result property="type" column="TYPE"/>
|
|
<result property="applyFlag" column="APPLY_FLAG"/>
|
|
<result property="categoryCode" column="CATEGORY_CODE"/>
|
|
<result property="categoryName" column="CATEGORY_NAME"/>
|
|
<result property="ruleName" column="RULE_NAME"/>
|
|
<result property="pid" column="PID"/>
|
|
<result property="pids" column="PIDS"/>
|
|
<result property="pointValue" column="POINT_VALUE"/>
|
|
<result property="delFlag" column="DEL_FLAG"/>
|
|
<result property="revision" column="REVISION"/>
|
|
<result property="createdBy" column="CREATED_BY"/>
|
|
<result property="createdTime" column="CREATED_TIME"/>
|
|
<result property="updatedBy" column="UPDATED_BY"/>
|
|
<result property="updatedTime" column="UPDATED_TIME"/>
|
|
</resultMap>
|
|
<select id="selectListbrief" resultType="com.epmet.dto.PointAdditiveRuleDTO">
|
|
select id,
|
|
CATEGORY_NAME
|
|
from point_additive_rule
|
|
where type = 'category'
|
|
and DEL_FLAG='0'
|
|
and pid = #{categoryId}
|
|
order by UPDATED_TIME desc
|
|
</select>
|
|
<select id="selectCategorydetail" resultType="com.epmet.dto.CategorydetailResultDTO">
|
|
select c.id,
|
|
c.CATEGORY_NAME as categoryName,
|
|
p.id as pid,
|
|
p.CATEGORY_NAME as parentCategoryName,
|
|
c.CREATED_TIME,
|
|
c.UPDATED_TIME
|
|
from point_additive_rule c
|
|
left join point_additive_rule p on c.PID = p.id and p.DEL_FLAG='0'
|
|
where c.type='category'
|
|
and c.DEL_FLAG='0'
|
|
and c.id = #{categoryId}
|
|
</select>
|
|
<select id="selectList4apply" resultType="com.epmet.dto.result.List4ApplyResultDTO">
|
|
select id,
|
|
if(CATEGORY_NAME is null,RULE_NAME,CATEGORY_NAME) as name,
|
|
pid,
|
|
POINT_VALUE
|
|
from point_additive_rule
|
|
where DEL_FLAG='0'
|
|
and CATEGORY_CODE=#{categoryCode}
|
|
<if test="applyFlag != null and applyFlag != ''">
|
|
and APPLY_FLAG= #{applyFlag}
|
|
</if>
|
|
<if test="businessCode != null and businessCode != '' and businessCode == 'point_fine'.toString()">
|
|
and (( type='rule' and POINT_VALUE < 0 )or TYPE='category')
|
|
</if>
|
|
<if test="businessCode != null and businessCode != '' and businessCode == 'point_reward'.toString()">
|
|
and (( type='rule' and POINT_VALUE > 0 )or TYPE='category')
|
|
</if>
|
|
and CUSTOMER_ID=#{customerId}
|
|
order by UPDATED_TIME desc
|
|
</select>
|
|
<select id="selectList4tree" resultType="com.epmet.dto.PointAdditiveRuleDTO">
|
|
select id,
|
|
pid,
|
|
type,
|
|
CATEGORY_NAME,
|
|
RULE_NAME,
|
|
APPLY_FLAG,
|
|
POINT_VALUE
|
|
from point_additive_rule
|
|
where DEL_FLAG='0'
|
|
<if test="categoryName != null and categoryName != ''">
|
|
and CATEGORY_NAME= #{categoryName}
|
|
</if>
|
|
<if test="ruleName != null and ruleName != ''">
|
|
and RULE_NAME= #{ruleName}
|
|
</if>
|
|
and CUSTOMER_ID=#{customerId}
|
|
order by UPDATED_TIME desc
|
|
</select>
|
|
<select id="selectPointTotalByIds" resultType="java.lang.Integer">
|
|
SELECT sum(POINT_VALUE)
|
|
FROM `point_additive_rule`
|
|
where DEL_FLAG='0'
|
|
and CUSTOMER_ID=#{customerId}
|
|
<if test="ruleIdList != null and ruleIdList.size() > 0">
|
|
AND id in
|
|
<foreach collection="ruleIdList" item="ruleId" open="(" close=")" separator=",">
|
|
#{ruleId}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
<select id="selectEntityByName" resultType="com.epmet.entity.PointAdditiveRuleEntity">
|
|
select *
|
|
FROM `point_additive_rule`
|
|
where DEL_FLAG='0'
|
|
and CUSTOMER_ID=#{customerId}
|
|
<if test="id != null and id != ''">
|
|
and id != #{id}
|
|
</if>
|
|
<if test="categoryName != null and categoryName != ''">
|
|
and CATEGORY_NAME= #{categoryName}
|
|
</if>
|
|
<if test="ruleName != null and ruleName != ''">
|
|
and RULE_NAME= #{ruleName}
|
|
</if>
|
|
</select>
|
|
<select id="selectRuledetail" resultType="com.epmet.dto.PointAdditiveRuleDTO">
|
|
SELECT id,
|
|
pid,
|
|
RULE_NAME,
|
|
POINT_VALUE,
|
|
APPLY_FLAG,
|
|
if(APPLY_FLAG='0','允许','禁止') as applyFlagName,
|
|
CREATED_TIME,
|
|
UPDATED_TIME
|
|
FROM point_additive_rule
|
|
WHERE DEL_FLAG='0'
|
|
AND ID=#{ruleId}
|
|
</select>
|
|
|
|
|
|
</mapper>
|
|
|