diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/UnitController.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/UnitController.java index 2ae6395..f732bde 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/UnitController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/UnitController.java @@ -12,6 +12,7 @@ import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.PasswordGenerator; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.mapper.SysDeptMapper; import com.ruoyi.system.service.ISysDeptService; import com.ruoyi.system.service.ISysUserService; import com.ruoyi.tc.entity.*; @@ -56,7 +57,7 @@ public class UnitController { private ExamineInfoService examineInfoService; @Resource - private ISysDeptService iSysDeptService; + private SysDeptMapper sysDeptMapper; @Resource private ISysUserService userService; @@ -178,7 +179,7 @@ public class UnitController { ExcelUtil util = new ExcelUtil<>(Unit.class); List list = util.importExcel(file.getInputStream()); //做组织架构的处理和更新处理 - List sd = iSysDeptService.selectDeptList(new SysDept()); + List sd = sysDeptMapper.selectDeptList(new SysDept()); Set set = new HashSet<>(); for (SysDept i : sd) { set.add(i.getDeptName()); @@ -195,7 +196,14 @@ public class UnitController { list.get(i).setId(unit.getId()); } } - if (set.contains(list.get(i).getDeptName())) { + int lastIndex = list.get(i).getDeptName().lastIndexOf("-"); + String result = null; + if (lastIndex!= -1) { + result = list.get(i).getDeptName().substring(lastIndex + 1); + }else { + result = list.get(i).getDeptName(); + } + if (set.contains(result)) { for (SysDept s : sd) { if (list.get(i).getDeptName().equals(s.getDeptName())) { list.get(i).setDeptId(s.getDeptId()); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/Unit.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/Unit.java index 10cf782..5b3d079 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/Unit.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/Unit.java @@ -273,7 +273,7 @@ public class Unit implements Serializable { private String delFlag; @ApiModelProperty("组织机构名称(部门名称)") - @Excel(name = "*组织机构",required = true) + @Excel(name = "*组织机构",required = true,dictType="dwzzjg",comboReadDict = true) @TableField(exist = false) private String deptName; }