mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-21 02:25:56 +08:00
add SysTenant, SysTenantPackage 新增代码生成相关类 ;
add SysMenuController#tenantPackageMenuTreeselect 接口获取租户套餐菜单列表 (参照 role, 未写具体 sql) ;
This commit is contained in:
parent
02b3f79c02
commit
45cf737c78
@ -76,6 +76,20 @@ public class SysMenuController extends BaseController {
|
|||||||
return R.ok(selectVo);
|
return R.ok(selectVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载对应租户套餐菜单列表树
|
||||||
|
*
|
||||||
|
* @param packageId 租户套餐ID
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/tenantPackageMenuTreeselect/{packageId}")
|
||||||
|
public R<MenuTreeSelectVo> tenantPackageMenuTreeselect(@PathVariable("packageId") Long packageId) {
|
||||||
|
List<SysMenuVo> menus = menuService.selectMenuList(LoginHelper.getUserId());
|
||||||
|
MenuTreeSelectVo selectVo = new MenuTreeSelectVo();
|
||||||
|
selectVo.setCheckedKeys(menuService.selectMenuListByTenantPackageId(packageId));
|
||||||
|
selectVo.setMenus(menuService.buildMenuTreeSelect(menus));
|
||||||
|
return R.ok(selectVo);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增菜单
|
* 新增菜单
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -0,0 +1,105 @@
|
|||||||
|
package com.ruoyi.system.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import com.ruoyi.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import com.ruoyi.common.log.annotation.Log;
|
||||||
|
import com.ruoyi.common.web.core.BaseController;
|
||||||
|
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.core.validate.AddGroup;
|
||||||
|
import com.ruoyi.common.core.validate.EditGroup;
|
||||||
|
import com.ruoyi.common.log.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.excel.utils.ExcelUtil;
|
||||||
|
import com.ruoyi.system.domain.vo.SysTenantVo;
|
||||||
|
import com.ruoyi.system.domain.bo.SysTenantBo;
|
||||||
|
import com.ruoyi.system.service.ISysTenantService;
|
||||||
|
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-02-05
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/tenant")
|
||||||
|
public class SysTenantController extends BaseController {
|
||||||
|
|
||||||
|
private final ISysTenantService iSysTenantService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询租户列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:tenant:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<SysTenantVo> list(SysTenantBo bo, PageQuery pageQuery) {
|
||||||
|
return iSysTenantService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出租户列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:tenant:export")
|
||||||
|
@Log(title = "租户", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(SysTenantBo bo, HttpServletResponse response) {
|
||||||
|
List<SysTenantVo> list = iSysTenantService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "租户", SysTenantVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取租户详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:tenant:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<SysTenantVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(iSysTenantService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增租户
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:tenant:add")
|
||||||
|
@Log(title = "租户", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysTenantBo bo) {
|
||||||
|
return toAjax(iSysTenantService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改租户
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:tenant:edit")
|
||||||
|
@Log(title = "租户", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysTenantBo bo) {
|
||||||
|
return toAjax(iSysTenantService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除租户
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:tenant:remove")
|
||||||
|
@Log(title = "租户", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(iSysTenantService.deleteWithValidByIds(List.of(ids), true));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,105 @@
|
|||||||
|
package com.ruoyi.system.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import com.ruoyi.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import com.ruoyi.common.log.annotation.Log;
|
||||||
|
import com.ruoyi.common.web.core.BaseController;
|
||||||
|
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.core.validate.AddGroup;
|
||||||
|
import com.ruoyi.common.core.validate.EditGroup;
|
||||||
|
import com.ruoyi.common.log.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.excel.utils.ExcelUtil;
|
||||||
|
import com.ruoyi.system.domain.vo.SysTenantPackageVo;
|
||||||
|
import com.ruoyi.system.domain.bo.SysTenantPackageBo;
|
||||||
|
import com.ruoyi.system.service.ISysTenantPackageService;
|
||||||
|
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户套餐
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-02-05
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/tenantPackage")
|
||||||
|
public class SysTenantPackageController extends BaseController {
|
||||||
|
|
||||||
|
private final ISysTenantPackageService iSysTenantPackageService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询租户套餐列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:tenantPackage:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<SysTenantPackageVo> list(SysTenantPackageBo bo, PageQuery pageQuery) {
|
||||||
|
return iSysTenantPackageService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出租户套餐列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:tenantPackage:export")
|
||||||
|
@Log(title = "租户套餐", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(SysTenantPackageBo bo, HttpServletResponse response) {
|
||||||
|
List<SysTenantPackageVo> list = iSysTenantPackageService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "租户套餐", SysTenantPackageVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取租户套餐详细信息
|
||||||
|
*
|
||||||
|
* @param packageId 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:tenantPackage:query")
|
||||||
|
@GetMapping("/{packageId}")
|
||||||
|
public R<SysTenantPackageVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long packageId) {
|
||||||
|
return R.ok(iSysTenantPackageService.queryById(packageId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增租户套餐
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:tenantPackage:add")
|
||||||
|
@Log(title = "租户套餐", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysTenantPackageBo bo) {
|
||||||
|
return toAjax(iSysTenantPackageService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改租户套餐
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:tenantPackage:edit")
|
||||||
|
@Log(title = "租户套餐", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysTenantPackageBo bo) {
|
||||||
|
return toAjax(iSysTenantPackageService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除租户套餐
|
||||||
|
*
|
||||||
|
* @param packageIds 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:tenantPackage:remove")
|
||||||
|
@Log(title = "租户套餐", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{packageIds}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] packageIds) {
|
||||||
|
return toAjax(iSysTenantPackageService.deleteWithValidByIds(List.of(packageIds), true));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,84 @@
|
|||||||
|
package com.ruoyi.system.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户对象 sys_tenant
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-02-05
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("sys_tenant")
|
||||||
|
public class SysTenant extends BaseEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 租户编号
|
||||||
|
*/
|
||||||
|
private String tenantId;
|
||||||
|
/**
|
||||||
|
* 联系人
|
||||||
|
*/
|
||||||
|
private String contactUserName;
|
||||||
|
/**
|
||||||
|
* 联系电话
|
||||||
|
*/
|
||||||
|
private String contactPhone;
|
||||||
|
/**
|
||||||
|
* 企业名称
|
||||||
|
*/
|
||||||
|
private String companyName;
|
||||||
|
/**
|
||||||
|
* 统一社会信用代码
|
||||||
|
*/
|
||||||
|
private String licenseNumber;
|
||||||
|
/**
|
||||||
|
* 地址
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
/**
|
||||||
|
* 企业简介
|
||||||
|
*/
|
||||||
|
private String intro;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 租户套餐编号
|
||||||
|
*/
|
||||||
|
private Long packageId;
|
||||||
|
/**
|
||||||
|
* 过期时间
|
||||||
|
*/
|
||||||
|
private Date expireTime;
|
||||||
|
/**
|
||||||
|
* 用户数量(-1不限制)
|
||||||
|
*/
|
||||||
|
private Long accountCount;
|
||||||
|
/**
|
||||||
|
* 租户状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
/**
|
||||||
|
* 删除标志(0代表存在 2代表删除)
|
||||||
|
*/
|
||||||
|
@TableLogic
|
||||||
|
private String delFlag;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
package com.ruoyi.system.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
import com.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户套餐对象 sys_tenant_package
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-02-05
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("sys_tenant_package")
|
||||||
|
public class SysTenantPackage extends BaseEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户套餐id
|
||||||
|
*/
|
||||||
|
@TableId(value = "package_id")
|
||||||
|
private Long packageId;
|
||||||
|
/**
|
||||||
|
* 套餐名称
|
||||||
|
*/
|
||||||
|
private String packageName;
|
||||||
|
/**
|
||||||
|
* 关联菜单id
|
||||||
|
*/
|
||||||
|
private String menuIds;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
/**
|
||||||
|
* 删除标志(0代表存在 2代表删除)
|
||||||
|
*/
|
||||||
|
@TableLogic
|
||||||
|
private String delFlag;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,95 @@
|
|||||||
|
package com.ruoyi.system.domain.bo;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.validate.AddGroup;
|
||||||
|
import com.ruoyi.common.core.validate.EditGroup;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户业务对象 sys_tenant
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-02-05
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class SysTenantBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "id不能为空", groups = { EditGroup.class })
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户编号
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "租户编号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系人
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "联系人不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String contactUserName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系电话
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "联系电话不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String contactPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "企业名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String companyName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统一社会信用代码
|
||||||
|
*/
|
||||||
|
private String licenseNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地址
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业简介
|
||||||
|
*/
|
||||||
|
private String intro;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户套餐编号
|
||||||
|
*/
|
||||||
|
private Long packageId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 过期时间
|
||||||
|
*/
|
||||||
|
private Date expireTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户数量(-1不限制)
|
||||||
|
*/
|
||||||
|
private Long accountCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
package com.ruoyi.system.domain.bo;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.validate.AddGroup;
|
||||||
|
import com.ruoyi.common.core.validate.EditGroup;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
import com.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户套餐业务对象 sys_tenant_package
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-02-05
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class SysTenantPackageBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户套餐id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "租户套餐id不能为空", groups = { EditGroup.class })
|
||||||
|
private Long packageId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "套餐名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String packageName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联菜单id
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "关联菜单id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String menuIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
package com.ruoyi.system.domain.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.ruoyi.common.excel.annotation.ExcelDictFormat;
|
||||||
|
import com.ruoyi.common.excel.convert.ExcelDictConvert;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户套餐视图对象 sys_tenant_package
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-02-05
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class SysTenantPackageVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户套餐id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "租户套餐id")
|
||||||
|
private Long packageId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "套餐名称")
|
||||||
|
private String packageName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联菜单id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "关联菜单id")
|
||||||
|
private String menuIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "0=正常,1=停用")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,107 @@
|
|||||||
|
package com.ruoyi.system.domain.vo;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.ruoyi.common.excel.annotation.ExcelDictFormat;
|
||||||
|
import com.ruoyi.common.excel.convert.ExcelDictConvert;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户视图对象 sys_tenant
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-02-05
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class SysTenantVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户编号
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "租户编号")
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系人
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "联系人")
|
||||||
|
private String contactUserName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系电话
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "联系电话")
|
||||||
|
private String contactPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "企业名称")
|
||||||
|
private String companyName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统一社会信用代码
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "统一社会信用代码")
|
||||||
|
private String licenseNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地址
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业简介
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "企业简介")
|
||||||
|
private String intro;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户套餐编号
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "租户套餐编号")
|
||||||
|
private Long packageId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 过期时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "过期时间")
|
||||||
|
private Date expireTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户数量(-1不限制)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "用户数量")
|
||||||
|
private Long accountCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "租户状态", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "0=正常,1=停用")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -80,4 +80,12 @@ 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
|
||||||
|
*
|
||||||
|
* @param packageId 租户套餐ID
|
||||||
|
* @return 选中菜单列表
|
||||||
|
*/
|
||||||
|
List<Long> selectMenuListByTenantPackageId(@Param("packageId") Long packageId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.system.domain.SysTenant;
|
||||||
|
import com.ruoyi.system.domain.vo.SysTenantVo;
|
||||||
|
import com.ruoyi.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-02-05
|
||||||
|
*/
|
||||||
|
public interface SysTenantMapper extends BaseMapperPlus<SysTenantMapper, SysTenant, SysTenantVo> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.system.domain.SysTenantPackage;
|
||||||
|
import com.ruoyi.system.domain.vo.SysTenantPackageVo;
|
||||||
|
import com.ruoyi.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户套餐Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-02-05
|
||||||
|
*/
|
||||||
|
public interface SysTenantPackageMapper extends BaseMapperPlus<SysTenantPackageMapper, SysTenantPackage, SysTenantPackageVo> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -65,6 +65,14 @@ public interface ISysMenuService {
|
|||||||
*/
|
*/
|
||||||
List<Long> selectMenuListByRoleId(Long roleId);
|
List<Long> selectMenuListByRoleId(Long roleId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据租户套餐ID查询菜单树信息
|
||||||
|
*
|
||||||
|
* @param packageId 租户套餐ID
|
||||||
|
* @return 选中菜单列表
|
||||||
|
*/
|
||||||
|
List<Long> selectMenuListByTenantPackageId(Long packageId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建前端路由所需要的菜单
|
* 构建前端路由所需要的菜单
|
||||||
*
|
*
|
||||||
|
|||||||
@ -0,0 +1,48 @@
|
|||||||
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import com.ruoyi.system.domain.vo.SysTenantPackageVo;
|
||||||
|
import com.ruoyi.system.domain.bo.SysTenantPackageBo;
|
||||||
|
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户套餐Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-02-05
|
||||||
|
*/
|
||||||
|
public interface ISysTenantPackageService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询租户套餐
|
||||||
|
*/
|
||||||
|
SysTenantPackageVo queryById(Long packageId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询租户套餐列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<SysTenantPackageVo> queryPageList(SysTenantPackageBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询租户套餐列表
|
||||||
|
*/
|
||||||
|
List<SysTenantPackageVo> queryList(SysTenantPackageBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增租户套餐
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(SysTenantPackageBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改租户套餐
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(SysTenantPackageBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除租户套餐信息
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
}
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import com.ruoyi.system.domain.vo.SysTenantVo;
|
||||||
|
import com.ruoyi.system.domain.bo.SysTenantBo;
|
||||||
|
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-02-05
|
||||||
|
*/
|
||||||
|
public interface ISysTenantService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询租户
|
||||||
|
*/
|
||||||
|
SysTenantVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询租户列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<SysTenantVo> queryPageList(SysTenantBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询租户列表
|
||||||
|
*/
|
||||||
|
List<SysTenantVo> queryList(SysTenantBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增租户
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(SysTenantBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改租户
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(SysTenantBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除租户信息
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
}
|
||||||
@ -149,6 +149,17 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
return baseMapper.selectMenuListByRoleId(roleId, role.getMenuCheckStrictly());
|
return baseMapper.selectMenuListByRoleId(roleId, role.getMenuCheckStrictly());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据租户套餐ID查询菜单树信息
|
||||||
|
*
|
||||||
|
* @param packageId 租户套餐ID
|
||||||
|
* @return 选中菜单列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Long> selectMenuListByTenantPackageId(Long packageId) {
|
||||||
|
return baseMapper.selectMenuListByTenantPackageId(packageId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建前端路由所需要的菜单
|
* 构建前端路由所需要的菜单
|
||||||
*
|
*
|
||||||
|
|||||||
@ -0,0 +1,110 @@
|
|||||||
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.system.domain.bo.SysTenantPackageBo;
|
||||||
|
import com.ruoyi.system.domain.vo.SysTenantPackageVo;
|
||||||
|
import com.ruoyi.system.domain.SysTenantPackage;
|
||||||
|
import com.ruoyi.system.mapper.SysTenantPackageMapper;
|
||||||
|
import com.ruoyi.system.service.ISysTenantPackageService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户套餐Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-02-05
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class SysTenantPackageServiceImpl implements ISysTenantPackageService {
|
||||||
|
|
||||||
|
private final SysTenantPackageMapper baseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询租户套餐
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysTenantPackageVo queryById(Long packageId){
|
||||||
|
return baseMapper.selectVoById(packageId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询租户套餐列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<SysTenantPackageVo> queryPageList(SysTenantPackageBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<SysTenantPackage> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<SysTenantPackageVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询租户套餐列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysTenantPackageVo> queryList(SysTenantPackageBo bo) {
|
||||||
|
LambdaQueryWrapper<SysTenantPackage> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<SysTenantPackage> buildQueryWrapper(SysTenantPackageBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<SysTenantPackage> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getPackageName()), SysTenantPackage::getPackageName, bo.getPackageName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysTenantPackage::getStatus, bo.getStatus());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增租户套餐
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(SysTenantPackageBo bo) {
|
||||||
|
SysTenantPackage add = BeanUtil.toBean(bo, SysTenantPackage.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setPackageId(add.getPackageId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改租户套餐
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(SysTenantPackageBo bo) {
|
||||||
|
SysTenantPackage update = BeanUtil.toBean(bo, SysTenantPackage.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(SysTenantPackage entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除租户套餐
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteBatchIds(ids) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,119 @@
|
|||||||
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.system.domain.bo.SysTenantBo;
|
||||||
|
import com.ruoyi.system.domain.vo.SysTenantVo;
|
||||||
|
import com.ruoyi.system.domain.SysTenant;
|
||||||
|
import com.ruoyi.system.mapper.SysTenantMapper;
|
||||||
|
import com.ruoyi.system.service.ISysTenantService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-02-05
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class SysTenantServiceImpl implements ISysTenantService {
|
||||||
|
|
||||||
|
private final SysTenantMapper baseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询租户
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysTenantVo queryById(Long id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询租户列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<SysTenantVo> queryPageList(SysTenantBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<SysTenant> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<SysTenantVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询租户列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysTenantVo> queryList(SysTenantBo bo) {
|
||||||
|
LambdaQueryWrapper<SysTenant> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<SysTenant> buildQueryWrapper(SysTenantBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<SysTenant> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getTenantId()), SysTenant::getTenantId, bo.getTenantId());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getContactUserName()), SysTenant::getContactUserName, bo.getContactUserName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getContactPhone()), SysTenant::getContactPhone, bo.getContactPhone());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getCompanyName()), SysTenant::getCompanyName, bo.getCompanyName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getLicenseNumber()), SysTenant::getLicenseNumber, bo.getLicenseNumber());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getAddress()), SysTenant::getAddress, bo.getAddress());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getIntro()), SysTenant::getIntro, bo.getIntro());
|
||||||
|
lqw.eq(bo.getPackageId() != null, SysTenant::getPackageId, bo.getPackageId());
|
||||||
|
lqw.eq(bo.getExpireTime() != null, SysTenant::getExpireTime, bo.getExpireTime());
|
||||||
|
lqw.eq(bo.getAccountCount() != null, SysTenant::getAccountCount, bo.getAccountCount());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysTenant::getStatus, bo.getStatus());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增租户
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(SysTenantBo bo) {
|
||||||
|
SysTenant add = BeanUtil.toBean(bo, SysTenant.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改租户
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(SysTenantBo bo) {
|
||||||
|
SysTenant update = BeanUtil.toBean(bo, SysTenant.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(SysTenant entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除租户
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteBatchIds(ids) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -82,4 +82,8 @@
|
|||||||
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>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.system.mapper.SysTenantMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.system.mapper.SysTenantPackageMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -33,6 +33,14 @@ export function roleMenuTreeselect(roleId) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据角色ID查询菜单下拉树结构
|
||||||
|
export function tenantPackageMenuTreeselect(packageId) {
|
||||||
|
return request({
|
||||||
|
url: '/system/menu/tenantPackageMenuTreeselect/' + packageId,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 新增菜单
|
// 新增菜单
|
||||||
export function addMenu(data) {
|
export function addMenu(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
44
ruoyi-ui/src/api/system/tenant.js
Normal file
44
ruoyi-ui/src/api/system/tenant.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询租户列表
|
||||||
|
export function listTenant(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/tenant/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询租户详细
|
||||||
|
export function getTenant(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/tenant/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增租户
|
||||||
|
export function addTenant(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/tenant',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改租户
|
||||||
|
export function updateTenant(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/tenant',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除租户
|
||||||
|
export function delTenant(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/tenant/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
44
ruoyi-ui/src/api/system/tenantPackage.js
Normal file
44
ruoyi-ui/src/api/system/tenantPackage.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询租户套餐列表
|
||||||
|
export function listTenantPackage(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/tenantPackage/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询租户套餐详细
|
||||||
|
export function getTenantPackage(packageId) {
|
||||||
|
return request({
|
||||||
|
url: '/system/tenantPackage/' + packageId,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增租户套餐
|
||||||
|
export function addTenantPackage(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/tenantPackage',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改租户套餐
|
||||||
|
export function updateTenantPackage(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/tenantPackage',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除租户套餐
|
||||||
|
export function delTenantPackage(packageId) {
|
||||||
|
return request({
|
||||||
|
url: '/system/tenantPackage/' + packageId,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
409
ruoyi-ui/src/views/system/tenant/index.vue
Normal file
409
ruoyi-ui/src/views/system/tenant/index.vue
Normal file
@ -0,0 +1,409 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="租户编号" prop="tenantId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.tenantId"
|
||||||
|
placeholder="请输入租户编号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="联系人" prop="contactUserName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.contactUserName"
|
||||||
|
placeholder="请输入联系人"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="联系电话" prop="contactPhone">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.contactPhone"
|
||||||
|
placeholder="请输入联系电话"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="企业名称" prop="companyName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.companyName"
|
||||||
|
placeholder="请输入企业名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="统一社会信用代码" prop="licenseNumber">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.licenseNumber"
|
||||||
|
placeholder="请输入统一社会信用代码"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="过期时间" prop="expireTime">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="queryParams.expireTime"
|
||||||
|
type="date"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
placeholder="请选择过期时间">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="用户数量" prop="accountCount">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.accountCount"
|
||||||
|
placeholder="请输入用户数量"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['system:tenant:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['system:tenant:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['system:tenant:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['system:tenant:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="tenantList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="id" align="center" prop="id" v-if="true"/>
|
||||||
|
<el-table-column label="租户编号" align="center" prop="tenantId" />
|
||||||
|
<el-table-column label="联系人" align="center" prop="contactUserName" />
|
||||||
|
<el-table-column label="联系电话" align="center" prop="contactPhone" />
|
||||||
|
<el-table-column label="企业名称" align="center" prop="companyName" />
|
||||||
|
<el-table-column label="统一社会信用代码" align="center" prop="licenseNumber" />
|
||||||
|
<el-table-column label="地址" align="center" prop="address" />
|
||||||
|
<el-table-column label="企业简介" align="center" prop="intro" />
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<el-table-column label="租户套餐编号" align="center" prop="packageId" />
|
||||||
|
<el-table-column label="过期时间" align="center" prop="expireTime" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.expireTime, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="用户数量" align="center" prop="accountCount" />
|
||||||
|
<el-table-column label="租户状态" align="center" prop="status" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:tenant:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:tenant:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改租户对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="租户编号" prop="tenantId">
|
||||||
|
<el-input v-model="form.tenantId" placeholder="请输入租户编号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="联系人" prop="contactUserName">
|
||||||
|
<el-input v-model="form.contactUserName" placeholder="请输入联系人" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="联系电话" prop="contactPhone">
|
||||||
|
<el-input v-model="form.contactPhone" placeholder="请输入联系电话" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="企业名称" prop="companyName">
|
||||||
|
<el-input v-model="form.companyName" placeholder="请输入企业名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="统一社会信用代码" prop="licenseNumber">
|
||||||
|
<el-input v-model="form.licenseNumber" placeholder="请输入统一社会信用代码" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="地址" prop="address">
|
||||||
|
<el-input v-model="form.address" placeholder="请输入地址" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="企业简介" prop="intro">
|
||||||
|
<el-input v-model="form.intro" placeholder="请输入企业简介" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="租户套餐" prop="packageId">
|
||||||
|
<el-select v-model="form.packageId" placeholder="请选择租户套餐" clearable size="small" style="width: 100%">
|
||||||
|
<el-option v-for="item in packageList" :key="item.packageId" :label="item.packageName" :value="item.packageId"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="过期时间" prop="expireTime">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="form.expireTime"
|
||||||
|
type="datetime"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
placeholder="请选择过期时间">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="用户数量" prop="accountCount">
|
||||||
|
<el-input v-model="form.accountCount" placeholder="请输入用户数量" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listTenant, getTenant, delTenant, addTenant, updateTenant } from "@/api/system/tenant";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Tenant",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 按钮loading
|
||||||
|
buttonLoading: false,
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 租户表格数据
|
||||||
|
tenantList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
tenantId: undefined,
|
||||||
|
contactUserName: undefined,
|
||||||
|
contactPhone: undefined,
|
||||||
|
companyName: undefined,
|
||||||
|
licenseNumber: undefined,
|
||||||
|
address: undefined,
|
||||||
|
intro: undefined,
|
||||||
|
packageId: undefined,
|
||||||
|
expireTime: undefined,
|
||||||
|
accountCount: undefined,
|
||||||
|
status: undefined,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 租户套餐列表
|
||||||
|
packageList: [],
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
id: [
|
||||||
|
{ required: true, message: "id不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
tenantId: [
|
||||||
|
{ required: true, message: "租户编号不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
contactUserName: [
|
||||||
|
{ required: true, message: "联系人不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
contactPhone: [
|
||||||
|
{ required: true, message: "联系电话不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
companyName: [
|
||||||
|
{ required: true, message: "企业名称不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询所有租户套餐 */
|
||||||
|
getTenantPackage(){
|
||||||
|
listTenantPackage().then(res =>{
|
||||||
|
this.packageList = res.rows;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/** 查询租户列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listTenant(this.queryParams).then(response => {
|
||||||
|
this.tenantList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: undefined,
|
||||||
|
tenantId: undefined,
|
||||||
|
contactUserName: undefined,
|
||||||
|
contactPhone: undefined,
|
||||||
|
companyName: undefined,
|
||||||
|
licenseNumber: undefined,
|
||||||
|
address: undefined,
|
||||||
|
intro: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
packageId: undefined,
|
||||||
|
expireTime: undefined,
|
||||||
|
accountCount: undefined,
|
||||||
|
status: undefined,
|
||||||
|
delFlag: undefined,
|
||||||
|
createDept: undefined,
|
||||||
|
createBy: undefined,
|
||||||
|
createTime: undefined,
|
||||||
|
updateBy: undefined,
|
||||||
|
updateTime: undefined
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.id)
|
||||||
|
this.single = selection.length!==1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加租户";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.loading = true;
|
||||||
|
this.reset();
|
||||||
|
const id = row.id || this.ids
|
||||||
|
getTenant(id).then(response => {
|
||||||
|
this.loading = false;
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改租户";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
this.buttonLoading = true;
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateTenant(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
}).finally(() => {
|
||||||
|
this.buttonLoading = false;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addTenant(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
}).finally(() => {
|
||||||
|
this.buttonLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row.id || this.ids;
|
||||||
|
this.$modal.confirm('是否确认删除租户编号为"' + ids + '"的数据项?').then(() => {
|
||||||
|
this.loading = true;
|
||||||
|
return delTenant(ids);
|
||||||
|
}).then(() => {
|
||||||
|
this.loading = false;
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {
|
||||||
|
}).finally(() => {
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('system/tenant/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `tenant_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
360
ruoyi-ui/src/views/system/tenantPackage/index.vue
Normal file
360
ruoyi-ui/src/views/system/tenantPackage/index.vue
Normal file
@ -0,0 +1,360 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="套餐名称" prop="packageName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.packageName"
|
||||||
|
placeholder="请输入套餐名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['system:tenantPackage:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['system:tenantPackage:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['system:tenantPackage:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['system:tenantPackage:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="tenantPackageList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="租户套餐id" align="center" prop="packageId" v-if="true"/>
|
||||||
|
<el-table-column label="套餐名称" align="center" prop="packageName" />
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<el-table-column label="状态" align="center" prop="status" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:tenantPackage:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:tenantPackage:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改租户套餐对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="套餐名称" prop="packageName">
|
||||||
|
<el-input v-model="form.packageName" placeholder="请输入套餐名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="关联菜单">
|
||||||
|
<el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">展开/折叠</el-checkbox>
|
||||||
|
<el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">全选/全不选</el-checkbox>
|
||||||
|
<el-checkbox v-model="form.menuCheckStrictly" @change="handleCheckedTreeConnect($event, 'menu')">父子联动</el-checkbox>
|
||||||
|
<el-tree
|
||||||
|
class="tree-border"
|
||||||
|
:data="menuOptions"
|
||||||
|
show-checkbox
|
||||||
|
ref="menu"
|
||||||
|
node-key="id"
|
||||||
|
:check-strictly="!form.menuCheckStrictly"
|
||||||
|
empty-text="加载中,请稍候"
|
||||||
|
:props="defaultProps"
|
||||||
|
></el-tree>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listTenantPackage, getTenantPackage, delTenantPackage, addTenantPackage, updateTenantPackage } from "@/api/system/tenantPackage";
|
||||||
|
import { treeselect as menuTreeselect, tenantPackageMenuTreeselect } from "@/api/system/menu";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "TenantPackage",
|
||||||
|
dicts: ['sys_normal_disable'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 按钮loading
|
||||||
|
buttonLoading: false,
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 租户套餐表格数据
|
||||||
|
tenantPackageList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
menuExpand: false,
|
||||||
|
menuNodeAll: false,
|
||||||
|
// 菜单列表
|
||||||
|
menuOptions: [],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
packageName: undefined,
|
||||||
|
status: undefined,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
defaultProps: {
|
||||||
|
children: "children",
|
||||||
|
label: "label"
|
||||||
|
},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
packageId: [
|
||||||
|
{ required: true, message: "租户套餐id不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
packageName: [
|
||||||
|
{ required: true, message: "套餐名称不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询菜单树结构 */
|
||||||
|
getMenuTreeselect() {
|
||||||
|
menuTreeselect().then(response => {
|
||||||
|
this.menuOptions = response.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 所有菜单节点数据
|
||||||
|
getMenuAllCheckedKeys() {
|
||||||
|
// 目前被选中的菜单节点
|
||||||
|
let checkedKeys = this.$refs.menu.getCheckedKeys();
|
||||||
|
// 半选中的菜单节点
|
||||||
|
let halfCheckedKeys = this.$refs.menu.getHalfCheckedKeys();
|
||||||
|
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
|
||||||
|
return checkedKeys;
|
||||||
|
},
|
||||||
|
/** 根据租户套餐ID查询菜单树结构 */
|
||||||
|
getPackageMenuTreeselect(packageId) {
|
||||||
|
return tenantPackageMenuTreeselect(packageId).then(response => {
|
||||||
|
this.menuOptions = response.data.menus;
|
||||||
|
return response;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 查询租户套餐列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listTenantPackage(this.queryParams).then(response => {
|
||||||
|
this.tenantPackageList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
packageId: undefined,
|
||||||
|
packageName: undefined,
|
||||||
|
menuIds: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
status: undefined,
|
||||||
|
delFlag: undefined,
|
||||||
|
createDept: undefined,
|
||||||
|
createBy: undefined,
|
||||||
|
createTime: undefined,
|
||||||
|
updateBy: undefined,
|
||||||
|
updateTime: undefined
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.packageId)
|
||||||
|
this.single = selection.length!==1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
// 树权限(展开/折叠)
|
||||||
|
handleCheckedTreeExpand(value, type) {
|
||||||
|
if (type == 'menu') {
|
||||||
|
let treeList = this.menuOptions;
|
||||||
|
for (let i = 0; i < treeList.length; i++) {
|
||||||
|
this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 树权限(全选/全不选)
|
||||||
|
handleCheckedTreeNodeAll(value, type) {
|
||||||
|
if (type == 'menu') {
|
||||||
|
this.$refs.menu.setCheckedNodes(value ? this.menuOptions: []);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 树权限(父子联动)
|
||||||
|
handleCheckedTreeConnect(value, type) {
|
||||||
|
if (type == 'menu') {
|
||||||
|
this.form.menuCheckStrictly = value ? true: false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.getMenuTreeselect();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加租户套餐";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.loading = true;
|
||||||
|
this.reset();
|
||||||
|
const packageId = row.packageId || this.ids
|
||||||
|
const packageMenu = this.getPackageMenuTreeselect(packageId);
|
||||||
|
getTenantPackage(packageId).then(response => {
|
||||||
|
this.loading = false;
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
packageMenu.then(res => {
|
||||||
|
let checkedKeys = res.data.checkedKeys
|
||||||
|
checkedKeys.forEach((v) => {
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.$refs.menu.setChecked(v, true ,false);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
this.title = "修改租户套餐";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
this.buttonLoading = true;
|
||||||
|
if (this.form.packageId != null) {
|
||||||
|
updateTenantPackage(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
}).finally(() => {
|
||||||
|
this.buttonLoading = false;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addTenantPackage(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
}).finally(() => {
|
||||||
|
this.buttonLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const packageIds = row.packageId || this.ids;
|
||||||
|
this.$modal.confirm('是否确认删除租户套餐编号为"' + packageIds + '"的数据项?').then(() => {
|
||||||
|
this.loading = true;
|
||||||
|
return delTenantPackage(packageIds);
|
||||||
|
}).then(() => {
|
||||||
|
this.loading = false;
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {
|
||||||
|
}).finally(() => {
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('system/tenantPackage/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `tenantPackage_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user