wujianwei
5 天以前 849648e82e5dec96f9f30fcc9c9bd799268b1f4c
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
<?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.ruoyi.cwgl.mapper.VoucherSubjectSettingMapper">
 
    <resultMap type="com.ruoyi.cwgl.domain.VoucherSubjectSetting" id="VoucherSubjectSettingResult">
        <result property="id"    column="id"    />
        <result property="parentId"    column="parent_id"    />
        <result property="parentSubjectCode"    column="parent_subject_code"    />
        <result property="parentSubjectName"    column="parent_subject_name"    />
        <result property="ancestors"    column="ancestors"    />
        <result property="accountSet"    column="account_set"    />
        <result property="subjectCode"    column="subject_code"    />
        <result property="subjectName"    column="subject_name"    />
        <result property="subjectType"    column="subject_type"    />
        <result property="enabled"    column="enabled"    />
        <result property="balanceDirection"    column="balance_direction"    />
        <result property="accountingItems"    column="accounting_items"    />
        <result property="contactUnit"    column="contact_unit"    />
        <result property="department"    column="department"    />
        <result property="productName"    column="product_name"    />
        <result property="quantityAmountAccounting"    column="quantity_amount_accounting"    />
        <result property="cashSubject"    column="cash_subject"    />
        <result property="bankSubject"    column="bank_subject"    />
        <result property="cashFlowSubject"    column="cash_flow_subject"    />
        <result property="expenseName"    column="expense_name"    />
        <result property="mnemonicCode"    column="mnemonic_code"    />
        <result property="foreignCurrencyAccounting"    column="foreign_currency_accounting"    />
        <result property="unitOfMeasurement"    column="unit_of_measurement"    />
        <result property="orderNum"    column="order_num"    />
        <result property="status"    column="status"    />
        <result property="delFlag"    column="del_flag"    />
        <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="remark"    column="remark"    />
        <result property="type"    column="type"    />
    </resultMap>
 
    <sql id="selectVoucherSubjectSettingVo">
        select thisTab.id, thisTab.parent_id, thisTab.parent_subject_code, thisTab.parent_subject_name, thisTab.ancestors, thisTab.account_set, thisTab.subject_code, thisTab.subject_name, thisTab.subject_type, thisTab.enabled, thisTab.balance_direction, thisTab.accounting_items, thisTab.contact_unit, thisTab.department, thisTab.product_name, thisTab.quantity_amount_accounting, thisTab.cash_subject, thisTab.bank_subject, thisTab.cash_flow_subject, thisTab.expense_name, thisTab.mnemonic_code, thisTab.foreign_currency_accounting, thisTab.unit_of_measurement, thisTab.order_num, thisTab.status, thisTab.del_flag, thisTab.create_by, thisTab.create_time, thisTab.update_by, thisTab.update_time, thisTab.remark, thisTab.type from voucher_subject_setting AS thisTab
    </sql>
    <sql id="selectVoucherSubjectSettingVoCount">
        select count(0) from voucher_subject_setting as thisTab
    </sql>
 
    <sql id="whereCondition">
        <if test="parentId != null "> and thisTab.parent_id = #{parentId}</if>
        <if test="parentSubjectCode != null  and parentSubjectCode != ''"> and thisTab.parent_subject_code like concat('%', #{parentSubjectCode}, '%')</if>
        <if test="parentSubjectName != null  and parentSubjectName != ''"> and thisTab.parent_subject_name like concat('%', #{parentSubjectName}, '%')</if>
        <if test="ancestors != null  and ancestors != ''"> and thisTab.ancestors = #{ancestors}</if>
        <if test="accountSet != null  and accountSet != ''"> and thisTab.account_set = #{accountSet}</if>
        <if test="subjectCode != null  and subjectCode != ''"> and thisTab.subject_code = #{subjectCode}</if>
        <if test="subjectName != null  and subjectName != ''"> and  thisTab.subject_name like concat('%', #{subjectName}, '%')</if>
        <if test="subjectType != null  and subjectType != ''"> and thisTab.subject_type = #{subjectType}</if>
        <if test="enabled != null  and enabled != ''"> and thisTab.enabled = #{enabled}</if>
        <if test="balanceDirection != null  and balanceDirection != ''"> and thisTab.balance_direction = #{balanceDirection}</if>
        <if test="accountingItems != null "> and thisTab.accounting_items = #{accountingItems}</if>
        <if test="accountingItemsContains != null "> and (thisTab.accounting_items &amp; #{accountingItemsContains}) = #{accountingItemsContains}</if>
        <if test="accountingItemsAny != null "> and (thisTab.accounting_items &amp; #{accountingItemsAny}) != 0</if>
        <if test="contactUnit != null  and contactUnit != ''"> and thisTab.contact_unit = #{contactUnit}</if>
        <if test="department != null  and department != ''"> and thisTab.department = #{department}</if>
        <if test="productName != null  and productName != ''"> and thisTab.product_name = #{productName}</if>
        <if test="quantityAmountAccounting != null  and quantityAmountAccounting != ''"> and thisTab.quantity_amount_accounting = #{quantityAmountAccounting}</if>
        <if test="cashSubject != null  and cashSubject != ''"> and thisTab.cash_subject = #{cashSubject}</if>
        <if test="bankSubject != null  and bankSubject != ''"> and thisTab.bank_subject = #{bankSubject}</if>
        <if test="cashFlowSubject != null  and cashFlowSubject != ''"> and thisTab.cash_flow_subject = #{cashFlowSubject}</if>
        <if test="expenseName != null  and expenseName != ''"> and  thisTab.expense_name like concat('%', #{expenseName}, '%')</if>
        <if test="mnemonicCode != null  and mnemonicCode != ''"> and thisTab.mnemonic_code = #{mnemonicCode}</if>
        <if test="foreignCurrencyAccounting != null  and foreignCurrencyAccounting != ''"> and thisTab.foreign_currency_accounting = #{foreignCurrencyAccounting}</if>
        <if test="unitOfMeasurement != null  and unitOfMeasurement != ''"> and thisTab.unit_of_measurement = #{unitOfMeasurement}</if>
        <if test="orderNum != null "> and thisTab.order_num = #{orderNum}</if>
        <if test="status != null  and status != ''"> and thisTab.status = #{status}</if>
        <if test="type != null  and type != ''"> and thisTab.type = #{type}</if>
    </sql>
 
    <!--查询-->
    <select id="selectVoucherSubjectSettingById" parameterType="Integer" resultMap="VoucherSubjectSettingResult">
        <include refid="selectVoucherSubjectSettingVo"/>
        where id = #{id}
    </select>
 
    <select id="selectVoucherSubjectSettingCount" parameterType="com.ruoyi.cwgl.domain.VoucherSubjectSetting" resultType="int">
        <include refid="selectVoucherSubjectSettingVoCount"/>
        <where>
            <include refid="whereCondition"/>
        </where>
    </select>
 
    <select id="selectVoucherSubjectSettingList" parameterType="com.ruoyi.cwgl.domain.VoucherSubjectSetting" resultMap="VoucherSubjectSettingResult">
        <include refid="selectVoucherSubjectSettingVo"/>
        <where>
            <include refid="whereCondition"/>
        </where>
        order by thisTab.id desc
    </select>
 
    <!-- 新增 -->
    <insert id="insertVoucherSubjectSetting" parameterType="com.ruoyi.cwgl.domain.VoucherSubjectSetting"  useGeneratedKeys="true" keyProperty="id">
        insert into voucher_subject_setting
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="parentId != null">parent_id,</if>
            <if test="parentSubjectCode != null and parentSubjectCode != ''">parent_subject_code,</if>
            <if test="parentSubjectName != null and parentSubjectName != ''">parent_subject_name,</if>
            <if test="ancestors != null">ancestors,</if>
            <if test="accountSet != null and accountSet != ''">account_set,</if>
            <if test="subjectCode != null and subjectCode != ''">subject_code,</if>
            <if test="subjectName != null and subjectName != ''">subject_name,</if>
            <if test="subjectType != null and subjectType != ''">subject_type,</if>
            <if test="enabled != null">enabled,</if>
            <if test="balanceDirection != null and balanceDirection != ''">balance_direction,</if>
            <if test="accountingItems != null">accounting_items,</if>
            <if test="quantityAmountAccounting != null">quantity_amount_accounting,</if>
            <if test="cashSubject != null">cash_subject,</if>
            <if test="bankSubject != null">bank_subject,</if>
            <if test="cashFlowSubject != null">cash_flow_subject,</if>
            <if test="expenseName != null">expense_name,</if>
            <if test="mnemonicCode != null">mnemonic_code,</if>
            <if test="foreignCurrencyAccounting != null">foreign_currency_accounting,</if>
            <if test="unitOfMeasurement != null">unit_of_measurement,</if>
            <if test="orderNum != null">order_num,</if>
            <if test="status != null">status,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
            <if test="type != null and type != ''">type,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="parentId != null">#{parentId},</if>
            <if test="parentSubjectCode != null and parentSubjectCode != ''">#{parentSubjectCode},</if>
            <if test="parentSubjectName != null and parentSubjectName != ''">#{parentSubjectName},</if>
            <if test="ancestors != null">#{ancestors},</if>
            <if test="accountSet != null and accountSet != ''">#{accountSet},</if>
            <if test="subjectCode != null and subjectCode != ''">#{subjectCode},</if>
            <if test="subjectName != null and subjectName != ''">#{subjectName},</if>
            <if test="subjectType != null and subjectType != ''">#{subjectType},</if>
            <if test="enabled != null">#{enabled},</if>
            <if test="balanceDirection != null and balanceDirection != ''">#{balanceDirection},</if>
            <if test="accountingItems != null">#{accountingItems},</if>
            <if test="quantityAmountAccounting != null">#{quantityAmountAccounting},</if>
            <if test="cashSubject != null">#{cashSubject},</if>
            <if test="bankSubject != null">#{bankSubject},</if>
            <if test="cashFlowSubject != null">#{cashFlowSubject},</if>
            <if test="expenseName != null">#{expenseName},</if>
            <if test="mnemonicCode != null">#{mnemonicCode},</if>
            <if test="foreignCurrencyAccounting != null">#{foreignCurrencyAccounting},</if>
            <if test="unitOfMeasurement != null">#{unitOfMeasurement},</if>
            <if test="orderNum != null">#{orderNum},</if>
            <if test="status != null">#{status},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
            <if test="type != null and type != ''">#{type},</if>
         </trim>
    </insert>
 
    <insert id="insertVoucherSubjectSettingBatch" parameterType="java.util.List"  useGeneratedKeys="true" keyProperty="id">
        insert into voucher_subject_setting
        <trim prefix="(" suffix=") values" suffixOverrides=",">
            id,parent_id,ancestors,account_set,subject_code,subject_name,subject_type,enabled,balance_direction,accounting_items,quantity_amount_accounting,cash_subject,bank_subject,cash_flow_subject,expense_name,mnemonic_code,foreign_currency_accounting,unit_of_measurement,order_num,status,del_flag,create_by,create_time,update_by,update_time,remark,type,
        </trim>
        <foreach item="item" index="index" collection="list" separator=",">
            <trim prefix="(" suffix=") " suffixOverrides=",">
                #{item.id},#{item.parentId},#{item.ancestors},#{item.accountSet},#{item.subjectCode},#{item.subjectName},#{item.subjectType},#{item.enabled},#{item.balanceDirection},#{item.accountingItems},#{item.quantityAmountAccounting},#{item.cashSubject},#{item.bankSubject},#{item.cashFlowSubject},#{item.expenseName},#{item.mnemonicCode},#{item.foreignCurrencyAccounting},#{item.unitOfMeasurement},#{item.orderNum},#{item.status},#{item.delFlag},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.remark},#{item.type},
            </trim>
        </foreach>
    </insert>
 
    <!-- 修改 -->
    <update id="updateVoucherSubjectSetting" parameterType="com.ruoyi.cwgl.domain.VoucherSubjectSetting">
        update voucher_subject_setting
        <trim prefix="SET" suffixOverrides=",">
            <if test="parentId != null">parent_id = #{parentId},</if>
            <if test="ancestors != null">ancestors = #{ancestors},</if>
            <if test="accountSet != null and accountSet != ''">account_set = #{accountSet},</if>
            <if test="subjectCode != null and subjectCode != ''">subject_code = #{subjectCode},</if>
            <if test="subjectName != null and subjectName != ''">subject_name = #{subjectName},</if>
            <if test="subjectType != null and subjectType != ''">subject_type = #{subjectType},</if>
            <if test="enabled != null">enabled = #{enabled},</if>
            <if test="balanceDirection != null and balanceDirection != ''">balance_direction = #{balanceDirection},</if>
            <if test="accountingItems != null">accounting_items = #{accountingItems},</if>
            <if test="quantityAmountAccounting != null">quantity_amount_accounting = #{quantityAmountAccounting},</if>
            <if test="cashSubject != null">cash_subject = #{cashSubject},</if>
            <if test="bankSubject != null">bank_subject = #{bankSubject},</if>
            <if test="cashFlowSubject != null">cash_flow_subject = #{cashFlowSubject},</if>
            <if test="expenseName != null">expense_name = #{expenseName},</if>
            <if test="mnemonicCode != null">mnemonic_code = #{mnemonicCode},</if>
            <if test="foreignCurrencyAccounting != null">foreign_currency_accounting = #{foreignCurrencyAccounting},</if>
            <if test="unitOfMeasurement != null">unit_of_measurement = #{unitOfMeasurement},</if>
            <if test="orderNum != null">order_num = #{orderNum},</if>
            <if test="status != null">status = #{status},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="type != null and type != ''">type = #{type},</if>
        </trim>
        where id = #{id}
    </update>
    <!-- 修改 -->
    <update id="updateVoucherSubjectSettingBatch" parameterType="java.util.List">
        <foreach collection="list" item="item" index="index" separator=";">
            update voucher_subject_setting
            <trim prefix="SET" suffixOverrides=",">
                <if test="item.parentId != null">parent_id = #{item.parentId},</if>
                <if test="item.ancestors != null">ancestors = #{item.ancestors},</if>
                <if test="item.accountSet != null and item.accountSet != ''">account_set = #{item.accountSet},</if>
                <if test="item.subjectCode != null and item.subjectCode != ''">subject_code = #{item.subjectCode},</if>
                <if test="item.subjectName != null and item.subjectName != ''">subject_name = #{item.subjectName},</if>
                <if test="item.subjectType != null and item.subjectType != ''">subject_type = #{item.subjectType},</if>
                <if test="item.enabled != null">enabled = #{item.enabled},</if>
                <if test="item.balanceDirection != null and item.balanceDirection != ''">balance_direction = #{item.balanceDirection},</if>
                <if test="item.accountingItems != null">accounting_items = #{item.accountingItems},</if>
                <if test="item.quantityAmountAccounting != null">quantity_amount_accounting = #{item.quantityAmountAccounting},</if>
                <if test="item.cashSubject != null">cash_subject = #{item.cashSubject},</if>
                <if test="item.bankSubject != null">bank_subject = #{item.bankSubject},</if>
                <if test="item.cashFlowSubject != null">cash_flow_subject = #{item.cashFlowSubject},</if>
                <if test="item.expenseName != null">expense_name = #{item.expenseName},</if>
                <if test="item.mnemonicCode != null">mnemonic_code = #{item.mnemonicCode},</if>
                <if test="item.foreignCurrencyAccounting != null">foreign_currency_accounting = #{item.foreignCurrencyAccounting},</if>
                <if test="item.unitOfMeasurement != null">unit_of_measurement = #{item.unitOfMeasurement},</if>
                <if test="item.orderNum != null">order_num = #{item.orderNum},</if>
                <if test="item.status != null">status = #{item.status},</if>
                <if test="item.delFlag != null">del_flag = #{item.delFlag},</if>
                <if test="item.createBy != null">create_by = #{item.createBy},</if>
                <if test="item.createTime != null">create_time = #{item.createTime},</if>
                <if test="item.updateBy != null">update_by = #{item.updateBy},</if>
                <if test="item.updateTime != null">update_time = #{item.updateTime},</if>
                <if test="item.remark != null">remark = #{item.remark},</if>
                <if test="item.type != null and item.type != ''">type = #{item.type},</if>
            </trim>
        where id = #{item.id}
        </foreach>
    </update>
 
    <!--删除-->
    <delete id="deleteVoucherSubjectSettingById" parameterType="Integer">
        delete from voucher_subject_setting where id = #{id}
    </delete>
    <delete id="deleteVoucherSubjectSettingByIds" parameterType="Integer">
        delete from voucher_subject_setting where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <!-- 校验科目代码是否唯一 -->
    <select id="checkSubjectCodeUnique" resultMap="VoucherSubjectSettingResult">
        <include refid="selectVoucherSubjectSettingVo"/>
        where subject_code = #{subjectCode} and account_set = #{accountSet} and del_flag = '0' limit 1
    </select>
 
</mapper>