xiaogang
2021-07-17 1024666b99a24bd7d5e4dc442d6b0c0319fa2f29
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?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="feeDiscountServiceDaoImpl">
 
    <!-- 保存费用折扣信息 add by wuxw 2018-07-03 -->
    <insert id="saveFeeDiscountInfo" parameterType="Map">
        insert into fee_discount(
        discount_name,discount_desc,discount_type,discount_id,community_id,rule_id
        ) values (
        #{discountName},#{discountDesc},#{discountType},#{discountId},#{communityId},#{ruleId}
        )
    </insert>
 
    <!-- 查询费用折扣信息 add by wuxw 2018-07-03 -->
    <select id="getFeeDiscountInfo" parameterType="Map" resultType="Map">
        select t.discount_name,t.discount_name discountName,t.discount_desc,t.discount_desc
        discountDesc,t.discount_type,t.discount_type discountType,td.name discountTypeName,t.status_cd,t.status_cd
        statusCd,t.discount_id,t.discount_id discountId,t.community_id,t.community_id communityId,t.rule_id,t.rule_id
        ruleId,t.create_time createTime,fdr.rule_name ruleName,fdr.bean_impl beanImpl
        from fee_discount t
        left join fee_discount_rule fdr on t.rule_id = fdr.rule_id and fdr.status_cd = '0'
        left join t_dict td on td.status_cd = t.discount_type and td.table_name = 'fee_discount'
        and table_columns = 'discount_type'
        where 1 = 1
        <if test="discountName !=null and discountName != ''">
            and t.discount_name like '%${discountName}%'
        </if>
        <if test="ruleName !=null and ruleName != ''">
            and fdr.rule_name like '%${ruleName}%'
        </if>
        <if test="discountDesc !=null and discountDesc != ''">
            and t.discount_desc= #{discountDesc}
        </if>
        <if test="discountType !=null and discountType != ''">
            and t.discount_type= #{discountType}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="discountId !=null and discountId != ''">
            and t.discount_id= #{discountId}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="ruleId !=null and ruleId != ''">
            and t.rule_id= #{ruleId}
        </if>
        order by t.create_time desc
        <if test="page != -1 and page != null ">
            limit #{page}, #{row}
        </if>
    </select>
 
    <!-- 修改费用折扣信息 add by wuxw 2018-07-03 -->
    <update id="updateFeeDiscountInfo" parameterType="Map">
        update fee_discount t set t.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,t.b_id = #{newBId}
        </if>
        <if test="discountName !=null and discountName != ''">
            , t.discount_name= #{discountName}
        </if>
        <if test="discountDesc !=null and discountDesc != ''">
            , t.discount_desc= #{discountDesc}
        </if>
        <if test="discountType !=null and discountType != ''">
            , t.discount_type= #{discountType}
        </if>
        <if test="communityId !=null and communityId != ''">
            , t.community_id= #{communityId}
        </if>
        <if test="ruleId !=null and ruleId != ''">
            , t.rule_id= #{ruleId}
        </if>
        where 1=1
        <if test="discountId !=null and discountId != ''">
            and t.discount_id= #{discountId}
        </if>
    </update>
 
    <!-- 查询费用折扣数量 add by wuxw 2018-07-03 -->
    <select id="queryFeeDiscountsCount" parameterType="Map" resultType="Map">
        select count(1) count
        from fee_discount t
        left join fee_discount_rule fdr on t.rule_id = fdr.rule_id and fdr.status_cd = '0'
        where 1 = 1
        <if test="discountName !=null and discountName != ''">
            and t.discount_name like '%${discountName}%'
        </if>
        <if test="ruleName !=null and ruleName != ''">
            and fdr.rule_name like '%${ruleName}%'
        </if>
        <if test="discountDesc !=null and discountDesc != ''">
            and t.discount_desc= #{discountDesc}
        </if>
        <if test="discountType !=null and discountType != ''">
            and t.discount_type= #{discountType}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="discountId !=null and discountId != ''">
            and t.discount_id= #{discountId}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="ruleId !=null and ruleId != ''">
            and t.rule_id= #{ruleId}
        </if>
    </select>
 
</mapper>