[fix]设备耗材管理

This commit is contained in:
yunpeng 2024-01-02 20:01:38 +08:00
parent d5ac905eaa
commit 85f75a0adf
9 changed files with 853 additions and 670 deletions

View File

@ -247,7 +247,6 @@ public class SysUserController extends BaseController {
/** /**
* 获取部门树列表 * 获取部门树列表
*/ */
@SaCheckPermission("system:user:list")
@GetMapping("/deptTree") @GetMapping("/deptTree")
public R<List<Tree<Long>>> deptTree(SysDept dept) { public R<List<Tree<Long>>> deptTree(SysDept dept) {
return R.ok(deptService.selectDeptTreeList(dept)); return R.ok(deptService.selectDeptTreeList(dept));

View File

@ -54,7 +54,7 @@ spring:
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题) # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
url: jdbc:mysql://localhost:3306/eqcs?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true url: jdbc:mysql://localhost:3306/eqcs?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
username: root username: root
password: 123456 password: eqc123456
# 从库数据源 # 从库数据源
# slave: # slave:
# lazy: true # lazy: true
@ -111,7 +111,7 @@ spring:
# 数据库索引 # 数据库索引
database: 0 database: 0
# 密码(如没有密码请注释掉) # 密码(如没有密码请注释掉)
# password: password: eqc123456
# 连接超时时间 # 连接超时时间
timeout: 10s timeout: 10s
# 是否开启ssl # 是否开启ssl

View File

@ -1,5 +1,5 @@
# redis 密码 # redis 密码
requirepass eqc123 requirepass eqc123456
# key 监听器配置 # key 监听器配置
# notify-keyspace-events Ex # notify-keyspace-events Ex

File diff suppressed because it is too large Load Diff

View File

@ -42,7 +42,7 @@ public class Equipments extends BaseEntity {
/** /**
* 所属科室 * 所属科室
*/ */
private String department; private Long department;
/** /**
* 所在位置 * 所在位置
*/ */

View File

@ -49,7 +49,7 @@ public class EquipmentsBo extends BaseEntity {
* 所属科室 * 所属科室
*/ */
//@NotBlank(message = "所属科室不能为空", groups = { AddGroup.class, EditGroup.class }) //@NotBlank(message = "所属科室不能为空", groups = { AddGroup.class, EditGroup.class })
private String department; private Long department;
/** /**
* 所在位置 * 所在位置

View File

@ -57,7 +57,7 @@ public class EquipmentConsumablesVo implements Serializable {
* 使用期效 * 使用期效
*/ */
@ExcelProperty(value = "使用期效") @ExcelProperty(value = "使用期效")
private Integer validity; private Long validity;
/** /**
* 使用期效单位 * 使用期效单位
@ -75,7 +75,7 @@ public class EquipmentConsumablesVo implements Serializable {
* 状态 0正在使用1已报废 2未使用过 * 状态 0正在使用1已报废 2未使用过
*/ */
@ExcelProperty(value = "状态 0正在使用1已报废 2未使用过") @ExcelProperty(value = "状态 0正在使用1已报废 2未使用过")
private Integer status; private Long status;
/** /**
* 备注 * 备注

View File

@ -1,5 +1,6 @@
package com.eqc.system.domain.vo; package com.eqc.system.domain.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.eqc.common.annotation.ExcelDictFormat; import com.eqc.common.annotation.ExcelDictFormat;
@ -45,11 +46,17 @@ public class EquipmentsVo implements Serializable {
@ExcelProperty(value = "设备供应商") @ExcelProperty(value = "设备供应商")
private String equipmentSupplier; private String equipmentSupplier;
/**
* 所属科室
*/
@ExcelIgnore
private Long department;
/** /**
* 所属科室 * 所属科室
*/ */
@ExcelProperty(value = "所属科室") @ExcelProperty(value = "所属科室")
private String department; private String departmentName;
/** /**
* 所在位置 * 所在位置

View File

@ -1,12 +1,15 @@
package com.eqc.system.service.impl; package com.eqc.system.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.eqc.common.core.domain.entity.SysDept;
import com.eqc.common.utils.StreamUtils;
import com.eqc.common.utils.StringUtils; import com.eqc.common.utils.StringUtils;
import com.eqc.common.core.page.TableDataInfo; import com.eqc.common.core.page.TableDataInfo;
import com.eqc.common.core.domain.PageQuery; import com.eqc.common.core.domain.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.eqc.system.service.ISysDeptService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.eqc.system.domain.bo.EquipmentsBo; import com.eqc.system.domain.bo.EquipmentsBo;
@ -30,6 +33,7 @@ import java.util.Collection;
public class EquipmentsServiceImpl implements IEquipmentsService { public class EquipmentsServiceImpl implements IEquipmentsService {
private final EquipmentsMapper baseMapper; private final EquipmentsMapper baseMapper;
private final ISysDeptService sysDeptService;
/** /**
* 查询设备 * 查询设备
@ -46,16 +50,26 @@ public class EquipmentsServiceImpl implements IEquipmentsService {
public TableDataInfo<EquipmentsVo> queryPageList(EquipmentsBo bo, PageQuery pageQuery) { public TableDataInfo<EquipmentsVo> queryPageList(EquipmentsBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<Equipments> lqw = buildQueryWrapper(bo); LambdaQueryWrapper<Equipments> lqw = buildQueryWrapper(bo);
Page<EquipmentsVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); Page<EquipmentsVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
Map<Long, String> deptIdNameMap = getDeptIdNameMap();
result.getRecords().forEach(equipmentsVo -> equipmentsVo.setDepartmentName(deptIdNameMap.getOrDefault(equipmentsVo.getDepartment(),null)));
return TableDataInfo.build(result); return TableDataInfo.build(result);
} }
private Map<Long,String> getDeptIdNameMap() {
List<SysDept> sysDepts = sysDeptService.selectDeptList(new SysDept());
return StreamUtils.toMap(sysDepts, SysDept::getDeptId, SysDept::getDeptName);
}
/** /**
* 查询设备列表 * 查询设备列表
*/ */
@Override @Override
public List<EquipmentsVo> queryList(EquipmentsBo bo) { public List<EquipmentsVo> queryList(EquipmentsBo bo) {
LambdaQueryWrapper<Equipments> lqw = buildQueryWrapper(bo); LambdaQueryWrapper<Equipments> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw); List<EquipmentsVo> equipmentsVos = baseMapper.selectVoList(lqw);
Map<Long, String> deptIdNameMap = getDeptIdNameMap();
equipmentsVos.forEach(equipmentsVo -> equipmentsVo.setDepartmentName(deptIdNameMap.getOrDefault(equipmentsVo.getDepartment(),null)));
return equipmentsVos;
} }
private LambdaQueryWrapper<Equipments> buildQueryWrapper(EquipmentsBo bo) { private LambdaQueryWrapper<Equipments> buildQueryWrapper(EquipmentsBo bo) {
@ -64,7 +78,7 @@ public class EquipmentsServiceImpl implements IEquipmentsService {
lqw.like(StringUtils.isNotBlank(bo.getEquipmentName()), Equipments::getEquipmentName, bo.getEquipmentName()); lqw.like(StringUtils.isNotBlank(bo.getEquipmentName()), Equipments::getEquipmentName, bo.getEquipmentName());
lqw.eq(StringUtils.isNotBlank(bo.getEquipmentNo()), Equipments::getEquipmentNo, bo.getEquipmentNo()); lqw.eq(StringUtils.isNotBlank(bo.getEquipmentNo()), Equipments::getEquipmentNo, bo.getEquipmentNo());
lqw.eq(StringUtils.isNotBlank(bo.getEquipmentSupplier()), Equipments::getEquipmentSupplier, bo.getEquipmentSupplier()); lqw.eq(StringUtils.isNotBlank(bo.getEquipmentSupplier()), Equipments::getEquipmentSupplier, bo.getEquipmentSupplier());
lqw.eq(StringUtils.isNotBlank(bo.getDepartment()), Equipments::getDepartment, bo.getDepartment()); lqw.eq(bo.getDepartment()!=null, Equipments::getDepartment, bo.getDepartment());
lqw.eq(StringUtils.isNotBlank(bo.getLocation()), Equipments::getLocation, bo.getLocation()); lqw.eq(StringUtils.isNotBlank(bo.getLocation()), Equipments::getLocation, bo.getLocation());
return lqw; return lqw;
} }