feat(bid): 完成物料分类体系全功能开发

1. 新增物料分类删除校验,支持校验子分类和关联物料
2. 优化物料列表查询,支持按分类及其后代分类筛选
3. 重构物料详情和编辑页面,使用级联选择器选择分类
4. 新增分类管理页面,支持增删改查分类树形结构
5. 新增物料分类初始化SQL脚本,导入标准分类体系
This commit is contained in:
2026-06-17 10:12:34 +08:00
parent 38f6246090
commit c7d4c2b0ad
9 changed files with 621 additions and 99 deletions

View File

@@ -16,6 +16,20 @@
FROM biz_material_category WHERE category_id = #{categoryId}
</select>
<select id="countChildren" resultType="int">
SELECT COUNT(*) FROM biz_material_category WHERE parent_id = #{parentId}
</select>
<select id="countMaterials" resultType="int">
SELECT COUNT(*) FROM biz_material WHERE category_id = #{categoryId}
</select>
<select id="selectDescendantIds" resultType="java.lang.Long">
SELECT category_id FROM biz_material_category
WHERE ancestors LIKE CONCAT(#{ancestors}, ',%')
OR ancestors = #{ancestors}
</select>
<insert id="insertCategory" useGeneratedKeys="true" keyProperty="categoryId">
INSERT INTO biz_material_category (tenant_id,category_name,parent_id,ancestors,sort,status,create_by,create_time)
VALUES (1,#{categoryName},#{parentId},#{ancestors},#{sort},#{status},#{createBy},NOW())

View File

@@ -29,7 +29,16 @@
LEFT JOIN biz_material_category c ON m.category_id = c.category_id
<where>
<if test="tenantId != null"> AND m.tenant_id = #{tenantId}</if>
<if test="categoryId != null"> AND m.category_id = #{categoryId}</if>
<if test="categoryId != null"> AND (
m.category_id = #{categoryId}
OR m.category_id IN (
SELECT category_id FROM biz_material_category
WHERE ancestors LIKE CONCAT(
(SELECT ancestors FROM biz_material_category WHERE category_id = #{categoryId}),
',%'
)
)
)</if>
<if test="materialCode != null and materialCode != ''"> AND m.material_code LIKE CONCAT('%',#{materialCode},'%')</if>
<if test="materialName != null and materialName != ''"> AND m.material_name LIKE CONCAT('%',#{materialName},'%')</if>
<if test="brand != null and brand != ''"> AND m.brand LIKE CONCAT('%',#{brand},'%')</if>