87 lines
4.0 KiB
XML
87 lines
4.0 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.bas.product.mapper.BasProductMapper">
|
|
|
|
<resultMap type="BasProduct" id="BasProductResult">
|
|
<result property="productId" column="product_id" />
|
|
<result property="productName" column="product_name" />
|
|
<result property="parentId" column="parent_id" />
|
|
<result property="price" column="price" />
|
|
<result property="cargoNo" column="cargo_no" />
|
|
<result property="unit" column="unit" />
|
|
<result property="spec" column="spec" />
|
|
<result property="remark" column="remark" />
|
|
</resultMap>
|
|
|
|
<sql id="selectBasProductVo">
|
|
select product_id, product_name, parent_id, price, cargo_no, unit, spec, remark from bas_product
|
|
</sql>
|
|
|
|
<select id="selectBasProductList" parameterType="BasProduct" resultMap="BasProductResult">
|
|
<include refid="selectBasProductVo"/>
|
|
<where>
|
|
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
|
|
<if test="parentId != null and parentId != ''"> and parent_id = #{parentId}</if>
|
|
<if test="price != null and price != ''"> and price = #{price}</if>
|
|
<if test="cargoNo != null and cargoNo != ''"> and cargo_no = #{cargoNo}</if>
|
|
<if test="unit != null and unit != ''"> and unit = #{unit}</if>
|
|
<if test="spec != null and spec != ''"> and spec = #{spec}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectBasProductByProductId" parameterType="String" resultMap="BasProductResult">
|
|
<include refid="selectBasProductVo"/>
|
|
where product_id = #{productId}
|
|
</select>
|
|
|
|
<insert id="insertBasProduct" parameterType="BasProduct">
|
|
insert into bas_product
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="productId != null">product_id,</if>
|
|
<if test="productName != null">product_name,</if>
|
|
<if test="parentId != null">parent_id,</if>
|
|
<if test="price != null">price,</if>
|
|
<if test="cargoNo != null">cargo_no,</if>
|
|
<if test="unit != null">unit,</if>
|
|
<if test="spec != null">spec,</if>
|
|
<if test="remark != null">remark,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="productId != null">#{productId},</if>
|
|
<if test="productName != null">#{productName},</if>
|
|
<if test="parentId != null">#{parentId},</if>
|
|
<if test="price != null">#{price},</if>
|
|
<if test="cargoNo != null">#{cargoNo},</if>
|
|
<if test="unit != null">#{unit},</if>
|
|
<if test="spec != null">#{spec},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateBasProduct" parameterType="BasProduct">
|
|
update bas_product
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="productName != null">product_name = #{productName},</if>
|
|
<if test="parentId != null">parent_id = #{parentId},</if>
|
|
<if test="price != null">price = #{price},</if>
|
|
<if test="cargoNo != null">cargo_no = #{cargoNo},</if>
|
|
<if test="unit != null">unit = #{unit},</if>
|
|
<if test="spec != null">spec = #{spec},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
</trim>
|
|
where product_id = #{productId}
|
|
</update>
|
|
|
|
<delete id="deleteBasProductByProductId" parameterType="String">
|
|
delete from bas_product where product_id = #{productId}
|
|
</delete>
|
|
|
|
<delete id="deleteBasProductByProductIds" parameterType="String">
|
|
delete from bas_product where product_id in
|
|
<foreach item="productId" collection="array" open="(" separator="," close=")">
|
|
#{productId}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |