Browse Source

feat:[资源库管理][仪器管理]冰箱

master
HanLong 2 months ago
parent
commit
f7739972ce
9 changed files with 125 additions and 2 deletions
  1. +20
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java
  2. +10
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Yq.java
  3. +10
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqForm.java
  4. +23
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqSearchForm.java
  5. +7
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/YqServiceImpl.java
  6. +7
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/mapper/SysDeptMapper.java
  7. +7
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/service/ISysDeptService.java
  8. +32
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/service/impl/SysDeptServiceImpl.java
  9. +9
    -2
      hxhq-modules/hxhq-system/src/main/resources/mapper/system/SysDeptMapper.xml

+ 20
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java View File

@ -23,12 +23,15 @@ import com.hxhq.common.core.web.domain.AjaxResult;
import com.hxhq.common.core.web.page.TableDataInfo; import com.hxhq.common.core.web.page.TableDataInfo;
import com.hxhq.common.redis.service.RedisService; import com.hxhq.common.redis.service.RedisService;
import com.hxhq.common.security.utils.SecurityUtils; import com.hxhq.common.security.utils.SecurityUtils;
import com.hxhq.system.api.domain.SysDept;
import com.hxhq.system.service.ISysDeptService;
import com.hxhq.system.service.ISysUserService; import com.hxhq.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
@ -70,6 +73,8 @@ public class PublicController extends BaseController {
public ICellService cellService; public ICellService cellService;
@Autowired @Autowired
public IBacteriaService bacteriaService; public IBacteriaService bacteriaService;
@Autowired
public ISysDeptService sysDeptService;
/** /**
@ -281,4 +286,19 @@ public class PublicController extends BaseController {
List<Bacteria> list = bacteriaService.queryStudyList(form); List<Bacteria> list = bacteriaService.queryStudyList(form);
return getDataTable(list); return getDataTable(list);
} }
/**
* 冰箱列表
* @return
*/
@GetMapping("/fridgeList")
public TableDataInfo getFridgeList(YqSearchForm form) {
List<SysDept> superiorAndSubordinate = sysDeptService.getSuperiorAndSubordinate(SecurityUtils.getLoginUser().getSysUser().getDeptId());
List<Long> deptIdList = superiorAndSubordinate.stream().map(SysDept::getDeptId).collect(Collectors.toList());
form.setDeptIdList(deptIdList);
startPage();
form.setFridge(NormalEnum.yes.getValue());
List<Yq> list = yqService.queryList(form);
return getDataTable(list);
}
} }

+ 10
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Yq.java View File

