Browse Source

修复排序

master
cgx 2 months ago
parent
commit
e401f50356
2 changed files with 11 additions and 2 deletions
  1. +9
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/tbDataConf/controller/TbDataConfController.java
  2. +2
    -2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/alUser/controller/IndexController.java

+ 9
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/tbDataConf/controller/TbDataConfController.java View File

@ -73,6 +73,15 @@ public class TbDataConfController extends JeecgController<TbDataConf, ITbDataCon
@ApiOperation(value = "平台铝价-添加", notes = "平台铝价-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody TbDataConf tbDataConf) {
if (tbDataConf.getType()==null){
return Result.error("请选择类型!");
}
if (tbDataConf.getPriceDate()==null){
return Result.error("请选择日期!");
}
if (tbDataConf.getPrice()==null){
return Result.error("请输入价格!");
}
tbDataConfService.save(tbDataConf);
return Result.OK("添加成功!");
}


+ 2
- 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/alUser/controller/IndexController.java View File

@ -69,11 +69,11 @@ public class IndexController {
@ApiOperation(value = "铝价接口")
@ApiOperation(value = "铝价接口")
@RequestMapping(value = "/alpriceNew", method = RequestMethod.POST)
public Result alpriceNew() {
List<TbDataConf> list = tbDataConfService.list();
Map<Integer, List<TbDataConf>> collect = list.stream().sorted(Comparator.comparing(TbDataConf::getType).reversed()).collect(Collectors.groupingBy(TbDataConf::getType));
Map<Integer, List<TbDataConf>> collect = list.stream().sorted(Comparator.comparing(TbDataConf::getPriceDate)).collect(Collectors.groupingBy(TbDataConf::getType));
return Result.ok(collect);
}


Loading…
Cancel
Save