upd: 编码规范
This commit is contained in:
+4
-6
@@ -5,17 +5,15 @@ import cn.odboy.model.system.dto.DeptQueryCriteria;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Mapper
|
||||
public interface DeptMapper extends BaseMapper<Dept> {
|
||||
List<Dept> findDeptListByPage(@Param("criteria") DeptQueryCriteria criteria);
|
||||
List<Dept> findDeptListByPid(@Param("pid") Long pid);
|
||||
List<Dept> findDept(@Param("criteria") DeptQueryCriteria criteria);
|
||||
List<Dept> findDeptByPid(@Param("pid") Long pid);
|
||||
int countDeptByPid(@Param("pid") Long pid);
|
||||
List<Dept> findDeptListByPidIsNull();
|
||||
Set<Dept> findDeptSetByRoleId(@Param("roleId") Long roleId);
|
||||
List<Dept> findDeptByPidIsNull();
|
||||
Set<Dept> findDeptByRoleId(@Param("roleId") Long roleId);
|
||||
void updateDeptSubCountById(@Param("count") Integer count, @Param("id") Long id);
|
||||
}
|
||||
+7
-7
@@ -64,7 +64,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements De
|
||||
}
|
||||
// 数据权限
|
||||
criteria.setIds(SecurityUtil.getCurrentUserDataScope());
|
||||
List<Dept> list = deptMapper.findDeptListByPage(criteria);
|
||||
List<Dept> list = deptMapper.findDept(criteria);
|
||||
// 如果为空,就代表为自定义权限或者本级权限,就需要去重,不理解可以注释掉,看查询结果
|
||||
if (StringUtil.isBlank(dataScopeType)) {
|
||||
return deduplication(list);
|
||||
@@ -85,12 +85,12 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements De
|
||||
|
||||
@Override
|
||||
public List<Dept> findByPid(long pid) {
|
||||
return deptMapper.findDeptListByPid(pid);
|
||||
return deptMapper.findDeptByPid(pid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Dept> findByRoleId(Long id) {
|
||||
return deptMapper.findDeptSetByRoleId(id);
|
||||
return deptMapper.findDeptByRoleId(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -150,7 +150,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements De
|
||||
public Set<Dept> getDeleteDepts(List<Dept> menuList, Set<Dept> deptSet) {
|
||||
for (Dept dept : menuList) {
|
||||
deptSet.add(dept);
|
||||
List<Dept> depts = deptMapper.findDeptListByPid(dept.getId());
|
||||
List<Dept> depts = deptMapper.findDeptByPid(dept.getId());
|
||||
if (CollUtil.isNotEmpty(depts)) {
|
||||
getDeleteDepts(depts, deptSet);
|
||||
}
|
||||
@@ -163,7 +163,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements De
|
||||
List<Long> list = new ArrayList<>();
|
||||
deptList.forEach(dept -> {
|
||||
if (dept != null && dept.getEnabled()) {
|
||||
List<Dept> depts = deptMapper.findDeptListByPid(dept.getId());
|
||||
List<Dept> depts = deptMapper.findDeptByPid(dept.getId());
|
||||
if (CollUtil.isNotEmpty(depts)) {
|
||||
list.addAll(getDeptChildren(depts));
|
||||
}
|
||||
@@ -177,10 +177,10 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements De
|
||||
@Override
|
||||
public List<Dept> getSuperior(Dept dept, List<Dept> depts) {
|
||||
if (dept.getPid() == null) {
|
||||
depts.addAll(deptMapper.findDeptListByPidIsNull());
|
||||
depts.addAll(deptMapper.findDeptByPidIsNull());
|
||||
return depts;
|
||||
}
|
||||
depts.addAll(deptMapper.findDeptListByPid(dept.getPid()));
|
||||
depts.addAll(deptMapper.findDeptByPid(dept.getPid()));
|
||||
return getSuperior(findById(dept.getPid()), depts);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
update sys_dept set sub_count = #{count} where dept_id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="findDeptListByPage" resultMap="BaseResultMap">
|
||||
<select id="findDept" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
dept_id,
|
||||
`name`,
|
||||
@@ -57,21 +57,21 @@
|
||||
ORDER BY dept_sort
|
||||
</select>
|
||||
|
||||
<select id="findDeptListByPid" resultMap="BaseResultMap">
|
||||
<select id="findDeptByPid" resultMap="BaseResultMap">
|
||||
select
|
||||
dept_id, name, pid, sub_count, create_time, update_time, create_by, update_by, enabled, dept_sort
|
||||
from sys_dept
|
||||
where pid = #{pid}
|
||||
</select>
|
||||
|
||||
<select id="findDeptListByPidIsNull" resultMap="BaseResultMap">
|
||||
<select id="findDeptByPidIsNull" resultMap="BaseResultMap">
|
||||
select
|
||||
dept_id, name, pid, sub_count, create_time, update_time, create_by, update_by, enabled, dept_sort
|
||||
from sys_dept
|
||||
where pid is null
|
||||
</select>
|
||||
|
||||
<select id="findDeptSetByRoleId" resultType="cn.odboy.model.system.domain.Dept">
|
||||
<select id="findDeptByRoleId" resultType="cn.odboy.model.system.domain.Dept">
|
||||
SELECT
|
||||
d.dept_id AS id,
|
||||
d.NAME,
|
||||
|
||||
Reference in New Issue
Block a user