From 0f67d1edde03d41dc6d779e9f0edca3e3f1d8dfa Mon Sep 17 00:00:00 2001 From: hhyykk Date: Thu, 18 Jul 2024 09:05:38 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E4=BB=A3=E7=A0=81=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projectuser/ProjectUserController.java | 42 +++++++++---------- .../projectuser/vo/ProjectUserPageReqVO.java | 11 ++--- .../projectuser/vo/ProjectUserRespVO.java | 5 +-- .../projectuser/vo/ProjectUserSaveReqVO.java | 4 +- .../dataobject/projectuser/ProjectUserDO.java | 9 ++-- .../mysql/projectuser/ProjectUserMapper.java | 10 ----- .../projectuser/ProjectUserService.java | 9 ++-- .../projectuser/ProjectUserServiceImpl.java | 18 ++++---- .../ProjectUserServiceImplTest.java | 30 +++++-------- 9 files changed, 52 insertions(+), 86 deletions(-) diff --git a/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/projectuser/ProjectUserController.java b/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/projectuser/ProjectUserController.java index a6ef69bc9..a26ee7d69 100644 --- a/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/projectuser/ProjectUserController.java +++ b/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/projectuser/ProjectUserController.java @@ -1,33 +1,31 @@ package cn.iocoder.yudao.module.pms.controller.admin.projectuser; -import org.springframework.web.bind.annotation.*; -import jakarta.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 jakarta.validation.constraints.*; -import jakarta.validation.*; -import jakarta.servlet.http.*; -import java.util.*; -import java.io.IOException; - +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; 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.pms.controller.admin.projectuser.vo.*; +import cn.iocoder.yudao.module.pms.controller.admin.projectuser.vo.ProjectUserPageReqVO; +import cn.iocoder.yudao.module.pms.controller.admin.projectuser.vo.ProjectUserRespVO; +import cn.iocoder.yudao.module.pms.controller.admin.projectuser.vo.ProjectUserSaveReqVO; import cn.iocoder.yudao.module.pms.dal.dataobject.projectuser.ProjectUserDO; import cn.iocoder.yudao.module.pms.service.projectuser.ProjectUserService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.io.IOException; +import java.util.List; + +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @Tag(name = "管理后台 - 项目与人员关联关系") @RestController diff --git a/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/projectuser/vo/ProjectUserPageReqVO.java b/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/projectuser/vo/ProjectUserPageReqVO.java index 0b5b4b5ed..0999fb32a 100644 --- a/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/projectuser/vo/ProjectUserPageReqVO.java +++ b/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/projectuser/vo/ProjectUserPageReqVO.java @@ -1,13 +1,10 @@ package cn.iocoder.yudao.module.pms.controller.admin.projectuser.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; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; @Schema(description = "管理后台 - 项目与人员关联关系分页 Request VO") @Data diff --git a/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/projectuser/vo/ProjectUserRespVO.java b/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/projectuser/vo/ProjectUserRespVO.java index 6c26e691b..ff64cb024 100644 --- a/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/projectuser/vo/ProjectUserRespVO.java +++ b/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/projectuser/vo/ProjectUserRespVO.java @@ -1,9 +1,8 @@ package cn.iocoder.yudao.module.pms.controller.admin.projectuser.vo; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import com.alibaba.excel.annotation.*; +import lombok.Data; @Schema(description = "管理后台 - 项目与人员关联关系 Response VO") @Data diff --git a/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/projectuser/vo/ProjectUserSaveReqVO.java b/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/projectuser/vo/ProjectUserSaveReqVO.java index 7a64c3344..e63bc6c27 100644 --- a/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/projectuser/vo/ProjectUserSaveReqVO.java +++ b/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/projectuser/vo/ProjectUserSaveReqVO.java @@ -1,9 +1,7 @@ package cn.iocoder.yudao.module.pms.controller.admin.projectuser.vo; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import jakarta.validation.constraints.*; +import lombok.Data; @Schema(description = "管理后台 - 项目与人员关联关系新增/修改 Request VO") @Data diff --git a/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/projectuser/ProjectUserDO.java b/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/projectuser/ProjectUserDO.java index 81de1ff5e..a8d0e9091 100644 --- a/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/projectuser/ProjectUserDO.java +++ b/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/projectuser/ProjectUserDO.java @@ -1,11 +1,10 @@ package cn.iocoder.yudao.module.pms.dal.dataobject.projectuser; -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; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; /** * 项目与人员关联关系 DO diff --git a/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/projectuser/ProjectUserMapper.java b/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/projectuser/ProjectUserMapper.java index 26e200e40..854842cbe 100644 --- a/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/projectuser/ProjectUserMapper.java +++ b/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/projectuser/ProjectUserMapper.java @@ -1,13 +1,8 @@ package cn.iocoder.yudao.module.pms.dal.mysql.projectuser; -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.pms.dal.dataobject.projectuser.ProjectUserDO; import org.apache.ibatis.annotations.Mapper; -import cn.iocoder.yudao.module.pms.controller.admin.projectuser.vo.*; /** * 项目与人员关联关系 Mapper @@ -17,9 +12,4 @@ import cn.iocoder.yudao.module.pms.controller.admin.projectuser.vo.*; @Mapper public interface ProjectUserMapper extends BaseMapperX { - default PageResult selectPage(ProjectUserPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .orderByDesc(ProjectUserDO::getId)); - } - } \ No newline at end of file diff --git a/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/projectuser/ProjectUserService.java b/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/projectuser/ProjectUserService.java index 67dd92d92..ba93b7a9e 100644 --- a/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/projectuser/ProjectUserService.java +++ b/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/projectuser/ProjectUserService.java @@ -1,11 +1,10 @@ package cn.iocoder.yudao.module.pms.service.projectuser; -import java.util.*; -import jakarta.validation.*; -import cn.iocoder.yudao.module.pms.controller.admin.projectuser.vo.*; -import cn.iocoder.yudao.module.pms.dal.dataobject.projectuser.ProjectUserDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.module.pms.controller.admin.projectuser.vo.ProjectUserPageReqVO; +import cn.iocoder.yudao.module.pms.controller.admin.projectuser.vo.ProjectUserSaveReqVO; +import cn.iocoder.yudao.module.pms.dal.dataobject.projectuser.ProjectUserDO; +import jakarta.validation.Valid; /** * 项目与人员关联关系 Service 接口 diff --git a/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/projectuser/ProjectUserServiceImpl.java b/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/projectuser/ProjectUserServiceImpl.java index bd2f9a9d6..aa6811e80 100644 --- a/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/projectuser/ProjectUserServiceImpl.java +++ b/yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/projectuser/ProjectUserServiceImpl.java @@ -1,21 +1,17 @@ package cn.iocoder.yudao.module.pms.service.projectuser; -import org.springframework.stereotype.Service; -import jakarta.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.transaction.annotation.Transactional; - -import java.util.*; -import cn.iocoder.yudao.module.pms.controller.admin.projectuser.vo.*; -import cn.iocoder.yudao.module.pms.dal.dataobject.projectuser.ProjectUserDO; 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.pms.controller.admin.projectuser.vo.ProjectUserPageReqVO; +import cn.iocoder.yudao.module.pms.controller.admin.projectuser.vo.ProjectUserSaveReqVO; +import cn.iocoder.yudao.module.pms.dal.dataobject.projectuser.ProjectUserDO; import cn.iocoder.yudao.module.pms.dal.mysql.projectuser.ProjectUserMapper; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstants.*; +import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstants.PROJECT_USER_NOT_EXISTS; /** * 项目与人员关联关系 Service 实现类 diff --git a/yudao-module-pms/yudao-module-pms-biz/src/test/java/cn/iocoder/yudao/module/pms/service/projectuser/ProjectUserServiceImplTest.java b/yudao-module-pms/yudao-module-pms-biz/src/test/java/cn/iocoder/yudao/module/pms/service/projectuser/ProjectUserServiceImplTest.java index 5ec4e40c2..d756855ee 100644 --- a/yudao-module-pms/yudao-module-pms-biz/src/test/java/cn/iocoder/yudao/module/pms/service/projectuser/ProjectUserServiceImplTest.java +++ b/yudao-module-pms/yudao-module-pms-biz/src/test/java/cn/iocoder/yudao/module/pms/service/projectuser/ProjectUserServiceImplTest.java @@ -1,32 +1,22 @@ package cn.iocoder.yudao.module.pms.service.projectuser; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.mock.mockito.MockBean; - -import jakarta.annotation.Resource; - +import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; - -import cn.iocoder.yudao.module.pms.controller.admin.projectuser.vo.*; +import cn.iocoder.yudao.module.pms.controller.admin.projectuser.vo.ProjectUserPageReqVO; +import cn.iocoder.yudao.module.pms.controller.admin.projectuser.vo.ProjectUserSaveReqVO; import cn.iocoder.yudao.module.pms.dal.dataobject.projectuser.ProjectUserDO; import cn.iocoder.yudao.module.pms.dal.mysql.projectuser.ProjectUserMapper; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - import jakarta.annotation.Resource; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Import; -import java.util.*; -import java.time.LocalDateTime; -import static cn.hutool.core.util.RandomUtil.*; -import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstants.*; -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*; -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; -import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*; -import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*; -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*; +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; +import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstants.PROJECT_USER_NOT_EXISTS; import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.*; /** * {@link ProjectUserServiceImpl} 的单元测试类