<?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.nuvole.four.mapper.ActivityFeeMapper" >
|
<select id="selectList" parameterType="com.nuvole.four.domain.query.ActivityFeeQuery" resultType="com.nuvole.four.domain.ActivityFee">
|
select <include refid="Base_Column_List"></include>
|
from activity_fee
|
<where>
|
deleted = 0
|
<if test="orgId!=null">
|
and org_id =#{orgId}
|
</if>
|
<if test="orgCode!=null and orgCode!=''">
|
and org_code like concat(#{orgCode}, '%')
|
</if>
|
<if test="name!=null and name!=''">
|
and name like concat('%',#{name},'%')
|
</if>
|
<if test="code!=null and code!=''">
|
and code like concat('%',#{code},'%')
|
</if>
|
<if test="beginTime!=null">
|
and begin_time =#{beginTime}
|
</if>
|
<if test="endTime!=null">
|
and end_time =#{endTime}
|
</if>
|
<if test="expireTime!=null">
|
and expire_time =#{expireTime}
|
</if>
|
<if test="totalFee!=null">
|
and total_fee =#{totalFee}
|
</if>
|
<if test="useFee!=null">
|
and use_fee =#{useFee}
|
</if>
|
<if test="surplusFee!=null">
|
and surplus_fee =#{surplusFee}
|
</if>
|
<if test="onlineAgreeWxRate!=null">
|
and online_agree_wx_rate =#{onlineAgreeWxRate}
|
</if>
|
<if test="onlineAgreeZfbRate!=null">
|
and online_agree_zfb_rate =#{onlineAgreeZfbRate}
|
</if>
|
<if test="onlineAgreeUnionpayRate!=null">
|
and online_agree_unionpay_rate =#{onlineAgreeUnionpayRate}
|
</if>
|
<if test="offlineAgreeWxRate!=null">
|
and offline_agree_wx_rate =#{offlineAgreeWxRate}
|
</if>
|
<if test="offlineAgreeZfbRate!=null">
|
and offline_agree_zfb_rate =#{offlineAgreeZfbRate}
|
</if>
|
<if test="offlineAgreeUnionpayRate!=null">
|
and offline_agree_unionpay_rate =#{offlineAgreeUnionpayRate}
|
</if>
|
<if test="onlineMerWxRate!=null">
|
and online_mer_wx_rate =#{onlineMerWxRate}
|
</if>
|
<if test="onlineMerZfbRate!=null">
|
and online_mer_zfb_rate =#{onlineMerZfbRate}
|
</if>
|
<if test="onlineMerUnionpayRate!=null">
|
and online_mer_unionpay_rate =#{onlineMerUnionpayRate}
|
</if>
|
<if test="offlineMerWxRate!=null">
|
and offline_mer_wx_rate =#{offlineMerWxRate}
|
</if>
|
<if test="offlineMerZfbRate!=null">
|
and offline_mer_zfb_rate =#{offlineMerZfbRate}
|
</if>
|
<if test="offlineMerUnionpayRate!=null">
|
and offline_mer_unionpay_rate =#{offlineMerUnionpayRate}
|
</if>
|
<if test="status!=null">
|
and status =#{status}
|
</if>
|
<if test="deleted!=null">
|
and deleted =#{deleted}
|
</if>
|
<if test="createBy!=null">
|
and create_by =#{createBy}
|
</if>
|
<if test="createTime!=null">
|
and create_time =#{createTime}
|
</if>
|
<if test="updateBy!=null">
|
and update_by =#{updateBy}
|
</if>
|
<if test="updateTime!=null">
|
and update_time =#{updateTime}
|
</if>
|
</where>
|
</select>
|
|
<select id="selectActivityWithDistribute" parameterType="com.nuvole.four.domain.query.ActivityFeeQuery" resultType="com.nuvole.four.domain.ActivityFee">
|
SELECT
|
af.id ,
|
adr.org_id,
|
adr.org_code,
|
af.`name`,
|
af.code,
|
af.begin_time,
|
af.end_time,
|
af.expire_time,
|
af.offline_mer_wx_rate,
|
af.offline_mer_zfb_rate,
|
af.offline_mer_unionpay_rate,
|
af.`status`,
|
af.create_time,
|
af.create_by
|
FROM
|
activity_fee af
|
JOIN activity_distribute_record adr ON adr.activity_id = af.id
|
and af.deleted = 0
|
<where>
|
<if test="orgId != null">
|
and adr.org_id = #{orgId}
|
</if>
|
<if test="orgCode!=null and orgCode!=''">
|
and adr.org_code like concat(#{orgCode}, '%')
|
</if>
|
<if test="name!=null and name!=''">
|
and af.name like concat('%',#{name},'%')
|
</if>
|
<if test="code!=null and code!=''">
|
and af.code like concat('%',#{code},'%')
|
</if>
|
<if test="beginTime!=null">
|
and af.begin_time =#{beginTime}
|
</if>
|
<if test="endTime!=null">
|
and af.end_time =#{endTime}
|
</if>
|
<if test="expireTime!=null">
|
and af.expire_time =#{expireTime}
|
</if>
|
</where>
|
UNION
|
SELECT
|
af.id,
|
'',
|
'',
|
af.`name`,
|
af.CODE,
|
af.begin_time,
|
af.end_time,
|
af.expire_time,
|
af.offline_mer_wx_rate,
|
af.offline_mer_zfb_rate,
|
af.offline_mer_unionpay_rate,
|
af.`status`,
|
af.create_time,
|
af.create_by
|
FROM
|
activity_fee af
|
WHERE
|
af.deleted = 0
|
AND af.create_by = #{createBy}
|
|
</select>
|
|
<select id="getActivityFeeDetail" resultType="com.nuvole.four.domain.dto.ActivityDistributeBudgetDto">
|
SELECT
|
adr.id,
|
af.total_fee totalFee,
|
af.surplus_fee surplusFee,
|
so.id orgId,
|
so.NAME orgName,
|
so.org_code orgCode,
|
so.lv orgLv,
|
so.pid pId,
|
IFNULL( af.use_fee, 0 ) useFee,
|
if( adr.id is null, 0, 1) useOrNot
|
FROM
|
sys_org so
|
LEFT JOIN activity_distribute_record adr ON adr.org_id = so.id AND adr.deleted = 0
|
left join activity_fee af on af.id = adr.activity_id and af.deleted = 0
|
where so.pid = #{orgId}
|
GROUP BY
|
so.id
|
ORDER BY
|
sort_no
|
</select>
|
</mapper>
|