1. 修复回滚父子角色功能时错误的代码逻辑,补全单元测试用例
2. 新增支持切换后业务菜单查询需限定只查询该公司业务数据能力
This commit is contained in:
@@ -10,5 +10,7 @@ public interface ErrorCodeConstants {
|
||||
|
||||
// ========== 模板样例 1_100_000_000 ==========
|
||||
ErrorCode EXAMPLE_NOT_EXISTS = new ErrorCode(1_100_000_000, "模板样例不存在");
|
||||
// ========== 合同 补充编号 ==========
|
||||
ErrorCode DEMO_CONTRACT_NOT_EXISTS = new ErrorCode(2_100_000_000, "合同不存在");
|
||||
|
||||
}
|
||||
|
||||
@@ -121,6 +121,11 @@
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-monitor</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-business</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package cn.iocoder.yudao.module.template;
|
||||
|
||||
import cn.iocoder.yudao.framework.business.framework.BusinessDataPermissionConfiguration;
|
||||
import cn.iocoder.yudao.framework.datapermission.config.YudaoCompanyDataPermissionAutoConfiguration;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* 项目的启动类
|
||||
@@ -9,6 +12,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
* @author 周迪
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@Import(BusinessDataPermissionConfiguration.class)
|
||||
public class TemplateServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,66 @@
|
||||
package cn.iocoder.yudao.module.template.controller.admin.contract.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import java.math.BigDecimal;
|
||||
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
|
||||
public class DemoContractPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "合同编号")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "合同名称", example = "李四")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "合同状态", example = "1")
|
||||
private Short status;
|
||||
|
||||
@Schema(description = "流程实例ID", example = "24962")
|
||||
private Long processInstanceId;
|
||||
|
||||
@Schema(description = "签订日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] signDate;
|
||||
|
||||
@Schema(description = "合同开始日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] startDate;
|
||||
|
||||
@Schema(description = "合同结束日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] endDate;
|
||||
|
||||
@Schema(description = "合同金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "公司ID", example = "4180")
|
||||
private Long companyId;
|
||||
|
||||
@Schema(description = "公司名称", example = "张三")
|
||||
private String companyName;
|
||||
|
||||
@Schema(description = "部门ID", example = "1707")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "部门名称", example = "张三")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "岗位ID", example = "26779")
|
||||
private Long postId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package cn.iocoder.yudao.module.template.controller.admin.contract.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 合同 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class DemoContractRespVO {
|
||||
|
||||
@Schema(description = "合同ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9541")
|
||||
@ExcelProperty("合同ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("合同编号")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||
@ExcelProperty("合同名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "合同状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("合同状态")
|
||||
private Short status;
|
||||
|
||||
@Schema(description = "流程实例ID", example = "24962")
|
||||
@ExcelProperty("流程实例ID")
|
||||
private Long processInstanceId;
|
||||
|
||||
@Schema(description = "签订日期")
|
||||
@ExcelProperty("签订日期")
|
||||
private LocalDateTime signDate;
|
||||
|
||||
@Schema(description = "合同开始日期")
|
||||
@ExcelProperty("合同开始日期")
|
||||
private LocalDateTime startDate;
|
||||
|
||||
@Schema(description = "合同结束日期")
|
||||
@ExcelProperty("合同结束日期")
|
||||
private LocalDateTime endDate;
|
||||
|
||||
@Schema(description = "合同金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("合同金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "公司ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4180")
|
||||
@ExcelProperty("公司ID")
|
||||
private Long companyId;
|
||||
|
||||
@Schema(description = "公司名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@ExcelProperty("公司名称")
|
||||
private String companyName;
|
||||
|
||||
@Schema(description = "部门ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1707")
|
||||
@ExcelProperty("部门ID")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@ExcelProperty("部门名称")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "岗位ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26779")
|
||||
@ExcelProperty("岗位ID")
|
||||
private Long postId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package cn.iocoder.yudao.module.template.controller.admin.contract.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 合同新增/修改 Request VO")
|
||||
@Data
|
||||
public class DemoContractSaveReqVO {
|
||||
|
||||
@Schema(description = "合同ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9541")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||
@NotEmpty(message = "合同名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "签订日期")
|
||||
private LocalDateTime signDate;
|
||||
|
||||
@Schema(description = "合同开始日期")
|
||||
private LocalDateTime startDate;
|
||||
|
||||
@Schema(description = "合同结束日期")
|
||||
private LocalDateTime endDate;
|
||||
|
||||
@Schema(description = "合同金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "合同金额不能为空")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "公司ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4180")
|
||||
@NotNull(message = "公司ID不能为空")
|
||||
private Long companyId;
|
||||
|
||||
@Schema(description = "公司名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@NotEmpty(message = "公司名称不能为空")
|
||||
private String companyName;
|
||||
|
||||
@Schema(description = "部门ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1707")
|
||||
@NotNull(message = "部门ID不能为空")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@NotEmpty(message = "部门名称不能为空")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "岗位ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26779")
|
||||
@NotNull(message = "岗位ID不能为空")
|
||||
private Long postId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package cn.iocoder.yudao.module.template.dal.dataobject.contract;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BusinessBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 合同 DO
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@TableName("demo_contract")
|
||||
@KeySequence("demo_contract_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DemoContractDO extends BusinessBaseDO {
|
||||
|
||||
/**
|
||||
* 合同ID
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 合同编号
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 合同名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 合同状态
|
||||
*/
|
||||
private Short status;
|
||||
/**
|
||||
* 流程实例ID
|
||||
*/
|
||||
private Long processInstanceId;
|
||||
/**
|
||||
* 签订日期
|
||||
*/
|
||||
private LocalDateTime signDate;
|
||||
/**
|
||||
* 合同开始日期
|
||||
*/
|
||||
private LocalDateTime startDate;
|
||||
/**
|
||||
* 合同结束日期
|
||||
*/
|
||||
private LocalDateTime endDate;
|
||||
/**
|
||||
* 合同金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.template.dal.mysql.contract;
|
||||
|
||||
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.template.dal.dataobject.contract.DemoContractDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.template.controller.admin.contract.vo.*;
|
||||
|
||||
/**
|
||||
* 合同 Mapper
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Mapper
|
||||
public interface DemoContractMapper extends BaseMapperX<DemoContractDO> {
|
||||
|
||||
default PageResult<DemoContractDO> selectPage(DemoContractPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<DemoContractDO>()
|
||||
.eqIfPresent(DemoContractDO::getCode, reqVO.getCode())
|
||||
.likeIfPresent(DemoContractDO::getName, reqVO.getName())
|
||||
.eqIfPresent(DemoContractDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(DemoContractDO::getProcessInstanceId, reqVO.getProcessInstanceId())
|
||||
.betweenIfPresent(DemoContractDO::getSignDate, reqVO.getSignDate())
|
||||
.betweenIfPresent(DemoContractDO::getStartDate, reqVO.getStartDate())
|
||||
.betweenIfPresent(DemoContractDO::getEndDate, reqVO.getEndDate())
|
||||
.eqIfPresent(DemoContractDO::getAmount, reqVO.getAmount())
|
||||
.eqIfPresent(DemoContractDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(DemoContractDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(DemoContractDO::getCompanyId, reqVO.getCompanyId())
|
||||
.likeIfPresent(DemoContractDO::getCompanyName, reqVO.getCompanyName())
|
||||
.eqIfPresent(DemoContractDO::getDeptId, reqVO.getDeptId())
|
||||
.likeIfPresent(DemoContractDO::getDeptName, reqVO.getDeptName())
|
||||
.eqIfPresent(DemoContractDO::getPostId, reqVO.getPostId())
|
||||
.orderByDesc(DemoContractDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package cn.iocoder.yudao.module.template.service.contract;
|
||||
|
||||
import java.util.*;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.module.template.controller.admin.contract.vo.*;
|
||||
import cn.iocoder.yudao.module.template.dal.dataobject.contract.DemoContractDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 合同 Service 接口
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
public interface DemoContractService {
|
||||
|
||||
/**
|
||||
* 创建合同
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDemoContract(@Valid DemoContractSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新合同
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDemoContract(@Valid DemoContractSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除合同
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDemoContract(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除合同
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteDemoContractListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得合同
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 合同
|
||||
*/
|
||||
DemoContractDO getDemoContract(Long id);
|
||||
|
||||
/**
|
||||
* 获得合同分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 合同分页
|
||||
*/
|
||||
PageResult<DemoContractDO> getDemoContractPage(DemoContractPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user