This commit is contained in:
2026-05-29 14:34:59 +08:00
parent ecc4295e40
commit 532bae8204
4 changed files with 32 additions and 5 deletions
@@ -82,7 +82,10 @@ public class SysUnitController {
// cnd.and("unitTypeCode", "=", "1"); // cnd.and("unitTypeCode", "=", "1");
cnd.asc("unitcode"); cnd.asc("unitcode");
cnd.and(Cnd.likeEX("name", unitName)); cnd.and(Cnd.likeEX("name", unitName));
SqlExpressionGroup group = Cnd.NEW().where();
group.and("delFlag", "=", false);
group.orIsNull("delFlag");
cnd.and(group);
Pagination<Sys_unit> listPage = sysUnitService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), Sys_unit.class, cnd); Pagination<Sys_unit> listPage = sysUnitService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), Sys_unit.class, cnd);
return Result.success(listPage); return Result.success(listPage);
} }
@@ -201,12 +204,22 @@ public class SysUnitController {
} else { } else {
cnd.and("parentId", "=", pid); cnd.and("parentId", "=", pid);
} }
SqlExpressionGroup group = Cnd.NEW().where();
group.and("delFlag", "=", false);
group.orIsNull("delFlag");
cnd.and(group);
cnd.asc("location").asc("path"); cnd.asc("location").asc("path");
list = sysUnitService.query(cnd); list = sysUnitService.query(cnd);
} else { } else {
Sys_user user = sysUserService.getUserById(SecurityUtil.getUserId()); Sys_user user = sysUserService.getUserById(SecurityUtil.getUserId());
if (user != null && Strings.isBlank(pid)) { if (user != null && Strings.isBlank(pid)) {
list = sysUnitService.query(Cnd.where("id", "=", user.getUnitId()).asc("path")); Cnd cnd = Cnd.where("id", "=", user.getUnitId());
SqlExpressionGroup group = Cnd.NEW().where();
group.and("delFlag", "=", false);
group.orIsNull("delFlag");
cnd.and(group);
cnd.asc("path");
list = sysUnitService.query(cnd);
} else { } else {
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
if (Strings.isBlank(pid)) { if (Strings.isBlank(pid)) {
@@ -214,6 +227,10 @@ public class SysUnitController {
} else { } else {
cnd.and("parentId", "=", pid); cnd.and("parentId", "=", pid);
} }
SqlExpressionGroup group = Cnd.NEW().where();
group.and("delFlag", "=", false);
group.orIsNull("delFlag");
cnd.and(group);
cnd.asc("location").asc("path"); cnd.asc("location").asc("path");
list = sysUnitService.query(cnd); list = sysUnitService.query(cnd);
} }
@@ -285,6 +302,10 @@ public class SysUnitController {
try { try {
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
cnd.andEX("id", "=", pid); cnd.andEX("id", "=", pid);
SqlExpressionGroup group = Cnd.NEW().where();
group.and("delFlag", "=", false);
group.orIsNull("delFlag");
cnd.and(group);
cnd.asc("unitcode"); cnd.asc("unitcode");
List<Sys_unit> list = sysUnitService.query(cnd); List<Sys_unit> list = sysUnitService.query(cnd);
@@ -99,9 +99,9 @@ public class SysDataUnitPullServiceImpl extends BaseServiceImpl<Sys_unit> implem
if (StringUtils.isNotBlank(unit.getDelFlagStr())) { if (StringUtils.isNotBlank(unit.getDelFlagStr())) {
if (unit.getDelFlagStr().equals("1")) { if (unit.getDelFlagStr().equals("1")) {
unit.setDelFlag(true);
} else {
unit.setDelFlag(false); unit.setDelFlag(false);
} else {
unit.setDelFlag(true);
} }
} }
@@ -137,6 +137,7 @@ public class CommonController {
cnd.andEX("unit.unionId", "=", unionId); cnd.andEX("unit.unionId", "=", unionId);
cnd.and("unit.unitTypeCode", "=", "1"); cnd.and("unit.unitTypeCode", "=", "1");
cnd.asc("unit.unitcode"); cnd.asc("unit.unitcode");
cnd.and("unit.delFlag", "=", false);
sql.setCondition(cnd); sql.setCondition(cnd);
List<NutMap> unitList = sysUserService.listMap(sql); List<NutMap> unitList = sysUserService.listMap(sql);
return Result.success(unitList); return Result.success(unitList);
@@ -82,7 +82,7 @@ layout("/layouts/platform.html"){
:expand-on-click-node="false" :expand-on-click-node="false"
:props="{ children: 'children', label: 'name' }" :props="{ children: 'children', label: 'name' }"
node-key="id" node-key="id"
default-expand-all :default-expanded-keys="firstLevelExpandedKeys"
@node-click="treeNodeClick" @node-click="treeNodeClick"
:filter-node-method="filterNode" :filter-node-method="filterNode"
highlight-current highlight-current
@@ -157,6 +157,7 @@ layout("/layouts/platform.html"){
filterText: null, filterText: null,
currentTreeNode: null, currentTreeNode: null,
currentTreeData: null, currentTreeData: null,
firstLevelExpandedKeys: [],
treeData: [] treeData: []
} }
}, },
@@ -176,6 +177,10 @@ layout("/layouts/platform.html"){
this.treeData = res.data this.treeData = res.data
if (this.treeData) { if (this.treeData) {
this.currentTreeData = this.treeData[0] this.currentTreeData = this.treeData[0]
// 默认只展开树的第一层级,避免多级单位数据一次性全部展开。
this.firstLevelExpandedKeys = this.treeData.map(function (item) {
return item.id
})
} }
}) })
}, },