mirror of https://github.com/elunez/eladmin
				
				
				
			
							parent
							
								
									0705b123be
								
							
						
					
					
						commit
						516530312a
					
				| 
						 | 
				
			
			@ -123,7 +123,7 @@ public class DateUtil {
 | 
			
		|||
     * @param localDateTime /
 | 
			
		||||
     * @return /
 | 
			
		||||
     */
 | 
			
		||||
    public String localDateTimeFormatyMd(LocalDateTime localDateTime) {
 | 
			
		||||
    public static String localDateTimeFormatyMd(LocalDateTime localDateTime) {
 | 
			
		||||
        return DFY_MD.format(localDateTime);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -45,7 +45,15 @@ public class QueryHelp {
 | 
			
		|||
            List<Long> dataScopes = SecurityUtils.getCurrentUserDataScope();
 | 
			
		||||
            if(CollectionUtil.isNotEmpty(dataScopes)){
 | 
			
		||||
                if(StringUtils.isNotBlank(permission.joinName()) && StringUtils.isNotBlank(permission.fieldName())) {
 | 
			
		||||
                    Join join = root.join(permission.joinName(), JoinType.LEFT);
 | 
			
		||||
                    Join join = null;
 | 
			
		||||
                    String[] joinNames = permission.joinName().split(">");
 | 
			
		||||
                    for (String name : joinNames) {
 | 
			
		||||
                        if (ObjectUtil.isNotNull(join)) {
 | 
			
		||||
                            join = join.join(name, JoinType.LEFT);
 | 
			
		||||
                        } else {
 | 
			
		||||
                            join = root.join(name, JoinType.LEFT);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    list.add(getExpression(permission.fieldName(),join, root).in(dataScopes));
 | 
			
		||||
                } else if (StringUtils.isBlank(permission.joinName()) && StringUtils.isNotBlank(permission.fieldName())) {
 | 
			
		||||
                    list.add(getExpression(permission.fieldName(),null, root).in(dataScopes));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,6 +35,9 @@ public enum DataScopeEnum {
 | 
			
		|||
    /* 自己部门的数据权限 */
 | 
			
		||||
    THIS_LEVEL("本级", "自己部门的数据权限"),
 | 
			
		||||
 | 
			
		||||
    /* 自己部门的数据权限 */
 | 
			
		||||
    THIS_LEVEL_AND_SUB("本级及其下属", "自己部门及其下属部门的数据权限"),
 | 
			
		||||
 | 
			
		||||
    /* 自定义的数据权限 */
 | 
			
		||||
    CUSTOMIZE("自定义", "自定义的数据权限");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -70,7 +70,7 @@ public class Role extends BaseEntity implements Serializable {
 | 
			
		|||
    @ApiModelProperty(value = "名称", hidden = true)
 | 
			
		||||
    private String name;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "数据权限,全部 、 本级 、 自定义")
 | 
			
		||||
    @ApiModelProperty(value = "数据权限,全部 、 本级 、本级及其下属 、 自定义")
 | 
			
		||||
    private String dataScope = DataScopeEnum.THIS_LEVEL.getValue();
 | 
			
		||||
 | 
			
		||||
    @Column(name = "level")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,6 +61,13 @@ public class DataServiceImpl implements DataService {
 | 
			
		|||
                case THIS_LEVEL:
 | 
			
		||||
                    deptIds.add(user.getDept().getId());
 | 
			
		||||
                    break;
 | 
			
		||||
                case THIS_LEVEL_AND_SUB:
 | 
			
		||||
                    deptIds.add(user.getDept().getId());
 | 
			
		||||
                    List<Dept> deptChildren = deptService.findByPid(user.getDept().getId());
 | 
			
		||||
                    if (deptChildren != null && deptChildren.size() != 0) {
 | 
			
		||||
                        deptIds.addAll(deptService.getDeptChildren(deptChildren));
 | 
			
		||||
                    }
 | 
			
		||||
                    break;
 | 
			
		||||
                case CUSTOMIZE:
 | 
			
		||||
                    deptIds.addAll(getCustomize(deptIds, role));
 | 
			
		||||
                    break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue