feat(role): 添加公开服务功能

This commit is contained in:
曾文豪
2025-04-07 15:44:45 +08:00
parent 5c0d47a011
commit 9ecf58d75e
4 changed files with 38 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ import com.tiesheng.role.pojos.vo.GroupTypeDTO;
import com.tiesheng.role.pojos.vo.ServiceMenuVO; import com.tiesheng.role.pojos.vo.ServiceMenuVO;
import com.tiesheng.role.service.CoreRoleService; import com.tiesheng.role.service.CoreRoleService;
import com.tiesheng.util.pojos.ApiResp; import com.tiesheng.util.pojos.ApiResp;
import com.tiesheng.util.pojos.DaoBase;
import com.tiesheng.util.pojos.TokenBean; import com.tiesheng.util.pojos.TokenBean;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@@ -43,6 +44,14 @@ public class CommRoleController {
List<CoreRoleAuthority> allOwnerMenus = coreRoleService.getOwnerAuthorityLeafList(tokenBean.getId(), tokenBean.getRoleId()); List<CoreRoleAuthority> allOwnerMenus = coreRoleService.getOwnerAuthorityLeafList(tokenBean.getId(), tokenBean.getRoleId());
List<String> list = allOwnerMenus.stream().map(CoreRoleAuthority::getService).collect(Collectors.toList()); List<String> list = allOwnerMenus.stream().map(CoreRoleAuthority::getService).collect(Collectors.toList());
// 添加公开服务
list.addAll(coreRoleService.getServerMapper().selectList(new QueryWrapper<CoreRoleServer>()
.eq("is_public", 1).eq("is_deleted", 0).eq("is_open", 1)
).stream().map(DaoBase::getId).collect(Collectors.toList()));
// 去除重复
list = CollUtil.distinct(list);
List<CoreRoleServer> roleServerList = new ArrayList<>(); List<CoreRoleServer> roleServerList = new ArrayList<>();
if (CollUtil.isNotEmpty(list)) { if (CollUtil.isNotEmpty(list)) {
roleServerList = coreRoleService.getServerMapper().selectList(new QueryWrapper<CoreRoleServer>() roleServerList = coreRoleService.getServerMapper().selectList(new QueryWrapper<CoreRoleServer>()

View File

@@ -66,6 +66,12 @@ public class CoreRoleServer extends DaoBase {
@TableField(value = "ext3") @TableField(value = "ext3")
private String ext3; private String ext3;
/**
* 是否公开
*/
@TableField(value = "is_public")
private Integer isPublic;
/** /**
* 获取名称 * 获取名称
* *
@@ -227,4 +233,22 @@ public class CoreRoleServer extends DaoBase {
public void setExt3(String ext3) { public void setExt3(String ext3) {
this.ext3 = ext3; this.ext3 = ext3;
} }
/**
* 获取是否公开
*
* @return is_public - 是否公开
*/
public Integer getIsPublic() {
return isPublic;
}
/**
* 设置是否公开
*
* @param isPublic 是否公开
*/
public void setIsPublic(Integer isPublic) {
this.isPublic = isPublic;
}
} }

View File

@@ -0,0 +1,3 @@
alter table core_role_server
add is_public int default 0 null comment '是否公开';

View File

@@ -17,10 +17,11 @@
<result column="ext1" jdbcType="VARCHAR" property="ext1" /> <result column="ext1" jdbcType="VARCHAR" property="ext1" />
<result column="ext2" jdbcType="VARCHAR" property="ext2" /> <result column="ext2" jdbcType="VARCHAR" property="ext2" />
<result column="ext3" jdbcType="VARCHAR" property="ext3" /> <result column="ext3" jdbcType="VARCHAR" property="ext3" />
<result column="is_public" jdbcType="INTEGER" property="isPublic" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
<!--@mbg.generated--> <!--@mbg.generated-->
id, create_time, update_time, is_deleted, `name`, remark, logo, sort, is_open, link, id, create_time, update_time, is_deleted, `name`, remark, logo, sort, is_open, link,
ext1, ext2, ext3 ext1, ext2, ext3, is_public
</sql> </sql>
</mapper> </mapper>