Bug修复,新增线路,对部门权限做管理
This commit is contained in:
parent
4bb7249749
commit
498be77b97
|
|
@ -437,4 +437,21 @@ public class UserController {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*获取权限部门
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "getOrgByUserId")
|
||||
@LogAnnotation(operModul = "系统管理-用户管理", operation = "查询组织机构", operDesc = "系统级事件",operType="查询")
|
||||
@PreAuthorize("@pms.hasPermission('sys:user:query')")
|
||||
public ServerResponse getOrgByUserId() {
|
||||
try {
|
||||
List<Org> list = userService.getOrgByUserId();
|
||||
return ServerResponse.createSuccess(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("获取组织机构失败");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,4 +202,10 @@ public interface UserDao {
|
|||
List<SelectVo> getProjects(UserDto userDto);
|
||||
|
||||
List<Long> getDataAuth(Long dept);
|
||||
|
||||
List<Org> getOrgByUserId(List<Long> deptIds);
|
||||
|
||||
List<Long> getParentId(Long deptId);
|
||||
|
||||
List<Long> getChildId(Long deptId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,4 +179,10 @@ public interface UserService {
|
|||
* @date 2025/4/22 9:50
|
||||
*/
|
||||
List<Long> getDataAuth(Long dept);
|
||||
|
||||
/**
|
||||
* 根据用户id查询组织机构
|
||||
* @return
|
||||
*/
|
||||
List<Org> getOrgByUserId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,10 +7,8 @@ import java.util.Optional;
|
|||
|
||||
import com.bonus.digitalSignage.base.entity.DtreeVo;
|
||||
import com.bonus.digitalSignage.model.Role;
|
||||
import com.bonus.digitalSignage.system.vo.Org;
|
||||
import com.bonus.digitalSignage.system.vo.*;
|
||||
import com.bonus.digitalSignage.model.PasswordConfig;
|
||||
import com.bonus.digitalSignage.system.vo.SelectVo;
|
||||
import com.bonus.digitalSignage.system.vo.SysMenuVo;
|
||||
import com.bonus.digitalSignage.utils.ServerResponse;
|
||||
import com.bonus.digitalSignage.utils.StringHelper;
|
||||
import com.bonus.digitalSignage.utils.UserUtil;
|
||||
|
|
@ -23,7 +21,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import com.bonus.digitalSignage.system.dao.UserDao;
|
||||
import com.bonus.digitalSignage.system.vo.UserDto;
|
||||
import com.bonus.digitalSignage.model.SysUser;
|
||||
import com.bonus.digitalSignage.system.service.UserService;
|
||||
|
||||
|
|
@ -337,4 +334,20 @@ public class UserServiceImpl implements UserService {
|
|||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户id查询组织机构
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Org> getOrgByUserId() {
|
||||
Long deptId = UserUtil.getLoginUser().getDept();
|
||||
//获取父类部门id
|
||||
List<Long> deptIds = userDao.getParentId(deptId);
|
||||
//获取子类部门id
|
||||
List<Long> deptIdList = userDao.getChildId(deptId);
|
||||
deptIds.addAll(deptIdList);
|
||||
userDao.getOrgByUserId(deptIds);
|
||||
return userDao.getOrgByUserId(deptIds);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -285,6 +285,50 @@
|
|||
ischild != - 1
|
||||
OR id = #{dept}
|
||||
</select>
|
||||
<select id="getOrgByUserId" resultType="com.bonus.digitalSignage.system.vo.Org">
|
||||
select id,
|
||||
depart_name as title,
|
||||
parent_id as parentId,
|
||||
'0' AS checkArr,
|
||||
level
|
||||
from tb_depart
|
||||
where is_active = '1'
|
||||
<if test="deptIds != '' and deptIds != null">
|
||||
and id IN
|
||||
<foreach item="item" index="index" collection="deptIds"
|
||||
open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
<select id="getParentId" resultType="java.lang.Long">
|
||||
SELECT sd.id AS id FROM (
|
||||
SELECT t2.id
|
||||
FROM ( SELECT @r AS _id, (SELECT @r := parent_id FROM tb_depart WHERE id = _id) AS parent_id,
|
||||
@l := @l + 1 AS lvl FROM (SELECT @r := #{deptId}, @l := 0) vars, tb_depart WHERE @r != 0) t1
|
||||
JOIN tb_depart t2 ON t1._id = t2.id
|
||||
ORDER BY t1.lvl DESC
|
||||
) a
|
||||
LEFT JOIN tb_depart sd ON a.id = sd.id
|
||||
WHERE sd.is_active = '1'
|
||||
</select>
|
||||
<select id="getChildId" resultType="java.lang.Long">
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
t1.id,
|
||||
t1.parent_id,
|
||||
IF
|
||||
( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), - 1 ) AS ischild
|
||||
FROM
|
||||
( SELECT id, parent_id FROM tb_depart t WHERE is_active = '1') t1,
|
||||
( SELECT @pids := #{dept} ) t2
|
||||
) t3
|
||||
WHERE
|
||||
ischild != - 1
|
||||
</select>
|
||||
|
||||
<insert id="saveUserRoles">
|
||||
insert into sys_role_user(roleId, userId) values
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ function saveData(data) {
|
|||
|
||||
function getOrgTree() {
|
||||
let data = [];
|
||||
let url = dataUrl + '/users/getOrg';
|
||||
let url = dataUrl + '/users/getOrgByUserId';
|
||||
ajaxRequest(url, "POST", null, false, function () {
|
||||
}, function (result) {
|
||||
if (result.code === 200) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue