|
|
@@ -341,63 +341,6 @@ public class PatientMonitorController {
|
|
|
}
|
|
|
return R.success(constantService.list(query));
|
|
|
}
|
|
|
-
|
|
|
- @PostMapping("/update/{type}")
|
|
|
- @SaCheckPermission("bus:constant:edit")
|
|
|
- @ApiOperation(value = "更新数据",notes = "权限【bus:constant:edit】")
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "type",value = "常量类型",required = true,allowableValues = "doctor,alarm,mix",allowMultiple = true,dataTypeClass = ConstantEnum.class)
|
|
|
- })
|
|
|
- public R update(@PathVariable("type") ConstantEnum type,@RequestBody JSONObject payload) {
|
|
|
- AbstractConstantService constantService = constantHashMap.get(type);
|
|
|
- if(constantService==null){
|
|
|
- return R.success("常量类型{"+type+"}不存在");
|
|
|
- }
|
|
|
- try {
|
|
|
- return constantService.updateById( payload.toBean(constantService.getEntityClass()))?R.success(payload):R.fail("数据更新失败");
|
|
|
- }catch (DuplicateKeyException e){
|
|
|
- throw new CustomException("常量名称不可重复");
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @PostMapping("/{type}/remove")
|
|
|
- @SaCheckPermission("bus:constant:remove")
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "id",value = "主键id",required = true),
|
|
|
- @ApiImplicitParam(name = "type",value = "常量类型",required = true,allowableValues = "mix,doctor,alarm",allowMultiple = true,dataTypeClass = ConstantEnum.class)
|
|
|
- })
|
|
|
- @ApiOperation(value = "根据ID删除",notes = "权限【bus:constant:remove】")
|
|
|
- public R delete(@PathVariable("type") ConstantEnum type,@RequestParam("id") Serializable id) {
|
|
|
- if(StrUtil.isNullOrUndefined(String.valueOf(id))){
|
|
|
- return R.success();
|
|
|
- }
|
|
|
- AbstractConstantService constantService = constantHashMap.get(type);
|
|
|
- if(constantService==null){
|
|
|
- return R.success("常量类型{"+type+"}不存在");
|
|
|
- }
|
|
|
- String key=String.valueOf(id);
|
|
|
- return constantService
|
|
|
- .removeById(key)? R.success():R.fail("删除失败");
|
|
|
- }
|
|
|
-
|
|
|
- @PostMapping("/save/{type}")
|
|
|
- @SaCheckPermission("bus:constant:add")
|
|
|
- @ApiOperation(value = "新增数据",notes = "权限【bus:constant:add】")
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "type",value = "常量类型",required = true,allowableValues = "doctor,alarm,mix",allowMultiple = true,dataTypeClass = ConstantEnum.class)
|
|
|
- })
|
|
|
- public R add(@PathVariable("type") ConstantEnum type,@RequestBody JSONObject payload) {
|
|
|
- AbstractConstantService constantService = constantHashMap.get(type);
|
|
|
- if(constantService==null){
|
|
|
- return R.success("常量类型{"+type+"}不存在");
|
|
|
- }
|
|
|
- try {
|
|
|
- return constantService.save( payload.toBean(constantService.getEntityClass()))?R.success(payload):R.fail("数据新增失败");
|
|
|
- }catch (DuplicateKeyException e){
|
|
|
- throw new CustomException("常量名称不可重复");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
|
|
|
}
|