cmvr-wms/ruoyi-system/src/main/resources/mapper/warehouse/ProductInfoMapper.xml
lixiaolong 4bf9d95a73 feat(warehouse): 仓库模块功能增强与性能优化
- 添加产品筛选选项接口支持品牌、分类、单位过滤
- 实现采购任务汇总统计功能
- 增加采购操作日志记录到货、验收、批次管理等操作
- 优化前端资源加载策略采用异步组件按需加载
- 集成 Element UI 主题颜色配置支持自定义主题
- 添加静态资源加载失败自动重试恢复机制
- 完善采购批次管理支持状态变更和批量分配
- 增强项目预算权限控制支持采购相关操作权限
- 优化数据库查询增加采购状态和批次条件筛选
- 添加采购到货验收流程的操作记录和撤销功能
2026-10-09 17:32:04 +08:00

100 lines
4.5 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.warehouse.mapper.ProductInfoMapper">
<resultMap type="ProductInfo" id="ProductInfoResult">
<id property="id" column="id"/>
<result property="productCode" column="product_code"/>
<result property="productName" column="product_name"/>
<result property="brand" column="brand"/>
<result property="category" column="category"/>
<result property="spec" column="spec"/>
<result property="unit" column="unit"/>
<result property="remark" column="remark"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectProductInfoVo">
select id, product_code, product_name, brand, category, spec, unit, remark, create_time, update_time from product_info
</sql>
<select id="selectProductInfoList" parameterType="ProductInfo" resultMap="ProductInfoResult">
<include refid="selectProductInfoVo"/>
<where>
<if test="productCode != null and productCode != ''">and product_code like concat('%', #{productCode}, '%')</if>
<if test="productName != null and productName != ''">
and lower(concat_ws(' ', product_name, brand, category, spec, unit))
like concat('%', lower(#{productName}), '%')
</if>
<if test="brand != null and brand != ''">and brand like concat('%', #{brand}, '%')</if>
<if test="category != null and category != ''">and category like concat('%', #{category}, '%')</if>
<if test="spec != null and spec != ''">and spec like concat('%', #{spec}, '%')</if>
</where>
order by id desc
</select>
<select id="selectProductInfoAll" resultMap="ProductInfoResult">
<include refid="selectProductInfoVo"/> order by product_code
</select>
<select id="selectDistinctBrands" resultType="String">
select distinct brand from product_info
where brand is not null and trim(brand) != ''
order by brand
</select>
<select id="selectDistinctCategories" resultType="String">
select distinct category from product_info
where category is not null and trim(category) != ''
order by category
</select>
<select id="selectDistinctUnits" resultType="String">
select distinct unit from product_info
where unit is not null and trim(unit) != ''
order by unit
</select>
<select id="selectProductInfoById" parameterType="Long" resultMap="ProductInfoResult">
<include refid="selectProductInfoVo"/> where id = #{id}
</select>
<select id="checkProductCodeUnique" parameterType="String" resultMap="ProductInfoResult">
<include refid="selectProductInfoVo"/> where product_code = #{productCode} limit 1
</select>
<select id="checkProductInfoUnique" parameterType="ProductInfo" resultMap="ProductInfoResult">
<include refid="selectProductInfoVo"/>
where product_name = #{productName}
and brand &lt;=&gt; #{brand}
and category &lt;=&gt; #{category}
and spec &lt;=&gt; #{spec}
limit 1
</select>
<insert id="insertProductInfo" parameterType="ProductInfo" useGeneratedKeys="true" keyProperty="id">
insert into product_info(product_code, product_name, brand, category, spec, unit, remark, create_time)
values(#{productCode}, #{productName}, #{brand}, #{category}, #{spec}, #{unit}, #{remark}, sysdate())
</insert>
<update id="updateProductInfo" parameterType="ProductInfo">
update product_info
<set>
<if test="productCode != null and productCode != ''">product_code = #{productCode},</if>
<if test="productName != null and productName != ''">product_name = #{productName},</if>
<if test="brand != null">brand = #{brand},</if>
<if test="category != null">category = #{category},</if>
<if test="spec != null">spec = #{spec},</if>
<if test="unit != null">unit = #{unit},</if>
<if test="remark != null">remark = #{remark},</if>
update_time = sysdate()
</set>
where id = #{id}
</update>
<delete id="deleteProductInfoByIds" parameterType="Long">
delete from product_info where id in
<foreach collection="array" item="id" open="(" separator="," close=")">#{id}</foreach>
</delete>
</mapper>