Your Name
2023-04-05 b6949a31464f2ca4e790affd467dcfc511223ba2
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
117
118
119
120
121
122
123
124
<?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="payFeeAuditServiceDaoImpl">
 
    <!-- 保存缴费审核信息 add by wuxw 2018-07-03 -->
    <insert id="savePayFeeAuditInfo" parameterType="Map">
        insert into pay_fee_audit(audit_user_id, audit_user_name, fee_detail_id, state, message, community_id, fee_id,
                                  audit_id)
        values (#{auditUserId}, #{auditUserName}, #{feeDetailId}, #{state}, #{message}, #{communityId}, #{feeId},
                #{auditId})
    </insert>
 
    <!-- 查询缴费审核信息 add by wuxw 2018-07-03 -->
    <select id="getPayFeeAuditInfo" parameterType="Map" resultType="Map">
        select pf.payer_obj_id payerObjId,pf.payer_obj_type payerObjType,pfc.fee_name feeName,
        pfd.cycles,pfd.start_time startTime,pfd.end_time endTime,pfd.receivable_amount receivableAmount,
        pfd.received_amount receivedAmount,pfd.create_time createTime,pfa.state,pfa.message,pfd.remark,
        pfa.audit_user_name auditUserName,pfd.b_id bId,pf.fee_id feeId,pf.community_id communityId,pfd.detail_id
        detailId
        from pay_fee_detail pfd
        INNER JOIN pay_fee pf on pf.fee_id = pfd.fee_id and pf.community_id = pfd.community_id and pf.status_cd = '0'
        inner join pay_fee_config pfc on pf.config_id = pfc.config_id and pf.community_id = pfc.community_id and
        pfc.status_cd = '0'
        left join pay_fee_audit pfa on pf.fee_id = pfa.fee_id and pfd.detail_id = pfa.fee_detail_id and pfa.status_cd =
        '0'
        where 1=1
        and pfd.community_id = #{communityId}
        and pfd.status_cd = '0'
        and pfd.state = '1400'
        <if test="roomId !=null and roomId != ''">
            and pf.payer_obj_id = #{roomId}
            and pf.payer_obj_type = '3333'
        </if>
        <if test="carId !=null and carId != ''">
            and pf.payer_obj_id = #{carId}
            and pf.payer_obj_type = '6666'
        </if>
        <if test="payerObjId !=null and payerObjId != ''">
            and pf.payer_obj_id = #{payerObjId}
        </if>
        <if test="payerObjType !=null and payerObjType != ''">
            and pf.payer_obj_type = #{payerObjType}
        </if>
        <if test="state != null and state != '' and state != '1010'">
            and pfa.state = #{state}
        </if>
        <if test="state != null and state != '' and state == '1010'">
            and pfa.state is null
        </if>
        ORDER BY pfd.create_time desc
        <if test="page != -1 and page != null ">
            limit #{page}, #{row}
        </if>
    </select>
 
    <!-- 修改缴费审核信息 add by wuxw 2018-07-03 -->
    <update id="updatePayFeeAuditInfo" parameterType="Map">
        update pay_fee_audit t set t.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,t.b_id = #{newBId}
        </if>
        <if test="auditUserId !=null and auditUserId != ''">
            , t.audit_user_id= #{auditUserId}
        </if>
        <if test="auditUserName !=null and auditUserName != ''">
            , t.audit_user_name= #{auditUserName}
        </if>
        <if test="feeDetailId !=null and feeDetailId != ''">
            , t.fee_detail_id= #{feeDetailId}
        </if>
        <if test="state !=null and state != ''">
            , t.state= #{state}
        </if>
        <if test="message !=null and message != ''">
            , t.message= #{message}
        </if>
        <if test="communityId !=null and communityId != ''">
            , t.community_id= #{communityId}
        </if>
        <if test="feeId !=null and feeId != ''">
            , t.fee_id= #{feeId}
        </if>
        where 1=1
        <if test="auditId !=null and auditId != ''">
            and t.audit_id= #{auditId}
        </if>
    </update>
 
    <!-- 查询缴费审核数量 add by wuxw 2018-07-03 -->
    <select id="queryPayFeeAuditsCount" parameterType="Map" resultType="Map">
        select count(1) count
        from pay_fee_detail pfd
        INNER JOIN pay_fee pf on pf.fee_id = pfd.fee_id and pf.community_id = pfd.community_id and pf.status_cd = '0'
        inner join pay_fee_config pfc on pf.config_id = pfc.config_id and pf.community_id = pfc.community_id and
        pfc.status_cd = '0'
        left join pay_fee_audit pfa on pf.fee_id = pfa.fee_id and pfd.detail_id = pfa.fee_detail_id and pfa.status_cd =
        '0'
        where 1=1
        and pfd.community_id = #{communityId}
        and pfd.status_cd = '0'
        and pfd.state = '1400'
        <if test="roomId !=null and roomId != ''">
            and pf.payer_obj_id = #{roomId}
            and pf.payer_obj_type = '3333'
        </if>
        <if test="carId !=null and carId != ''">
            and pf.payer_obj_id = #{carId}
            and pf.payer_obj_type = '6666'
        </if>
        <if test="payerObjId !=null and payerObjId != ''">
            and pf.payer_obj_id = #{payerObjId}
        </if>
        <if test="payerObjType !=null and payerObjType != ''">
            and pf.payer_obj_type = #{payerObjType}
        </if>
        <if test="state != null and state != '' and state != '1010'">
            and pfa.state = #{state}
        </if>
        <if test="state != null and state != '' and state == '1010'">
            and pfa.state is null
        </if>
    </select>
</mapper>