From 6b79e22056bcc2c14d3e20802174b89bc2a0a204 Mon Sep 17 00:00:00 2001 From: zhibing.pu <393733352@qq.com> Date: 星期五, 09 八月 2024 10:12:44 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCompanyController.java | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 44 insertions(+), 2 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCompanyController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCompanyController.java index 65707f8..66c00cb 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCompanyController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCompanyController.java @@ -1,9 +1,16 @@ package com.ruoyi.other.controller; -import org.springframework.web.bind.annotation.RequestMapping; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.account.api.dto.UnitListQueryDto; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.other.api.domain.TCompany; +import com.ruoyi.other.service.TCompanyService; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; -import org.springframework.web.bind.annotation.RestController; +import javax.annotation.Resource; +import java.time.LocalDateTime; /** * <p> @@ -16,6 +23,41 @@ @RestController @RequestMapping("/t-company") public class TCompanyController { + @Resource + private TCompanyService companyService; + //单位分页 + @PostMapping(value = "/unit/page") + public R<Page<TCompany>> unitPage(@RequestBody UnitListQueryDto unitListQueryDto) { + Page<TCompany> page = companyService.lambdaQuery() + .orderByDesc(TCompany::getCreateTime) + .like(unitListQueryDto.getCompanyName()!=null&& unitListQueryDto.getCompanyName().isEmpty(), TCompany::getName, unitListQueryDto.getCompanyName()) + .page(Page.of(unitListQueryDto.getPageCurr(), unitListQueryDto.getPageSize())); + return R.ok(page); + + } + //单位添加 + @PostMapping(value = "/unit/addOrUpdate") + public R add(@RequestBody TCompany tCompany) { + if (tCompany.getId()==null){ + tCompany.setCreateTime(LocalDateTime.now()); + } + companyService.saveOrUpdate(tCompany); + return R.ok(); + } + + @PostMapping(value = "/unit/delete") + public R add(@RequestParam Integer id) { + companyService.removeById(id); + + return R.ok(); + } + + @PostMapping(value = "/unit/delete") + public R<TCompany> delete(@RequestParam Integer id) { + + + return R.ok( companyService.getById(id)); + } } -- Gitblit v1.7.1