From cd08bf41f787659948901ec5dc7f468ab7fcded6 Mon Sep 17 00:00:00 2001
From: Administrator <zhubaomin>
Date: 星期一, 20 五月 2024 11:12:56 +0800
Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
---
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectSv.java | 149 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 149 insertions(+), 0 deletions(-)
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectSv.java
new file mode 100644
index 0000000..8b4d90a
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectSv.java
@@ -0,0 +1,149 @@
+package com.dy.pipIrrIrrigate.project;
+
+
+import com.dy.common.webUtil.QueryResultVo;
+import com.dy.pipIrrGlobal.daoIr.IrProjectMapper;
+import com.dy.pipIrrGlobal.pojoIr.IrProject;
+import com.dy.pipIrrGlobal.voIr.VoProject;
+import com.dy.pipIrrGlobal.voPr.VoIntake;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.common.utils.PojoUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author :WuZeYu
+ * @Date :2024/5/14 13:56
+ * @LastEditTime :2024/5/14 13:56
+ * @Description
+ */
+@Slf4j
+@Service
+public class ProjectSv {
+ @Autowired
+ private IrProjectMapper irProjectMapper;
+
+ /**
+ * 娣诲姞椤圭洰
+ *
+ * @param po
+ * @return
+ */
+ public Integer addProject(IrProject po) {
+ po.setOperateDt(new Date());
+ po.setDeleted((byte) 0);
+ if (po.getVillageId() != null) {
+ po.setTownId(irProjectMapper.getSupperByVillageId(po.getVillageId()));
+ po.setCountyId(irProjectMapper.getSupperByVillageId(po.getTownId()));
+ po.setCityId(irProjectMapper.getSupperByVillageId(po.getCountyId()));
+ po.setProvinceId(irProjectMapper.getSupperByVillageId(po.getCityId()));
+ }
+ if (po.getTownId() != null) {
+ po.setCountyId(irProjectMapper.getSupperByVillageId(po.getTownId()));
+ po.setCityId(irProjectMapper.getSupperByVillageId(po.getCountyId()));
+ po.setProvinceId(irProjectMapper.getSupperByVillageId(po.getCityId()));
+ }
+ if (po.getCountyId() != null) {
+ po.setCityId(irProjectMapper.getSupperByVillageId(po.getCountyId()));
+ po.setProvinceId(irProjectMapper.getSupperByVillageId(po.getCityId()));
+ }
+ if (po.getCityId() != null) {
+ po.setProvinceId(irProjectMapper.getSupperByVillageId(po.getCityId()));
+ }
+ int rows = irProjectMapper.insertSelective(po);
+ if (rows == 0) {
+ return 0;
+ }
+ return 1;
+ }
+
+ /**
+ * 鍒犻櫎椤圭洰
+ *
+ * @param id
+ */
+ public Integer deleteProject(Long id) {
+ int rows = irProjectMapper.deleteLogicById(id);
+ if (rows == 0) {
+ return 0;
+ }
+ return 1;
+ }
+
+ /**
+ * 淇敼椤圭洰淇℃伅
+ * @param po
+ * @return
+ */
+ public Integer updateProject(IrProject po){
+ po.setOperateDt(new Date());
+ if (po.getVillageId() != null) {
+ po.setTownId(irProjectMapper.getSupperByVillageId(po.getVillageId()));
+ po.setCountyId(irProjectMapper.getSupperByVillageId(po.getTownId()));
+ po.setCityId(irProjectMapper.getSupperByVillageId(po.getCountyId()));
+ po.setProvinceId(irProjectMapper.getSupperByVillageId(po.getCityId()));
+ }
+ if (po.getTownId() != null) {
+ po.setCountyId(irProjectMapper.getSupperByVillageId(po.getTownId()));
+ po.setCityId(irProjectMapper.getSupperByVillageId(po.getCountyId()));
+ po.setProvinceId(irProjectMapper.getSupperByVillageId(po.getCityId()));
+ }
+ if (po.getCountyId() != null) {
+ po.setCityId(irProjectMapper.getSupperByVillageId(po.getCountyId()));
+ po.setProvinceId(irProjectMapper.getSupperByVillageId(po.getCityId()));
+ }
+ if (po.getCityId() != null) {
+ po.setProvinceId(irProjectMapper.getSupperByVillageId(po.getCityId()));
+ }
+ int rows = irProjectMapper.updateByPrimaryKeySelective(po);
+ if (rows == 0){
+ return 0;
+ }
+ return 1;
+ }
+
+ /**
+ * 淇敼椤圭洰鐘舵��
+ * @param po
+ * @return
+ */
+ public Integer updateProjectState(IrProject po){
+ po.setOperateDt(new Date());
+ int rows = irProjectMapper.updateProjectState(po);
+ if (rows == 0){
+ return 0;
+ }
+ return 1;
+ }
+
+ /**
+ * 鑾峰彇涓�涓」鐩暟鎹�
+ * @param id
+ * @return
+ */
+ public IrProject selectById(Long id){
+ IrProject irProject = irProjectMapper.selectById(id);
+ return irProject;
+ }
+
+ /**
+ * 鍒嗛〉鏌ヨ椤圭洰
+ * @param queryVo
+ * @return
+ */
+ public QueryResultVo<List<VoProject>> getProjects(QueryVo queryVo){
+ Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
+ Long itemTotal = irProjectMapper.getRecordCount(params);
+
+ QueryResultVo<List<VoProject>> rsVo = new QueryResultVo<>();
+ rsVo.pageSize = queryVo.pageSize;
+ rsVo.pageCurr = queryVo.pageCurr;
+ rsVo.calculateAndSet(itemTotal, params);
+ rsVo.obj = irProjectMapper.getProjects(params);
+ return rsVo;
+ }
+}
--
Gitblit v1.8.0