医院废弃物信息化管理平台
“mitao”
2026-04-21 2f18b3a28054c3917010f95ba84f7425280a2622
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package cn.besteam.modules.medical.controller;
 
import cn.besteam.common.api.vo.Result;
import cn.besteam.common.aspect.annotation.AutoLog;
import cn.besteam.common.constant.ErrorCode;
import cn.besteam.common.exception.BusinessException;
import cn.besteam.modules.medical.entity.MwWarningConfig;
import cn.besteam.modules.medical.entity.MwWarningConfigPlatform;
import cn.besteam.modules.medical.service.IMwWarningConfigPlatformService;
import cn.besteam.modules.medical.service.IMwWarningConfigService;
import cn.besteam.modules.medical.vo.MwWarningConfigVO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
/**
 * @Title: Controller
 * @Description: 预警-配置-平台
 * @author: besteam
 * @date: 2020-07-17
 * @version: V1.0
 */
@RestController
@RequestMapping("/medical/mwWarningConfigPlatform")
@Slf4j
@Api(description = "预警-配置-平台")
public class MwWarningConfigPlatformController {
 
    @Autowired
    private IMwWarningConfigPlatformService mwWarningConfigService;
 
    /**
     * 编辑
     *
     * @param mwWarningConfigVO
     * @return
     */
    @PostMapping(value = "/editByType")
    @AutoLog(value = "编辑预警配置平台(新)")
    @ApiOperation(value = "编辑预警配置平台(新)", notes = "编辑预警配置", produces = "application/json")
    public Result<Boolean> editByType(@RequestBody MwWarningConfigVO mwWarningConfigVO) {
 
        MwWarningConfigPlatform warningConfig = mwWarningConfigService.getOne(new QueryWrapper<MwWarningConfigPlatform>().lambda().eq(MwWarningConfigPlatform::getType, mwWarningConfigVO.getType()).last("limit 1"));
        if (warningConfig == null) {
            throw new BusinessException(ErrorCode.ERR_500, "预警配置不存在");
        }
        warningConfig.setDefaultValue(mwWarningConfigVO.getDefaultValue());
        warningConfig.setWasteTypes(mwWarningConfigVO.getWasteTypes());
        return Result.ok(mwWarningConfigService.updateById(warningConfig));
    }
 
    @GetMapping(value = "/getByType")
    @ApiOperation(value = "按类型获取预警配置平台(新)", notes = "按类型获取预警配置", produces = "application/json")
    public Result<MwWarningConfigVO> getByType(@RequestParam Integer type) {
 
        MwWarningConfigPlatform warningConfig = mwWarningConfigService.getOne(new QueryWrapper<MwWarningConfigPlatform>().lambda().eq(MwWarningConfigPlatform::getType, type).last("limit 1"));
        if (warningConfig == null) {
            throw new BusinessException(ErrorCode.ERR_500, "预警配置不存在");
        }
        MwWarningConfigVO vo = new MwWarningConfigVO();
        BeanUtils.copyProperties(warningConfig, vo);
        return Result.ok(vo);
    }
 
}