From ec46ddfd26d7399cd24e1e84c22b2f6cf568feb8 Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Fri, 19 Jul 2024 14:58:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E5=85=B1=E4=B8=8B=E6=8B=89=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bonus/aqgqj/base/entity/SelectEntity.java | 7 +- .../aqgqj/basis/entity/vo/ExperDeviceVo.java | 72 +++++++++++++++++++ .../system/controller/SelectController.java | 28 ++++++++ .../com/bonus/aqgqj/system/dao/SelectDao.java | 21 ++++++ .../aqgqj/system/service/SelectService.java | 21 +++++- .../service/impl/SelectServiceImpl.java | 24 +++++++ .../bonus/aqgqj/system/vo/dto/SelectDto.java | 18 +++++ .../resources/mappers/system/SelectMapper.xml | 18 +++++ 8 files changed, 207 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/bonus/aqgqj/basis/entity/vo/ExperDeviceVo.java create mode 100644 src/main/java/com/bonus/aqgqj/system/vo/dto/SelectDto.java diff --git a/src/main/java/com/bonus/aqgqj/base/entity/SelectEntity.java b/src/main/java/com/bonus/aqgqj/base/entity/SelectEntity.java index 737b4cd..09c1feb 100644 --- a/src/main/java/com/bonus/aqgqj/base/entity/SelectEntity.java +++ b/src/main/java/com/bonus/aqgqj/base/entity/SelectEntity.java @@ -13,7 +13,12 @@ public class SelectEntity { private String id; /** - *名称 + * 名称 */ private String name; + + /** + * 字典值 + */ + private String value; } diff --git a/src/main/java/com/bonus/aqgqj/basis/entity/vo/ExperDeviceVo.java b/src/main/java/com/bonus/aqgqj/basis/entity/vo/ExperDeviceVo.java new file mode 100644 index 0000000..44f1c6c --- /dev/null +++ b/src/main/java/com/bonus/aqgqj/basis/entity/vo/ExperDeviceVo.java @@ -0,0 +1,72 @@ +package com.bonus.aqgqj.basis.entity.vo; + +import com.bonus.aqgqj.utils.UserUtil; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +import java.util.Date; + +/** + * @className:ExperDeviceVo + * @author:cwchen + * @date:2024-07-19-13:29 + * @version:1.0 + * @description:试验设备-vo + */ +@Data +public class ExperDeviceVo { + + /** + * 设备id + */ + private Long devId; + /** + * 设备名称 + */ + private String devName; + /** + * 设备型号 + */ + private String devModule; + /** + * 设备编号 + */ + private String devCode; + /** + * 合同生效日期 + */ + private String contractDate; + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private Date createTime; + /** + * 修改时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private Date updateTime = new Date(); + /** + * 创建人 + */ + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private Long createUser = UserUtil.getLoginUser().getId(); + /** + * 修改人 + */ + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private Long updateUser = UserUtil.getLoginUser().getId(); + /** + * 数据来源 0 新增 1 实验配置 + */ + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private Integer dataSource = 1; + /** + * 删除状态 0正常 1删除 + */ + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private Integer delFlag = 0; +} diff --git a/src/main/java/com/bonus/aqgqj/system/controller/SelectController.java b/src/main/java/com/bonus/aqgqj/system/controller/SelectController.java index ac45066..9b12f0a 100644 --- a/src/main/java/com/bonus/aqgqj/system/controller/SelectController.java +++ b/src/main/java/com/bonus/aqgqj/system/controller/SelectController.java @@ -4,6 +4,7 @@ import com.bonus.aqgqj.annotation.DecryptAndVerify; import com.bonus.aqgqj.base.entity.SelectEntity; import com.bonus.aqgqj.system.service.SelectService; import com.bonus.aqgqj.system.vo.EncryptedReq; +import com.bonus.aqgqj.system.vo.dto.SelectDto; import com.bonus.aqgqj.utils.ServerResponse; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.PostMapping; @@ -101,4 +102,31 @@ public class SelectController { public ServerResponse getRoomTypeSelect() { return service.getRoomTypeSelect(); } + + /** + * 字典表下拉选-根据父编码查找 + * + * @param param + * @return ServerResponse + * @author cwchen + * @date 2024/7/19 13:15 + */ + @PostMapping(value = "getDicts") + @DecryptAndVerify(decryptedClass = SelectDto.class) + public ServerResponse getDicts(EncryptedReq param) { + return service.getDicts(param.getData()); + } + + /** + * 试验设备-下拉选 + * @param param + * @return ServerResponse + * @author cwchen + * @date 2024/7/19 13:23 + */ + @PostMapping(value = "getDevices") + @DecryptAndVerify(decryptedClass = SelectDto.class) + public ServerResponse getDevices(EncryptedReq param) { + return service.getDevices(param.getData()); + } } diff --git a/src/main/java/com/bonus/aqgqj/system/dao/SelectDao.java b/src/main/java/com/bonus/aqgqj/system/dao/SelectDao.java index 5d10ba5..4e39244 100644 --- a/src/main/java/com/bonus/aqgqj/system/dao/SelectDao.java +++ b/src/main/java/com/bonus/aqgqj/system/dao/SelectDao.java @@ -1,6 +1,8 @@ package com.bonus.aqgqj.system.dao; import com.bonus.aqgqj.base.entity.SelectEntity; +import com.bonus.aqgqj.basis.entity.vo.ExperDeviceVo; +import com.bonus.aqgqj.system.vo.dto.SelectDto; import org.springframework.stereotype.Repository; import java.util.List; @@ -65,4 +67,23 @@ public interface SelectDao { * @date 2023/11/19 15:14 */ List getRoomTypeSelect(); + + /** + * 字典表下拉选-根据父编码查找 + * + * @param dto + * @return List + * @author cwchen + * @date 2024/7/19 13:19 + */ + List getDicts(SelectDto dto); + + /** + * 试验设备-下拉选 + * @param dto + * @return List + * @author cwchen + * @date 2024/7/19 13:26 + */ + List getDevices(SelectDto dto); } diff --git a/src/main/java/com/bonus/aqgqj/system/service/SelectService.java b/src/main/java/com/bonus/aqgqj/system/service/SelectService.java index 545f67b..0a28e5b 100644 --- a/src/main/java/com/bonus/aqgqj/system/service/SelectService.java +++ b/src/main/java/com/bonus/aqgqj/system/service/SelectService.java @@ -2,6 +2,7 @@ package com.bonus.aqgqj.system.service; import com.bonus.aqgqj.base.entity.SelectEntity; +import com.bonus.aqgqj.system.vo.dto.SelectDto; import com.bonus.aqgqj.utils.ServerResponse; import java.util.List; @@ -47,7 +48,6 @@ public interface SelectService { ServerResponse getDeviceChildTypeSelect(); - /** * @return ServerResponse * @description 字典-下拉选 @@ -63,4 +63,23 @@ public interface SelectService { * @date 2023/11/19 15:14 */ ServerResponse getRoomTypeSelect(); + + /** + * 字典表下拉选-根据父编码查找 + * + * @param dto + * @return ServerResponse + * @author cwchen + * @date 2024/7/19 13:16 + */ + ServerResponse getDicts(SelectDto dto); + + /** + * 试验设备下拉选 + * @param data + * @return ServerResponse + * @author cwchen + * @date 2024/7/19 13:24 + */ + ServerResponse getDevices(SelectDto data); } diff --git a/src/main/java/com/bonus/aqgqj/system/service/impl/SelectServiceImpl.java b/src/main/java/com/bonus/aqgqj/system/service/impl/SelectServiceImpl.java index d7b1b8b..a183e86 100644 --- a/src/main/java/com/bonus/aqgqj/system/service/impl/SelectServiceImpl.java +++ b/src/main/java/com/bonus/aqgqj/system/service/impl/SelectServiceImpl.java @@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.bonus.aqgqj.base.entity.SelectEntity; +import com.bonus.aqgqj.basis.entity.vo.ExperDeviceVo; import com.bonus.aqgqj.system.dao.SelectDao; import com.bonus.aqgqj.system.service.SelectService; +import com.bonus.aqgqj.system.vo.dto.SelectDto; import com.bonus.aqgqj.utils.ServerResponse; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -86,4 +88,26 @@ public class SelectServiceImpl implements SelectService { } return ServerResponse.createSuccess("查询成功",list); } + + @Override + public ServerResponse getDicts(SelectDto dto) { + List list = new ArrayList(); + try { + list = mapper.getDicts(dto); + } catch (Exception e) { + log.error(e.toString(),e); + } + return ServerResponse.createSuccess("查询成功",list); + } + + @Override + public ServerResponse getDevices(SelectDto dto) { + List list = new ArrayList(); + try { + list = mapper.getDevices(dto); + } catch (Exception e) { + log.error(e.toString(),e); + } + return ServerResponse.createSuccess("查询成功",list); + } } diff --git a/src/main/java/com/bonus/aqgqj/system/vo/dto/SelectDto.java b/src/main/java/com/bonus/aqgqj/system/vo/dto/SelectDto.java new file mode 100644 index 0000000..8ab42bc --- /dev/null +++ b/src/main/java/com/bonus/aqgqj/system/vo/dto/SelectDto.java @@ -0,0 +1,18 @@ +package com.bonus.aqgqj.system.vo.dto; + +import lombok.Data; + +/** + * @className:SelectDto + * @author:cwchen + * @date:2024-07-19-13:14 + * @version:1.0 + * @description:下拉选-dto + */ +@Data +public class SelectDto { + + /** 字段编码*/ + private String code; + +} diff --git a/src/main/resources/mappers/system/SelectMapper.xml b/src/main/resources/mappers/system/SelectMapper.xml index 63de80f..3af4a5e 100644 --- a/src/main/resources/mappers/system/SelectMapper.xml +++ b/src/main/resources/mappers/system/SelectMapper.xml @@ -57,4 +57,22 @@ LEFT JOIN sys_distinct sd2 ON sd.id = sd2.p_id AND sd2.del_flag = 0 WHERE sd.dict_code = 'room_type' AND sd.del_flag = 0 + + + + \ No newline at end of file