@ -84,6 +84,16 @@ public class Yq extends MpBaseEntity {
@Compare(name = "温层") @Compare(name = "温层")
private String wc; private String wc;
/** 是否是冰箱 1-否 10-是 */
private Integer fridge;
public Integer getFridge() {
return fridge;
}
public void setFridge(Integer fridge) {
this.fridge = fridge;
}
public void setMc(String mc) { public void setMc(String mc) {
this.mc = mc; this.mc = mc;

+ 10
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqForm.java View File

@ -72,6 +72,8 @@ public class YqForm {
@Length(max = 500, message = "备注不能超过500字") @Length(max = 500, message = "备注不能超过500字")
private String remark; private String remark;
/** 是否是冰箱 1-否 10-是 */
private Integer fridge;
/** 签名人密码 */ /** 签名人密码 */
@NotNull(message = "请输入签名人密码") @NotNull(message = "请输入签名人密码")
@ -174,4 +176,12 @@ public class YqForm {
public void setBmId(Long bmId) { public void setBmId(Long bmId) {
this.bmId = bmId; this.bmId = bmId;
} }
public Integer getFridge() {
return fridge;
}
public void setFridge(Integer fridge) {
this.fridge = fridge;
}
} }

+ 23
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqSearchForm.java View File

@ -1,5 +1,7 @@
package com.hxhq.business.form.yq; package com.hxhq.business.form.yq;
import java.util.List;
/** 仪器列表搜索 /** 仪器列表搜索
* @author 15881*/ * @author 15881*/
public class YqSearchForm { public class YqSearchForm {
@ -22,6 +24,27 @@ public class YqSearchForm {
/** 部门名称 */ /** 部门名称 */
private String bmMc; private String bmMc;
/** 是否是冰箱 1-否 10-是 */
private Integer fridge;
private List<Long> deptIdList;
public List<Long> getDeptIdList() {
return deptIdList;
}
public void setDeptIdList(List<Long> deptIdList) {
this.deptIdList = deptIdList;
}
public Integer getFridge() {
return fridge;
}
public void setFridge(Integer fridge) {
this.fridge = fridge;
}
public String getBmMc() { public String getBmMc() {
return bmMc; return bmMc;
} }

+ 7
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/YqServiceImpl.java View File

@ -8,6 +8,7 @@ import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hxhq.business.domain.MjyJcgj; import com.hxhq.business.domain.MjyJcgj;
@ -74,6 +75,12 @@ public class YqServiceImpl extends ServiceImpl implements IYqServi
if(StringUtils.isNotEmpty(form.getBmMc())) { if(StringUtils.isNotEmpty(form.getBmMc())) {
queryWrapper.like("d.dept_name", form.getBmMc()); queryWrapper.like("d.dept_name", form.getBmMc());
} }
if(form.getFridge() != null) {
queryWrapper.eq("y.fridge", form.getFridge());
}
if(CollectionUtils.isNotEmpty(form.getDeptIdList())) {
queryWrapper.in("y.bm_id", form.getDeptIdList());
}
queryWrapper.orderByDesc("y.id"); queryWrapper.orderByDesc("y.id");
return baseMapper.queryList(queryWrapper); return baseMapper.queryList(queryWrapper);
} }

+ 7
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/mapper/SysDeptMapper.java View File

@ -45,6 +45,13 @@ public interface SysDeptMapper
public List<SysDept> selectChildrenDeptById(Long deptId); public List<SysDept> selectChildrenDeptById(Long deptId);
/** /**
* 根据id数组查询部门
* @param deptIdList
* @return
*/
public List<SysDept> selectDeptByIdList(@Param("deptIdList") List<Long> deptIdList);
/**
* 根据ID查询所有子部门正常状态 * 根据ID查询所有子部门正常状态
* *
* @param deptId 部门ID * @param deptId 部门ID

+ 7
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/service/ISysDeptService.java View File

@ -121,4 +121,11 @@ public interface ISysDeptService
* @return 结果 * @return 结果
*/ */
public int deleteDeptById(Long deptId); public int deleteDeptById(Long deptId);
/**
* 获取上下级部门列表
* @param deptId
* @return
*/
public List<SysDept> getSuperiorAndSubordinate(Long deptId);
} }

+ 32
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/service/impl/SysDeptServiceImpl.java View File

@ -1,13 +1,17 @@
package com.hxhq.system.service.impl; package com.hxhq.system.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import cn.hutool.core.util.ArrayUtil;
import com.hxhq.business.enums.dept.DeptTypeEnum;
import com.hxhq.system.domain.vo.TreeSelect; import com.hxhq.system.domain.vo.TreeSelect;
import com.hxhq.system.mapper.SysDeptMapper; import com.hxhq.system.mapper.SysDeptMapper;
import com.hxhq.system.mapper.SysRoleMapper; import com.hxhq.system.mapper.SysRoleMapper;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.hxhq.common.core.constant.UserConstants; import com.hxhq.common.core.constant.UserConstants;
@ -294,6 +298,34 @@ public class SysDeptServiceImpl implements ISysDeptService
return deptMapper.deleteDeptById(deptId); return deptMapper.deleteDeptById(deptId);
} }
@Override
public List<SysDept> getSuperiorAndSubordinate(Long deptId) {
List<SysDept> result = new ArrayList<>();
SysDept sysDept = deptMapper.selectDeptById(deptId);
if(sysDept.getType() == DeptTypeEnum.dept.getValue()) {
// 当前组织如果是部门则不需要寻找上级
result.add(sysDept);
} else {
// 若当前组织不是部门类型则需要寻找上级的部门
String ancestors = sysDept.getAncestors();
String[] parentIdList = ancestors.split(",");
List<SysDept> parentDeptList = deptMapper.selectDeptByIdList(Arrays.stream(parentIdList)
.map(Long::parseLong)
.collect(Collectors.toList()));
for (SysDept dept : parentDeptList) {
if(dept.getType() == DeptTypeEnum.dept.getValue()) {
result.add(dept);
break;
}
}
}
// 查询所有子部门
List<SysDept> childrenDeptList = deptMapper.selectChildrenDeptById(deptId);
result.addAll(childrenDeptList);
return result;
}
/** /**
* 递归列表 * 递归列表
*/ */

+ 9
- 2
hxhq-modules/hxhq-system/src/main/resources/mapper/system/SysDeptMapper.xml View File

@ -88,8 +88,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectDeptVo"/> <include refid="selectDeptVo"/>
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1 where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
</select> </select>
<insert id="insertDept" parameterType="com.hxhq.system.api.domain.SysDept">
<select id="selectDeptByIdList" resultType="com.hxhq.system.api.domain.SysDept">
SELECT * FROM sys_dept WHERE dept_id in
<foreach item="item" index="index" collection="deptIdList" open="(" separator="," close=")">
#{item}
</foreach>
ORDER BY dept_id DESC
</select>
<insert id="insertDept" parameterType="com.hxhq.system.api.domain.SysDept">
insert into sys_dept( insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if> <if test="deptId != null and deptId != 0">dept_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if> <if test="parentId != null and parentId != 0">parent_id,</if>

Loading…
Cancel
Save