修改权限改造引起的bug
This commit is contained in:
@ -40,6 +40,8 @@ public class Job implements Serializable {
|
||||
//@NotNull
|
||||
private Boolean enabled;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Dept dept;
|
||||
|
||||
/** 岗位排序 */
|
||||
//@NotNull
|
||||
|
@ -36,4 +36,8 @@ public class DeptDto implements Serializable {
|
||||
|
||||
/** 创建日期 */
|
||||
private Timestamp createTime;
|
||||
|
||||
public String getLabel() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
@ -19,21 +19,22 @@ import java.io.Serializable;
|
||||
@Data
|
||||
public class JobDto implements Serializable {
|
||||
|
||||
/** 岗位ID */
|
||||
private Long id;
|
||||
|
||||
/** 岗位名称 */
|
||||
private String name;
|
||||
|
||||
/** 岗位状态 */
|
||||
private Boolean enabled;
|
||||
|
||||
/** 岗位排序 */
|
||||
private Long sort;
|
||||
|
||||
/** 部门ID */
|
||||
private Long deptId;
|
||||
private String name;
|
||||
|
||||
private Boolean enabled;
|
||||
|
||||
private DeptDto dept;
|
||||
|
||||
private String deptSuperiorName;
|
||||
|
||||
/** 创建日期 */
|
||||
private Timestamp createTime;
|
||||
|
||||
// public JobDto(String name, Boolean enabled) {
|
||||
// this.name = name;
|
||||
// this.enabled = enabled;
|
||||
// }
|
||||
}
|
||||
|
@ -8,9 +8,13 @@
|
||||
*/
|
||||
package co.yixiang.modules.system.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.sql.Timestamp;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
@ -19,48 +23,38 @@ import java.io.Serializable;
|
||||
@Data
|
||||
public class UserDto implements Serializable {
|
||||
|
||||
/** ID */
|
||||
|
||||
@ApiModelProperty(hidden = true)
|
||||
private Long id;
|
||||
|
||||
/** 头像 */
|
||||
private Long avatarId;
|
||||
private String username;
|
||||
|
||||
private String nickName;
|
||||
|
||||
private String sex;
|
||||
|
||||
private String avatar;
|
||||
|
||||
/** 邮箱 */
|
||||
private String email;
|
||||
|
||||
/** 状态:1启用、0禁用 */
|
||||
private Boolean enabled;
|
||||
|
||||
/** 密码 */
|
||||
private String password;
|
||||
|
||||
/** 用户名 */
|
||||
private String username;
|
||||
|
||||
/** 部门名称 */
|
||||
private Long deptId;
|
||||
|
||||
/** 手机号码 */
|
||||
private String phone;
|
||||
|
||||
/** 岗位名称 */
|
||||
private Long jobId;
|
||||
private Boolean enabled;
|
||||
|
||||
/** 创建日期 */
|
||||
private Timestamp createTime;
|
||||
@JsonIgnore
|
||||
private String password;
|
||||
|
||||
/** 最后修改密码的日期 */
|
||||
private Timestamp lastPasswordResetTime;
|
||||
private Date lastPasswordResetTime;
|
||||
|
||||
/** 昵称 */
|
||||
private String nickName;
|
||||
@ApiModelProperty(hidden = true)
|
||||
private Set<RoleSmallDto> roles;
|
||||
|
||||
@ApiModelProperty(hidden = true)
|
||||
private JobSmallDto job;
|
||||
|
||||
private DeptSmallDto dept;
|
||||
|
||||
private JobSmallDto job;
|
||||
private Long deptId;
|
||||
|
||||
/** 性别 */
|
||||
private String sex;
|
||||
private Timestamp createTime;
|
||||
}
|
||||
|
@ -55,6 +55,8 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, Dept> implement
|
||||
|
||||
private final IGenerator generator;
|
||||
|
||||
private final DeptMapper deptMapper;
|
||||
|
||||
@Override
|
||||
//@Cacheable
|
||||
public Map<String, Object> queryAll(DeptQueryCriteria criteria, Pageable pageable) {
|
||||
@ -95,7 +97,7 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, Dept> implement
|
||||
* @return /
|
||||
*/
|
||||
@Override
|
||||
@Cacheable(key = "#p0")
|
||||
// @Cacheable(key = "#p0")
|
||||
public List<Dept> findByPid(long pid) {
|
||||
DeptQueryCriteria criteria = new DeptQueryCriteria();
|
||||
criteria.setPid(pid);
|
||||
@ -180,7 +182,6 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, Dept> implement
|
||||
*/
|
||||
@Override
|
||||
public Set<Dept> findByRoleIds(Long id) {
|
||||
//todo
|
||||
return null;
|
||||
return deptMapper.findDeptByRoleId(id);
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ package co.yixiang.modules.system.service.impl;
|
||||
|
||||
import co.yixiang.modules.system.domain.Job;
|
||||
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||
import co.yixiang.modules.system.service.DeptService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import co.yixiang.dozer.service.IGenerator;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
@ -51,6 +52,8 @@ public class JobServiceImpl extends BaseServiceImpl<JobMapper, Job> implements J
|
||||
|
||||
private final IGenerator generator;
|
||||
|
||||
private final DeptService deptService;
|
||||
|
||||
@Override
|
||||
//@Cacheable
|
||||
public Map<String, Object> queryAll(JobQueryCriteria criteria, Pageable pageable) {
|
||||
@ -66,7 +69,25 @@ public class JobServiceImpl extends BaseServiceImpl<JobMapper, Job> implements J
|
||||
@Override
|
||||
//@Cacheable
|
||||
public List<Job> queryAll(JobQueryCriteria criteria){
|
||||
return baseMapper.selectList(QueryHelpPlus.getPredicate(Job.class, criteria));
|
||||
List<Job> jobList = baseMapper.selectList(QueryHelpPlus.getPredicate(Job.class, criteria));
|
||||
List<Job> jobScopeList = new ArrayList<>();
|
||||
if(criteria.getDeptIds().size()==0){
|
||||
for (Job job : jobList) {
|
||||
job.setDept(deptService.getById(job.getDeptId()));
|
||||
jobScopeList.add(job);
|
||||
}
|
||||
}else {
|
||||
//断权限范围
|
||||
for (Long deptId : criteria.getDeptIds()) {
|
||||
for (Job job : jobList) {
|
||||
if(deptId ==job.getDeptId()){
|
||||
job.setDept(deptService.getById(job.getDeptId()));
|
||||
jobScopeList.add(job);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return jobScopeList;
|
||||
}
|
||||
|
||||
|
||||
@ -78,7 +99,6 @@ public class JobServiceImpl extends BaseServiceImpl<JobMapper, Job> implements J
|
||||
map.put("岗位名称", job.getName());
|
||||
map.put("岗位状态", job.getEnabled());
|
||||
map.put("岗位排序", job.getSort());
|
||||
map.put("部门ID", job.getDeptId());
|
||||
map.put("创建日期", job.getCreateTime());
|
||||
list.add(map);
|
||||
}
|
||||
|
@ -90,14 +90,12 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, User> imp
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (UserDto user : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("头像", user.getAvatarId());
|
||||
map.put("邮箱", user.getEmail());
|
||||
map.put("状态:1启用、0禁用", user.getEnabled());
|
||||
map.put("密码", user.getPassword());
|
||||
map.put("用户名", user.getUsername());
|
||||
map.put("部门名称", user.getDeptId());
|
||||
map.put("手机号码", user.getPhone());
|
||||
map.put("岗位名称", user.getJobId());
|
||||
map.put("创建日期", user.getCreateTime());
|
||||
map.put("最后修改密码的日期", user.getLastPasswordResetTime());
|
||||
map.put("昵称", user.getNickName());
|
||||
|
@ -26,6 +26,9 @@ import java.util.Set;
|
||||
@Mapper
|
||||
public interface DeptMapper extends CoreMapper<Dept> {
|
||||
|
||||
@Select("select * from dept m LEFT JOIN roles_depts t on m.id= t.dept_id LEFT JOIN role r on r.id = t.role_id where r.id = #{roleId}")
|
||||
@Select("select m.* from dept m LEFT JOIN roles_depts t on m.id= t.dept_id LEFT JOIN role r on r.id = t.role_id where r.id = ${roleId}")
|
||||
Set<Dept> findDeptByRoleId(@Param("roleId") Long roleId);
|
||||
|
||||
@Select("select * from dept m LEFT JOIN roles_depts t on m.id= t.dept_id LEFT JOIN role r on r.id = t.role_id where r.id = #{roleId}")
|
||||
Set<Dept> findDeptByRoleId(@Param("roleIds") Set<Long> roleId);
|
||||
}
|
||||
|
@ -26,6 +26,6 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface DictDetailMapper extends CoreMapper<DictDetail> {
|
||||
|
||||
@Select("<script>SELECT t.* from dict_detail d LEFT JOIN dict t on d.dict_id = t.id where 1=1 <if test = \"label !=null\" > and d.label LIKE concat('%', #{label}, '%') </if> <if test = \"dictName != ''||dictName !=null\" > AND t.name = #{dictName} order by t.sort asc</if></script>")
|
||||
@Select("<script>SELECT d.* from dict_detail d LEFT JOIN dict t on d.dict_id = t.id where 1=1 <if test = \"label !=null\" > and d.label LIKE concat('%', #{label}, '%') </if> <if test = \"dictName != ''||dictName !=null\" > AND t.name = #{dictName} order by t.sort asc</if></script>")
|
||||
List<DictDetail> selectDictDetailList(@Param("label") String label,@Param("dictName") String dictName);
|
||||
}
|
||||
|
Reference in New Issue
Block a user