|
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -38,7 +39,7 @@ public class MaintenanceOptionController {
|
|
|
* @return cn.com.xwy.boot.web.dto.RestResponse
|
|
|
*/
|
|
|
@PostMapping("/list")
|
|
|
- public RestResponse list(@RequestBody OptionReq req) {
|
|
|
+ public RestResponse<?> list(@RequestBody OptionReq req) {
|
|
|
IPage<MaintenanceOption> page = optionService.page(
|
|
|
new Page<>(req.getPageNum(), req.getPageSize()), new QueryWrapper<MaintenanceOption>()
|
|
|
//10086L是固定数据的公司id
|
|
@@ -60,24 +61,24 @@ public class MaintenanceOptionController {
|
|
|
* @return RestResponse
|
|
|
*/
|
|
|
@PostMapping("/options")
|
|
|
- public RestResponse options(@RequestBody OptionReq req) {
|
|
|
+ public RestResponse<?> options(@RequestBody OptionReq req) {
|
|
|
Integer category = req.getLiftCategory();
|
|
|
String sort = null;
|
|
|
- if (category == 4 || category == 5) {
|
|
|
+ if (Objects.nonNull(category) && (category == 4 || category == 5)) {
|
|
|
req.setLiftCategory(3);
|
|
|
sort = "-1";
|
|
|
}
|
|
|
- if (category == 3) {
|
|
|
+ if (Objects.nonNull(category) && category == 3) {
|
|
|
req.setLiftCategory(4);
|
|
|
}
|
|
|
List<MaintenanceOption> options = optionService.list(
|
|
|
new QueryWrapper<MaintenanceOption>()
|
|
|
//10086L是固定数据的公司id
|
|
|
.in("mt_company_id", 10086L, req.getMtCompanyId())
|
|
|
- .in(req.getType() != null, "type", type(req))
|
|
|
- .eq(req.getLiftCategory() != null, "lift_category", req.getLiftCategory())
|
|
|
+ .in(Objects.nonNull(req.getType()), "type", type(req))
|
|
|
+ .eq(Objects.nonNull(req.getLiftCategory()), "lift_category", req.getLiftCategory())
|
|
|
.eq("status", 2)
|
|
|
- .in(sort != null, "sort", sort));
|
|
|
+ .in(Objects.nonNull(sort), "sort", sort));
|
|
|
if (options.isEmpty()) {
|
|
|
return RestResponse.success();
|
|
|
}
|
|
@@ -92,7 +93,7 @@ public class MaintenanceOptionController {
|
|
|
* @return RestResponse
|
|
|
*/
|
|
|
@PostMapping("/add")
|
|
|
- public RestResponse add(@RequestBody MaintenanceOption option) {
|
|
|
+ public RestResponse<?> add(@RequestBody MaintenanceOption option) {
|
|
|
if (option.getLiftCategory() == 3) {
|
|
|
option.setSort(-1);
|
|
|
}
|
|
@@ -108,7 +109,7 @@ public class MaintenanceOptionController {
|
|
|
* @return RestResponse
|
|
|
*/
|
|
|
@PostMapping("/modify")
|
|
|
- public RestResponse modify(@RequestBody MaintenanceOption option) {
|
|
|
+ public RestResponse<?> modify(@RequestBody MaintenanceOption option) {
|
|
|
Long mtCompanyId = optionService.getById(option.getId()).getMtCompanyId();
|
|
|
//10086L是固定数据的公司id
|
|
|
if (option.getMtCompanyId().equals(mtCompanyId) || option.getMtCompanyId().equals(10086L)) {
|
|
@@ -124,7 +125,7 @@ public class MaintenanceOptionController {
|
|
|
* @return RestResponse
|
|
|
*/
|
|
|
@PostMapping("/delete")
|
|
|
- public RestResponse delete(@RequestBody MaintenanceOption option) {
|
|
|
+ public RestResponse<?> delete(@RequestBody MaintenanceOption option) {
|
|
|
Long mtCompanyId = optionService.getById(option.getId()).getMtCompanyId();
|
|
|
//10086L是固定数据的公司id
|
|
|
if (option.getMtCompanyId().equals(mtCompanyId) || option.getMtCompanyId().equals(10086L)) {
|