Merge branch 'dev-8.0.5' into dev-8.1.0

pull/60/head v8.1.0
fengshuonan 2024-01-30 14:20:05 +08:00
commit 875becabed
14 changed files with 255 additions and 20 deletions

View File

@ -0,0 +1,90 @@
/*
* Copyright [2020-2030] [https://www.stylefeng.cn]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* GunsAPACHE LICENSE 2.0使
*
* 1.LICENSE
* 2.Guns
* 3.
* 4. https://gitee.com/stylefeng/guns
* 5. https://gitee.com/stylefeng/guns
* 6.
*/
package cn.stylefeng.roses.kernel.rule.pojo.dict;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import cn.stylefeng.roses.kernel.rule.tree.factory.base.AbstractTreeNode;
import lombok.Data;
import java.util.List;
/**
* id,name,codepojo
*
* @author fengshuonan
* @since 2024-01-29 14:03
*/
@Data
public class SimpleTreeDict implements AbstractTreeNode<SimpleTreeDict> {
/**
* id
*/
@ChineseDescription("业务id")
private String id;
/**
*
*/
@ChineseDescription("业务名称")
private String name;
/**
*
*/
@ChineseDescription("业务编码")
private String code;
/**
* id
*/
@ChineseDescription("业务父级id")
private String parentId;
/**
*
*/
@ChineseDescription("子集节点")
private List<SimpleTreeDict> children;
public SimpleTreeDict() {
}
@Override
public String getNodeId() {
return id;
}
@Override
public String getNodeParentId() {
return parentId;
}
@Override
public void setChildrenNodes(List<SimpleTreeDict> childrenNodes) {
this.children = childrenNodes;
}
}

View File

@ -86,10 +86,14 @@ public class CustomMetaObjectHandler implements MetaObjectHandler {
try {
// 设置updateUserBaseEntity)
setValue(metaObject, DbFieldConstants.UPDATE_USER, this.getUserUniqueId());
if (metaObject.hasSetter(DbFieldConstants.UPDATE_USER)) {
metaObject.setValue(DbFieldConstants.UPDATE_USER, this.getUserUniqueId());
}
// 设置updateTimeBaseEntity)
setValue(metaObject, DbFieldConstants.UPDATE_TIME, new Date());
if (metaObject.hasSetter(DbFieldConstants.UPDATE_TIME)) {
metaObject.setValue(DbFieldConstants.UPDATE_TIME, new Date());
}
} catch (ReflectionException e) {
log.warn("CustomMetaObjectHandler处理过程中无相关字段不做处理");
}
@ -102,7 +106,7 @@ public class CustomMetaObjectHandler implements MetaObjectHandler {
* @author fengshuonan
* @since 2021/10/29 10:01
*/
private Long getUserUniqueId() {
protected Long getUserUniqueId() {
try {
return LoginContext.me().getLoginUser().getUserId();
@ -119,7 +123,7 @@ public class CustomMetaObjectHandler implements MetaObjectHandler {
* @author fengshuonan
* @since 2021/10/29 10:01
*/
private void setValue(MetaObject metaObject, String fieldName, Object value) {
protected void setValue(MetaObject metaObject, String fieldName, Object value) {
Object originalAttr = getFieldValByName(fieldName, metaObject);
if (ObjectUtil.isEmpty(originalAttr)) {
setFieldValByName(fieldName, value, metaObject);
@ -132,7 +136,7 @@ public class CustomMetaObjectHandler implements MetaObjectHandler {
* @author yxx
* @since 2022/09/01 10:14
*/
private Long getUserOrgId() {
protected Long getUserOrgId() {
try {
return LoginContext.me().getLoginUser().getCurrentOrgId();
@ -149,7 +153,7 @@ public class CustomMetaObjectHandler implements MetaObjectHandler {
* @author fengshuonan
* @since 2023/9/5 16:19
*/
private Long getTenantId() {
protected Long getTenantId() {
try {
// 1. 优先从线程变量中获取,这个优先级最高
@ -172,7 +176,7 @@ public class CustomMetaObjectHandler implements MetaObjectHandler {
* @author fengshuonan
* @since 2022/9/7 17:23
*/
private void setDelFlagDefaultValue(MetaObject metaObject) {
protected void setDelFlagDefaultValue(MetaObject metaObject) {
Object originalAttr = getFieldValByName(DbFieldConstants.DEL_FLAG, metaObject);
if (ObjectUtil.isNotEmpty(originalAttr)) {
return;
@ -197,7 +201,7 @@ public class CustomMetaObjectHandler implements MetaObjectHandler {
* @author fengshuonan
* @since 2022/9/7 17:23
*/
private void setStatusDefaultValue(MetaObject metaObject) {
protected void setStatusDefaultValue(MetaObject metaObject) {
Object originalAttr = getFieldValByName(DbFieldConstants.STATUS_FLAG, metaObject);
if (ObjectUtil.isNotEmpty(originalAttr)) {
return;

View File

@ -0,0 +1,47 @@
/*
* Copyright [2020-2030] [https://www.stylefeng.cn]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* GunsAPACHE LICENSE 2.0使
*
* 1.LICENSE
* 2.Guns
* 3.
* 4. https://gitee.com/stylefeng/guns
* 5. https://gitee.com/stylefeng/guns
* 6.
*/
package cn.stylefeng.roses.kernel.sys.api;
import cn.stylefeng.roses.kernel.sys.api.pojo.menu.ProjectBusinessDTO;
import java.util.List;
/**
*
*
* @author fengshuonan
* @since 2024-01-10 17:19
*/
public interface ProjectBusinessGetApi {
/**
*
*
* @author fengshuonan
* @since 2024-01-10 17:19
*/
List<ProjectBusinessDTO> getProjectBusinessList();
}

View File

@ -30,7 +30,7 @@ import cn.stylefeng.roses.kernel.rule.base.ReadableEnum;
import lombok.Getter;
/**
* 10-20-30-40-
* 10-20-30-40-50-
*
* @author fengshuonan
* @since 2023/6/15 9:45
@ -56,7 +56,12 @@ public enum MenuTypeEnum implements ReadableEnum<MenuTypeEnum> {
/**
*
*/
OUT_URL(40, "外部链接");
OUT_URL(40, "外部链接"),
/**
*
*/
APP_DESIGN(50, "应用设计");
private final Integer code;

View File

@ -0,0 +1,31 @@
package cn.stylefeng.roses.kernel.sys.api.pojo.menu;
import lombok.Data;
import java.util.List;
/**
*
*
* @author fengshuonan
* @since 2024-01-10 17:16
*/
@Data
public class ProjectBusinessDTO {
/**
* idid
*/
private Long id;
/**
*
*/
private String name;
/**
*
*/
private List<ProjectBusinessDTO> businessList;
}

View File

@ -16,6 +16,7 @@ import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.event.sdk.publish.BusinessEventPublisher;
import cn.stylefeng.roses.kernel.log.api.util.BusinessLogUtil;
import cn.stylefeng.roses.kernel.rule.constants.TreeConstants;
import cn.stylefeng.roses.kernel.rule.enums.StatusEnum;
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
import cn.stylefeng.roses.kernel.rule.pojo.dict.SimpleDict;
import cn.stylefeng.roses.kernel.rule.tree.factory.DefaultTreeBuildFactory;
@ -202,6 +203,8 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
@Override
public PageResult<HrOrganization> commonOrgPage(HrOrganizationRequest hrOrganizationRequest) {
// 只查询未禁用的组织机构
hrOrganizationRequest.setStatusFlag(StatusEnum.ENABLE.getCode());
LambdaQueryWrapper<HrOrganization> wrapper = createWrapper(hrOrganizationRequest);
// 只查询需要的字段
@ -680,6 +683,9 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
queryWrapper.eq(HrOrganization::getOrgType, OrgTypeEnum.COMPANY.getCode());
}
// 只查询启用状态的机构
queryWrapper.eq(HrOrganization::getStatusFlag, StatusEnum.ENABLE.getCode());
return queryWrapper;
}

View File

@ -30,9 +30,9 @@ public class IndexUserMenuInfo implements AbstractTreeNode<IndexUserMenuInfo> {
private Long menuParentId;
/**
* 10-20-30-40-
* 10-20-30-40-50-
*/
@ChineseDescription("菜单类型10-后台菜单20-纯前台路由界面30-内部链接40-外部链接")
@ChineseDescription("菜单类型10-后台菜单20-纯前台路由界面30-内部链接40-外部链接50-应用设计")
private Integer menuType;
/**
@ -83,6 +83,12 @@ public class IndexUserMenuInfo implements AbstractTreeNode<IndexUserMenuInfo> {
@ChineseDescription("路由元信息")
private String meta;
/**
* id
*/
@ChineseDescription("应用设计的业务id")
private Long appDesignBusinessId;
/**
*
*/

View File

@ -369,6 +369,7 @@ public class UserIndexInfoService {
indexUserMenuInfo.setPath(userMenuItem.getAntdvRouter());
indexUserMenuInfo.setComponent(userMenuItem.getAntdvComponent());
indexUserMenuInfo.setSortNumber(userMenuItem.getMenuSort());
indexUserMenuInfo.setAppDesignBusinessId(userMenuItem.getAppDesignBusinessId());
appMenuList.add(indexUserMenuInfo);
}
}

View File

@ -1,20 +1,25 @@
package cn.stylefeng.roses.kernel.sys.modular.menu.controller;
import cn.hutool.extra.spring.SpringUtil;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import cn.stylefeng.roses.kernel.sys.api.ProjectBusinessGetApi;
import cn.stylefeng.roses.kernel.sys.api.constants.PermissionCodeConstants;
import cn.stylefeng.roses.kernel.sys.api.pojo.menu.ProjectBusinessDTO;
import cn.stylefeng.roses.kernel.sys.modular.menu.entity.SysMenu;
import cn.stylefeng.roses.kernel.sys.modular.menu.pojo.request.SysMenuRequest;
import cn.stylefeng.roses.kernel.sys.modular.menu.pojo.response.AppGroupDetail;
import cn.stylefeng.roses.kernel.sys.modular.menu.service.SysMenuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
@ -25,6 +30,7 @@ import java.util.List;
*/
@RestController
@ApiResource(name = "菜单管理界面的接口", requiredPermission = true, requirePermissionCode = PermissionCodeConstants.AUTH_MENU)
@Slf4j
public class SysMenuController {
@Resource
@ -101,4 +107,24 @@ public class SysMenuController {
return new SuccessResponseData<>();
}
/**
*
*
* @author fengshuonan
* @since 2024-01-10 17:16
*/
@GetResource(name = "获取所有项目的应用设计业务列表", path = "/sysMenu/getProjectBusinessList")
public ResponseData<List<ProjectBusinessDTO>> getProjectBusinessList() {
ProjectBusinessGetApi bean = null;
try {
bean = SpringUtil.getBean(ProjectBusinessGetApi.class);
} catch (Exception e) {
log.warn("无法获取到ProjectBusinessGetApi Bean");
return new SuccessResponseData<>(new ArrayList<>());
}
return new SuccessResponseData<>(bean.getProjectBusinessList());
}
}

View File

@ -89,10 +89,10 @@ public class SysMenu extends BaseExpandFieldEntity implements BasePidBuildModel
private String remark;
/**
* 10-20-30-40-
* 10-20-30-40-50-
*/
@TableField("menu_type")
@ChineseDescription("菜单类型10-后台菜单20-纯前台路由界面30-内部链接40-外部链接")
@ChineseDescription("菜单类型10-后台菜单20-纯前台路由界面30-内部链接40-外部链接50-应用设计")
private Integer menuType;
/**
@ -137,6 +137,13 @@ public class SysMenu extends BaseExpandFieldEntity implements BasePidBuildModel
@ChineseDescription("是否可见(分离版用)Y-是N-否")
private String antdvVisible;
/**
* id
*/
@TableField("app_design_business_id")
@ChineseDescription("应用设计的业务id")
private Long appDesignBusinessId;
/**
*
* <p>

View File

@ -83,9 +83,9 @@ public class SysMenuRequest extends BaseRequest {
private String remark;
/**
* 10-20-30-40-
* 10-20-30-40-50-
*/
@ChineseDescription("菜单类型10-后台菜单20-纯前台路由界面30-内部链接40-外部链接")
@ChineseDescription("菜单类型10-后台菜单20-纯前台路由界面30-内部链接40-外部链接50-应用设计")
@NotNull(message = "菜单类型不能为空", groups = {add.class, edit.class})
private Integer menuType;
@ -125,6 +125,12 @@ public class SysMenuRequest extends BaseRequest {
@ChineseDescription("是否可见(分离版用)Y-是N-否")
private String antdvVisible;
/**
* id
*/
@ChineseDescription("应用设计的业务id")
private Long appDesignBusinessId;
/**
*
*/

View File

@ -30,7 +30,7 @@ public class MenuItemDetail implements AbstractTreeNode<MenuItemDetail> {
private String menuName;
/**
* 10-20-30-40-
* 10-20-30-40-50-
*/
private Integer menuType;

View File

@ -123,7 +123,8 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
sysMenuLambdaQueryWrapper.select(SysMenu::getAppId, SysMenu::getMenuName, SysMenu::getMenuCode, SysMenu::getMenuSort,
SysMenu::getMenuType, SysMenu::getAntdvComponent, SysMenu::getAntdvRouter, SysMenu::getAntdvVisible,
SysMenu::getAntdvActiveUrl, SysMenu::getAntdvLinkUrl, SysMenu::getAntdvIcon, SysMenu::getMenuParentId);
SysMenu::getAntdvActiveUrl, SysMenu::getAntdvLinkUrl, SysMenu::getAntdvIcon, SysMenu::getMenuParentId,
SysMenu::getAppDesignBusinessId);
SysMenu sysMenu = this.getOne(sysMenuLambdaQueryWrapper, false);
@ -158,7 +159,8 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
@Override
public List<SysMenu> getTotalMenus(Set<Long> limitMenuIds) {
LambdaQueryWrapper<SysMenu> menuLambdaQueryWrapper = new LambdaQueryWrapper<>();
menuLambdaQueryWrapper.select(SysMenu::getMenuId, SysMenu::getMenuName, SysMenu::getMenuParentId, SysMenu::getAppId, SysMenu::getMenuSort);
menuLambdaQueryWrapper.select(SysMenu::getMenuId, SysMenu::getMenuName, SysMenu::getMenuParentId, SysMenu::getAppId,
SysMenu::getMenuSort);
// 如果限制菜单不为空则根据限制菜单id进行筛选否则查询所有菜单
if (ObjectUtil.isNotEmpty(limitMenuIds)) {
@ -219,7 +221,8 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
// 查询指定的菜单内容
sysMenuLambdaQueryWrapper.select(SysMenu::getMenuId, SysMenu::getMenuParentId, SysMenu::getMenuPids, SysMenu::getAppId,
SysMenu::getMenuCode, SysMenu::getMenuName, SysMenu::getMenuType, SysMenu::getAntdvIcon, SysMenu::getAntdvVisible,
SysMenu::getAntdvActiveUrl, SysMenu::getAntdvRouter, SysMenu::getAntdvComponent, SysMenu::getMenuSort);
SysMenu::getAntdvActiveUrl, SysMenu::getAntdvRouter, SysMenu::getAntdvComponent, SysMenu::getMenuSort,
SysMenu::getAppDesignBusinessId);
sysMenuLambdaQueryWrapper.orderByAsc(SysMenu::getMenuSort);

View File

@ -0,0 +1,3 @@
ALTER TABLE `sys_menu`
MODIFY COLUMN `menu_type` tinyint NULL DEFAULT NULL COMMENT '菜单类型10-后台菜单20-纯前台路由界面30-内部链接40-外部链接50-应用设计' AFTER `remark`,
ADD COLUMN `app_design_business_id` bigint NULL COMMENT '应用设计的业务id' AFTER `antdv_visible`;