From 67d06a785d5fc4524639ace27651c01ff05a4b58 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期四, 29 五月 2025 22:31:33 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCompanyController.java |   44 +++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 41 insertions(+), 3 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..36138e4 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,13 +1,20 @@
 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>
- *  前端控制器
+ * 前端控制器
  * </p>
  *
  * @author 无关风月
@@ -16,6 +23,37 @@
 @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()!="", 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 delete(@RequestParam("id") Integer id) {
+		return R.ok(companyService.removeById(id));
+	}
 
+	@PostMapping(value = "/unit/detail")
+	public R detail(@RequestParam("id") Integer id) {
+		return R.ok(companyService.getById(id));
+	}
 }
 

--
Gitblit v1.7.1