mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-21 02:25:56 +08:00
add SysTenantPackage 新增字段 menuCheckStrictly 用于前端展示 ;
update sql SysTenantPackage 新增字段 menuCheckStrictly ; update SysMenuServiceImpl#selectMenuListByTenantPackageId 更新获取菜单列表 SQL 参数以及判断空值判断 ; update SysTenantPackageServiceImpl#insertByBo 更新接口菜单id参数保存 ; update SysMenuMapper#selectMenuListByTenantPackageMenuId 更新获取选中菜单接口 ;
This commit is contained in:
parent
4fd3029488
commit
bbfd0d1580
@ -37,6 +37,10 @@ public class SysTenantPackage extends BaseEntity {
|
|||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
private String remark;
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示)
|
||||||
|
*/
|
||||||
|
private Boolean menuCheckStrictly;
|
||||||
/**
|
/**
|
||||||
* 状态(0正常 1停用)
|
* 状态(0正常 1停用)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -33,13 +33,18 @@ public class SysTenantPackageBo extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 关联菜单id
|
* 关联菜单id
|
||||||
*/
|
*/
|
||||||
private String menuIds;
|
private Long[] menuIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单树选择项是否关联显示
|
||||||
|
*/
|
||||||
|
private Boolean menuCheckStrictly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态(0正常 1停用)
|
* 状态(0正常 1停用)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -46,6 +46,12 @@ public class SysTenantPackageVo implements Serializable {
|
|||||||
@ExcelProperty(value = "备注")
|
@ExcelProperty(value = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单树选择项是否关联显示
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "菜单树选择项是否关联显示")
|
||||||
|
private Boolean menuCheckStrictly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态(0正常 1停用)
|
* 状态(0正常 1停用)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -81,11 +81,11 @@ public interface SysMenuMapper extends BaseMapperPlus<SysMenuMapper, SysMenu, Sy
|
|||||||
List<Long> selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly);
|
List<Long> selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据租户套餐ID查询菜单树信息 TODO
|
* 根据租户套餐菜单ID查询菜单树信息
|
||||||
*
|
*
|
||||||
* @param packageId 租户套餐ID
|
* @param menuIds 租户套餐菜单ID
|
||||||
* @return 选中菜单列表
|
* @return 选中菜单列表
|
||||||
*/
|
*/
|
||||||
List<Long> selectMenuListByTenantPackageId(@Param("packageId") Long packageId);
|
List<Long> selectMenuListByTenantPackageMenuId(@Param("menuIds") String menuIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.ruoyi.system.mapper;
|
|||||||
import com.ruoyi.system.domain.SysTenantPackage;
|
import com.ruoyi.system.domain.SysTenantPackage;
|
||||||
import com.ruoyi.system.domain.vo.SysTenantPackageVo;
|
import com.ruoyi.system.domain.vo.SysTenantPackageVo;
|
||||||
import com.ruoyi.common.mybatis.core.mapper.BaseMapperPlus;
|
import com.ruoyi.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租户套餐Mapper接口
|
* 租户套餐Mapper接口
|
||||||
@ -11,4 +12,12 @@ import com.ruoyi.common.mybatis.core.mapper.BaseMapperPlus;
|
|||||||
*/
|
*/
|
||||||
public interface SysTenantPackageMapper extends BaseMapperPlus<SysTenantPackageMapper, SysTenantPackage, SysTenantPackageVo> {
|
public interface SysTenantPackageMapper extends BaseMapperPlus<SysTenantPackageMapper, SysTenantPackage, SysTenantPackageVo> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取租户套餐菜单id
|
||||||
|
*
|
||||||
|
* @param packageId 租户套餐id
|
||||||
|
* @return 菜单id
|
||||||
|
*/
|
||||||
|
String selectMenuIds(@Param("packageId") Long packageId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import com.ruoyi.system.domain.vo.SysMenuVo;
|
|||||||
import com.ruoyi.system.mapper.SysMenuMapper;
|
import com.ruoyi.system.mapper.SysMenuMapper;
|
||||||
import com.ruoyi.system.mapper.SysRoleMapper;
|
import com.ruoyi.system.mapper.SysRoleMapper;
|
||||||
import com.ruoyi.system.mapper.SysRoleMenuMapper;
|
import com.ruoyi.system.mapper.SysRoleMenuMapper;
|
||||||
|
import com.ruoyi.system.mapper.SysTenantPackageMapper;
|
||||||
import com.ruoyi.system.service.ISysMenuService;
|
import com.ruoyi.system.service.ISysMenuService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -41,6 +42,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
private final SysMenuMapper baseMapper;
|
private final SysMenuMapper baseMapper;
|
||||||
private final SysRoleMapper roleMapper;
|
private final SysRoleMapper roleMapper;
|
||||||
private final SysRoleMenuMapper roleMenuMapper;
|
private final SysRoleMenuMapper roleMenuMapper;
|
||||||
|
private final SysTenantPackageMapper sysTenantPackageMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户查询系统菜单列表
|
* 根据用户查询系统菜单列表
|
||||||
@ -157,7 +159,9 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Long> selectMenuListByTenantPackageId(Long packageId) {
|
public List<Long> selectMenuListByTenantPackageId(Long packageId) {
|
||||||
return baseMapper.selectMenuListByTenantPackageId(packageId);
|
String menuIds = sysTenantPackageMapper.selectMenuIds(packageId);
|
||||||
|
return StringUtils.isNotBlank(menuIds)
|
||||||
|
? baseMapper.selectMenuListByTenantPackageMenuId(menuIds) : new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.ruoyi.system.service.impl;
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||||
@ -16,6 +17,7 @@ import com.ruoyi.system.mapper.SysTenantPackageMapper;
|
|||||||
import com.ruoyi.system.service.ISysTenantPackageService;
|
import com.ruoyi.system.service.ISysTenantPackageService;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -74,6 +76,13 @@ public class SysTenantPackageServiceImpl implements ISysTenantPackageService {
|
|||||||
public Boolean insertByBo(SysTenantPackageBo bo) {
|
public Boolean insertByBo(SysTenantPackageBo bo) {
|
||||||
SysTenantPackage add = BeanUtil.toBean(bo, SysTenantPackage.class);
|
SysTenantPackage add = BeanUtil.toBean(bo, SysTenantPackage.class);
|
||||||
validEntityBeforeSave(add);
|
validEntityBeforeSave(add);
|
||||||
|
// 保存菜单id
|
||||||
|
List<Long> menuIds = Arrays.asList(bo.getMenuIds());
|
||||||
|
if (CollUtil.isNotEmpty(menuIds)) {
|
||||||
|
add.setMenuIds(StringUtils.join(menuIds, ", "));
|
||||||
|
} else {
|
||||||
|
add.setMenuIds("");
|
||||||
|
}
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
bo.setPackageId(add.getPackageId());
|
bo.setPackageId(add.getPackageId());
|
||||||
@ -89,6 +98,13 @@ public class SysTenantPackageServiceImpl implements ISysTenantPackageService {
|
|||||||
public Boolean updateByBo(SysTenantPackageBo bo) {
|
public Boolean updateByBo(SysTenantPackageBo bo) {
|
||||||
SysTenantPackage update = BeanUtil.toBean(bo, SysTenantPackage.class);
|
SysTenantPackage update = BeanUtil.toBean(bo, SysTenantPackage.class);
|
||||||
validEntityBeforeSave(update);
|
validEntityBeforeSave(update);
|
||||||
|
// 保存菜单id
|
||||||
|
List<Long> menuIds = Arrays.asList(bo.getMenuIds());
|
||||||
|
if (CollUtil.isNotEmpty(menuIds)) {
|
||||||
|
update.setMenuIds(StringUtils.join(menuIds, ", "));
|
||||||
|
} else {
|
||||||
|
update.setMenuIds("");
|
||||||
|
}
|
||||||
return baseMapper.updateById(update) > 0;
|
return baseMapper.updateById(update) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -82,8 +82,10 @@
|
|||||||
where m.status = '0' and rm.role_id = #{roleId}
|
where m.status = '0' and rm.role_id = #{roleId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectMenuListByTenantPackageId" resultType="java.lang.Long">
|
<select id="selectMenuListByTenantPackageMenuId" resultType="java.lang.Long">
|
||||||
|
select m.menu_id
|
||||||
|
from sys_menu m
|
||||||
|
where m.menu_id in (${menuIds})
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -4,4 +4,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ruoyi.system.mapper.SysTenantPackageMapper">
|
<mapper namespace="com.ruoyi.system.mapper.SysTenantPackageMapper">
|
||||||
|
|
||||||
|
<select id="selectMenuIds" resultType="java.lang.String">
|
||||||
|
SELECT menu_ids
|
||||||
|
FROM sys_tenant_package
|
||||||
|
WHERE package_id = #{packageId}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -247,6 +247,11 @@ export default {
|
|||||||
},
|
},
|
||||||
// 表单重置
|
// 表单重置
|
||||||
reset() {
|
reset() {
|
||||||
|
if (this.$refs.menu != undefined) {
|
||||||
|
this.$refs.menu.setCheckedKeys([]);
|
||||||
|
}
|
||||||
|
this.menuExpand = false;
|
||||||
|
this.menuNodeAll = false;
|
||||||
this.form = {
|
this.form = {
|
||||||
packageId: undefined,
|
packageId: undefined,
|
||||||
packageName: undefined,
|
packageName: undefined,
|
||||||
@ -335,6 +340,7 @@ export default {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
this.buttonLoading = true;
|
this.buttonLoading = true;
|
||||||
if (this.form.packageId != null) {
|
if (this.form.packageId != null) {
|
||||||
|
this.form.menuIds = this.getMenuAllCheckedKeys();
|
||||||
updateTenantPackage(this.form).then(response => {
|
updateTenantPackage(this.form).then(response => {
|
||||||
this.$modal.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
@ -343,6 +349,7 @@ export default {
|
|||||||
this.buttonLoading = false;
|
this.buttonLoading = false;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
this.form.menuIds = this.getMenuAllCheckedKeys();
|
||||||
addTenantPackage(this.form).then(response => {
|
addTenantPackage(this.form).then(response => {
|
||||||
this.$modal.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
|
|||||||
@ -56,17 +56,18 @@ insert into sys_tenant values(1, '000000', '管理组', '15888888888', 'XXX有
|
|||||||
-- 租户套餐表
|
-- 租户套餐表
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
create table sys_tenant_package (
|
create table sys_tenant_package (
|
||||||
package_id number(20) not null,
|
package_id number(20) not null,
|
||||||
package_name varchar2(20) default '',
|
package_name varchar2(20) default '',
|
||||||
menu_ids varchar2(3000) default '',
|
menu_ids varchar2(3000) default '',
|
||||||
remark varchar2(200) default '',
|
remark varchar2(200) default '',
|
||||||
status char(1) default '0',
|
menu_check_strictly number(1) default 1,
|
||||||
del_flag char(1) default '0',
|
status char(1) default '0',
|
||||||
create_dept number(20) default null,
|
del_flag char(1) default '0',
|
||||||
create_by number(20) default null,
|
create_dept number(20) default null,
|
||||||
create_time date,
|
create_by number(20) default null,
|
||||||
update_by number(20) default null,
|
create_time date,
|
||||||
update_time date
|
update_by number(20) default null,
|
||||||
|
update_time date
|
||||||
);
|
);
|
||||||
|
|
||||||
alter table sys_tenant_package add constraint pk_sys_tenant_package primary key (package_id);
|
alter table sys_tenant_package add constraint pk_sys_tenant_package primary key (package_id);
|
||||||
|
|||||||
@ -61,17 +61,18 @@ insert into sys_tenant values(1, '000000', '管理组', '15888888888', 'XXX有
|
|||||||
drop table if exists sys_tenant_package;
|
drop table if exists sys_tenant_package;
|
||||||
create table if not exists sys_tenant_package
|
create table if not exists sys_tenant_package
|
||||||
(
|
(
|
||||||
package_id int8,
|
package_id int8,
|
||||||
package_name varchar(20) default ''::varchar,
|
package_name varchar(20) default ''::varchar,
|
||||||
menu_ids varchar(3000) default ''::varchar,
|
menu_ids varchar(3000) default ''::varchar,
|
||||||
remark varchar(200) default ''::varchar,
|
remark varchar(200) default ''::varchar,
|
||||||
status char default '0'::bpchar,
|
menu_check_strictly bool default true,
|
||||||
del_flag char default '0'::bpchar,
|
status char default '0'::bpchar,
|
||||||
create_dept int8,
|
del_flag char default '0'::bpchar,
|
||||||
create_by int8,
|
create_dept int8,
|
||||||
create_time timestamp,
|
create_by int8,
|
||||||
update_by int8,
|
create_time timestamp,
|
||||||
update_time timestamp,
|
update_by int8,
|
||||||
|
update_time timestamp,
|
||||||
constraint "pk_sys_tenant_package" primary key (package_id)
|
constraint "pk_sys_tenant_package" primary key (package_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -39,17 +39,18 @@ insert into sys_tenant values(1, '000000', '管理组', '15888888888', 'XXX有
|
|||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
drop table if exists sys_tenant_package;
|
drop table if exists sys_tenant_package;
|
||||||
create table sys_tenant_package (
|
create table sys_tenant_package (
|
||||||
package_id bigint(20) not null comment '租户套餐id',
|
package_id bigint(20) not null comment '租户套餐id',
|
||||||
package_name varchar(20) comment '套餐名称',
|
package_name varchar(20) comment '套餐名称',
|
||||||
menu_ids varchar(3000) comment '关联菜单id',
|
menu_ids varchar(3000) comment '关联菜单id',
|
||||||
remark varchar(200) comment '备注',
|
remark varchar(200) comment '备注',
|
||||||
status char(1) default '0' comment '状态(0正常 1停用)',
|
menu_check_strictly tinyint(1) default 1 comment '菜单树选择项是否关联显示',
|
||||||
del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)',
|
status char(1) default '0' comment '状态(0正常 1停用)',
|
||||||
create_dept bigint(20) comment '创建部门',
|
del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)',
|
||||||
create_by bigint(20) comment '创建者',
|
create_dept bigint(20) comment '创建部门',
|
||||||
create_time datetime comment '创建时间',
|
create_by bigint(20) comment '创建者',
|
||||||
update_by bigint(20) comment '更新者',
|
create_time datetime comment '创建时间',
|
||||||
update_time datetime comment '更新时间',
|
update_by bigint(20) comment '更新者',
|
||||||
|
update_time datetime comment '更新时间',
|
||||||
primary key (package_id)
|
primary key (package_id)
|
||||||
) engine=innodb comment = '租户套餐表';
|
) engine=innodb comment = '租户套餐表';
|
||||||
|
|
||||||
|
|||||||
@ -156,6 +156,7 @@ CREATE TABLE [sys_tenant_package]
|
|||||||
[package_name] nvarchar(20) NOT NULL,
|
[package_name] nvarchar(20) NOT NULL,
|
||||||
[menu_ids] nvarchar(20) NULL,
|
[menu_ids] nvarchar(20) NULL,
|
||||||
[remark] nvarchar(200) NULL,
|
[remark] nvarchar(200) NULL,
|
||||||
|
[menu_check_strictly] tinyint DEFAULT ((1)) NULL,
|
||||||
[status] nchar(1) DEFAULT ('0') NULL,
|
[status] nchar(1) DEFAULT ('0') NULL,
|
||||||
[del_flag] nchar(1) DEFAULT ('0') NULL,
|
[del_flag] nchar(1) DEFAULT ('0') NULL,
|
||||||
[create_dept] bigint NULL,
|
[create_dept] bigint NULL,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user