wujianwei
2026-03-20 6df8411e720cfef1b474f178825bdee32ef71a59
service/src/main/resources/mapper/cwgl/VoucherSubjectSettingMapper.xml
@@ -7,6 +7,8 @@
    <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"    />
@@ -15,6 +17,9 @@
        <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"    />
@@ -31,10 +36,11 @@
        <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.ancestors, thisTab.account_set, thisTab.subject_code, thisTab.subject_name, thisTab.subject_type, thisTab.enabled, thisTab.balance_direction, thisTab.accounting_items, 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 from voucher_subject_setting AS thisTab
        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
@@ -42,6 +48,8 @@
    <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>
@@ -49,7 +57,12 @@
        <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 accountingItems != ''"> and thisTab.accounting_items = #{accountingItems}</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>
@@ -60,6 +73,7 @@
        <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>
    <!--查询-->
@@ -88,6 +102,8 @@
        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>
@@ -112,9 +128,12 @@
            <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>
@@ -139,17 +158,18 @@
            <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,
            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.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>
@@ -183,6 +203,7 @@
            <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>
@@ -216,6 +237,7 @@
                <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>
@@ -232,4 +254,10 @@
        </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>