Compare commits
2 Commits
07e9ae9d23
...
4bf52c4404
| Author | SHA1 | Date |
|---|---|---|
|
|
4bf52c4404 | |
|
|
205fb40864 |
|
|
@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.models.Role;
|
import com.electromagnetic.industry.software.manage.pojo.models.Role;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.req.RoleDTO;
|
import com.electromagnetic.industry.software.manage.pojo.req.RoleDTO;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.req.RolePageDTO;
|
import com.electromagnetic.industry.software.manage.pojo.req.RolePageDTO;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface RoleService extends IService<Role> {
|
public interface RoleService extends IService<Role> {
|
||||||
|
|
@ -48,9 +48,10 @@ public interface RoleService extends IService<Role> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有角色名
|
* 获取所有角色名
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<String> getAllRoleNames();
|
List<HashMap<String, String>> getAllRoleNames();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过角色名称查看角色权限
|
* 通过角色名称查看角色权限
|
||||||
|
|
|
||||||
|
|
@ -218,15 +218,25 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有角色名
|
* 获取所有角色名
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public List<String> getAllRoleNames() {
|
public List<HashMap<String, String>> getAllRoleNames() {
|
||||||
LambdaQueryWrapper<Role> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Role> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.select(Role::getRoleName)
|
queryWrapper.select(Role::getRoleName)
|
||||||
.eq(Role::getEffectFlag, EffectFlagEnum.EFFECT.code);
|
.eq(Role::getEffectFlag, EffectFlagEnum.EFFECT.code);
|
||||||
return this.listObjs(queryWrapper).stream().map(Object::toString).collect(Collectors.toList());
|
|
||||||
|
List<String> roleNames = this.listObjs(queryWrapper).stream().map(Object::toString).collect(Collectors.toList());
|
||||||
|
List<HashMap<String,String>> result = new ArrayList<>();
|
||||||
|
for (String roleName : roleNames) {
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
map.put("value", roleName);
|
||||||
|
map.put("label", roleName);
|
||||||
|
result.add(map);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue