From 17e1c168eb52e8c8822520cacbf1511f16e31759 Mon Sep 17 00:00:00 2001 From: Vinjor Date: Sun, 4 Aug 2024 16:55:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E8=B5=84=E8=B4=A8=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/CompanyQualsController.java | 49 ++++++++++++++++--- .../service/impl/CompanyQualsServiceImpl.java | 6 +-- 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/company/controller/admin/CompanyQualsController.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/company/controller/admin/CompanyQualsController.java index e8e4b654..4245c367 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/company/controller/admin/CompanyQualsController.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/company/controller/admin/CompanyQualsController.java @@ -4,17 +4,18 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.company.entity.CompanyQuals; import cn.iocoder.yudao.module.company.service.CompanyQualsService; +import cn.iocoder.yudao.module.company.vo.CompanyQualsRespVO; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.ok; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; /** @@ -32,15 +33,49 @@ public class CompanyQualsController { private CompanyQualsService companyQualsService; /** - * 分页查询 + * 列表查询--不分页 * @author vinjor-M * @date 9:52 2024/8/2 * @param corpId 企业id **/ - @GetMapping("/page") - @Operation(summary = "获得企业资质信息表分页") + @GetMapping("/list") + @Operation(summary = "获得企业资质信息表不分页") @PreAuthorize("@ss.hasPermission('base:company-quals:query')") public CommonResult> getCompanyPage(String corpId) { - return success(companyQualsService.list(new LambdaQueryWrapperX().eq(CompanyQuals::getCorpId,corpId))); + return success(companyQualsService.list(new LambdaQueryWrapperX(). + eq(CompanyQuals::getCorpId,corpId).orderByDesc(CompanyQuals::getCreateTime))); + } + + @PostMapping("/create") + @Operation(summary = "创建企业资质") + @PreAuthorize("@ss.hasPermission('base:company-quals:create')") + public CommonResult createCompanyQuals(@RequestBody CompanyQualsRespVO createReqVO) { + companyQualsService.saveDataObj(createReqVO); + return ok(); + } + + @PutMapping("/update") + @Operation(summary = "更新企业资质") + @PreAuthorize("@ss.hasPermission('base:company-quals:update')") + public CommonResult updateCompanyQuals(@RequestBody CompanyQualsRespVO updateReqVO) { + companyQualsService.updateDataObj(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除企业资质") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('base:company-quals:delete')") + public CommonResult deleteCompanyQuals(@RequestParam("id") String id) { + companyQualsService.removeDataObj(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得企业资质") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('base:company-quals:query')") + public CommonResult getCompanyQuals(@RequestParam("id") String id) { + return success(companyQualsService.getById(id)); } } \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/company/service/impl/CompanyQualsServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/company/service/impl/CompanyQualsServiceImpl.java index 354c2bb9..c9a04212 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/company/service/impl/CompanyQualsServiceImpl.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/company/service/impl/CompanyQualsServiceImpl.java @@ -28,7 +28,7 @@ public class CompanyQualsServiceImpl extends ServiceImpl