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
select count(0) from voucher_subject_setting as thisTab
and thisTab.parent_id = #{parentId}
and thisTab.parent_subject_code like concat('%', #{parentSubjectCode}, '%')
and thisTab.parent_subject_name like concat('%', #{parentSubjectName}, '%')
and thisTab.ancestors = #{ancestors}
and thisTab.account_set = #{accountSet}
and thisTab.subject_code = #{subjectCode}
and thisTab.subject_name like concat('%', #{subjectName}, '%')
and thisTab.subject_type = #{subjectType}
and thisTab.enabled = #{enabled}
and thisTab.balance_direction = #{balanceDirection}
and thisTab.accounting_items = #{accountingItems}
and (thisTab.accounting_items & #{accountingItemsContains}) = #{accountingItemsContains}
and (thisTab.accounting_items & #{accountingItemsAny}) != 0
and thisTab.contact_unit = #{contactUnit}
and thisTab.department = #{department}
and thisTab.product_name = #{productName}
and thisTab.quantity_amount_accounting = #{quantityAmountAccounting}
and thisTab.cash_subject = #{cashSubject}
and thisTab.bank_subject = #{bankSubject}
and thisTab.cash_flow_subject = #{cashFlowSubject}
and thisTab.expense_name like concat('%', #{expenseName}, '%')
and thisTab.mnemonic_code = #{mnemonicCode}
and thisTab.foreign_currency_accounting = #{foreignCurrencyAccounting}
and thisTab.unit_of_measurement = #{unitOfMeasurement}
and thisTab.order_num = #{orderNum}
and thisTab.status = #{status}
and thisTab.type = #{type}
insert into voucher_subject_setting
parent_id,
parent_subject_code,
parent_subject_name,
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,
#{parentId},
#{parentSubjectCode},
#{parentSubjectName},
#{ancestors},
#{accountSet},
#{subjectCode},
#{subjectName},
#{subjectType},
#{enabled},
#{balanceDirection},
#{accountingItems},
#{quantityAmountAccounting},
#{cashSubject},
#{bankSubject},
#{cashFlowSubject},
#{expenseName},
#{mnemonicCode},
#{foreignCurrencyAccounting},
#{unitOfMeasurement},
#{orderNum},
#{status},
#{delFlag},
#{createBy},
#{createTime},
#{updateBy},
#{updateTime},
#{remark},
#{type},
insert into voucher_subject_setting
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,
#{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},
update voucher_subject_setting
parent_id = #{parentId},
ancestors = #{ancestors},
account_set = #{accountSet},
subject_code = #{subjectCode},
subject_name = #{subjectName},
subject_type = #{subjectType},
enabled = #{enabled},
balance_direction = #{balanceDirection},
accounting_items = #{accountingItems},
quantity_amount_accounting = #{quantityAmountAccounting},
cash_subject = #{cashSubject},
bank_subject = #{bankSubject},
cash_flow_subject = #{cashFlowSubject},
expense_name = #{expenseName},
mnemonic_code = #{mnemonicCode},
foreign_currency_accounting = #{foreignCurrencyAccounting},
unit_of_measurement = #{unitOfMeasurement},
order_num = #{orderNum},
status = #{status},
del_flag = #{delFlag},
create_by = #{createBy},
create_time = #{createTime},
update_by = #{updateBy},
update_time = #{updateTime},
remark = #{remark},
type = #{type},
where id = #{id}
update voucher_subject_setting
parent_id = #{item.parentId},
ancestors = #{item.ancestors},
account_set = #{item.accountSet},
subject_code = #{item.subjectCode},
subject_name = #{item.subjectName},
subject_type = #{item.subjectType},
enabled = #{item.enabled},
balance_direction = #{item.balanceDirection},
accounting_items = #{item.accountingItems},
quantity_amount_accounting = #{item.quantityAmountAccounting},
cash_subject = #{item.cashSubject},
bank_subject = #{item.bankSubject},
cash_flow_subject = #{item.cashFlowSubject},
expense_name = #{item.expenseName},
mnemonic_code = #{item.mnemonicCode},
foreign_currency_accounting = #{item.foreignCurrencyAccounting},
unit_of_measurement = #{item.unitOfMeasurement},
order_num = #{item.orderNum},
status = #{item.status},
del_flag = #{item.delFlag},
create_by = #{item.createBy},
create_time = #{item.createTime},
update_by = #{item.updateBy},
update_time = #{item.updateTime},
remark = #{item.remark},
type = #{item.type},
where id = #{item.id}
delete from voucher_subject_setting where id = #{id}
delete from voucher_subject_setting where id in
#{id}