Merge branch 'master' of http://122.51.230.86:3000/dianliang/lanan-system
This commit is contained in:
commit
7b1eada5f1
@ -1,4 +1,5 @@
|
||||
package cn.iocoder.yudao.module.company.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
@ -28,6 +29,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业信息表(每个租户的下属企业信息);(dl_company)表控制层
|
||||
*
|
||||
* @author : http://www.chiner.pro
|
||||
* @date : 2024-7-31
|
||||
*/
|
||||
@ -39,24 +41,44 @@ public class CompanyController {
|
||||
@Autowired
|
||||
private CompanyService companyService;
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得企业信息表(每个租户的下属企业信息)分页")
|
||||
@PreAuthorize("@ss.hasPermission('base:company:query')")
|
||||
public CommonResult<IPage<?>> getCompanyPage(CompanyReqVO pageReqVO,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
|
||||
Page<Company> page = new Page<>(pageNo, pageSize);
|
||||
return success(companyService.queryListPage(pageReqVO,page));
|
||||
}
|
||||
/**
|
||||
* 分页查询
|
||||
* @author vinjor-M
|
||||
* @date 9:52 2024/8/2
|
||||
* @param pageReqVO 查询条件对象
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 条数
|
||||
**/
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得企业信息表(每个租户的下属企业信息)分页")
|
||||
@PreAuthorize("@ss.hasPermission('base:company:query')")
|
||||
public CommonResult<IPage<?>> getCompanyPage(CompanyReqVO pageReqVO,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<Company> page = new Page<>(pageNo, pageSize);
|
||||
return success(companyService.queryListPage(pageReqVO, page));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增企业
|
||||
* @author vinjor-M
|
||||
* @date 9:53 2024/8/2
|
||||
* @param companyRespVO 企业对象
|
||||
**/
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建企业信息表(每个租户的下属企业信息)")
|
||||
@PreAuthorize("@ss.hasPermission('base:company:create')")
|
||||
public CommonResult<String> createCompany(@RequestBody Company company) {
|
||||
companyService.save(company);
|
||||
public CommonResult<String> createCompany(@RequestBody CompanyRespVO companyRespVO) {
|
||||
companyService.save(companyRespVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新企业
|
||||
* @author vinjor-M
|
||||
* @date 9:53 2024/8/2
|
||||
* @param company 企业对象
|
||||
**/
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新企业信息表(每个租户的下属企业信息)")
|
||||
@PreAuthorize("@ss.hasPermission('base:company:update')")
|
||||
@ -65,6 +87,12 @@ public class CompanyController {
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除企业
|
||||
* @author vinjor-M
|
||||
* @date 9:53 2024/8/2
|
||||
* @param id 企业id
|
||||
**/
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除企业信息表(每个租户的下属企业信息)")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@ -74,6 +102,12 @@ public class CompanyController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询企业
|
||||
* @author vinjor-M
|
||||
* @date 9:53 2024/8/2
|
||||
* @param id 企业id
|
||||
**/
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得企业信息表(每个租户的下属企业信息)")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@ -83,11 +117,18 @@ public class CompanyController {
|
||||
return success(BeanUtils.toBean(company, CompanyRespVO.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出企业
|
||||
* @author vinjor-M
|
||||
* @date 9:53 2024/8/2
|
||||
* @param pageReqVO 查询条件--暂时导出所有
|
||||
* @param response 返回体
|
||||
**/
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出企业信息表(每个租户的下属企业信息) Excel")
|
||||
@PreAuthorize("@ss.hasPermission('base:company:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportCompanyExcel( CompanyReqVO pageReqVO,
|
||||
public void exportCompanyExcel(CompanyReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<Company> list = companyService.list();
|
||||
// 导出 Excel
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.company.service;
|
||||
|
||||
import cn.iocoder.yudao.module.company.entity.Company;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyReqVO;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyRespVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
@ -19,4 +20,12 @@ public interface CompanyService extends IService<Company> {
|
||||
* @return 企业信息表(每个租户的下属企业信息)分页
|
||||
*/
|
||||
IPage<Company> queryListPage(CompanyReqVO pageReqVO, Page<Company> page);
|
||||
|
||||
/**
|
||||
* 新增企业信息
|
||||
* @author vinjor-M
|
||||
* @date 9:56 2024/8/2
|
||||
* @param companyRespVO 企业对象
|
||||
**/
|
||||
void saveDataObj(CompanyRespVO companyRespVO);
|
||||
}
|
@ -1,14 +1,30 @@
|
||||
package cn.iocoder.yudao.module.company.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.module.company.entity.Company;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyRespVO;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
|
||||
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
|
||||
import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.enums.permission.RoleCodeEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.permission.RoleTypeEnum;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyReqVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import cn.iocoder.yudao.module.company.mapper.CompanyMapper;
|
||||
import cn.iocoder.yudao.module.company.service.CompanyService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static java.util.Collections.singleton;
|
||||
|
||||
/**
|
||||
* 企业信息表(每个租户的下属企业信息);(dl_company)表服务实现类
|
||||
@ -19,17 +35,73 @@ import cn.iocoder.yudao.module.company.service.CompanyService;
|
||||
public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> implements CompanyService {
|
||||
@Autowired
|
||||
private CompanyMapper companyMapper;
|
||||
@Resource
|
||||
@Lazy // 延迟,避免循环依赖报错
|
||||
private AdminUserApi adminUserApi;
|
||||
@Resource
|
||||
private RoleApi roleApi;
|
||||
@Resource
|
||||
private PermissionApi permissionApi;
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
|
||||
|
||||
/**
|
||||
* 获得企业信息表(每个租户的下属企业信息)分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @param page
|
||||
* @return 企业信息表(每个租户的下属企业信息)分页
|
||||
* @param pageReqVO 分页查询条件
|
||||
* @param page 分页对象
|
||||
* @author vinjor-M
|
||||
*/
|
||||
@Override
|
||||
public IPage<Company> queryListPage(CompanyReqVO pageReqVO, Page<Company> page) {
|
||||
return companyMapper.selectListPage(pageReqVO,page);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增企业信息
|
||||
*
|
||||
* @param companyRespVO 企业对象
|
||||
* @author vinjor-M
|
||||
* @date 9:56 2024/8/2
|
||||
**/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveDataObj(CompanyRespVO companyRespVO) {
|
||||
/*1.保存企业信息*/
|
||||
this.save(companyRespVO);
|
||||
/*2.新增企业管理员角色和用户信息*/
|
||||
|
||||
/*3.新增企业部门信息*/
|
||||
DeptRespDTO deptRespDTO = new DeptRespDTO();
|
||||
deptRespDTO.setName(companyRespVO.getCorpName());
|
||||
deptRespDTO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
// deptRespDTO.setLeaderUserId(userId);
|
||||
deptApi.saveDept(deptRespDTO);
|
||||
/*3.更新企业管理员所属部门信息*/
|
||||
}
|
||||
|
||||
// private Long createUser(Long roleId, CompanyRespVO companyRespVO) {
|
||||
// // 创建用户
|
||||
// Long userId = adminUserApi.createUser(TenantConvert.INSTANCE.convert02(createReqVO));
|
||||
// // 分配角色
|
||||
// permissionService.assignUserRole(userId, singleton(roleId));
|
||||
// return userId;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 创建企业时自动创建企业管理员角色
|
||||
// * @author vinjor-M
|
||||
// * @date 10:22 2024/8/2
|
||||
// * @param companyRespVO 企业对象
|
||||
// **/
|
||||
// private Long createRole(CompanyRespVO companyRespVO) {
|
||||
// // 创建角色
|
||||
// RoleReqDTO reqVO = new RoleReqDTO();
|
||||
// reqVO.setName(RoleCodeEnum.COMPANY_ADMIN.getName()).setCode(RoleCodeEnum.COMPANY_ADMIN.getCode())
|
||||
// .setSort(0).setRemark("系统自动生成");
|
||||
// Long roleId = roleApi.createRole(reqVO, RoleTypeEnum.SYSTEM.getType());
|
||||
// // 分配权限
|
||||
// permissionApi.assignRoleMenu(roleId, companyRespVO.getMenuIds());
|
||||
// return roleId;
|
||||
// }
|
||||
}
|
@ -16,5 +16,8 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
**/
|
||||
@Data
|
||||
public class CompanyRespVO extends Company {
|
||||
|
||||
/**
|
||||
* 该企业分配的菜单权限
|
||||
*/
|
||||
String menuIds;
|
||||
}
|
||||
|
@ -13,6 +13,13 @@ import java.util.Map;
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface DeptApi {
|
||||
/**
|
||||
* 创建部门信息
|
||||
*
|
||||
* @param deptRespDTO 部门对象
|
||||
* @return 部门id
|
||||
*/
|
||||
Long saveDept(DeptRespDTO deptRespDTO);
|
||||
|
||||
/**
|
||||
* 获得部门信息
|
||||
|
@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.system.api.permission.dto;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 角色 Request DTO
|
||||
*
|
||||
* @author vinjor-m
|
||||
*/
|
||||
@Data
|
||||
public class RoleReqDTO {
|
||||
|
||||
/**
|
||||
* 角色编号
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 顺序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
@ -111,6 +111,11 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode TENANT_PACKAGE_USED = new ErrorCode(1_002_016_001, "租户正在使用该套餐,请给租户重新设置套餐后再尝试删除");
|
||||
ErrorCode TENANT_PACKAGE_DISABLE = new ErrorCode(1_002_016_002, "名字为【{}】的租户套餐已被禁用");
|
||||
|
||||
// ========== 服务套餐 1-002-017-000 ==========
|
||||
ErrorCode SERVICE_PACKAGE_NOT_EXISTS = new ErrorCode(1_002_017_000, "服务套餐不存在");
|
||||
ErrorCode SERVICE_PACKAGE_USED = new ErrorCode(1_002_017_001, "租户正在使用该套餐,请给租户重新设置套餐后再尝试删除");
|
||||
ErrorCode SERVICE_PACKAGE_DISABLE = new ErrorCode(1_002_017_002, "名字为【{}】的服务套餐已被禁用");
|
||||
|
||||
// ========== 社交用户 1-002-018-000 ==========
|
||||
ErrorCode SOCIAL_USER_AUTH_FAILURE = new ErrorCode(1_002_018_000, "社交授权失败,原因是:{}");
|
||||
ErrorCode SOCIAL_USER_NOT_FOUND = new ErrorCode(1_002_018_001, "社交授权失败,找不到对应的用户");
|
||||
|
@ -13,8 +13,9 @@ public enum RoleCodeEnum {
|
||||
|
||||
SUPER_ADMIN("super_admin", "超级管理员"),
|
||||
TENANT_ADMIN("tenant_admin", "租户管理员"),
|
||||
CRM_ADMIN("crm_admin", "CRM 管理员"); // CRM 系统专用
|
||||
;
|
||||
CRM_ADMIN("crm_admin", "CRM 管理员"), // CRM 系统专用
|
||||
COMPANY_ADMIN("company_admin", "企业管理员");
|
||||
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
|
@ -2,8 +2,11 @@ package cn.iocoder.yudao.module.system.api.dept;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||
import cn.iocoder.yudao.module.system.dal.redis.RedisKeyConstants;
|
||||
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -22,6 +25,17 @@ public class DeptApiImpl implements DeptApi {
|
||||
@Resource
|
||||
private DeptService deptService;
|
||||
|
||||
/**
|
||||
* 创建部门信息
|
||||
* @param deptRespDTO 部门对象
|
||||
* @return 部门id
|
||||
*/
|
||||
@Override
|
||||
public Long saveDept(DeptRespDTO deptRespDTO) {
|
||||
DeptSaveReqVO deptSaveReqVO = BeanUtils.toBean(deptRespDTO,DeptSaveReqVO.class);
|
||||
return deptService.createDept(deptSaveReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeptRespDTO getDept(Long id) {
|
||||
DeptDO dept = deptService.getDept(id);
|
||||
|
@ -0,0 +1,92 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.service;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.packages.TenantPackageSimpleRespVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantPackageDO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.system.controller.admin.service.vo.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.service.ServicePackageDO;
|
||||
import cn.iocoder.yudao.module.system.service.service.ServicePackageService;
|
||||
|
||||
@Tag(name = "管理后台 - 服务套餐")
|
||||
@RestController
|
||||
@RequestMapping("/system/service-package")
|
||||
@Validated
|
||||
public class ServicePackageController {
|
||||
|
||||
@Resource
|
||||
private ServicePackageService servicePackageService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建服务套餐")
|
||||
@PreAuthorize("@ss.hasPermission('system:service-package:create')")
|
||||
public CommonResult<String> createServicePackage(@Valid @RequestBody ServicePackageSaveReqVO createReqVO) {
|
||||
return success(servicePackageService.createServicePackage(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新服务套餐")
|
||||
@PreAuthorize("@ss.hasPermission('system:service-package:update')")
|
||||
public CommonResult<Boolean> updateServicePackage(@Valid @RequestBody ServicePackageSaveReqVO updateReqVO) {
|
||||
servicePackageService.updateServicePackage(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除服务套餐")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('system:service-package:delete')")
|
||||
public CommonResult<Boolean> deleteServicePackage(@RequestParam("id") String id) {
|
||||
servicePackageService.deleteServicePackage(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得服务套餐")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:service-package:query')")
|
||||
public CommonResult<ServicePackageRespVO> getServicePackage(@RequestParam("id") String id) {
|
||||
ServicePackageDO servicePackage = servicePackageService.getServicePackage(id);
|
||||
return success(BeanUtils.toBean(servicePackage, ServicePackageRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得服务套餐分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:service-package:query')")
|
||||
public CommonResult<PageResult<ServicePackageRespVO>> getServicePackagePage(@Valid ServicePackagePageReqVO pageReqVO) {
|
||||
PageResult<ServicePackageDO> pageResult = servicePackageService.getServicePackagePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, ServicePackageRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping({"/get-simple-list", "simple-list"})
|
||||
@Operation(summary = "获取服务套餐精简信息列表", description = "只包含被开启的服务套餐,主要用于前端的下拉选项")
|
||||
public CommonResult<List<ServicePackageSimpleRespVO>> getTenantPackageList() {
|
||||
List<ServicePackageDO> list = servicePackageService.getServicePackageListByStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
return success(BeanUtils.toBean(list, ServicePackageSimpleRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.service.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 服务套餐分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ServicePackagePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "套餐名", example = "赵六")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "套餐状态(0正常 1停用)", example = "2")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.service.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 服务套餐 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ServicePackageRespVO {
|
||||
|
||||
@Schema(description = "套餐编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1800")
|
||||
@ExcelProperty("套餐编号")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "套餐名", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@ExcelProperty("套餐名")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "套餐状态(0正常 1停用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("租户状态(0正常 1停用)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "关联的菜单编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("关联的菜单编号")
|
||||
private Set<Long> menuIds;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.service.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 服务套餐新增/修改 Request VO")
|
||||
@Data
|
||||
public class ServicePackageSaveReqVO {
|
||||
|
||||
@Schema(description = "套餐编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1800")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "套餐名", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@NotEmpty(message = "套餐名不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "套餐状态(0正常 1停用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "套餐状态(0正常 1停用)不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "关联的菜单编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "关联的菜单编号不能为空")
|
||||
private Set<Long> menuIds;
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.service.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 -服务套餐精简 Response VO")
|
||||
@Data
|
||||
public class ServicePackageSimpleRespVO {
|
||||
|
||||
@Schema(description = "套餐编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "套餐编号不能为空")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "套餐名", requiredMode = Schema.RequiredMode.REQUIRED, example = "VIP")
|
||||
@NotNull(message = "套餐名不能为空")
|
||||
private String name;
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.service;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 服务套餐 DO
|
||||
*
|
||||
* @author 后台管理员
|
||||
*/
|
||||
@TableName("system_service_package")
|
||||
@KeySequence("system_service_package_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ServicePackageDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 套餐编号
|
||||
*/
|
||||
@TableId
|
||||
private String id;
|
||||
/**
|
||||
* 套餐名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 租户状态(0正常 1停用)
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 关联的菜单编号
|
||||
*/
|
||||
private String menuIds;
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.service.ServicePackageDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantPackageDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.service.vo.*;
|
||||
|
||||
/**
|
||||
* 服务套餐 Mapper
|
||||
*
|
||||
* @author 后台管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface ServicePackageMapper extends BaseMapperX<ServicePackageDO> {
|
||||
|
||||
default PageResult<ServicePackageDO> selectPage(ServicePackagePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ServicePackageDO>()
|
||||
.likeIfPresent(ServicePackageDO::getName, reqVO.getName())
|
||||
.eqIfPresent(ServicePackageDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(ServicePackageDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(ServicePackageDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(ServicePackageDO::getId));
|
||||
}
|
||||
default List<ServicePackageDO> selectListByStatus(Integer status) {
|
||||
return selectList(ServicePackageDO::getStatus, status);
|
||||
}
|
||||
}
|
@ -59,6 +59,7 @@ public class DeptServiceImpl implements DeptService {
|
||||
@Override
|
||||
@CacheEvict(cacheNames = RedisKeyConstants.DEPT_CHILDREN_ID_LIST,
|
||||
allEntries = true) // allEntries 清空所有缓存,因为操作一个部门,涉及到多个缓存
|
||||
@TenantIgnore //不自动拼接租户id
|
||||
public void updateDept(DeptSaveReqVO updateReqVO) {
|
||||
if (updateReqVO.getParentId() == null) {
|
||||
updateReqVO.setParentId(DeptDO.PARENT_ID_ROOT);
|
||||
|
@ -0,0 +1,71 @@
|
||||
package cn.iocoder.yudao.module.system.service.service;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.service.vo.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.service.ServicePackageDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantPackageDO;
|
||||
|
||||
/**
|
||||
* 服务套餐 Service 接口
|
||||
*
|
||||
* @author 后台管理员
|
||||
*/
|
||||
public interface ServicePackageService {
|
||||
|
||||
/**
|
||||
* 创建服务套餐
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
String createServicePackage(@Valid ServicePackageSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新服务套餐
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateServicePackage(@Valid ServicePackageSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除服务套餐
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteServicePackage(String id);
|
||||
|
||||
/**
|
||||
* 获得服务套餐
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 服务套餐
|
||||
*/
|
||||
ServicePackageDO getServicePackage(String id);
|
||||
|
||||
/**
|
||||
* 获得服务套餐分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 服务套餐分页
|
||||
*/
|
||||
PageResult<ServicePackageDO> getServicePackagePage(ServicePackagePageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 校验服务套餐
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 服务套餐
|
||||
*/
|
||||
ServicePackageDO validServicePackage(String id);
|
||||
|
||||
/**
|
||||
* 获得指定状态的服务套餐列表
|
||||
*
|
||||
* @param status 状态
|
||||
* @return 服务套餐
|
||||
*/
|
||||
List<ServicePackageDO> getServicePackageListByStatus(Integer status);
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
package cn.iocoder.yudao.module.system.service.service;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantPackageDO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.service.vo.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.service.ServicePackageDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.service.ServicePackageMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 服务套餐 Service 实现类
|
||||
*
|
||||
* @author 后台管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ServicePackageServiceImpl implements ServicePackageService {
|
||||
|
||||
@Resource
|
||||
private ServicePackageMapper servicePackageMapper;
|
||||
|
||||
@Override
|
||||
public String createServicePackage(ServicePackageSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
ServicePackageDO servicePackage = BeanUtils.toBean(createReqVO, ServicePackageDO.class);
|
||||
servicePackageMapper.insert(servicePackage);
|
||||
// 返回
|
||||
return servicePackage.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateServicePackage(ServicePackageSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
if (servicePackageMapper.selectById(updateReqVO.getId()) == null) {
|
||||
//不存在,执行插入
|
||||
this.createServicePackage(updateReqVO);
|
||||
}else {
|
||||
// 更新
|
||||
ServicePackageDO updateObj = BeanUtils.toBean(updateReqVO, ServicePackageDO.class);
|
||||
servicePackageMapper.updateById(updateObj);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteServicePackage(String id) {
|
||||
// 校验存在
|
||||
validateServicePackageExists(id);
|
||||
// 校验正在使用--TODO 后续完善
|
||||
// validateTenantUsed(id);
|
||||
// 删除
|
||||
servicePackageMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateServicePackageExists(String id) {
|
||||
if (servicePackageMapper.selectById(id) == null) {
|
||||
throw exception(SERVICE_PACKAGE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServicePackageDO getServicePackage(String id) {
|
||||
return servicePackageMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ServicePackageDO> getServicePackagePage(ServicePackagePageReqVO pageReqVO) {
|
||||
return servicePackageMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServicePackageDO validServicePackage(String id) {
|
||||
// ServicePackageDO tenantPackage = tenantPackageMapper.selectById(id);
|
||||
// if (tenantPackage == null) {
|
||||
// throw exception(TENANT_PACKAGE_NOT_EXISTS);
|
||||
// }
|
||||
// if (tenantPackage.getStatus().equals(CommonStatusEnum.DISABLE.getStatus())) {
|
||||
// throw exception(TENANT_PACKAGE_DISABLE, tenantPackage.getName());
|
||||
// }
|
||||
// return tenantPackage;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ServicePackageDO> getServicePackageListByStatus(Integer status) {
|
||||
return servicePackageMapper.selectListByStatus(status);
|
||||
}
|
||||
|
||||
}
|
@ -251,6 +251,7 @@ yudao:
|
||||
ignore-tables:
|
||||
- system_tenant
|
||||
- system_tenant_package
|
||||
- system_service_package
|
||||
- system_dict_data
|
||||
- system_dict_type
|
||||
- system_error_code
|
||||
|
Loading…
Reference in New Issue
Block a user