Files
usdt/luqj-custom/src/main/resources/mapper/custom/CustomHsCodeMapper.xml
T
2025-12-02 23:07:47 +08:00

115 lines
6.7 KiB
XML

<?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.custom.mapper.CustomHsCodeMapper">
<resultMap type="CustomHsCode" id="CustomHsCodeResult">
<result property="id" column="id" />
<result property="code" column="code" />
<result property="name" column="name" />
<result property="licenseCode" column="license_code" />
<result property="generalTaxRate" column="general_tax_rate" />
<result property="preferentialTaxRate" column="preferential_tax_rate" />
<result property="remark" column="remark" />
<result property="exportTaxRate" column="export_tax_rate" />
<result property="consumptionTaxRate" column="consumption_tax_rate" />
<result property="vatRate" column="vat_rate" />
<result property="firstLegalUnit" column="first_legal_unit" />
<result property="secondLegalUnit" column="second_legal_unit" />
<result property="declareReason" column="declare_reason" />
<result property="isExistInventory" column="is_exist_inventory" />
</resultMap>
<sql id="selectCustomHsCodeVo">
select id, code, name, license_code, general_tax_rate, preferential_tax_rate, remark, export_tax_rate, consumption_tax_rate, vat_rate, first_legal_unit, second_legal_unit, declare_reason, is_exist_inventory from custom_hs_code
</sql>
<select id="selectCustomHsCodeList" parameterType="CustomHsCode" resultMap="CustomHsCodeResult">
<include refid="selectCustomHsCodeVo"/>
<where>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="licenseCode != null and licenseCode != ''"> and license_code = #{licenseCode}</if>
<if test="generalTaxRate != null "> and general_tax_rate = #{generalTaxRate}</if>
<if test="preferentialTaxRate != null "> and preferential_tax_rate = #{preferentialTaxRate}</if>
<if test="exportTaxRate != null "> and export_tax_rate = #{exportTaxRate}</if>
<if test="consumptionTaxRate != null "> and consumption_tax_rate = #{consumptionTaxRate}</if>
<if test="vatRate != null "> and vat_rate = #{vatRate}</if>
<if test="firstLegalUnit != null and firstLegalUnit != ''"> and first_legal_unit = #{firstLegalUnit}</if>
<if test="secondLegalUnit != null and secondLegalUnit != ''"> and second_legal_unit = #{secondLegalUnit}</if>
<if test="declareReason != null and declareReason != ''"> and declare_reason = #{declareReason}</if>
<if test="isExistInventory != null "> and is_exist_inventory = #{isExistInventory}</if>
</where>
</select>
<select id="selectCustomHsCodeById" parameterType="Long" resultMap="CustomHsCodeResult">
<include refid="selectCustomHsCodeVo"/>
where id = #{id}
</select>
<insert id="insertCustomHsCode" parameterType="CustomHsCode" useGeneratedKeys="true" keyProperty="id">
insert into custom_hs_code
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null">code,</if>
<if test="name != null">name,</if>
<if test="licenseCode != null">license_code,</if>
<if test="generalTaxRate != null">general_tax_rate,</if>
<if test="preferentialTaxRate != null">preferential_tax_rate,</if>
<if test="remark != null">remark,</if>
<if test="exportTaxRate != null">export_tax_rate,</if>
<if test="consumptionTaxRate != null">consumption_tax_rate,</if>
<if test="vatRate != null">vat_rate,</if>
<if test="firstLegalUnit != null">first_legal_unit,</if>
<if test="secondLegalUnit != null">second_legal_unit,</if>
<if test="declareReason != null">declare_reason,</if>
<if test="isExistInventory != null">is_exist_inventory,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">#{code},</if>
<if test="name != null">#{name},</if>
<if test="licenseCode != null">#{licenseCode},</if>
<if test="generalTaxRate != null">#{generalTaxRate},</if>
<if test="preferentialTaxRate != null">#{preferentialTaxRate},</if>
<if test="remark != null">#{remark},</if>
<if test="exportTaxRate != null">#{exportTaxRate},</if>
<if test="consumptionTaxRate != null">#{consumptionTaxRate},</if>
<if test="vatRate != null">#{vatRate},</if>
<if test="firstLegalUnit != null">#{firstLegalUnit},</if>
<if test="secondLegalUnit != null">#{secondLegalUnit},</if>
<if test="declareReason != null">#{declareReason},</if>
<if test="isExistInventory != null">#{isExistInventory},</if>
</trim>
</insert>
<update id="updateCustomHsCode" parameterType="CustomHsCode">
update custom_hs_code
<trim prefix="SET" suffixOverrides=",">
<if test="code != null">code = #{code},</if>
<if test="name != null">name = #{name},</if>
<if test="licenseCode != null">license_code = #{licenseCode},</if>
<if test="generalTaxRate != null">general_tax_rate = #{generalTaxRate},</if>
<if test="preferentialTaxRate != null">preferential_tax_rate = #{preferentialTaxRate},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="exportTaxRate != null">export_tax_rate = #{exportTaxRate},</if>
<if test="consumptionTaxRate != null">consumption_tax_rate = #{consumptionTaxRate},</if>
<if test="vatRate != null">vat_rate = #{vatRate},</if>
<if test="firstLegalUnit != null">first_legal_unit = #{firstLegalUnit},</if>
<if test="secondLegalUnit != null">second_legal_unit = #{secondLegalUnit},</if>
<if test="declareReason != null">declare_reason = #{declareReason},</if>
<if test="isExistInventory != null">is_exist_inventory = #{isExistInventory},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCustomHsCodeById" parameterType="Long">
delete from custom_hs_code where id = #{id}
</delete>
<delete id="deleteCustomHsCodeByIds" parameterType="String">
delete from custom_hs_code where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>