emis-service/emis-biz/src/main/resources/mapper/EmisWaybillDeclareGoodsMapper.xml
2025-01-02 22:58:45 +08:00

279 lines
18 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.xdadan.erp.emis.mapper.EmisWaybillDeclareGoodsMapper" >
<resultMap type="EmisWaybillDeclareGoods" id="EmisWaybillDeclareGoodsResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
<result property="id" column="id" />
<result property="waybillId" column="waybill_id" />
<result property="billCode" column="bill_code" />
<result property="goodsCode" column="goods_code" />
<result property="goodsName" column="goods_name" />
<result property="goodsModel" column="goods_model" />
<result property="grossWeight" column="gross_weight" />
<result property="netWeight" column="net_weight" />
<result property="cargoQty" column="cargo_qty" />
<result property="abnormalQty" column="abnormal_qty" />
<result property="unit" column="unit" />
<result property="weight" column="weight" />
<result property="price" column="price" />
<result property="currency" column="currency" />
<result property="nationArea" column="nation_area" />
<result property="taxNo" column="tax_no" />
<result property="hscode" column="hscode" />
<result property="brand" column="brand" />
<result property="material" column="material" />
<result property="purpose" column="purpose" />
<result property="ingredients" column="ingredients" />
<result property="manufacturer" column="manufacturer" />
<result property="supplier" column="supplier" />
<result property="function" column="function" />
<result property="length" column="length" />
<result property="width" column="width" />
<result property="height" column="height" />
<result property="volume" column="volume" />
<result property="barcode" column="barcode" />
<result property="extraData" column="extra_data" />
<result property="orderNum" column="order_num" />
</resultMap>
<sql id="selectEmisWaybillDeclareGoodsVo">
select id, waybill_id, bill_code, goods_code, goods_name, goods_model, gross_weight, net_weight, cargo_qty, abnormal_qty, unit, weight, price, currency, nation_area, tax_no, hscode, brand, material, purpose, ingredients, manufacturer, supplier, function, length, width, height, volume, barcode, extra_data, order_num, del_flag, create_by, create_time, update_by, update_time, remark from emis_waybill_declare_goods
</sql>
<select id="selectEmisWaybillDeclareGoodsList" parameterType="EmisWaybillDeclareGoods" resultMap="EmisWaybillDeclareGoodsResult">
<include refid="selectEmisWaybillDeclareGoodsVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="waybillId != null "> and waybill_id = #{waybillId}</if>
<if test="billCode != null and billCode != ''"> and bill_code like concat('%', #{billCode}, '%')</if>
<if test="goodsCode != null and goodsCode != ''"> and goods_code like concat('%', #{goodsCode}, '%')</if>
<if test="goodsName != null and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
<if test="goodsModel != null and goodsModel != ''"> and goods_model like concat('%', #{goodsModel}, '%')</if>
<if test="grossWeight != null "> and gross_weight = #{grossWeight}</if>
<if test="netWeight != null "> and net_weight = #{netWeight}</if>
<if test="cargoQty != null "> and cargo_qty = #{cargoQty}</if>
<if test="abnormalQty != null "> and abnormal_qty = #{abnormalQty}</if>
<if test="unit != null and unit != ''"> and unit like concat('%', #{unit}, '%')</if>
<if test="weight != null "> and weight = #{weight}</if>
<if test="price != null "> and price = #{price}</if>
<if test="currency != null and currency != ''"> and currency like concat('%', #{currency}, '%')</if>
<if test="nationArea != null and nationArea != ''"> and nation_area like concat('%', #{nationArea}, '%')</if>
<if test="taxNo != null and taxNo != ''"> and tax_no like concat('%', #{taxNo}, '%')</if>
<if test="hscode != null and hscode != ''"> and hscode like concat('%', #{hscode}, '%')</if>
<if test="brand != null and brand != ''"> and brand like concat('%', #{brand}, '%')</if>
<if test="material != null and material != ''"> and material like concat('%', #{material}, '%')</if>
<if test="purpose != null and purpose != ''"> and purpose like concat('%', #{purpose}, '%')</if>
<if test="ingredients != null and ingredients != ''"> and ingredients like concat('%', #{ingredients}, '%')</if>
<if test="manufacturer != null and manufacturer != ''"> and manufacturer like concat('%', #{manufacturer}, '%')</if>
<if test="supplier != null and supplier != ''"> and supplier like concat('%', #{supplier}, '%')</if>
<if test="function != null and function != ''"> and function like concat('%', #{function}, '%')</if>
<if test="length != null "> and length = #{length}</if>
<if test="width != null "> and width = #{width}</if>
<if test="height != null "> and height = #{height}</if>
<if test="volume != null "> and volume = #{volume}</if>
<if test="barcode != null and barcode != ''"> and barcode like concat('%', #{barcode}, '%')</if>
<if test="extraData != null and extraData != ''"> and extra_data like concat('%', #{extraData}, '%')</if>
<if test="orderNum != null "> and order_num = #{orderNum}</if>
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
</where>
order by create_time desc
</select>
<select id="checkUnique" parameterType="EmisWaybillDeclareGoods" resultType="int">
select count(1) from emis_waybill_declare_goods
where del_flag='0'
and id = #{id}
and waybill_id = #{waybillId}
and bill_code = #{billCode}
and goods_code = #{goodsCode}
and goods_name = #{goodsName}
and goods_model = #{goodsModel}
and gross_weight = #{grossWeight}
and net_weight = #{netWeight}
and cargo_qty = #{cargoQty}
and abnormal_qty = #{abnormalQty}
and unit = #{unit}
and weight = #{weight}
and price = #{price}
and currency = #{currency}
and nation_area = #{nationArea}
and tax_no = #{taxNo}
and hscode = #{hscode}
and brand = #{brand}
and material = #{material}
and purpose = #{purpose}
and ingredients = #{ingredients}
and manufacturer = #{manufacturer}
and supplier = #{supplier}
and function = #{function}
and length = #{length}
and width = #{width}
and height = #{height}
and volume = #{volume}
and barcode = #{barcode}
and extra_data = #{extraData}
and order_num = #{orderNum}
and del_flag = #{delFlag}
and create_by = #{createBy}
and create_time = #{createTime}
and update_by = #{updateBy}
and update_time = #{updateTime}
and remark = #{remark}
limit 1
</select>
<select id="selectEmisWaybillDeclareGoodsById" parameterType="Long" resultMap="EmisWaybillDeclareGoodsResult">
select id, waybill_id, bill_code, goods_code, goods_name, goods_model, gross_weight, net_weight, cargo_qty, abnormal_qty, unit, weight, price, currency, nation_area, tax_no, hscode, brand, material, purpose, ingredients, manufacturer, supplier, function, length, width, height, volume, barcode, extra_data, order_num, del_flag, create_by, create_time, update_by, update_time, remark
from emis_waybill_declare_goods a
where a.id = #{id}
</select>
<insert id="insertEmisWaybillDeclareGoods" parameterType="EmisWaybillDeclareGoods" useGeneratedKeys="true" keyProperty="id">
insert into emis_waybill_declare_goods
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="waybillId != null">waybill_id,</if>
<if test="billCode != null and billCode != ''">bill_code,</if>
<if test="goodsCode != null and goodsCode != ''">goods_code,</if>
<if test="goodsName != null and goodsName != ''">goods_name,</if>
<if test="goodsModel != null and goodsModel != ''">goods_model,</if>
<if test="grossWeight != null">gross_weight,</if>
<if test="netWeight != null">net_weight,</if>
<if test="cargoQty != null">cargo_qty,</if>
<if test="abnormalQty != null">abnormal_qty,</if>
<if test="unit != null and unit != ''">unit,</if>
<if test="weight != null">weight,</if>
<if test="price != null">price,</if>
<if test="currency != null and currency != ''">currency,</if>
<if test="nationArea != null and nationArea != ''">nation_area,</if>
<if test="taxNo != null and taxNo != ''">tax_no,</if>
<if test="hscode != null and hscode != ''">hscode,</if>
<if test="brand != null and brand != ''">brand,</if>
<if test="material != null and material != ''">material,</if>
<if test="purpose != null and purpose != ''">purpose,</if>
<if test="ingredients != null and ingredients != ''">ingredients,</if>
<if test="manufacturer != null and manufacturer != ''">manufacturer,</if>
<if test="supplier != null and supplier != ''">supplier,</if>
<if test="function != null and function != ''">function,</if>
<if test="length != null">length,</if>
<if test="width != null">width,</if>
<if test="height != null">height,</if>
<if test="volume != null">volume,</if>
<if test="barcode != null and barcode != ''">barcode,</if>
<if test="extraData != null and extraData != ''">extra_data,</if>
<if test="orderNum != null">order_num,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null and remark != ''">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="waybillId != null">#{waybillId},</if>
<if test="billCode != null and billCode != ''">#{billCode},</if>
<if test="goodsCode != null and goodsCode != ''">#{goodsCode},</if>
<if test="goodsName != null and goodsName != ''">#{goodsName},</if>
<if test="goodsModel != null and goodsModel != ''">#{goodsModel},</if>
<if test="grossWeight != null">#{grossWeight},</if>
<if test="netWeight != null">#{netWeight},</if>
<if test="cargoQty != null">#{cargoQty},</if>
<if test="abnormalQty != null">#{abnormalQty},</if>
<if test="unit != null and unit != ''">#{unit},</if>
<if test="weight != null">#{weight},</if>
<if test="price != null">#{price},</if>
<if test="currency != null and currency != ''">#{currency},</if>
<if test="nationArea != null and nationArea != ''">#{nationArea},</if>
<if test="taxNo != null and taxNo != ''">#{taxNo},</if>
<if test="hscode != null and hscode != ''">#{hscode},</if>
<if test="brand != null and brand != ''">#{brand},</if>
<if test="material != null and material != ''">#{material},</if>
<if test="purpose != null and purpose != ''">#{purpose},</if>
<if test="ingredients != null and ingredients != ''">#{ingredients},</if>
<if test="manufacturer != null and manufacturer != ''">#{manufacturer},</if>
<if test="supplier != null and supplier != ''">#{supplier},</if>
<if test="function != null and function != ''">#{function},</if>
<if test="length != null">#{length},</if>
<if test="width != null">#{width},</if>
<if test="height != null">#{height},</if>
<if test="volume != null">#{volume},</if>
<if test="barcode != null and barcode != ''">#{barcode},</if>
<if test="extraData != null and extraData != ''">#{extraData},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null and remark != ''">#{remark},</if>
</trim>
</insert>
<update id="updateEmisWaybillDeclareGoods" parameterType="EmisWaybillDeclareGoods">
update emis_waybill_declare_goods
<trim prefix="SET" suffixOverrides=",">
<if test="waybillId != null">waybill_id = #{waybillId},</if>
<if test="billCode != null and billCode != ''">bill_code = #{billCode},</if>
<if test="goodsCode != null and goodsCode != ''">goods_code = #{goodsCode},</if>
<if test="goodsName != null and goodsName != ''">goods_name = #{goodsName},</if>
<if test="goodsModel != null and goodsModel != ''">goods_model = #{goodsModel},</if>
<if test="grossWeight != null">gross_weight = #{grossWeight},</if>
<if test="netWeight != null">net_weight = #{netWeight},</if>
<if test="cargoQty != null">cargo_qty = #{cargoQty},</if>
<if test="abnormalQty != null">abnormal_qty = #{abnormalQty},</if>
<if test="unit != null and unit != ''">unit = #{unit},</if>
<if test="weight != null">weight = #{weight},</if>
<if test="price != null">price = #{price},</if>
<if test="currency != null and currency != ''">currency = #{currency},</if>
<if test="nationArea != null and nationArea != ''">nation_area = #{nationArea},</if>
<if test="taxNo != null and taxNo != ''">tax_no = #{taxNo},</if>
<if test="hscode != null and hscode != ''">hscode = #{hscode},</if>
<if test="brand != null and brand != ''">brand = #{brand},</if>
<if test="material != null and material != ''">material = #{material},</if>
<if test="purpose != null and purpose != ''">purpose = #{purpose},</if>
<if test="ingredients != null and ingredients != ''">ingredients = #{ingredients},</if>
<if test="manufacturer != null and manufacturer != ''">manufacturer = #{manufacturer},</if>
<if test="supplier != null and supplier != ''">supplier = #{supplier},</if>
<if test="function != null and function != ''">function = #{function},</if>
<if test="length != null">length = #{length},</if>
<if test="width != null">width = #{width},</if>
<if test="height != null">height = #{height},</if>
<if test="volume != null">volume = #{volume},</if>
<if test="barcode != null and barcode != ''">barcode = #{barcode},</if>
<if test="extraData != null and extraData != ''">extra_data = #{extraData},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEmisWaybillDeclareGoodsById" parameterType="Long">
delete from emis_waybill_declare_goods where id = #{id}
</delete>
<delete id="deleteEmisWaybillDeclareGoodsByIds" parameterType="String">
delete from emis_waybill_declare_goods where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteEmisWaybillDeclareGoodsByWaybillId" parameterType="Long">
update emis_waybill_declare_goods set del_flag='1' where waybill_id = #{waybillId}
</delete>
</mapper>