From f47d695f19bca1e58ddedcc10f8d3dff7d7f8f1d Mon Sep 17 00:00:00 2001
From: zhibing.pu <393733352@qq.com>
Date: 星期三, 21 八月 2024 11:39:43 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCompanyController.java |   41 +++++++++++++++++++++++++++++++++++++----
 1 files changed, 37 insertions(+), 4 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..c5e604a 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,32 @@
 @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 delete(@RequestParam("id") Integer id) {
+		return R.ok(companyService.removeById(id));
+	}
 }
 

--
Gitblit v1.7.1