upd: 编码规范

This commit is contained in:
2025-04-09 19:10:38 +08:00
parent 285df6bb4d
commit 4127365d42
3 changed files with 15 additions and 15 deletions
@@ -10,15 +10,15 @@ import java.util.Set;
@Mapper @Mapper
public interface DeptMapper extends BaseMapper<Dept> { public interface DeptMapper extends BaseMapper<Dept> {
List<Dept> selectDeptByCriteria(@Param("criteria") QueryDeptRequest criteria); List<Dept> queryDeptListByArgs(@Param("criteria") QueryDeptRequest criteria);
List<Dept> selectDeptByPid(@Param("pid") Long pid); List<Dept> queryDeptListByPid(@Param("pid") Long pid);
int getDeptCountByPid(@Param("pid") Long pid); int getDeptCountByPid(@Param("pid") Long pid);
List<Dept> selectDeptByPidIsNull(); List<Dept> queryDeptListByPidIsNull();
Set<Dept> selectDeptByRoleId(@Param("roleId") Long roleId); Set<Dept> queryDeptSetByRoleId(@Param("roleId") Long roleId);
void updateSubCountById(@Param("count") Integer count, @Param("id") Long id); void updateSubCountById(@Param("count") Integer count, @Param("id") Long id);
} }
@@ -72,7 +72,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements De
} }
// 数据权限 // 数据权限
criteria.setIds(SecurityHelper.getCurrentUserDataScope()); criteria.setIds(SecurityHelper.getCurrentUserDataScope());
List<Dept> list = deptMapper.selectDeptByCriteria(criteria); List<Dept> list = deptMapper.queryDeptListByArgs(criteria);
// 如果为空,就代表为自定义权限或者本级权限,就需要去重,不理解可以注释掉,看查询结果 // 如果为空,就代表为自定义权限或者本级权限,就需要去重,不理解可以注释掉,看查询结果
if (StringUtil.isBlank(dataScopeType)) { if (StringUtil.isBlank(dataScopeType)) {
return deduplication(list); return deduplication(list);
@@ -93,12 +93,12 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements De
@Override @Override
public List<Dept> selectDeptByPid(long pid) { public List<Dept> selectDeptByPid(long pid) {
return deptMapper.selectDeptByPid(pid); return deptMapper.queryDeptListByPid(pid);
} }
@Override @Override
public Set<Dept> selectDeptByRoleId(Long id) { public Set<Dept> selectDeptByRoleId(Long id) {
return deptMapper.selectDeptByRoleId(id); return deptMapper.queryDeptSetByRoleId(id);
} }
@Override @Override
@@ -158,7 +158,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements De
public Set<Dept> selectRelationDept(List<Dept> menuList, Set<Dept> deptSet) { public Set<Dept> selectRelationDept(List<Dept> menuList, Set<Dept> deptSet) {
for (Dept dept : menuList) { for (Dept dept : menuList) {
deptSet.add(dept); deptSet.add(dept);
List<Dept> deptList = deptMapper.selectDeptByPid(dept.getId()); List<Dept> deptList = deptMapper.queryDeptListByPid(dept.getId());
if (CollUtil.isNotEmpty(deptList)) { if (CollUtil.isNotEmpty(deptList)) {
selectRelationDept(deptList, deptSet); selectRelationDept(deptList, deptSet);
} }
@@ -171,7 +171,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements De
List<Long> list = new ArrayList<>(); List<Long> list = new ArrayList<>();
deptList.forEach(dept -> { deptList.forEach(dept -> {
if (dept != null && dept.getEnabled()) { if (dept != null && dept.getEnabled()) {
List<Dept> deptList1 = deptMapper.selectDeptByPid(dept.getId()); List<Dept> deptList1 = deptMapper.queryDeptListByPid(dept.getId());
if (CollUtil.isNotEmpty(deptList1)) { if (CollUtil.isNotEmpty(deptList1)) {
list.addAll(selectChildDeptIdByDeptIds(deptList1)); list.addAll(selectChildDeptIdByDeptIds(deptList1));
} }
@@ -185,10 +185,10 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements De
@Override @Override
public List<Dept> selectSuperiorDeptByPid(Dept dept, List<Dept> deptList) { public List<Dept> selectSuperiorDeptByPid(Dept dept, List<Dept> deptList) {
if (dept.getPid() == null) { if (dept.getPid() == null) {
deptList.addAll(deptMapper.selectDeptByPidIsNull()); deptList.addAll(deptMapper.queryDeptListByPidIsNull());
return deptList; return deptList;
} }
deptList.addAll(deptMapper.selectDeptByPid(dept.getPid())); deptList.addAll(deptMapper.queryDeptListByPid(dept.getPid()));
return selectSuperiorDeptByPid(getDeptById(dept.getPid()), deptList); return selectSuperiorDeptByPid(getDeptById(dept.getPid()), deptList);
} }
@@ -13,7 +13,7 @@
<result column="create_time" property="createTime"/> <result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/> <result column="update_time" property="updateTime"/>
</resultMap> </resultMap>
<select id="selectDeptByCriteria" resultMap="BaseResultMap"> <select id="queryDeptListByArgs" resultMap="BaseResultMap">
SELECT SELECT
dept_id, dept_id,
`name`, `name`,
@@ -52,7 +52,7 @@
</where> </where>
ORDER BY dept_sort ORDER BY dept_sort
</select> </select>
<select id="selectDeptByPid" resultMap="BaseResultMap"> <select id="queryDeptListByPid" resultMap="BaseResultMap">
select dept_id, select dept_id,
name, name,
pid, pid,
@@ -71,7 +71,7 @@
from sys_dept from sys_dept
where pid = #{pid} where pid = #{pid}
</select> </select>
<select id="selectDeptByPidIsNull" resultMap="BaseResultMap"> <select id="queryDeptListByPidIsNull" resultMap="BaseResultMap">
select dept_id, select dept_id,
name, name,
pid, pid,
@@ -85,7 +85,7 @@
from sys_dept from sys_dept
where pid is null where pid is null
</select> </select>
<select id="selectDeptByRoleId" resultType="cn.odboy.model.system.domain.Dept"> <select id="queryDeptSetByRoleId" resultType="cn.odboy.model.system.domain.Dept">
SELECT d.dept_id AS id, SELECT d.dept_id AS id,
d.NAME, d.NAME,
d.pid, d.pid,