Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
46eca9c4
Commit
46eca9c4
authored
May 15, 2022
by
季圣华
Browse files
增加批量更新商品信息的接口
parent
ad9ee39c
Changes
2
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/controller/MaterialController.java
View file @
46eca9c4
...
...
@@ -624,4 +624,24 @@ public class MaterialController {
return
returnJson
(
objectMap
,
ErpInfo
.
ERROR
.
name
,
ErpInfo
.
ERROR
.
code
);
}
}
/**
* 批量更新商品信息
* @param jsonObject
* @param request
* @return
* @throws Exception
*/
@PostMapping
(
value
=
"/batchUpdate"
)
@ApiOperation
(
value
=
"批量更新商品信息"
)
public
String
batchUpdate
(
@RequestBody
JSONObject
jsonObject
,
HttpServletRequest
request
)
throws
Exception
{
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<>();
int
res
=
materialService
.
batchUpdate
(
jsonObject
);
if
(
res
>
0
)
{
return
returnJson
(
objectMap
,
ErpInfo
.
OK
.
name
,
ErpInfo
.
OK
.
code
);
}
else
{
return
returnJson
(
objectMap
,
ErpInfo
.
ERROR
.
name
,
ErpInfo
.
ERROR
.
code
);
}
}
}
jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java
View file @
46eca9c4
...
...
@@ -1080,4 +1080,14 @@ public class MaterialService {
}
return
res
;
}
public
int
batchUpdate
(
JSONObject
jsonObject
)
{
String
ids
=
jsonObject
.
getString
(
"ids"
);
String
materialStr
=
jsonObject
.
getString
(
"material"
);
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
Material
material
=
JSONObject
.
parseObject
(
materialStr
,
Material
.
class
);
MaterialExample
example
=
new
MaterialExample
();
example
.
createCriteria
().
andIdIn
(
idList
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
return
materialMapper
.
updateByExampleSelective
(
material
,
example
);
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment