✨ Introducing new features. 新增租户菜单功能
This commit is contained in:
1 parent
4cb7646afb
commit
6e31ea6f9f
6 files changed
+225
No files matched your search
+3
@@ -82,6 +82,9 @@ public class SysTenant extends Model<SysTenant> {
|
||||
@ApiModelProperty(value = "租户冻结标记,9:冻结,0:正常")
|
||||
private String status;
|
||||
|
||||
@ApiModelProperty("租户菜单ID")
|
||||
private String menuId;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package com.pig4cloud.pigx.admin.api.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 租户菜单
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "租户菜单")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysTenantMenu extends Model<SysTenantMenu> {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 租户菜单名称
|
||||
*/
|
||||
@ApiModelProperty(value = "租户菜单名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 菜单id集合
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单id集合")
|
||||
private String menuIds;
|
||||
|
||||
/**
|
||||
* 0正常 9-冻结
|
||||
*/
|
||||
@ApiModelProperty(value = "租户菜单,9:冻结,0:正常")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
@ApiModelProperty(value = "修改人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@ApiModelProperty(value = "删除标记,1:已删除,0:正常")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package com.pig4cloud.pigx.admin.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysTenantMenu;
|
||||
import com.pig4cloud.pigx.admin.service.SysTenantMenuService;
|
||||
import com.pig4cloud.pigx.common.core.constant.CacheConstants;
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.log.annotation.SysLog;
|
||||
import com.pig4cloud.pigx.common.security.annotation.Inner;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/tenant-menu")
|
||||
@Api(value = "tenant", tags = "租户菜单管理")
|
||||
public class SysTenantMenuController {
|
||||
|
||||
private final SysTenantMenuService sysTenantMenuService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param sysTenantMenu 租户菜单
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R getSysTenantPage(Page page, SysTenantMenu sysTenantMenu) {
|
||||
return R.ok(sysTenantMenuService.page(page, Wrappers.query(sysTenantMenu)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询租户信息
|
||||
* @param sysTenantMenu 查询条件
|
||||
* @return 租户信息
|
||||
*/
|
||||
@GetMapping
|
||||
public R getByObj(SysTenantMenu sysTenantMenu) {
|
||||
return R.ok(sysTenantMenuService.list(Wrappers.query(sysTenantMenu)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增租户
|
||||
* @param sysTenantMenu 租户
|
||||
* @return R
|
||||
*/
|
||||
@SysLog("新增租户")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('admin_systenantmenu_add')")
|
||||
@CacheEvict(value = CacheConstants.TENANT_DETAILS, allEntries = true)
|
||||
public R save(@RequestBody SysTenantMenu sysTenantMenu) {
|
||||
return R.ok(sysTenantMenuService.saveTenant(sysTenantMenu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改租户
|
||||
* @param sysTenantMenu 租户
|
||||
* @return R
|
||||
*/
|
||||
@SysLog("修改租户")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('admin_systenantmenu_edit')")
|
||||
@CacheEvict(value = CacheConstants.TENANT_DETAILS, allEntries = true)
|
||||
public R updateById(@RequestBody SysTenantMenu sysTenantMenu) {
|
||||
return R.ok(sysTenantMenuService.updateById(sysTenantMenu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除租户
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@SysLog("删除租户")
|
||||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('admin_systenantmenu_del')")
|
||||
@CacheEvict(value = CacheConstants.TENANT_DETAILS, allEntries = true)
|
||||
public R removeById(@PathVariable Long id) {
|
||||
return R.ok(sysTenantMenuService.removeById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部有效的租户
|
||||
* @return
|
||||
*/
|
||||
@Inner(value = false)
|
||||
@GetMapping("/list")
|
||||
public R list() {
|
||||
List<SysTenantMenu> tenants = sysTenantMenuService.list(
|
||||
Wrappers.<SysTenantMenu>lambdaQuery().eq(SysTenantMenu::getStatus, CommonConstants.STATUS_NORMAL));
|
||||
return R.ok(tenants);
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.pig4cloud.pigx.admin.mapper;
|
||||
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysTenantMenu;
|
||||
import com.pig4cloud.pigx.common.data.datascope.PigxBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SysTenantMenuMapper extends PigxBaseMapper<SysTenantMenu> {
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.pig4cloud.pigx.admin.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysTenantMenu;
|
||||
|
||||
public interface SysTenantMenuService extends IService<SysTenantMenu> {
|
||||
|
||||
Boolean saveTenant(SysTenantMenu sysTenantMenu);
|
||||
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.pig4cloud.pigx.admin.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysTenantMenu;
|
||||
import com.pig4cloud.pigx.admin.mapper.SysTenantMenuMapper;
|
||||
import com.pig4cloud.pigx.admin.service.SysTenantMenuService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 租户菜单管理
|
||||
*/
|
||||
@Service
|
||||
public class SysTenantMenuServiceImpl extends ServiceImpl<SysTenantMenuMapper, SysTenantMenu>
|
||||
implements SysTenantMenuService {
|
||||
|
||||
@Override
|
||||
public Boolean saveTenant(SysTenantMenu sysTenantMenu) {
|
||||
return this.save(sysTenantMenu);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user