Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
M
mini-wms
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
周海峰
mini-wms
Commits
f3255ab9
Commit
f3255ab9
authored
Nov 28, 2025
by
zhangtw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
物料信息物料分类
parent
6e8acd67
隐藏空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
2641 行增加
和
1 行删除
+2641
-1
ruoyi-admin-vue/src/api/inventory/materials.js
+44
-0
ruoyi-admin-vue/src/api/inventory/materials_category.js
+44
-0
ruoyi-admin-vue/src/router/index.js
+17
-0
ruoyi-admin-vue/src/views/inventory/materials/index.vue
+557
-0
ruoyi-admin-vue/src/views/inventory/materials_category/index.vue
+421
-0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/inventory/MaterialsCategoryController.java
+108
-0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/inventory/MaterialsController.java
+129
-0
ruoyi-admin/src/main/resources/application-druid.yml
+2
-1
ruoyi-inventory/src/main/java/com/ruoyi/inventory/domain/Materials.java
+406
-0
ruoyi-inventory/src/main/java/com/ruoyi/inventory/domain/MaterialsCategory.java
+113
-0
ruoyi-inventory/src/main/java/com/ruoyi/inventory/mapper/MaterialsCategoryMapper.java
+61
-0
ruoyi-inventory/src/main/java/com/ruoyi/inventory/mapper/MaterialsMapper.java
+65
-0
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/IMaterialsCategoryService.java
+61
-0
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/IMaterialsService.java
+65
-0
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/impl/MaterialsCategoryServiceImpl.java
+96
-0
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/impl/MaterialsServiceImpl.java
+167
-0
ruoyi-inventory/src/main/resources/mapper/inventory/MaterialsCategoryMapper.xml
+89
-0
ruoyi-inventory/src/main/resources/mapper/inventory/MaterialsMapper.xml
+196
-0
没有找到文件。
ruoyi-admin-vue/src/api/inventory/materials.js
0 → 100644
View file @
f3255ab9
import
request
from
'@/utils/request'
// 查询物料列表
export
function
listMaterials
(
query
)
{
return
request
({
url
:
'/inventory/materials/list'
,
method
:
'get'
,
params
:
query
})
}
// 查询物料详细
export
function
getMaterials
(
id
)
{
return
request
({
url
:
'/inventory/materials/'
+
id
,
method
:
'get'
})
}
// 新增物料
export
function
addMaterials
(
data
)
{
return
request
({
url
:
'/inventory/materials'
,
method
:
'post'
,
data
:
data
})
}
// 修改物料
export
function
updateMaterials
(
data
)
{
return
request
({
url
:
'/inventory/materials'
,
method
:
'put'
,
data
:
data
})
}
// 删除物料
export
function
delMaterials
(
id
)
{
return
request
({
url
:
'/inventory/materials/'
+
id
,
method
:
'delete'
})
}
ruoyi-admin-vue/src/api/inventory/materials_category.js
0 → 100644
View file @
f3255ab9
import
request
from
'@/utils/request'
// 查询物料分类列表
export
function
listMaterials_category
(
query
)
{
return
request
({
url
:
'/inventory/materials_category/list'
,
method
:
'get'
,
params
:
query
})
}
// 查询物料分类详细
export
function
getMaterials_category
(
id
)
{
return
request
({
url
:
'/inventory/materials_category/'
+
id
,
method
:
'get'
})
}
// 新增物料分类
export
function
addMaterials_category
(
data
)
{
return
request
({
url
:
'/inventory/materials_category'
,
method
:
'post'
,
data
:
data
})
}
// 修改物料分类
export
function
updateMaterials_category
(
data
)
{
return
request
({
url
:
'/inventory/materials_category'
,
method
:
'put'
,
data
:
data
})
}
// 删除物料分类
export
function
delMaterials_category
(
id
)
{
return
request
({
url
:
'/inventory/materials_category/'
+
id
,
method
:
'delete'
})
}
ruoyi-admin-vue/src/router/index.js
View file @
f3255ab9
...
@@ -161,6 +161,23 @@ export const dynamicRoutes = [
...
@@ -161,6 +161,23 @@ export const dynamicRoutes = [
meta
:
{
title
:
'修改生成配置'
,
activeMenu
:
'/tool/gen'
}
meta
:
{
title
:
'修改生成配置'
,
activeMenu
:
'/tool/gen'
}
}
}
]
]
},
{
path
:
'/inventory'
,
component
:
Layout
,
name
:
'Inventory'
,
meta
:
{
title
:
'基础信息管理'
,
icon
:
'el-icon-menu'
},
children
:
[
{
path
:
'materials'
,
component
:
()
=>
import
(
'@/views/inventory/materials/index'
),
name
:
'Materials'
,
meta
:
{
title
:
'物料管理'
,
permissions
:
[
'inventory:materials:list'
]
}
}
]
}
}
]
]
...
...
ruoyi-admin-vue/src/views/inventory/materials/index.vue
0 → 100644
View file @
f3255ab9
<
template
>
<div
class=
"app-container"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:inline=
"true"
v-show=
"showSearch"
label-width=
"88px"
>
<el-form-item
label=
"物料编码"
prop=
"materialCode"
>
<el-input
v-model=
"queryParams.materialCode"
placeholder=
"请输入物料编码"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"物料名称"
prop=
"materialName"
>
<el-input
v-model=
"queryParams.materialName"
placeholder=
"请输入物料名称"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"SAP物料号"
prop=
"sapNo"
>
<el-input
v-model=
"queryParams.sapNo"
placeholder=
"请输入SAP物料号"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"TS Code"
prop=
"tsCode"
>
<el-input
v-model=
"queryParams.tsCode"
placeholder=
"请输入TS Code"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"物料分类"
prop=
"categoryCode"
>
<el-input
v-model=
"queryParams.categoryCode"
placeholder=
"请输入物料分类"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"规格型号"
prop=
"specification"
>
<el-input
v-model=
"queryParams.specification"
placeholder=
"请输入规格型号"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
icon=
"el-icon-search"
size=
"mini"
@
click=
"handleQuery"
>
搜索
</el-button>
<el-button
icon=
"el-icon-refresh"
size=
"mini"
@
click=
"resetQuery"
>
重置
</el-button>
</el-form-item>
</el-form>
<el-row
:gutter=
"10"
class=
"mb8"
>
<el-col
:span=
"1.5"
>
<el-button
type=
"primary"
plain
icon=
"el-icon-plus"
size=
"mini"
@
click=
"handleAdd"
v-hasPermi=
"['inventory:materials:add']"
>
新增
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"success"
plain
icon=
"el-icon-edit"
size=
"mini"
:disabled=
"single"
@
click=
"handleUpdate"
v-hasPermi=
"['inventory:materials:edit']"
>
修改
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"danger"
plain
icon=
"el-icon-delete"
size=
"mini"
:disabled=
"multiple"
@
click=
"handleDelete"
v-hasPermi=
"['inventory:materials:remove']"
>
删除
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"success"
plain
icon=
"el-icon-upload2"
size=
"mini"
@
click=
"handleImport"
v-hasPermi=
"['inventory:materials:import']"
>
导入
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"warning"
plain
icon=
"el-icon-download"
size=
"mini"
@
click=
"handleExport"
v-hasPermi=
"['inventory:materials:export']"
>
导出
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"primary"
icon=
"el-icon-s-grid"
size=
"mini"
@
click=
"openMaterialsCategory"
v-hasPermi=
"['inventory:materials:category']"
>
物料分类管理
</el-button>
</el-col>
<right-toolbar
:showSearch
.
sync=
"showSearch"
@
queryTable=
"getList"
></right-toolbar>
</el-row>
<el-table
v-loading=
"loading"
:data=
"materialsList"
@
selection-change=
"handleSelectionChange"
:scroll-x=
"true"
>
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
/>
<el-table-column
type=
"index"
label=
"序号"
align=
"center"
/>
<el-table-column
label=
"物料编码"
align=
"center"
prop=
"materialCode"
/>
<el-table-column
label=
"物料名称"
align=
"center"
prop=
"materialName"
/>
<el-table-column
label=
"SAP物料号"
align=
"center"
prop=
"sapNo"
/>
<el-table-column
label=
"TS Code"
align=
"center"
prop=
"tsCode"
/>
<el-table-column
label=
"物料分类"
align=
"center"
prop=
"categoryCode"
>
<template
slot-scope=
"scope"
>
{{
categoryMap
[
scope
.
row
.
categoryCode
]
||
scope
.
row
.
categoryCode
}}
</
template
>
</el-table-column>
<el-table-column
label=
"危险类别ID"
align=
"center"
prop=
"hazardId"
/>
<el-table-column
label=
"规格型号"
align=
"center"
prop=
"specification"
/>
<el-table-column
label=
"计量单位"
align=
"center"
prop=
"materialUnit"
/>
<el-table-column
label=
"单位重量"
align=
"center"
prop=
"unitWeight"
/>
<el-table-column
label=
"包装重量"
align=
"center"
prop=
"packageWeight"
/>
<el-table-column
label=
"总重量"
align=
"center"
prop=
"totalWeight"
/>
<el-table-column
label=
"体积"
align=
"center"
prop=
"volume"
/>
<el-table-column
label=
"保质期天数"
align=
"center"
prop=
"shelfLifeDays"
/>
<el-table-column
label=
"存储温度要求"
align=
"center"
prop=
"storageTemperature"
/>
<el-table-column
label=
"特殊存储要求"
align=
"center"
prop=
"specialRequirements"
/>
<el-table-column
label=
"是否批次管理"
align=
"center"
prop=
"isBatchManaged"
>
<
template
slot-scope=
"scope"
>
<el-tag
:type=
"scope.row.isBatchManaged === 1 ? 'success' : 'info'"
size=
"mini"
>
{{
scope
.
row
.
isBatchManaged
===
1
?
'是'
:
'否'
}}
</el-tag>
</
template
>
</el-table-column>
<el-table-column
label=
"是否序列号管理"
align=
"center"
prop=
"isSerialManaged"
>
<
template
slot-scope=
"scope"
>
<el-tag
:type=
"scope.row.isSerialManaged === 1 ? 'success' : 'info'"
size=
"mini"
>
{{
scope
.
row
.
isSerialManaged
===
1
?
'是'
:
'否'
}}
</el-tag>
</
template
>
</el-table-column>
<el-table-column
label=
"最低库存"
align=
"center"
prop=
"minStockLevel"
/>
<el-table-column
label=
"最高库存"
align=
"center"
prop=
"maxStockLevel"
/>
<el-table-column
label=
"是否激活"
align=
"center"
prop=
"isActive"
>
<
template
slot-scope=
"scope"
>
<el-tag
:type=
"scope.row.isActive === 1 ? 'success' : 'info'"
size=
"mini"
>
{{
scope
.
row
.
isActive
===
1
?
'是'
:
'否'
}}
</el-tag>
</
template
>
</el-table-column>
<el-table-column
label=
"风险等级"
align=
"center"
prop=
"riskLevel"
/>
<el-table-column
label=
"排序"
align=
"center"
prop=
"sortNo"
/>
<el-table-column
label=
"创建时间"
align=
"center"
prop=
"createTime"
width=
"180"
>
<
template
slot-scope=
"scope"
>
<span>
{{
parseTime
(
scope
.
row
.
createTime
,
'{y
}
-{m
}
-{d
}
'
)
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"修改时间"
align
=
"center"
prop
=
"updateTime"
width
=
"180"
>
<
template
slot
-
scope
=
"scope"
>
<
span
>
{{
parseTime
(
scope
.
row
.
updateTime
,
'{y
}
-{m
}
-{d
}
'
)
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"操作"
align
=
"center"
class
-
name
=
"small-padding"
fixed
=
"right"
width
=
"200"
>
<
template
v
-
slot
=
"scope"
>
<
el
-
button
size
=
"mini"
type
=
"text"
icon
=
"el-icon-edit"
@
click
=
"handleUpdate(scope.row)"
v
-
hasPermi
=
"['inventory:materials:edit']"
>
修改
<
/el-button
>
<
el
-
button
size
=
"mini"
type
=
"text"
icon
=
"el-icon-delete"
@
click
=
"handleDelete(scope.row)"
v
-
hasPermi
=
"['inventory:materials:remove']"
>
删除
<
/el-button
>
<
/template
>
<
/el-table-column
>
<
/el-table
>
<
pagination
v
-
show
=
"total>0"
:
total
=
"total"
:
page
.
sync
=
"queryParams.pageNum"
:
limit
.
sync
=
"queryParams.pageSize"
@
pagination
=
"getList"
/>
<!--
添加或修改物料对话框
-->
<
el
-
dialog
:
title
=
"title"
:
visible
.
sync
=
"open"
width
=
"900px"
append
-
to
-
body
>
<
el
-
form
ref
=
"form"
:
model
=
"form"
:
rules
=
"rules"
label
-
width
=
"120px"
>
<
el
-
row
:
gutter
=
"24"
>
<
el
-
col
:
span
=
"12"
>
<
el
-
form
-
item
label
=
"物料编码"
prop
=
"materialCode"
>
<
el
-
input
v
-
model
=
"form.materialCode"
placeholder
=
"请输入物料编码"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"SAP物料号"
prop
=
"sapNo"
>
<
el
-
input
v
-
model
=
"form.sapNo"
placeholder
=
"请输入SAP物料号"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"物料分类"
prop
=
"categoryCode"
>
<
el
-
select
v
-
model
=
"form.categoryCode"
placeholder
=
"请选择物料分类"
clearable
@
click
=
"getCategoryList"
>
<
el
-
option
v
-
for
=
"item in categoryOptions"
:
key
=
"item.value"
:
label
=
"item.label"
:
value
=
"item.value"
>
<
/el-option
>
<
/el-select
>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"规格型号"
prop
=
"specification"
>
<
el
-
input
v
-
model
=
"form.specification"
placeholder
=
"请输入规格型号"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"单位重量"
prop
=
"unitWeight"
>
<
el
-
input
v
-
model
=
"form.unitWeight"
placeholder
=
"请输入单位重量"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"总重量"
prop
=
"totalWeight"
>
<
el
-
input
v
-
model
=
"form.totalWeight"
placeholder
=
"请输入总重量"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"保质期天数"
prop
=
"shelfLifeDays"
>
<
el
-
input
v
-
model
=
"form.shelfLifeDays"
placeholder
=
"请输入保质期天数"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"特殊存储要求"
prop
=
"specialRequirements"
>
<
el
-
input
v
-
model
=
"form.specialRequirements"
placeholder
=
"请输入特殊存储要求"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"是否序列号管理"
prop
=
"isSerialManaged"
>
<
el
-
radio
-
group
v
-
model
=
"form.isSerialManaged"
>
<
el
-
radio
:
label
=
"1"
>
是
<
/el-radio
>
<
el
-
radio
:
label
=
"0"
>
否
<
/el-radio
>
<
/el-radio-group
>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"最高库存"
prop
=
"maxStockLevel"
>
<
el
-
input
v
-
model
=
"form.maxStockLevel"
placeholder
=
"请输入最高库存"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"风险等级"
prop
=
"riskLevel"
>
<
el
-
input
v
-
model
=
"form.riskLevel"
placeholder
=
"请输入风险等级"
/>
<
/el-form-item
>
<!--
<
el
-
form
-
item
label
=
"创建人编码"
prop
=
"createUserCode"
>
<
el
-
input
v
-
model
=
"form.createUserCode"
placeholder
=
"请输入创建人编码"
/>
<
/el-form-item> --
>
<
/el-col
>
<
el
-
col
:
span
=
"12"
>
<
el
-
form
-
item
label
=
"物料名称"
prop
=
"materialName"
>
<
el
-
input
v
-
model
=
"form.materialName"
placeholder
=
"请输入物料名称"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"TS Code"
prop
=
"tsCode"
>
<
el
-
input
v
-
model
=
"form.tsCode"
placeholder
=
"请输入TS Code"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"危险类别ID"
prop
=
"hazardId"
>
<
el
-
input
v
-
model
=
"form.hazardId"
placeholder
=
"请输入危险类别ID"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"计量单位"
prop
=
"materialUnit"
>
<
el
-
input
v
-
model
=
"form.materialUnit"
placeholder
=
"请输入计量单位"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"包装重量"
prop
=
"packageWeight"
>
<
el
-
input
v
-
model
=
"form.packageWeight"
placeholder
=
"请输入包装重量"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"体积"
prop
=
"volume"
>
<
el
-
input
v
-
model
=
"form.volume"
placeholder
=
"请输入体积"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"存储温度要求"
prop
=
"storageTemperature"
>
<
el
-
input
v
-
model
=
"form.storageTemperature"
placeholder
=
"请输入存储温度要求"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"是否批次管理"
prop
=
"isBatchManaged"
>
<
el
-
radio
-
group
v
-
model
=
"form.isBatchManaged"
>
<
el
-
radio
:
label
=
"1"
>
是
<
/el-radio
>
<
el
-
radio
:
label
=
"0"
>
否
<
/el-radio
>
<
/el-radio-group
>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"最低库存"
prop
=
"minStockLevel"
>
<
el
-
input
v
-
model
=
"form.minStockLevel"
placeholder
=
"请输入最低库存"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"是否激活"
prop
=
"isActive"
>
<
el
-
radio
-
group
v
-
model
=
"form.isActive"
>
<
el
-
radio
:
label
=
"1"
>
是
<
/el-radio
>
<
el
-
radio
:
label
=
"0"
>
否
<
/el-radio
>
<
/el-radio-group
>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"排序"
prop
=
"sortNo"
>
<
el
-
input
v
-
model
=
"form.sortNo"
placeholder
=
"请输入排序"
/>
<
/el-form-item
>
<!--
<
el
-
form
-
item
label
=
"更新人编码"
prop
=
"updateUserCode"
>
<
el
-
input
v
-
model
=
"form.updateUserCode"
placeholder
=
"请输入更新人编码"
/>
<
/el-form-item> --
>
<
/el-col
>
<
/el-row
>
<
/el-form
>
<
div
slot
=
"footer"
class
=
"dialog-footer"
>
<
el
-
button
type
=
"primary"
@
click
=
"submitForm"
>
确
定
<
/el-button
>
<
el
-
button
@
click
=
"cancel"
>
取
消
<
/el-button
>
<
/div
>
<
/el-dialog
>
<!--
物料分类管理抽屉
-->
<
el
-
drawer
title
=
"物料分类管理"
:
visible
.
sync
=
"parentDialogVisible"
direction
=
"rtl"
size
=
"80%"
append
-
to
-
body
>
<
MaterialsCategory
ref
=
"materialsCategoryRef"
:
init
-
query
=
"{ categoryCode: queryParams.categoryCode
}
"
@
dialog
-
close
=
"parentDialogVisible = false"
@
form
-
submit
=
"handleCategorySubmit"
/>
<
/el-drawer
>
<
import
-
excel
ref
=
"import"
title
=
"导入"
import
-
url
=
"/inventory/materials/import"
template
-
url
=
"inventory/materials/importTemplate"
template
-
name
=
"materials_importTemplate"
@
success
=
"getList"
/>
<
/div
>
<
/template
>
<
script
>
import
{
listMaterials
,
getMaterials
,
delMaterials
,
addMaterials
,
updateMaterials
}
from
"@/api/inventory/materials"
import
{
listMaterials_category
}
from
"@/api/inventory/materials_category"
import
MaterialsCategory
from
"@/views/inventory/materials_category/index.vue"
import
ImportExcel
from
"@/components/ImportExcel/index"
export
default
{
components
:
{
MaterialsCategory
,
ImportExcel
}
,
name
:
"Materials"
,
data
()
{
return
{
categoryMap
:
{
}
,
categoryForm
:
''
,
categoryOptions
:
[],
// 遮罩层
loading
:
true
,
// 选中数组
ids
:
[],
// 非单个禁用
single
:
true
,
// 非多个禁用
multiple
:
true
,
// 显示搜索条件
showSearch
:
true
,
// 总条数
total
:
0
,
// 物料表格数据
materialsList
:
[],
// 弹出层标题
title
:
""
,
// 是否显示弹出层
open
:
false
,
// 物料分类抽屉显示状态
parentDialogVisible
:
false
,
// 查询参数
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
materialCode
:
null
,
materialName
:
null
,
sapNo
:
null
,
tsCode
:
null
,
categoryCode
:
null
,
specification
:
null
,
}
,
// 表单参数
form
:
{
}
,
// 表单校验
rules
:
{
materialCode
:
[{
required
:
true
,
message
:
'请输入物料编码'
,
trigger
:
'blur'
}
],
materialName
:
[{
required
:
true
,
message
:
'请输入物料名称'
,
trigger
:
'blur'
}
],
sapNo
:
[{
required
:
true
,
message
:
'请输入SAP物料号'
,
trigger
:
'blur'
}
],
tsCode
:
[{
required
:
true
,
message
:
'请输入TS Code'
,
trigger
:
'blur'
}
]
}
}
}
,
created
()
{
this
.
getList
(),
this
.
getCategoryList
();
}
,
methods
:
{
getCategoryList
()
{
listMaterials_category
().
then
(
response
=>
{
this
.
categoryOptions
=
response
.
rows
.
map
(
item
=>
({
label
:
item
.
categoryName
,
value
:
item
.
categoryCode
}
));
this
.
categoryMap
=
response
.
rows
.
reduce
((
map
,
item
)
=>
{
map
[
item
.
categoryCode
]
=
item
.
categoryName
;
return
map
;
}
,
{
}
);
}
).
catch
(
error
=>
{
console
.
error
(
'加载分类失败'
,
error
);
}
);
}
,
/** 打开物料分类管理 */
openMaterialsCategory
()
{
this
.
parentDialogVisible
=
true
if
(
this
.
$refs
.
materialsCategoryRef
)
{
this
.
$refs
.
materialsCategoryRef
.
resetForm
()
this
.
$refs
.
materialsCategoryRef
.
getList
()
}
}
,
/** 物料分类提交回调 */
handleCategorySubmit
(
res
)
{
this
.
parentDialogVisible
=
false
// 刷新物料列表
this
.
getList
()
}
,
/** 查询物料列表 */
getList
()
{
this
.
loading
=
true
listMaterials
(
this
.
queryParams
).
then
(
response
=>
{
this
.
materialsList
=
response
.
rows
.
filter
(
item
=>
item
.
isUsed
!==
0
&&
item
.
isUsed
!==
'0'
);
this
.
total
=
response
.
total
this
.
loading
=
false
}
)
}
,
// 取消按钮
cancel
()
{
this
.
open
=
false
this
.
reset
()
}
,
// 表单重置
reset
()
{
this
.
form
=
{
id
:
null
,
materialCode
:
null
,
materialName
:
null
,
sapNo
:
null
,
tsCode
:
null
,
categoryCode
:
null
,
hazardId
:
null
,
specification
:
null
,
materialUnit
:
null
,
unitWeight
:
null
,
packageWeight
:
null
,
totalWeight
:
null
,
volume
:
null
,
shelfLifeDays
:
null
,
storageTemperature
:
null
,
specialRequirements
:
null
,
isBatchManaged
:
'0'
,
isSerialManaged
:
'0'
,
minStockLevel
:
null
,
maxStockLevel
:
null
,
isUsed
:
'1'
,
isActive
:
'1'
,
riskLevel
:
null
,
sortNo
:
null
,
createUserCode
:
null
,
updateUserCode
:
null
}
this
.
resetForm
(
"form"
)
}
,
/** 搜索按钮操作 */
handleQuery
()
{
this
.
queryParams
.
pageNum
=
1
this
.
getList
()
}
,
/** 重置按钮操作 */
resetQuery
()
{
this
.
resetForm
(
"queryForm"
)
this
.
queryParams
=
{
pageNum
:
1
,
pageSize
:
10
,
materialCode
:
null
,
materialName
:
null
,
sapNo
:
null
,
tsCode
:
null
,
categoryCode
:
null
,
specification
:
null
,
}
this
.
getList
()
}
,
// 多选框选中数据
handleSelectionChange
(
selection
)
{
this
.
ids
=
selection
.
map
(
item
=>
item
.
id
)
this
.
single
=
selection
.
length
!==
1
this
.
multiple
=
!
selection
.
length
}
,
/** 新增按钮操作 */
handleAdd
()
{
this
.
reset
()
this
.
open
=
true
this
.
title
=
"添加物料"
}
,
/** 修改按钮操作 */
handleUpdate
(
row
)
{
this
.
reset
()
const
id
=
row
.
id
||
this
.
ids
getMaterials
(
id
).
then
(
response
=>
{
this
.
form
=
response
.
data
this
.
open
=
true
this
.
title
=
"修改物料"
}
)
}
,
/** 提交按钮 */
submitForm
()
{
this
.
$refs
[
"form"
].
validate
(
valid
=>
{
if
(
valid
)
{
const
promise
=
this
.
form
.
id
?
updateMaterials
(
this
.
form
)
:
addMaterials
(
this
.
form
)
promise
.
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
this
.
form
.
id
?
"修改成功"
:
"新增成功"
)
this
.
open
=
false
this
.
getList
()
}
)
}
}
)
}
,
/** 删除按钮操作 */
handleDelete
(
row
)
{
const
ids
=
row
.
id
||
this
.
ids
this
.
$modal
.
confirm
(
row
.
id
?
'是否确认删除编号为"'
+
row
.
materialCode
+
'"的数据项?'
:
'是否确认删除选中数量为"'
+
ids
.
length
+
'"的数据项?'
).
then
(()
=>
{
return
delMaterials
(
ids
)
}
).
then
(()
=>
{
this
.
getList
()
this
.
$modal
.
msgSuccess
(
"删除成功"
)
}
).
catch
(()
=>
{
}
)
}
,
/** 导入按钮操作 */
handleImport
()
{
this
.
$refs
.
import
.
show
()
}
,
/** 导出按钮操作 */
handleExport
()
{
this
.
download
(
'inventory/materials/export'
,
{
...
this
.
queryParams
}
,
`materials_${new Date().getTime()
}
.xlsx`
)
}
}
}
<
/script>
\ No newline at end of file
ruoyi-admin-vue/src/views/inventory/materials_category/index.vue
0 → 100644
View file @
f3255ab9
<
template
>
<div
class=
"app-container"
>
<!-- 搜索表单 -->
<el-form
:model=
"queryParams"
ref=
"queryRef"
:inline=
"true"
v-show=
"showSearch"
label-width=
"128px"
>
<el-form-item
label=
"物料分类编码"
prop=
"categoryCode"
>
<el-input
v-model=
"queryParams.categoryCode"
placeholder=
"请输入物料分类编码"
clearable
@
keyup
.
enter=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"物料分类名称"
prop=
"categoryName"
>
<el-input
v-model=
"queryParams.categoryName"
placeholder=
"请输入物料分类名称"
clearable
@
keyup
.
enter=
"handleQuery"
/>
</el-form-item>
<!--
<el-form-item
label=
"排序"
prop=
"sortNo"
>
<el-input
v-model=
"queryParams.sortNo"
placeholder=
"请输入排序"
clearable
@
keyup
.
enter=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"创建时间"
prop=
"createTime"
>
<el-date-picker
clearable
v-model=
"queryParams.createTime"
type=
"date"
value-format=
"YYYY-MM-DD"
placeholder=
"请选择创建时间"
>
</el-date-picker>
</el-form-item>
<el-form-item
label=
"修改时间"
prop=
"updateTime"
>
<el-date-picker
clearable
v-model=
"queryParams.updateTime"
type=
"date"
value-format=
"YYYY-MM-DD"
placeholder=
"请选择修改时间"
>
</el-date-picker>
</el-form-item>
-->
<el-form-item>
<el-button
type=
"primary"
icon=
"el-icon-search"
@
click=
"handleQuery"
>
搜索
</el-button>
<el-button
icon=
"el-icon-refresh"
@
click=
"resetQuery"
>
重置
</el-button>
</el-form-item>
</el-form>
<!-- 操作按钮 -->
<el-row
:gutter=
"10"
class=
"mb8"
>
<el-col
:span=
"1.5"
>
<el-button
type=
"primary"
plain
icon=
"el-icon-plus"
@
click=
"handleAdd"
v-hasPermi=
"['inventory:materials_category:add']"
>
新增
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"success"
plain
icon=
"el-icon-edit"
:disabled=
"single"
@
click=
"handleUpdate"
v-hasPermi=
"['inventory:materials_category:edit']"
>
修改
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"danger"
plain
icon=
"el-icon-delete"
:disabled=
"multiple"
@
click=
"handleDelete"
v-hasPermi=
"['inventory:materials_category:remove']"
>
删除
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"warning"
plain
icon=
"el-icon-download"
@
click=
"handleExport"
v-hasPermi=
"['inventory:materials_category:export']"
>
导出
</el-button>
</el-col>
<right-toolbar
v-model=
"showSearch"
@
queryTable=
"getList"
></right-toolbar>
</el-row>
<!-- 数据表格 -->
<el-table
v-loading=
"loading"
:data=
"materials_categoryList"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
/>
<el-table-column
label=
"物料分类编码"
align=
"center"
prop=
"categoryCode"
/>
<el-table-column
label=
"物料分类名称"
align=
"center"
prop=
"categoryName"
/>
<el-table-column
label=
"排序"
align=
"center"
prop=
"sortNo"
/>
<el-table-column
label=
"创建时间"
align=
"center"
prop=
"createTime"
width=
"120"
>
<template
slot-scope=
"scope"
>
<span>
{{
parseTime
(
scope
.
row
.
createTime
,
'{y
}
-{m
}
-{d
}
'
)
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"修改时间"
align
=
"center"
prop
=
"updateTime"
width
=
"120"
>
<
template
slot
-
scope
=
"scope"
>
<
span
>
{{
parseTime
(
scope
.
row
.
updateTime
,
'{y
}
-{m
}
-{d
}
'
)
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"操作"
align
=
"center"
class
-
name
=
"small-padding fixed-width"
width
=
"120"
>
<
template
slot
-
scope
=
"scope"
>
<
el
-
button
size
=
"mini"
link
type
=
"text"
icon
=
"el-icon-edit"
@
click
=
"handleUpdate(scope.row)"
v
-
hasPermi
=
"['inventory:materials_category:edit']"
>
修改
<
/el-button
>
<
el
-
button
size
=
"mini"
link
type
=
"text"
icon
=
"el-icon-delete"
@
click
=
"handleDelete(scope.row)"
v
-
hasPermi
=
"['inventory:materials_category:remove']"
>
删除
<
/el-button
>
<
/template
>
<
/el-table-column
>
<
/el-table
>
<!--
分页组件
-->
<
pagination
v
-
show
=
"total>0"
:
total
=
"total"
:
page
.
sync
=
"queryParams.pageNum"
:
limit
.
sync
=
"queryParams.pageSize"
@
pagination
=
"getList"
/>
<!--
添加
/
修改对话框(通过
props
控制显示)
-->
<
el
-
dialog
:
title
=
"dialogTitle"
:
visible
.
sync
=
"dialogOpen"
width
=
"600px"
append
-
to
-
body
@
close
=
"handleDialogClose"
>
<
el
-
form
ref
=
"materials_categoryRef"
:
model
=
"form"
:
rules
=
"rules"
label
-
width
=
"120px"
>
<
el
-
form
-
item
label
=
"物料分类编码"
prop
=
"categoryCode"
>
<
el
-
input
v
-
model
=
"form.categoryCode"
placeholder
=
"请输入物料编码"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"物料分类名称"
prop
=
"categoryName"
>
<
el
-
input
v
-
model
=
"form.categoryName"
placeholder
=
"请输入物料名称"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"排序"
prop
=
"sortNo"
>
<
el
-
input
v
-
model
=
"form.sortNo"
placeholder
=
"请输入排序"
/>
<
/el-form-item
>
<!--
<
el
-
form
-
item
label
=
"创建人编码"
prop
=
"createUserCode"
>
<
el
-
input
v
-
model
=
"form.createUserCode"
placeholder
=
"请输入创建人编码"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"更新人编码"
prop
=
"updateUserCode"
>
<
el
-
input
v
-
model
=
"form.updateUserCode"
placeholder
=
"请输入更新人编码"
/>
<
/el-form-item> --
>
<
/el-form
>
<
div
slot
=
"footer"
class
=
"dialog-footer"
>
<
el
-
button
type
=
"primary"
@
click
=
"submitForm"
>
确
定
<
/el-button
>
<
el
-
button
@
click
=
"handleDialogClose"
>
取
消
<
/el-button
>
<
/div
>
<
/el-dialog
>
<
/div
>
<
/template
>
<
script
>
import
{
listMaterials_category
,
getMaterials_category
,
delMaterials_category
,
addMaterials_category
,
updateMaterials_category
}
from
"@/api/inventory/materials_category"
export
default
{
name
:
"MaterialsCategory"
,
props
:
{
// 外部传入的初始查询参数(可选)
initQuery
:
{
type
:
Object
,
default
:
()
=>
({
}
)
}
,
// 外部控制对话框显示(可选)
dialogVisible
:
{
type
:
Boolean
,
default
:
false
}
,
// 外部传入的表单数据(编辑用)
dialogFormData
:
{
type
:
Object
,
default
:
()
=>
({
}
)
}
,
// 外部传入的对话框标题
dialogTitle
:
{
type
:
String
,
default
:
"新增物料分类"
}
}
,
data
()
{
return
{
materials_categoryList
:
[],
loading
:
true
,
showSearch
:
true
,
ids
:
[],
single
:
true
,
multiple
:
true
,
total
:
0
,
// 内部对话框状态(避免直接修改props)
dialogOpen
:
false
,
form
:
{
id
:
null
,
categoryCode
:
null
,
categoryName
:
null
,
sortNo
:
null
,
createUserCode
:
null
,
updateUserCode
:
null
}
,
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
categoryCode
:
null
,
categoryName
:
null
,
sortNo
:
null
,
createTime
:
null
,
updateTime
:
null
,
}
,
rules
:
{
}
}
}
,
watch
:
{
// 监听外部传入的对话框显示状态
dialogVisible
:
{
immediate
:
true
,
handler
(
val
)
{
this
.
dialogOpen
=
val
}
}
,
// 监听外部传入的表单数据
dialogFormData
:
{
immediate
:
true
,
handler
(
val
)
{
this
.
form
=
{
...
val
}
}
}
,
// 监听初始查询参数
initQuery
:
{
immediate
:
true
,
handler
(
val
)
{
this
.
queryParams
=
{
...
this
.
queryParams
,
...
val
}
this
.
getList
()
}
}
}
,
created
()
{
this
.
getList
()
}
,
methods
:
{
/** 查询列表(内部方法) */
getList
()
{
this
.
loading
=
true
listMaterials_category
(
this
.
queryParams
).
then
(
response
=>
{
this
.
materials_categoryList
=
response
.
rows
this
.
total
=
response
.
total
this
.
loading
=
false
// 通知父组件列表加载完成
this
.
$emit
(
"list-loaded"
,
{
list
:
response
.
rows
,
total
:
response
.
total
}
)
}
)
}
,
/** 搜索按钮操作 */
handleQuery
()
{
this
.
queryParams
.
pageNum
=
1
this
.
getList
()
}
,
/** 重置搜索条件 */
resetQuery
()
{
this
.
$refs
[
"queryRef"
].
resetFields
()
this
.
queryParams
=
{
pageNum
:
1
,
pageSize
:
10
,
categoryCode
:
null
,
categoryName
:
null
,
sortNo
:
null
,
createTime
:
null
,
updateTime
:
null
,
...
this
.
initQuery
// 保留初始查询参数
}
this
.
getList
()
}
,
/** 多选框选中事件 */
handleSelectionChange
(
selection
)
{
this
.
ids
=
selection
.
map
(
item
=>
item
.
id
)
this
.
single
=
selection
.
length
!==
1
this
.
multiple
=
!
selection
.
length
// 通知父组件选中数据变化
this
.
$emit
(
"selection-change"
,
selection
)
}
,
/** 新增按钮操作 */
handleAdd
()
{
this
.
form
=
{
id
:
null
,
categoryCode
:
null
,
categoryName
:
null
,
sortNo
:
null
,
createUserCode
:
null
,
updateUserCode
:
null
}
this
.
dialogOpen
=
true
this
.
$emit
(
"dialog-open"
,
{
type
:
"add"
,
form
:
this
.
form
}
)
}
,
/** 修改按钮操作 */
handleUpdate
(
row
)
{
const
_id
=
row
?
row
.
id
:
this
.
ids
getMaterials_category
(
_id
).
then
(
response
=>
{
this
.
form
=
response
.
data
this
.
dialogOpen
=
true
this
.
$emit
(
"dialog-open"
,
{
type
:
"edit"
,
form
:
this
.
form
}
)
}
)
}
,
/** 提交表单 */
submitForm
()
{
this
.
$refs
[
"materials_categoryRef"
].
validate
(
valid
=>
{
if
(
valid
)
{
const
submitPromise
=
this
.
form
.
id
?
updateMaterials_category
(
this
.
form
)
:
addMaterials_category
(
this
.
form
)
submitPromise
.
then
(
response
=>
{
const
type
=
this
.
form
.
id
?
"update"
:
"add"
this
.
$modal
.
msgSuccess
(
`${type === "add" ? "新增" : "修改"
}
成功`
)
this
.
dialogOpen
=
false
this
.
getList
()
// 通知父组件提交成功
this
.
$emit
(
"form-submit"
,
{
type
,
data
:
this
.
form
,
response
}
)
}
)
}
}
)
}
,
/** 删除操作 */
handleDelete
(
row
)
{
const
_ids
=
row
?
row
.
id
:
this
.
ids
this
.
$modal
.
confirm
(
`是否确认删除物料分类编号为"${_ids
}
"的数据项?`
).
then
(()
=>
{
return
delMaterials_category
(
_ids
)
}
).
then
(()
=>
{
this
.
getList
()
this
.
$modal
.
msgSuccess
(
"删除成功"
)
// 通知父组件删除成功
this
.
$emit
(
"item-delete"
,
{
ids
:
_ids
}
)
}
).
catch
(()
=>
{
}
)
}
,
/** 导出操作 */
handleExport
()
{
this
.
download
(
'inventory/materials_category/export'
,
{
...
this
.
queryParams
}
,
`materials_category_${new Date().getTime()
}
.xlsx`
)
// 通知父组件导出操作
this
.
$emit
(
"export-data"
,
this
.
queryParams
)
}
,
/** 对话框关闭事件 */
handleDialogClose
()
{
this
.
$refs
[
"materials_categoryRef"
]?.
resetFields
()
this
.
$emit
(
"dialog-close"
)
}
,
/** 表单重置(供外部调用) */
resetForm
()
{
this
.
form
=
{
id
:
null
,
categoryCode
:
null
,
categoryName
:
null
,
sortNo
:
null
,
createUserCode
:
null
,
updateUserCode
:
null
}
this
.
$refs
[
"materials_categoryRef"
]?.
resetFields
()
}
}
}
<
/script>
\ No newline at end of file
ruoyi-admin/src/main/java/com/ruoyi/web/controller/inventory/MaterialsCategoryController.java
0 → 100644
View file @
f3255ab9
package
com
.
ruoyi
.
web
.
controller
.
inventory
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
com.ruoyi.common.utils.uuid.UUID
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.enums.BusinessType
;
import
com.ruoyi.inventory.domain.MaterialsCategory
;
import
com.ruoyi.inventory.service.IMaterialsCategoryService
;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
com.ruoyi.common.core.page.TableDataInfo
;
/**
* 物料分类Controller
*
* @author ruoyi
* @date 2025-11-28
*/
@RestController
@RequestMapping
(
"/inventory/materials_category"
)
public
class
MaterialsCategoryController
extends
BaseController
{
@Autowired
private
IMaterialsCategoryService
materialsCategoryService
;
/**
* 查询物料分类列表
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:materials_category:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
MaterialsCategory
materialsCategory
)
{
startPage
();
List
<
MaterialsCategory
>
list
=
materialsCategoryService
.
selectMaterialsCategoryList
(
materialsCategory
);
return
getDataTable
(
list
);
}
/**
* 导出物料分类列表
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:materials_category:export')"
)
@Log
(
title
=
"物料分类"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
MaterialsCategory
materialsCategory
)
{
List
<
MaterialsCategory
>
list
=
materialsCategoryService
.
selectMaterialsCategoryList
(
materialsCategory
);
ExcelUtil
<
MaterialsCategory
>
util
=
new
ExcelUtil
<
MaterialsCategory
>(
MaterialsCategory
.
class
);
util
.
exportExcel
(
response
,
list
,
"物料分类数据"
);
}
/**
* 获取物料分类详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:materials_category:query')"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
String
id
)
{
return
success
(
materialsCategoryService
.
selectMaterialsCategoryById
(
id
));
}
/**
* 新增物料分类
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:materials_category:add')"
)
@Log
(
title
=
"物料分类"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
MaterialsCategory
materialsCategory
)
{
materialsCategory
.
setId
(
UUID
.
randomUUID
().
toString
());
return
toAjax
(
materialsCategoryService
.
insertMaterialsCategory
(
materialsCategory
));
}
/**
* 修改物料分类
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:materials_category:edit')"
)
@Log
(
title
=
"物料分类"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
MaterialsCategory
materialsCategory
)
{
return
toAjax
(
materialsCategoryService
.
updateMaterialsCategory
(
materialsCategory
));
}
/**
* 删除物料分类
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:materials_category:remove')"
)
@Log
(
title
=
"物料分类"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
String
[]
ids
)
{
return
toAjax
(
materialsCategoryService
.
deleteMaterialsCategoryByIds
(
ids
));
}
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/inventory/MaterialsController.java
0 → 100644
View file @
f3255ab9
package
com
.
ruoyi
.
web
.
controller
.
inventory
;
import
java.util.List
;
import
java.util.UUID
;
import
javax.servlet.http.HttpServletResponse
;
import
com.ruoyi.common.core.domain.entity.SysUser
;
import
com.ruoyi.inventory.domain.Owners
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.enums.BusinessType
;
import
com.ruoyi.inventory.domain.Materials
;
import
com.ruoyi.inventory.service.IMaterialsService
;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
com.ruoyi.common.core.page.TableDataInfo
;
import
org.springframework.web.multipart.MultipartFile
;
/**
* 物料Controller
*
* @author ruoyi
* @date 2025-11-28
*/
@RestController
@RequestMapping
(
"/inventory/materials"
)
public
class
MaterialsController
extends
BaseController
{
@Autowired
private
IMaterialsService
materialsService
;
/**
* 查询物料列表
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:materials:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
Materials
materials
)
{
startPage
();
List
<
Materials
>
list
=
materialsService
.
selectMaterialsList
(
materials
);
return
getDataTable
(
list
);
}
/**
* 导出物料列表
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:materials:export')"
)
@Log
(
title
=
"物料"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
Materials
materials
)
{
List
<
Materials
>
list
=
materialsService
.
selectMaterialsList
(
materials
);
ExcelUtil
<
Materials
>
util
=
new
ExcelUtil
<
Materials
>(
Materials
.
class
);
util
.
exportExcel
(
response
,
list
,
"物料数据"
);
}
/**
* 获取物料详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:materials:query')"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
String
id
)
{
return
success
(
materialsService
.
selectMaterialsById
(
id
));
}
/**
* 新增物料
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:materials:add')"
)
@Log
(
title
=
"物料"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
Materials
materials
)
{
materials
.
setId
(
UUID
.
randomUUID
().
toString
());
return
toAjax
(
materialsService
.
insertMaterials
(
materials
));
}
/**
* 修改物料
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:materials:edit')"
)
@Log
(
title
=
"物料"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
Materials
materials
)
{
return
toAjax
(
materialsService
.
updateMaterials
(
materials
));
}
/**
* 删除物料
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:materials:remove')"
)
@Log
(
title
=
"物料"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
String
[]
ids
)
{
return
toAjax
(
materialsService
.
deleteMaterialsByIds
(
ids
));
}
@PostMapping
(
"/importTemplate"
)
public
void
importTemplate
(
HttpServletResponse
response
)
{
ExcelUtil
<
Materials
>
util
=
new
ExcelUtil
<
Materials
>(
Materials
.
class
);
util
.
importTemplateExcel
(
response
,
"物料信息"
);
}
@PreAuthorize
(
"@ss.hasPermi('inventory:materials:import')"
)
@Log
(
title
=
"物料信息导入"
,
businessType
=
BusinessType
.
IMPORT
)
@PostMapping
(
"/import"
)
public
AjaxResult
importTemplate
(
MultipartFile
file
,
boolean
updateSupport
)
throws
Exception
{
ExcelUtil
<
Materials
>
util
=
new
ExcelUtil
<
Materials
>(
Materials
.
class
);
List
<
Materials
>
materialsList
=
util
.
importExcel
(
file
.
getInputStream
());
String
operName
=
getUsername
();
String
message
=
materialsService
.
importMaterials
(
materialsList
,
updateSupport
,
operName
);
return
success
(
message
);
}
}
ruoyi-admin/src/main/resources/application-druid.yml
View file @
f3255ab9
...
@@ -6,7 +6,8 @@ spring:
...
@@ -6,7 +6,8 @@ spring:
druid
:
druid
:
# 主库数据源
# 主库数据源
master
:
master
:
url
:
jdbc:mysql://demo.docmis.cn:23500/inventory_manager?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# 数据库连接地址
url
:
jdbc:mysql://demo.docmis.cn:23500/inventory_manager?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&useSSL=false
username
:
root
username
:
root
password
:
'
!QAZ2wsx#EDC2022'
password
:
'
!QAZ2wsx#EDC2022'
# 从库数据源
# 从库数据源
...
...
ruoyi-inventory/src/main/java/com/ruoyi/inventory/domain/Materials.java
0 → 100644
View file @
f3255ab9
package
com
.
ruoyi
.
inventory
.
domain
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
com.ruoyi.common.annotation.Excel
;
import
com.ruoyi.common.core.domain.BaseEntity
;
/**
* 物料对象 materials
*
* @author ruoyi
* @date 2025-11-28
*/
public
class
Materials
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** 编号 */
private
String
id
;
/** 物料编码 检索条件 */
@Excel
(
name
=
"物料编码"
)
private
String
materialCode
;
/** 物料名称 检索条件 */
@Excel
(
name
=
"物料名称"
)
private
String
materialName
;
/** SAP物料号 检索条件 */
@Excel
(
name
=
"SAP物料号"
)
private
String
sapNo
;
/** TS Code 检索条件 */
@Excel
(
name
=
"TS Code"
)
private
String
tsCode
;
/** 物料分类 检索条件 */
@Excel
(
name
=
"物料分类"
)
private
String
categoryCode
;
/** 危险类别ID 字典 */
@Excel
(
name
=
"危险类别ID"
)
private
String
hazardId
;
/** 规格型号 检索条件 */
@Excel
(
name
=
"规格型号"
)
private
String
specification
;
/** 计量单位 字典 */
@Excel
(
name
=
"计量单位"
)
private
String
materialUnit
;
/** 单位重量 */
@Excel
(
name
=
"单位重量"
)
private
Long
unitWeight
;
/** 包装重量 */
@Excel
(
name
=
"包装重量"
)
private
Long
packageWeight
;
/** 总重量 */
@Excel
(
name
=
"总重量"
)
private
Long
totalWeight
;
/** 体积 */
@Excel
(
name
=
"体积"
)
private
Long
volume
;
/** 保质期天数 */
@Excel
(
name
=
"保质期天数"
)
private
Long
shelfLifeDays
;
/** 存储温度要求 */
@Excel
(
name
=
"存储温度要求"
)
private
String
storageTemperature
;
/** 特殊存储要求 */
@Excel
(
name
=
"特殊存储要求"
)
private
String
specialRequirements
;
/** 是否批次管理 1-是 0-否 */
@Excel
(
name
=
"是否批次管理 1-是 0-否"
)
private
Long
isBatchManaged
;
/** 是否序列号管理 1-是 0-否 */
@Excel
(
name
=
"是否序列号管理 1-是 0-否"
)
private
Long
isSerialManaged
;
/** 最低库存 */
@Excel
(
name
=
"最低库存"
)
private
Long
minStockLevel
;
/** 最高库存 */
@Excel
(
name
=
"最高库存"
)
private
Long
maxStockLevel
;
/** 是否正在使用 1-是 0-否 */
@Excel
(
name
=
"是否正在使用 1-是 0-否"
)
private
Long
isUsed
;
/** 是否激活 1-是 0-否 */
@Excel
(
name
=
"是否激活 1-是 0-否"
)
private
Long
isActive
;
/** 风险等级 字典 */
@Excel
(
name
=
"风险等级"
)
private
String
riskLevel
;
/** 排序 */
@Excel
(
name
=
"排序"
)
private
Long
sortNo
;
/** 创建日期 */
private
String
createUserCode
;
/** 排序号 */
private
String
updateUserCode
;
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getId
()
{
return
id
;
}
public
void
setMaterialCode
(
String
materialCode
)
{
this
.
materialCode
=
materialCode
;
}
public
String
getMaterialCode
()
{
return
materialCode
;
}
public
void
setMaterialName
(
String
materialName
)
{
this
.
materialName
=
materialName
;
}
public
String
getMaterialName
()
{
return
materialName
;
}
public
void
setSapNo
(
String
sapNo
)
{
this
.
sapNo
=
sapNo
;
}
public
String
getSapNo
()
{
return
sapNo
;
}
public
void
setTsCode
(
String
tsCode
)
{
this
.
tsCode
=
tsCode
;
}
public
String
getTsCode
()
{
return
tsCode
;
}
public
void
setCategoryCode
(
String
categoryCode
)
{
this
.
categoryCode
=
categoryCode
;
}
public
String
getCategoryCode
()
{
return
categoryCode
;
}
public
void
setHazardId
(
String
hazardId
)
{
this
.
hazardId
=
hazardId
;
}
public
String
getHazardId
()
{
return
hazardId
;
}
public
void
setSpecification
(
String
specification
)
{
this
.
specification
=
specification
;
}
public
String
getSpecification
()
{
return
specification
;
}
public
void
setMaterialUnit
(
String
materialUnit
)
{
this
.
materialUnit
=
materialUnit
;
}
public
String
getMaterialUnit
()
{
return
materialUnit
;
}
public
void
setUnitWeight
(
Long
unitWeight
)
{
this
.
unitWeight
=
unitWeight
;
}
public
Long
getUnitWeight
()
{
return
unitWeight
;
}
public
void
setPackageWeight
(
Long
packageWeight
)
{
this
.
packageWeight
=
packageWeight
;
}
public
Long
getPackageWeight
()
{
return
packageWeight
;
}
public
void
setTotalWeight
(
Long
totalWeight
)
{
this
.
totalWeight
=
totalWeight
;
}
public
Long
getTotalWeight
()
{
return
totalWeight
;
}
public
void
setVolume
(
Long
volume
)
{
this
.
volume
=
volume
;
}
public
Long
getVolume
()
{
return
volume
;
}
public
void
setShelfLifeDays
(
Long
shelfLifeDays
)
{
this
.
shelfLifeDays
=
shelfLifeDays
;
}
public
Long
getShelfLifeDays
()
{
return
shelfLifeDays
;
}
public
void
setStorageTemperature
(
String
storageTemperature
)
{
this
.
storageTemperature
=
storageTemperature
;
}
public
String
getStorageTemperature
()
{
return
storageTemperature
;
}
public
void
setSpecialRequirements
(
String
specialRequirements
)
{
this
.
specialRequirements
=
specialRequirements
;
}
public
String
getSpecialRequirements
()
{
return
specialRequirements
;
}
public
void
setIsBatchManaged
(
Long
isBatchManaged
)
{
this
.
isBatchManaged
=
isBatchManaged
;
}
public
Long
getIsBatchManaged
()
{
return
isBatchManaged
;
}
public
void
setIsSerialManaged
(
Long
isSerialManaged
)
{
this
.
isSerialManaged
=
isSerialManaged
;
}
public
Long
getIsSerialManaged
()
{
return
isSerialManaged
;
}
public
void
setMinStockLevel
(
Long
minStockLevel
)
{
this
.
minStockLevel
=
minStockLevel
;
}
public
Long
getMinStockLevel
()
{
return
minStockLevel
;
}
public
void
setMaxStockLevel
(
Long
maxStockLevel
)
{
this
.
maxStockLevel
=
maxStockLevel
;
}
public
Long
getMaxStockLevel
()
{
return
maxStockLevel
;
}
public
Long
getIsUsed
()
{
return
isUsed
;
}
public
void
setIsUsed
(
Long
isUsed
)
{
this
.
isUsed
=
isUsed
;
}
public
void
setIsActive
(
Long
isActive
)
{
this
.
isActive
=
isActive
;
}
public
Long
getIsActive
()
{
return
isActive
;
}
public
void
setRiskLevel
(
String
riskLevel
)
{
this
.
riskLevel
=
riskLevel
;
}
public
String
getRiskLevel
()
{
return
riskLevel
;
}
public
void
setSortNo
(
Long
sortNo
)
{
this
.
sortNo
=
sortNo
;
}
public
Long
getSortNo
()
{
return
sortNo
;
}
public
void
setCreateUserCode
(
String
createUserCode
)
{
this
.
createUserCode
=
createUserCode
;
}
public
String
getCreateUserCode
()
{
return
createUserCode
;
}
public
void
setUpdateUserCode
(
String
updateUserCode
)
{
this
.
updateUserCode
=
updateUserCode
;
}
public
String
getUpdateUserCode
()
{
return
updateUserCode
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"materialCode"
,
getMaterialCode
())
.
append
(
"materialName"
,
getMaterialName
())
.
append
(
"sapNo"
,
getSapNo
())
.
append
(
"tsCode"
,
getTsCode
())
.
append
(
"categoryCode"
,
getCategoryCode
())
.
append
(
"hazardId"
,
getHazardId
())
.
append
(
"specification"
,
getSpecification
())
.
append
(
"materialUnit"
,
getMaterialUnit
())
.
append
(
"unitWeight"
,
getUnitWeight
())
.
append
(
"packageWeight"
,
getPackageWeight
())
.
append
(
"totalWeight"
,
getTotalWeight
())
.
append
(
"volume"
,
getVolume
())
.
append
(
"shelfLifeDays"
,
getShelfLifeDays
())
.
append
(
"storageTemperature"
,
getStorageTemperature
())
.
append
(
"specialRequirements"
,
getSpecialRequirements
())
.
append
(
"isBatchManaged"
,
getIsBatchManaged
())
.
append
(
"isSerialManaged"
,
getIsSerialManaged
())
.
append
(
"minStockLevel"
,
getMinStockLevel
())
.
append
(
"maxStockLevel"
,
getMaxStockLevel
())
.
append
(
"isUsed"
,
getIsUsed
())
.
append
(
"isActive"
,
getIsActive
())
.
append
(
"riskLevel"
,
getRiskLevel
())
.
append
(
"sortNo"
,
getSortNo
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"createUserCode"
,
getCreateUserCode
())
.
append
(
"updateTime"
,
getUpdateTime
())
.
append
(
"updateUserCode"
,
getUpdateUserCode
())
.
toString
();
}
}
ruoyi-inventory/src/main/java/com/ruoyi/inventory/domain/MaterialsCategory.java
0 → 100644
View file @
f3255ab9
package
com
.
ruoyi
.
inventory
.
domain
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
com.ruoyi.common.annotation.Excel
;
import
com.ruoyi.common.core.domain.BaseEntity
;
/**
* 物料分类对象 materials_category
*
* @author ruoyi
* @date 2025-11-28
*/
public
class
MaterialsCategory
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** 编号 */
private
String
id
;
/** 物料编码 检索条件 */
@Excel
(
name
=
"物料编码 检索条件"
)
private
String
categoryCode
;
/** 物料名称 检索条件 */
@Excel
(
name
=
"物料名称 检索条件"
)
private
String
categoryName
;
/** 排序 */
@Excel
(
name
=
"排序"
)
private
Long
sortNo
;
/** 创建日期 */
private
String
createUserCode
;
/** 排序号 */
private
String
updateUserCode
;
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getId
()
{
return
id
;
}
public
void
setCategoryCode
(
String
categoryCode
)
{
this
.
categoryCode
=
categoryCode
;
}
public
String
getCategoryCode
()
{
return
categoryCode
;
}
public
void
setCategoryName
(
String
categoryName
)
{
this
.
categoryName
=
categoryName
;
}
public
String
getCategoryName
()
{
return
categoryName
;
}
public
void
setSortNo
(
Long
sortNo
)
{
this
.
sortNo
=
sortNo
;
}
public
Long
getSortNo
()
{
return
sortNo
;
}
public
void
setCreateUserCode
(
String
createUserCode
)
{
this
.
createUserCode
=
createUserCode
;
}
public
String
getCreateUserCode
()
{
return
createUserCode
;
}
public
void
setUpdateUserCode
(
String
updateUserCode
)
{
this
.
updateUserCode
=
updateUserCode
;
}
public
String
getUpdateUserCode
()
{
return
updateUserCode
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"categoryCode"
,
getCategoryCode
())
.
append
(
"categoryName"
,
getCategoryName
())
.
append
(
"sortNo"
,
getSortNo
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"createUserCode"
,
getCreateUserCode
())
.
append
(
"updateTime"
,
getUpdateTime
())
.
append
(
"updateUserCode"
,
getUpdateUserCode
())
.
toString
();
}
}
ruoyi-inventory/src/main/java/com/ruoyi/inventory/mapper/MaterialsCategoryMapper.java
0 → 100644
View file @
f3255ab9
package
com
.
ruoyi
.
inventory
.
mapper
;
import
java.util.List
;
import
com.ruoyi.inventory.domain.MaterialsCategory
;
/**
* 物料分类Mapper接口
*
* @author ruoyi
* @date 2025-11-28
*/
public
interface
MaterialsCategoryMapper
{
/**
* 查询物料分类
*
* @param id 物料分类主键
* @return 物料分类
*/
public
MaterialsCategory
selectMaterialsCategoryById
(
String
id
);
/**
* 查询物料分类列表
*
* @param materialsCategory 物料分类
* @return 物料分类集合
*/
public
List
<
MaterialsCategory
>
selectMaterialsCategoryList
(
MaterialsCategory
materialsCategory
);
/**
* 新增物料分类
*
* @param materialsCategory 物料分类
* @return 结果
*/
public
int
insertMaterialsCategory
(
MaterialsCategory
materialsCategory
);
/**
* 修改物料分类
*
* @param materialsCategory 物料分类
* @return 结果
*/
public
int
updateMaterialsCategory
(
MaterialsCategory
materialsCategory
);
/**
* 删除物料分类
*
* @param id 物料分类主键
* @return 结果
*/
public
int
deleteMaterialsCategoryById
(
String
id
);
/**
* 批量删除物料分类
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public
int
deleteMaterialsCategoryByIds
(
String
[]
ids
);
}
ruoyi-inventory/src/main/java/com/ruoyi/inventory/mapper/MaterialsMapper.java
0 → 100644
View file @
f3255ab9
package
com
.
ruoyi
.
inventory
.
mapper
;
import
java.util.List
;
import
com.ruoyi.inventory.domain.Materials
;
import
org.apache.ibatis.annotations.Param
;
/**
* 物料Mapper接口
*
* @author ruoyi
* @date 2025-11-28
*/
public
interface
MaterialsMapper
{
/**
* 查询物料
*
* @param id 物料主键
* @return 物料
*/
public
Materials
selectMaterialsById
(
String
id
);
/**
* 查询物料列表
*
* @param materials 物料
* @return 物料集合
*/
public
List
<
Materials
>
selectMaterialsList
(
Materials
materials
);
/**
* 新增物料
*
* @param materials 物料
* @return 结果
*/
public
int
insertMaterials
(
Materials
materials
);
/**
* 修改物料
*
* @param materials 物料
* @return 结果
*/
public
int
updateMaterials
(
Materials
materials
);
/**
* 删除物料
*
* @param id 物料主键
* @return 结果
*/
public
int
deleteMaterialsById
(
String
id
);
/**
* 批量删除物料
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public
int
deleteMaterialsByIds
(
String
[]
ids
);
public
int
updateMaterialsIsUsedByIds
(
String
[]
ids
);
}
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/IMaterialsCategoryService.java
0 → 100644
View file @
f3255ab9
package
com
.
ruoyi
.
inventory
.
service
;
import
java.util.List
;
import
com.ruoyi.inventory.domain.MaterialsCategory
;
/**
* 物料分类Service接口
*
* @author ruoyi
* @date 2025-11-28
*/
public
interface
IMaterialsCategoryService
{
/**
* 查询物料分类
*
* @param id 物料分类主键
* @return 物料分类
*/
public
MaterialsCategory
selectMaterialsCategoryById
(
String
id
);
/**
* 查询物料分类列表
*
* @param materialsCategory 物料分类
* @return 物料分类集合
*/
public
List
<
MaterialsCategory
>
selectMaterialsCategoryList
(
MaterialsCategory
materialsCategory
);
/**
* 新增物料分类
*
* @param materialsCategory 物料分类
* @return 结果
*/
public
int
insertMaterialsCategory
(
MaterialsCategory
materialsCategory
);
/**
* 修改物料分类
*
* @param materialsCategory 物料分类
* @return 结果
*/
public
int
updateMaterialsCategory
(
MaterialsCategory
materialsCategory
);
/**
* 批量删除物料分类
*
* @param ids 需要删除的物料分类主键集合
* @return 结果
*/
public
int
deleteMaterialsCategoryByIds
(
String
[]
ids
);
/**
* 删除物料分类信息
*
* @param id 物料分类主键
* @return 结果
*/
public
int
deleteMaterialsCategoryById
(
String
id
);
}
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/IMaterialsService.java
0 → 100644
View file @
f3255ab9
package
com
.
ruoyi
.
inventory
.
service
;
import
java.util.List
;
import
com.ruoyi.inventory.domain.Materials
;
import
com.ruoyi.inventory.domain.Owners
;
/**
* 物料Service接口
*
* @author ruoyi
* @date 2025-11-28
*/
public
interface
IMaterialsService
{
/**
* 查询物料
*
* @param id 物料主键
* @return 物料
*/
public
Materials
selectMaterialsById
(
String
id
);
/**
* 查询物料列表
*
* @param materials 物料
* @return 物料集合
*/
public
List
<
Materials
>
selectMaterialsList
(
Materials
materials
);
/**
* 新增物料
*
* @param materials 物料
* @return 结果
*/
public
int
insertMaterials
(
Materials
materials
);
/**
* 修改物料
*
* @param materials 物料
* @return 结果
*/
public
int
updateMaterials
(
Materials
materials
);
/**
* 批量删除物料
*
* @param ids 需要删除的物料主键集合
* @return 结果
*/
public
int
deleteMaterialsByIds
(
String
[]
ids
);
/**
* 删除物料信息
*
* @param id 物料主键
* @return 结果
*/
public
int
deleteMaterialsById
(
String
id
);
public
String
importMaterials
(
List
<
Materials
>
materialsList
,
Boolean
isUpdateSupport
,
String
operName
);
}
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/impl/MaterialsCategoryServiceImpl.java
0 → 100644
View file @
f3255ab9
package
com
.
ruoyi
.
inventory
.
service
.
impl
;
import
java.util.List
;
import
com.ruoyi.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.ruoyi.inventory.mapper.MaterialsCategoryMapper
;
import
com.ruoyi.inventory.domain.MaterialsCategory
;
import
com.ruoyi.inventory.service.IMaterialsCategoryService
;
/**
* 物料分类Service业务层处理
*
* @author ruoyi
* @date 2025-11-28
*/
@Service
public
class
MaterialsCategoryServiceImpl
implements
IMaterialsCategoryService
{
@Autowired
private
MaterialsCategoryMapper
materialsCategoryMapper
;
/**
* 查询物料分类
*
* @param id 物料分类主键
* @return 物料分类
*/
@Override
public
MaterialsCategory
selectMaterialsCategoryById
(
String
id
)
{
return
materialsCategoryMapper
.
selectMaterialsCategoryById
(
id
);
}
/**
* 查询物料分类列表
*
* @param materialsCategory 物料分类
* @return 物料分类
*/
@Override
public
List
<
MaterialsCategory
>
selectMaterialsCategoryList
(
MaterialsCategory
materialsCategory
)
{
return
materialsCategoryMapper
.
selectMaterialsCategoryList
(
materialsCategory
);
}
/**
* 新增物料分类
*
* @param materialsCategory 物料分类
* @return 结果
*/
@Override
public
int
insertMaterialsCategory
(
MaterialsCategory
materialsCategory
)
{
materialsCategory
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
materialsCategoryMapper
.
insertMaterialsCategory
(
materialsCategory
);
}
/**
* 修改物料分类
*
* @param materialsCategory 物料分类
* @return 结果
*/
@Override
public
int
updateMaterialsCategory
(
MaterialsCategory
materialsCategory
)
{
materialsCategory
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
materialsCategoryMapper
.
updateMaterialsCategory
(
materialsCategory
);
}
/**
* 批量删除物料分类
*
* @param ids 需要删除的物料分类主键
* @return 结果
*/
@Override
public
int
deleteMaterialsCategoryByIds
(
String
[]
ids
)
{
return
materialsCategoryMapper
.
deleteMaterialsCategoryByIds
(
ids
);
}
/**
* 删除物料分类信息
*
* @param id 物料分类主键
* @return 结果
*/
@Override
public
int
deleteMaterialsCategoryById
(
String
id
)
{
return
materialsCategoryMapper
.
deleteMaterialsCategoryById
(
id
);
}
}
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/impl/MaterialsServiceImpl.java
0 → 100644
View file @
f3255ab9
package
com
.
ruoyi
.
inventory
.
service
.
impl
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.UUID
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.inventory.domain.Owners
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.ruoyi.inventory.mapper.MaterialsMapper
;
import
com.ruoyi.inventory.domain.Materials
;
import
com.ruoyi.inventory.service.IMaterialsService
;
/**
* 物料Service业务层处理
*
* @author ruoyi
* @date 2025-11-28
*/
@Service
public
class
MaterialsServiceImpl
implements
IMaterialsService
{
@Autowired
private
MaterialsMapper
materialsMapper
;
/**
* 查询物料
*
* @param id 物料主键
* @return 物料
*/
@Override
public
Materials
selectMaterialsById
(
String
id
)
{
return
materialsMapper
.
selectMaterialsById
(
id
);
}
/**
* 查询物料列表
*
* @param materials 物料
* @return 物料
*/
@Override
public
List
<
Materials
>
selectMaterialsList
(
Materials
materials
)
{
return
materialsMapper
.
selectMaterialsList
(
materials
);
}
/**
* 新增物料
*
* @param materials 物料
* @return 结果
*/
@Override
public
int
insertMaterials
(
Materials
materials
)
{
materials
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
materialsMapper
.
insertMaterials
(
materials
);
}
/**
* 修改物料
*
* @param materials 物料
* @return 结果
*/
@Override
public
int
updateMaterials
(
Materials
materials
)
{
materials
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
materialsMapper
.
updateMaterials
(
materials
);
}
/**
* 批量修改物料的使用状态
*
* @param ids 需要删除的物料主键
* @return 结果
*/
@Override
public
int
deleteMaterialsByIds
(
String
[]
ids
)
{
return
materialsMapper
.
updateMaterialsIsUsedByIds
(
ids
);
}
/**
* 删除物料信息
*
* @param id 物料主键
* @return 结果
*/
@Override
public
int
deleteMaterialsById
(
String
id
)
{
return
materialsMapper
.
deleteMaterialsById
(
id
);
}
@Override
public
String
importMaterials
(
List
<
Materials
>
materialsList
,
Boolean
isUpdateSupport
,
String
operName
)
{
if
(
StringUtils
.
isNull
(
materialsList
)
||
materialsList
.
size
()
==
0
)
{
throw
new
ServiceException
(
"导入用户数据不能为空!"
);
}
int
successNum
=
0
;
int
failureNum
=
0
;
StringBuilder
successMsg
=
new
StringBuilder
();
StringBuilder
failureMsg
=
new
StringBuilder
();
Date
now
=
DateUtils
.
getNowDate
();
Long
userId
=
SecurityUtils
.
getUserId
();
String
operId
=
userId
.
toString
();
for
(
Materials
materials
:
materialsList
)
{
try
{
materials
.
setId
(
UUID
.
randomUUID
().
toString
());
// 填充创建人、创建时间、修改人、修改时间
materials
.
setCreateBy
(
operId
);
materials
.
setCreateTime
(
now
);
materials
.
setUpdateBy
(
operId
);
materials
.
setUpdateTime
(
now
);
// 填充创建用户编码和更新用户编码
materials
.
setCreateUserCode
(
operId
);
materials
.
setUpdateUserCode
(
operId
);
// 设置默认值
if
(
materials
.
getIsActive
()
==
null
)
{
materials
.
setIsActive
(
1L
);
// 默认激活
}
if
(
materials
.
getIsUsed
()
==
null
)
{
materials
.
setIsUsed
(
1L
);
// 默认未删除
}
if
(
materials
.
getSortNo
()
==
null
)
{
materials
.
setSortNo
(
0L
);
// 默认排序号
}
materialsMapper
.
insertMaterials
(
materials
);
successNum
++;
successMsg
.
append
(
"<br/>"
+
successNum
+
"、物料 "
+
materials
.
getMaterialName
()
+
" 导入成功"
);
}
catch
(
Exception
e
)
{
failureNum
++;
String
msg
=
"<br/>"
+
failureNum
+
"、物料 "
+
materials
.
getMaterialName
()
+
" 导入失败:"
;
failureMsg
.
append
(
msg
+
e
.
getMessage
());
}
}
if
(
failureNum
>
0
)
{
failureMsg
.
insert
(
0
,
"很抱歉,导入失败!共 "
+
failureNum
+
" 条数据格式不正确"
);
throw
new
ServiceException
(
failureMsg
.
toString
());
}
else
{
successMsg
.
insert
(
0
,
"恭喜您,数据已全部导入成功!共 "
+
successNum
+
" 条,数据如下:"
);
}
return
successMsg
.
toString
();
}
}
ruoyi-inventory/src/main/resources/mapper/inventory/MaterialsCategoryMapper.xml
0 → 100644
View file @
f3255ab9
<?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.inventory.mapper.MaterialsCategoryMapper"
>
<resultMap
type=
"MaterialsCategory"
id=
"MaterialsCategoryResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"categoryCode"
column=
"category_code"
/>
<result
property=
"categoryName"
column=
"category_name"
/>
<result
property=
"sortNo"
column=
"sort_no"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"createUserCode"
column=
"create_user_code"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"updateUserCode"
column=
"update_user_code"
/>
</resultMap>
<sql
id=
"selectMaterialsCategoryVo"
>
select id, category_code, category_name, sort_no, create_time, create_user_code, update_time, update_user_code from materials_category
</sql>
<select
id=
"selectMaterialsCategoryList"
parameterType=
"MaterialsCategory"
resultMap=
"MaterialsCategoryResult"
>
<include
refid=
"selectMaterialsCategoryVo"
/>
<where>
<if
test=
"categoryCode != null and categoryCode != ''"
>
and category_code like concat('%', #{categoryCode}, '%')
</if>
<if
test=
"categoryName != null and categoryName != ''"
>
and category_name like concat('%', #{categoryName}, '%')
</if>
<if
test=
"sortNo != null "
>
and sort_no = #{sortNo}
</if>
<if
test=
"createTime != null "
>
and create_time like concat('%', #{createTime}, '%')
</if>
<if
test=
"updateTime != null "
>
and update_time like concat('%', #{updateTime}, '%')
</if>
</where>
order by sort_no asc
</select>
<select
id=
"selectMaterialsCategoryById"
parameterType=
"String"
resultMap=
"MaterialsCategoryResult"
>
<include
refid=
"selectMaterialsCategoryVo"
/>
where id = #{id}
order by sort_no asc
</select>
<insert
id=
"insertMaterialsCategory"
parameterType=
"MaterialsCategory"
>
insert into materials_category
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"categoryCode != null"
>
category_code,
</if>
<if
test=
"categoryName != null"
>
category_name,
</if>
<if
test=
"sortNo != null"
>
sort_no,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"createUserCode != null"
>
create_user_code,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"updateUserCode != null"
>
update_user_code,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id},
</if>
<if
test=
"categoryCode != null"
>
#{categoryCode},
</if>
<if
test=
"categoryName != null"
>
#{categoryName},
</if>
<if
test=
"sortNo != null"
>
#{sortNo},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"createUserCode != null"
>
#{createUserCode},
</if>
<if
test=
"updateTime != null"
>
#{updateTime},
</if>
<if
test=
"updateUserCode != null"
>
#{updateUserCode},
</if>
</trim>
</insert>
<update
id=
"updateMaterialsCategory"
parameterType=
"MaterialsCategory"
>
update materials_category
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"categoryCode != null"
>
category_code = #{categoryCode},
</if>
<if
test=
"categoryName != null"
>
category_name = #{categoryName},
</if>
<if
test=
"sortNo != null"
>
sort_no = #{sortNo},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"createUserCode != null"
>
create_user_code = #{createUserCode},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"updateUserCode != null"
>
update_user_code = #{updateUserCode},
</if>
</trim>
where id = #{id}
</update>
<delete
id=
"deleteMaterialsCategoryById"
parameterType=
"String"
>
delete from materials_category where id = #{id}
</delete>
<delete
id=
"deleteMaterialsCategoryByIds"
parameterType=
"String"
>
delete from materials_category where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
ruoyi-inventory/src/main/resources/mapper/inventory/MaterialsMapper.xml
0 → 100644
View file @
f3255ab9
<?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.inventory.mapper.MaterialsMapper"
>
<resultMap
type=
"Materials"
id=
"MaterialsResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"materialCode"
column=
"material_code"
/>
<result
property=
"materialName"
column=
"material_name"
/>
<result
property=
"sapNo"
column=
"sap_no"
/>
<result
property=
"tsCode"
column=
"ts_code"
/>
<result
property=
"categoryCode"
column=
"category_code"
/>
<result
property=
"hazardId"
column=
"hazard_id"
/>
<result
property=
"specification"
column=
"specification"
/>
<result
property=
"materialUnit"
column=
"material_unit"
/>
<result
property=
"unitWeight"
column=
"unit_weight"
/>
<result
property=
"packageWeight"
column=
"package_weight"
/>
<result
property=
"totalWeight"
column=
"total_weight"
/>
<result
property=
"volume"
column=
"volume"
/>
<result
property=
"shelfLifeDays"
column=
"shelf_life_days"
/>
<result
property=
"storageTemperature"
column=
"storage_temperature"
/>
<result
property=
"specialRequirements"
column=
"special_requirements"
/>
<result
property=
"isBatchManaged"
column=
"is_batch_managed"
/>
<result
property=
"isSerialManaged"
column=
"is_serial_managed"
/>
<result
property=
"minStockLevel"
column=
"min_stock_level"
/>
<result
property=
"maxStockLevel"
column=
"max_stock_level"
/>
<result
property=
"isUsed"
column=
"is_used"
/>
<result
property=
"isActive"
column=
"is_active"
/>
<result
property=
"riskLevel"
column=
"risk_level"
/>
<result
property=
"sortNo"
column=
"sort_no"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"createUserCode"
column=
"create_user_code"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"updateUserCode"
column=
"update_user_code"
/>
</resultMap>
<sql
id=
"selectMaterialsVo"
>
select id, material_code, material_name, sap_no, ts_code, category_code, hazard_id, specification, material_unit, unit_weight, package_weight, total_weight, volume, shelf_life_days, storage_temperature, special_requirements, is_batch_managed, is_serial_managed, min_stock_level, max_stock_level, is_used, is_active, risk_level, sort_no, create_time, create_user_code, update_time, update_user_code from materials
</sql>
<select
id=
"selectMaterialsList"
parameterType=
"Materials"
resultMap=
"MaterialsResult"
>
<include
refid=
"selectMaterialsVo"
/>
<where>
<if
test=
"materialCode != null and materialCode != ''"
>
and material_code like concat('%', #{materialCode}, '%')
</if>
<if
test=
"materialName != null and materialName != ''"
>
and material_name like concat('%', #{materialName}, '%')
</if>
<if
test=
"sapNo != null and sapNo != ''"
>
and sap_no like concat('%', #{sapNo}, '%')
</if>
<if
test=
"tsCode != null and tsCode != ''"
>
and ts_code like concat('%', #{tsCode}, '%')
</if>
<if
test=
"categoryCode != null and categoryCode != ''"
>
and category_code like concat('%', #{categoryCode}, '%')
</if>
<if
test=
"hazardId != null and hazardId != ''"
>
and hazard_id like concat('%', #{hazardId}, '%')
</if>
<if
test=
"specification != null and specification != ''"
>
and specification like concat('%', #{specification}, '%')
</if>
<if
test=
"materialUnit != null and materialUnit != ''"
>
and material_unit like concat('%', #{materialUnit}, '%')
</if>
<if
test=
"unitWeight != null "
>
and unit_weight = #{unitWeight}
</if>
<if
test=
"packageWeight != null "
>
and package_weight = #{packageWeight}
</if>
<if
test=
"totalWeight != null "
>
and total_weight = #{totalWeight}
</if>
<if
test=
"volume != null "
>
and volume = #{volume}
</if>
<if
test=
"shelfLifeDays != null "
>
and shelf_life_days = #{shelfLifeDays}
</if>
<if
test=
"storageTemperature != null and storageTemperature != ''"
>
and storage_temperature like concat('%', #{storageTemperature}, '%')
</if>
<if
test=
"specialRequirements != null and specialRequirements != ''"
>
and special_requirements like concat('%', #{specialRequirements}, '%')
</if>
<if
test=
"isBatchManaged != null "
>
and is_batch_managed = #{isBatchManaged}
</if>
<if
test=
"isSerialManaged != null "
>
and is_serial_managed = #{isSerialManaged}
</if>
<if
test=
"minStockLevel != null "
>
and min_stock_level = #{minStockLevel}
</if>
<if
test=
"maxStockLevel != null "
>
and max_stock_level = #{maxStockLevel}
</if>
<if
test=
"isUsed != null "
>
and is_used = #{isUsed}
</if>
<if
test=
"isActive != null "
>
and is_active = #{isActive}
</if>
<if
test=
"riskLevel != null and riskLevel != ''"
>
and risk_level like concat('%', #{riskLevel}, '%')
</if>
<if
test=
"sortNo != null "
>
and sort_no = #{sortNo}
</if>
<if
test=
"createTime != null "
>
and create_time like concat('%', #{createTime}, '%')
</if>
<if
test=
"updateTime != null "
>
and update_time like concat('%', #{updateTime}, '%')
</if>
</where>
order by sort_no asc
</select>
<select
id=
"selectMaterialsById"
parameterType=
"String"
resultMap=
"MaterialsResult"
>
<include
refid=
"selectMaterialsVo"
/>
where id = #{id}
order by sort_no asc
</select>
<insert
id=
"insertMaterials"
parameterType=
"Materials"
>
insert into materials
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"materialCode != null"
>
material_code,
</if>
<if
test=
"materialName != null"
>
material_name,
</if>
<if
test=
"sapNo != null"
>
sap_no,
</if>
<if
test=
"tsCode != null"
>
ts_code,
</if>
<if
test=
"categoryCode != null"
>
category_code,
</if>
<if
test=
"hazardId != null"
>
hazard_id,
</if>
<if
test=
"specification != null"
>
specification,
</if>
<if
test=
"materialUnit != null"
>
material_unit,
</if>
<if
test=
"unitWeight != null"
>
unit_weight,
</if>
<if
test=
"packageWeight != null"
>
package_weight,
</if>
<if
test=
"totalWeight != null"
>
total_weight,
</if>
<if
test=
"volume != null"
>
volume,
</if>
<if
test=
"shelfLifeDays != null"
>
shelf_life_days,
</if>
<if
test=
"storageTemperature != null"
>
storage_temperature,
</if>
<if
test=
"specialRequirements != null"
>
special_requirements,
</if>
<if
test=
"isBatchManaged != null"
>
is_batch_managed,
</if>
<if
test=
"isSerialManaged != null"
>
is_serial_managed,
</if>
<if
test=
"minStockLevel != null"
>
min_stock_level,
</if>
<if
test=
"maxStockLevel != null"
>
max_stock_level,
</if>
<if
test=
"isUsed != null"
>
is_used,
</if>
<if
test=
"isActive != null"
>
is_active,
</if>
<if
test=
"riskLevel != null"
>
risk_level,
</if>
<if
test=
"sortNo != null"
>
sort_no,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"createUserCode != null"
>
create_user_code,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"updateUserCode != null"
>
update_user_code,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id},
</if>
<if
test=
"materialCode != null"
>
#{materialCode},
</if>
<if
test=
"materialName != null"
>
#{materialName},
</if>
<if
test=
"sapNo != null"
>
#{sapNo},
</if>
<if
test=
"tsCode != null"
>
#{tsCode},
</if>
<if
test=
"categoryCode != null"
>
#{categoryCode},
</if>
<if
test=
"hazardId != null"
>
#{hazardId},
</if>
<if
test=
"specification != null"
>
#{specification},
</if>
<if
test=
"materialUnit != null"
>
#{materialUnit},
</if>
<if
test=
"unitWeight != null"
>
#{unitWeight},
</if>
<if
test=
"packageWeight != null"
>
#{packageWeight},
</if>
<if
test=
"totalWeight != null"
>
#{totalWeight},
</if>
<if
test=
"volume != null"
>
#{volume},
</if>
<if
test=
"shelfLifeDays != null"
>
#{shelfLifeDays},
</if>
<if
test=
"storageTemperature != null"
>
#{storageTemperature},
</if>
<if
test=
"specialRequirements != null"
>
#{specialRequirements},
</if>
<if
test=
"isBatchManaged != null"
>
#{isBatchManaged},
</if>
<if
test=
"isSerialManaged != null"
>
#{isSerialManaged},
</if>
<if
test=
"minStockLevel != null"
>
#{minStockLevel},
</if>
<if
test=
"maxStockLevel != null"
>
#{maxStockLevel},
</if>
<if
test=
"isUsed != null"
>
#{isUsed},
</if>
<if
test=
"isActive != null"
>
#{isActive},
</if>
<if
test=
"riskLevel != null"
>
#{riskLevel},
</if>
<if
test=
"sortNo != null"
>
#{sortNo},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"createUserCode != null"
>
#{createUserCode},
</if>
<if
test=
"updateTime != null"
>
#{updateTime},
</if>
<if
test=
"updateUserCode != null"
>
#{updateUserCode},
</if>
</trim>
</insert>
<update
id=
"updateMaterials"
parameterType=
"Materials"
>
update materials
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"materialCode != null"
>
material_code = #{materialCode},
</if>
<if
test=
"materialName != null"
>
material_name = #{materialName},
</if>
<if
test=
"sapNo != null"
>
sap_no = #{sapNo},
</if>
<if
test=
"tsCode != null"
>
ts_code = #{tsCode},
</if>
<if
test=
"categoryCode != null"
>
category_code = #{categoryCode},
</if>
<if
test=
"hazardId != null"
>
hazard_id = #{hazardId},
</if>
<if
test=
"specification != null"
>
specification = #{specification},
</if>
<if
test=
"materialUnit != null"
>
material_unit = #{materialUnit},
</if>
<if
test=
"unitWeight != null"
>
unit_weight = #{unitWeight},
</if>
<if
test=
"packageWeight != null"
>
package_weight = #{packageWeight},
</if>
<if
test=
"totalWeight != null"
>
total_weight = #{totalWeight},
</if>
<if
test=
"volume != null"
>
volume = #{volume},
</if>
<if
test=
"shelfLifeDays != null"
>
shelf_life_days = #{shelfLifeDays},
</if>
<if
test=
"storageTemperature != null"
>
storage_temperature = #{storageTemperature},
</if>
<if
test=
"specialRequirements != null"
>
special_requirements = #{specialRequirements},
</if>
<if
test=
"isBatchManaged != null"
>
is_batch_managed = #{isBatchManaged},
</if>
<if
test=
"isSerialManaged != null"
>
is_serial_managed = #{isSerialManaged},
</if>
<if
test=
"minStockLevel != null"
>
min_stock_level = #{minStockLevel},
</if>
<if
test=
"maxStockLevel != null"
>
max_stock_level = #{maxStockLevel},
</if>
<if
test=
"isUsed != null"
>
is_used = #{isUsed},
</if>
<if
test=
"isActive != null"
>
is_active = #{isActive},
</if>
<if
test=
"riskLevel != null"
>
risk_level = #{riskLevel},
</if>
<if
test=
"sortNo != null"
>
sort_no = #{sortNo},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"createUserCode != null"
>
create_user_code = #{createUserCode},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"updateUserCode != null"
>
update_user_code = #{updateUserCode},
</if>
</trim>
where id = #{id}
</update>
<update
id=
"updateMaterialsIsUsedByIds"
>
update materials set is_used = 0 where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</update>
<delete
id=
"deleteMaterialsById"
parameterType=
"String"
>
delete from materials where id = #{id}
</delete>
<delete
id=
"deleteMaterialsByIds"
parameterType=
"String"
>
delete from materials where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论