upd: 编码规范
This commit is contained in:
+3
-3
@@ -15,11 +15,11 @@ public interface DeptMapper extends BaseMapper<Dept> {
|
||||
|
||||
List<Dept> findAll(@Param("criteria") DeptQueryCriteria criteria);
|
||||
|
||||
List<Dept> findByPid(@Param("pid") Long pid);
|
||||
List<Dept> selectByPid(@Param("pid") Long pid);
|
||||
|
||||
List<Dept> findByPidIsNull();
|
||||
List<Dept> selectByPidIsNull();
|
||||
|
||||
Set<Dept> findByRoleId(@Param("roleId") Long roleId);
|
||||
Set<Dept> selectByRoleId(@Param("roleId") Long roleId);
|
||||
|
||||
@Select("select count(*) from sys_dept where pid = #{pid}")
|
||||
int countByPid(@Param("pid") Long pid);
|
||||
|
||||
+6
-6
@@ -85,12 +85,12 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements De
|
||||
|
||||
@Override
|
||||
public List<Dept> findByPid(long pid) {
|
||||
return deptMapper.findByPid(pid);
|
||||
return deptMapper.selectByPid(pid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Dept> findByRoleId(Long id) {
|
||||
return deptMapper.findByRoleId(id);
|
||||
return deptMapper.selectByRoleId(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.findByPid(dept.getId());
|
||||
List<Dept> depts = deptMapper.selectByPid(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.findByPid(dept.getId());
|
||||
List<Dept> depts = deptMapper.selectByPid(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.findByPidIsNull());
|
||||
depts.addAll(deptMapper.selectByPidIsNull());
|
||||
return depts;
|
||||
}
|
||||
depts.addAll(deptMapper.findByPid(dept.getPid()));
|
||||
depts.addAll(deptMapper.selectByPid(dept.getPid()));
|
||||
return getSuperior(findById(dept.getPid()), depts);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,52 +15,76 @@
|
||||
</resultMap>
|
||||
|
||||
<select id="findAll" resultMap="BaseResultMap">
|
||||
select
|
||||
dept_id, name, pid, sub_count, create_time, update_time, create_by, update_by, enabled, dept_sort
|
||||
from sys_dept
|
||||
SELECT
|
||||
dept_id,
|
||||
`name`,
|
||||
pid,
|
||||
sub_count,
|
||||
create_time,
|
||||
update_time,
|
||||
create_by,
|
||||
update_by,
|
||||
enabled,
|
||||
dept_sort
|
||||
FROM
|
||||
sys_dept
|
||||
<where>
|
||||
<if test="criteria.ids != null and criteria.ids.size() > 0">
|
||||
and dept_id in
|
||||
AND dept_id in
|
||||
<foreach collection="criteria.ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="criteria.name != null and criteria.name != ''">
|
||||
and name like concat('%', #{criteria.name}, '%')
|
||||
AND `name` LIKE concat('%', #{criteria.name}, '%')
|
||||
</if>
|
||||
<if test="criteria.enabled != null">
|
||||
and enabled = #{criteria.enabled}
|
||||
AND enabled = #{criteria.enabled}
|
||||
</if>
|
||||
<if test="criteria.pid != null">
|
||||
and pid = #{criteria.pid}
|
||||
AND pid = #{criteria.pid}
|
||||
</if>
|
||||
<if test="criteria.pidIsNull != null">
|
||||
and pid is null
|
||||
AND pid IS NULL
|
||||
</if>
|
||||
<if test="criteria.createTime != null and criteria.createTime.size() != 0">
|
||||
and create_time between #{criteria.createTime[0]} and #{criteria.createTime[1]}
|
||||
AND create_time BETWEEN #{criteria.createTime[0]} AND #{criteria.createTime[1]}
|
||||
</if>
|
||||
</where>
|
||||
order by dept_sort
|
||||
ORDER BY dept_sort
|
||||
</select>
|
||||
|
||||
<select id="findByPid" resultMap="BaseResultMap">
|
||||
<select id="selectByPid" 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="findByPidIsNull" resultMap="BaseResultMap">
|
||||
<select id="selectByPidIsNull" 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="findByRoleId" resultType="cn.odboy.model.system.domain.Dept">
|
||||
select d.dept_id as id, d.name, d.pid, d.sub_count, d.create_time, d.update_time, d.create_by, d.update_by, d.enabled, d.dept_sort
|
||||
from sys_dept d, sys_roles_depts r
|
||||
where d.dept_id = r.dept_id and r.role_id = #{roleId}
|
||||
<select id="selectByRoleId" resultType="cn.odboy.model.system.domain.Dept">
|
||||
SELECT
|
||||
d.dept_id AS id,
|
||||
d.NAME,
|
||||
d.pid,
|
||||
d.sub_count,
|
||||
d.create_time,
|
||||
d.update_time,
|
||||
d.create_by,
|
||||
d.update_by,
|
||||
d.enabled,
|
||||
d.dept_sort
|
||||
FROM
|
||||
sys_dept d,
|
||||
sys_roles_depts rd
|
||||
WHERE
|
||||
d.dept_id = rd.dept_id
|
||||
AND rd.role_id = #{roleId}
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user