From 6d31770c150bcaf17a5814bc2aff8b9754f89525 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期四, 16 五月 2024 17:31:40 +0800
Subject: [PATCH] Merge remote-tracking branch 'git-pipIrr/master'

---
 pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/result/IrrigateResultCode.java |   10 
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrProjectMapper.java                        |   58 +++
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrProject.java                             |  111 +++++++
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrProjectMapper.xml                                       |  213 ++++++++++++++
 pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectCtrl.java       |  261 +++++++++++++++++
 pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectSv.java         |  149 +++++++++
 pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/QueryVo.java           |   26 +
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoProject.java                               |   46 +++
 8 files changed, 870 insertions(+), 4 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrProjectMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrProjectMapper.java
new file mode 100644
index 0000000..f73a9f3
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrProjectMapper.java
@@ -0,0 +1,58 @@
+package com.dy.pipIrrGlobal.daoIr;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.dy.pipIrrGlobal.pojoIr.IrProject;
+import com.dy.pipIrrGlobal.pojoPr.PrController;
+import com.dy.pipIrrGlobal.pojoPr.PrIntake;
+import com.dy.pipIrrGlobal.voIr.VoProject;
+import com.dy.pipIrrGlobal.voPr.VoIntake;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author :WuZeYu
+ * @Date :2024/5/14  15:04
+ * @LastEditTime :2024/5/14  15:04
+ * @Description
+ */
+@Mapper
+public interface IrProjectMapper extends BaseMapper<IrProject> {
+//澧�
+    int insertSelective(IrProject record);
+//鍒�
+    int deleteLogicById(Long id);
+//鏀�
+    int updateByPrimaryKeySelective(IrProject record);
+//鏌ヤ竴涓�
+    IrProject selectById(Long id);
+
+    /**
+     * 淇敼椤圭洰鐘舵��
+     * @return
+     */
+    int updateProjectState(IrProject record);
+
+    /**
+     * 鏍规嵁涓嬬骇Id鑾峰彇涓婁竴绾у湴鍧�Id
+     * @param vaId 涓嬩竴绾d
+     * @return
+     */
+    Long getSupperByVillageId(long vaId);
+
+    /**
+     * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鍙栨按鍙h褰曟暟
+     * @param params
+     * @return
+     */
+    Long getRecordCount(Map<?, ?> params);
+
+    /**
+     * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鍙栨按鍙h褰�
+     * @param params
+     * @return
+     */
+    List<VoProject> getProjects(Map<?, ?> params);
+}
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrProject.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrProject.java
new file mode 100644
index 0000000..b6e9ae6
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrProject.java
@@ -0,0 +1,111 @@
+package com.dy.pipIrrGlobal.pojoIr;
+
+import com.alibaba.fastjson2.annotation.JSONField;
+import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.dy.common.po.BaseEntity;
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import lombok.*;
+import org.hibernate.validator.constraints.Length;
+
+import java.util.Date;
+
+/**
+ * @author :WuZeYu
+ * @Date :2024/5/14  13:53
+ * @LastEditTime :2024/5/14  13:53
+ * @Description
+ */
+
+/**
+ * 椤圭洰琛�
+ */
+
+@TableName(value="ir_project", autoResultMap = true)
+@Data
+@Builder
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+@Schema(name = "椤圭洰瀹炰綋")
+public class IrProject implements BaseEntity {
+    public static final long serialVersionUID = 202405141427001L;
+
+    /**
+     * 涓婚敭
+     */
+    @JSONField(serializeUsing= ObjectWriterImplToString.class)
+    @TableId(type = IdType.INPUT)
+    @Schema(description = "瀹炰綋id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+    private Long id;
+
+    /**
+     * 椤圭洰鍚嶇О
+     */
+    @Schema(description = "椤圭洰鍚嶇О", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotBlank(message = "椤圭洰鍚嶇О涓嶈兘涓虹┖")
+    @Length(message = "椤圭洰鍚嶇О涓嶅ぇ浜巤max}瀛�",max = 50)
+    private String projectName;
+
+    /**
+     * 鐪両D
+     */
+    @Schema(description = "鐪両D", requiredMode = Schema.RequiredMode.REQUIRED)
+    private Long provinceId;
+    /**
+     * 甯侷D
+     */
+    @Schema(description = "甯侷D", requiredMode = Schema.RequiredMode.REQUIRED)
+    private Long cityId;
+    /**
+     * 鍘縄D
+     */
+    @Schema(description = "鍘縄D", requiredMode = Schema.RequiredMode.REQUIRED)
+    private Long countyId;
+    /**
+     * 闀嘔D
+     */
+    @Schema(description = "闀嘔D", requiredMode = Schema.RequiredMode.REQUIRED)
+    private Long townId;
+    /**
+     * 鏉慖D
+     */
+    @Schema(description = "鏉慖D", requiredMode = Schema.RequiredMode.REQUIRED)
+    private Long villageId;
+
+
+
+    /**
+     * 椤圭洰鐘舵��;1-鍚姩锛�2-鍋滄
+     */
+    @Schema(description = "椤圭洰鐘舵��", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+    private Byte projectState;
+
+    /**
+     * 鎿嶄綔浜篒D
+     */
+    @Schema(description = "鎿嶄綔浜篒D", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+    private Long operator;
+
+    /**
+     * 鎿嶄綔鏃堕棿
+     */
+    @Schema(description = "鎿嶄綔鏃堕棿", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+    private Date operateDt;
+
+    /**
+     * 澶囨敞
+     */
+    @Schema(description = "澶囨敞", requiredMode = Schema.RequiredMode.REQUIRED)
+    private String remarks;
+
+    /**
+     * 閫昏緫鍒犻櫎鏍囪瘑;0-鏈垹闄わ紝1-鍒犻櫎
+     */
+    @Schema(description = "鍒犻櫎鏍囪瘑", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
+    private Byte deleted;
+}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoProject.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoProject.java
new file mode 100644
index 0000000..fad1580
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voIr/VoProject.java
@@ -0,0 +1,46 @@
+package com.dy.pipIrrGlobal.voIr;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.dy.common.po.BaseEntity;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * @author :WuZeYu
+ * @Date :2024/5/15  21:02
+ * @LastEditTime :2024/5/15  21:02
+ * @Description
+ */
+@Data
+@Schema(title = "椤圭洰瑙嗗浘瀵硅薄")
+public class VoProject  implements BaseEntity {
+    @Schema(title = "椤圭洰ID")
+    @ExcelProperty("椤圭洰ID")
+    @ColumnWidth(15)
+    private String projectId;
+
+
+    @Schema(title = "椤圭洰鍚嶇О")
+    @ExcelProperty("椤圭洰鍚嶇О")
+    @ColumnWidth(15)
+    private String projectName;
+
+
+    @Schema(title = "椤圭洰鐘舵��")
+    @ExcelProperty("椤圭洰鐘舵��")
+    @ColumnWidth(2)
+    private String projectState;
+
+
+    @Schema(title = "椤圭洰鍦板潃")
+    @ExcelProperty("椤圭洰鍦板潃")
+    @ColumnWidth(25)
+    private String address;
+
+
+    @Schema(title = "椤圭洰澶囨敞")
+    @ExcelProperty("椤圭洰澶囨敞")
+    @ColumnWidth(250)
+    private String remarks;
+}
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrProjectMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrProjectMapper.xml
new file mode 100644
index 0000000..d451fd2
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrProjectMapper.xml
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.dy.pipIrrGlobal.daoIr.IrProjectMapper">
+    <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrProject">
+        <!--@mbg.generated-->
+        <!--@Table ir_project-->
+        <id column="id" jdbcType="BIGINT" property="id" />
+        <result column="project_name" jdbcType="VARCHAR" property="projectName" />
+        <result column="province_id" jdbcType="BIGINT" property="provinceId" />
+        <result column="city_id" jdbcType="BIGINT" property="cityId" />
+        <result column="county_id" jdbcType="BIGINT" property="countyId" />
+        <result column="town_id" jdbcType="BIGINT" property="townId" />
+        <result column="village_id" jdbcType="BIGINT" property="villageId" />
+        <result column="project_state" jdbcType="TINYINT" property="projectState" />
+        <result column="remarks" jdbcType="VARCHAR" property="remarks" />
+        <result column="operator" jdbcType="BIGINT" property="operator" />
+        <result column="operate_time" jdbcType="TIMESTAMP" property="operateDt" />
+        <result column="deleted" jdbcType="TINYINT" property="deleted" />
+    </resultMap>
+    <sql id="Base_Column_List">
+        <!--@mbg.generated-->
+        id, project_name, province_id, city_id, county_id, town_id, `village_id`, project_state, remarks, `operator`,
+        operate_time, deleted
+    </sql>
+    <!--娣诲姞-->
+    <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrProject">
+        <!--@mbg.generated-->
+        insert into ir_project
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">
+                id,
+            </if>
+            <if test="projectName != null">
+                project_name,
+            </if>
+            <if test="provinceId != null">
+                province_id,
+            </if>
+            <if test="cityId != null">
+                city_id,
+            </if>
+            <if test="countyId != null">
+                county_id,
+            </if>
+            <if test="townId != null">
+                town_id,
+            </if>
+            <if test="villageId != null">
+                village_id,
+            </if>
+            <if test="projectState != null">
+                project_state,
+            </if>
+            <if test="remarks != null">
+                remarks,
+            </if>
+            <if test="operator != null">
+                `operator`,
+            </if>
+            <if test="operateDt != null">
+                operate_time,
+            </if>
+            <if test="deleted != null">
+                deleted,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">
+                #{id,jdbcType=BIGINT},
+            </if>
+            <if test="projectName != null">
+                #{projectName,jdbcType=VARCHAR},
+            </if>
+            <if test="provinceId != null">
+                #{provinceId,jdbcType=BIGINT},
+            </if>
+            <if test="cityId != null">
+                #{cityId,jdbcType=BIGINT},
+            </if>
+            <if test="countyId != null">
+                #{countyId,jdbcType=BIGINT},
+            </if>
+            <if test="townId != null">
+                #{townId,jdbcType=BIGINT},
+            </if>
+            <if test="villageId != null">
+                #{villageId,jdbcType=BIGINT},
+            </if>
+            <if test="projectState != null">
+                #{projectState,jdbcType=TINYINT},
+            </if>
+            <if test="remarks != null">
+                #{remarks,jdbcType=VARCHAR},
+            </if>
+            <if test="operator != null">
+                #{operator,jdbcType=BIGINT},
+            </if>
+            <if test="operateDt != null">
+                #{operateDt,jdbcType=TIMESTAMP},
+            </if>
+            <if test="deleted != null">
+                #{deleted,jdbcType=TINYINT},
+            </if>
+        </trim>
+    </insert>
+
+    <!--鏍规嵁涓嬬骇鑾峰彇涓婁竴绾у湴鍧�-->
+    <select id="getSupperByVillageId" parameterType="_long" resultType="java.lang.Long">
+        select dis_tow.*
+        from ba_district dis_vil
+        inner join
+        ba_district dis_tow
+        on dis_vil.supperId = dis_tow.id
+        where dis_vil.id = #{vaId,jdbcType=BIGINT}
+    </select>
+    <!--閫昏緫鍒犻櫎-->
+    <delete id="deleteLogicById" parameterType="java.lang.Long">
+        <!--@mbg.generated-->
+        update ir_project
+        set deleted = 1
+        where id = #{id,jdbcType=BIGINT}
+    </delete>
+    <!--淇敼淇℃伅-->
+    <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrProject">
+        update ir_project
+        <set>
+            <if test="projectName != null">
+                project_name = #{projectName,jdbcType=VARCHAR},
+            </if>
+            <if test="provinceId != null">
+                province_id = #{provinceId,jdbcType=BIGINT},
+            </if>
+            <if test="cityId != null">
+                city_id = #{cityId,jdbcType=BIGINT},
+            </if>
+            <if test="countyId != null">
+                county_id = #{countyId,jdbcType=BIGINT},
+            </if>
+            <if test="townId != null">
+                town_id = #{townId,jdbcType=BIGINT},
+            </if>
+            <if test="villageId != null">
+                village_id = #{villageId,jdbcType=BIGINT},
+            </if>
+            <if test="projectState != null">
+                project_state = #{projectState,jdbcType=TINYINT},
+            </if>
+            <if test="remarks != null">
+                remarks = #{remarks,jdbcType=VARCHAR},
+            </if>
+            <if test="operator != null">
+                operator = #{operator,jdbcType=BIGINT},
+            </if>
+            <if test="operateDt != null">
+                operate_time = #{operateDt,jdbcType=TIMESTAMP},
+            </if>
+            <if test="deleted != null">
+                deleted = #{deleted,jdbcType=TINYINT},
+            </if>
+        </set>
+        where id = #{id,jdbcType=BIGINT}
+    </update>
+    <!--淇敼鐘舵��-->
+    <update id="updateProjectState">
+        update ir_project
+        set project_state = #{projectState,jdbcType=TINYINT},
+            operator = #{operator,jdbcType=BIGINT},
+            operate_time = #{operateDt,jdbcType=TIMESTAMP}
+        where id = #{id,jdbcType=BIGINT}
+    </update>
+    <!--鏌ヨ涓�涓俊鎭�-->
+    <select id="selectById" resultMap="BaseResultMap">
+        select     <include refid="Base_Column_List" /> from ir_project where id = #{id,jdbcType=BIGINT} and deleted = 0
+    </select>
+    <!--鍒嗛〉鏌ヨ鏁伴噺-->
+    <select id="getRecordCount" resultType="java.lang.Long">
+        SELECT COUNT(*) AS recordCount
+        FROM ir_project pro
+        <where>
+            pro.deleted = 0
+            <if test="projectName != null and projectName != ''">
+                AND pro.project_name LIKE CONCAT('%', #{projectName}, '%')
+            </if>
+            <if test = "projectState != null and projectState != ''">
+                AND pro.project_state = #{projectState}
+            </if>
+        </where>
+    </select>
+    <!--鍒嗛〉鏌ヨ鏁版嵁-->
+    <select id="getProjects" resultType="com.dy.pipIrrGlobal.voIr.VoProject">
+        SELECT
+        CAST(pro.id AS char)AS projectId,
+        pro.project_name  AS  projectName,
+        pro.project_state  AS  projectState,
+        CONCAT(province.`name`,city.`name`,country.`name`, town.`name`, village.`name`) AS address,
+        pro.remarks
+        FROM ir_project pro
+        LEFT JOIN ba_district province ON pro.province_id = province.id
+        LEFT JOIN ba_district city ON pro.city_id = city.id
+        LEFT JOIN ba_district country ON pro.county_id = country.id
+        LEFT JOIN ba_district town ON pro.town_id = town.id
+        LEFT JOIN ba_district village ON pro.village_id = village.id
+        <where>
+            pro.deleted = 0
+            <if test="projectName != null and projectName != ''">
+                AND pro.project_name LIKE CONCAT('%', #{projectName}, '%')
+            </if>
+            <if test = "projectState != null and projectState != ''">
+                AND pro.project_state = #{projectState}
+            </if>
+        </where>
+    </select>
+</mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectCtrl.java
new file mode 100644
index 0000000..ee36545
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectCtrl.java
@@ -0,0 +1,261 @@
+package com.dy.pipIrrIrrigate.project;
+
+import com.dy.common.aop.SsoAop;
+import com.dy.common.webUtil.BaseResponse;
+import com.dy.common.webUtil.BaseResponseUtils;
+import com.dy.common.webUtil.QueryResultVo;
+import com.dy.common.webUtil.ResultCodeMsg;
+import com.dy.pipIrrGlobal.pojoIr.IrProject;
+import com.dy.pipIrrGlobal.pojoPr.PrIntake;
+import com.dy.pipIrrGlobal.voIr.VoProject;
+import com.dy.pipIrrGlobal.voPr.VoIntake;
+import com.dy.pipIrrGlobal.voSe.VoActiveCard;
+import com.dy.pipIrrIrrigate.result.IrrigateResultCode;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.http.MediaType;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.*;
+
+import java.lang.reflect.Array;
+import java.util.*;
+
+/**
+ * @author :WuZeYu
+ * @Date :2024/5/14  13:53
+ * @LastEditTime :2024/5/14  13:53
+ * @Description
+ */
+@Slf4j
+@Tag(name = "椤圭洰绠$悊", description = "椤圭洰鎿嶄綔")
+@RestController
+@RequestMapping(path = "project")
+@RequiredArgsConstructor
+public class ProjectCtrl {
+    private final ProjectSv projectSv;
+
+    /**
+     * 娣诲姞椤圭洰
+     *
+     * @param po            椤圭洰瀹炰綋瀵硅薄
+     * @param bindingResult
+     * @return 娣诲姞鏄惁鎴愬姛
+     */
+    @Operation(summary = "娣诲姞椤圭洰璁板綍", description = "娣诲姞椤圭洰璁板綍")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = Boolean.class))}
+            )
+    })
+    @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @Transactional(rollbackFor = Exception.class)
+    @SsoAop()
+    public BaseResponse<Boolean> add(@RequestBody @Valid IrProject po, BindingResult bindingResult) {
+        if (bindingResult != null && bindingResult.hasErrors()) {
+            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+        }
+        try {
+            Integer rec = Optional.ofNullable(projectSv.addProject(po)).orElse(0);
+            if (rec == 0) {
+                return BaseResponseUtils.buildFail(IrrigateResultCode.ADD_PROJECT_FAIL.getMessage());
+            }
+        } catch (Exception e) {
+            log.error("娣诲姞椤圭洰寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage());
+        }
+        return BaseResponseUtils.buildSuccess(true);
+    }
+
+    /**
+     * 閫昏緫鍒犻櫎椤圭洰
+     * @param map
+     * @return
+     */
+    @Operation(summary = "閫昏緫鍒犻櫎椤圭洰", description = "閫昏緫鍒犻櫎椤圭洰")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = Boolean.class))}
+            )
+    })
+    @PostMapping(path = "delete", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @Transactional(rollbackFor = Exception.class)
+    @SsoAop()
+    public BaseResponse<Boolean> delete(@RequestBody Map map) {
+        if (map == null || map.size() <= 0) {
+            BaseResponseUtils.buildFail(IrrigateResultCode.PLEASE_INPUT_PROJECT_ID.getMessage());
+        }
+        Long projectId = Long.parseLong(map.get("id").toString());
+        try {
+            Integer rows = projectSv.deleteProject(projectId);
+            if (rows == 0) {
+                return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_PROJECT_FAIL.getMessage());
+            }
+        } catch (Exception e) {
+            log.error("鍒犻櫎椤圭洰寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage());
+        }
+        return BaseResponseUtils.buildSuccess(true);
+    }
+
+    /**
+     * 鎵归噺鍒犻櫎
+     * @param projectIds
+     * @return
+     */
+    @PostMapping(path = "delete_batch", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @Transactional(rollbackFor = Exception.class)
+    @SsoAop()
+    public BaseResponse<Boolean> delete_batch(@RequestBody Map<String,List> projectIds) {
+        if (projectIds == null || projectIds.size() <= 0) {
+            BaseResponseUtils.buildFail(IrrigateResultCode.PLEASE_INPUT_PROJECT_ID.getMessage());
+        }
+        List ids = projectIds.get("projectIds");
+        for (int i = 0; i < ids.size(); i++) {
+            long projectId = Long.parseLong(ids.get(i).toString());
+            try {
+                Integer rows = projectSv.deleteProject(projectId);
+                if (rows == 0) {
+                    return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_PROJECT_FAIL.getMessage());
+                }
+            } catch (Exception e) {
+                log.error("鍒犻櫎椤圭洰寮傚父", e);
+                return BaseResponseUtils.buildException(e.getMessage());
+            }
+        }
+        return BaseResponseUtils.buildSuccess(true);
+    }
+
+    /**
+     * 淇敼椤圭洰淇℃伅
+     * @param po
+     * @param bindingResult
+     * @return
+     */
+    @Operation(summary = "淇敼椤圭洰淇℃伅", description = "淇敼椤圭洰淇℃伅")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = Boolean.class))}
+            )
+    })
+    @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @Transactional(rollbackFor = Exception.class)
+    @SsoAop()
+    public BaseResponse<Boolean> update(@RequestBody @Valid IrProject po, BindingResult bindingResult){
+        if (bindingResult != null && bindingResult.hasErrors()) {
+            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+        }
+        try {
+            Integer rec = Optional.ofNullable(projectSv.updateProject(po)).orElse(0);
+            if (rec == 0) {
+                return BaseResponseUtils.buildFail(IrrigateResultCode.UPDATE_PROJECT_FAIL.getMessage());
+            }
+        } catch (Exception e) {
+            log.error("淇敼椤圭洰寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage());
+        }
+        return BaseResponseUtils.buildSuccess(true);
+    }
+
+    /**
+     * 淇敼椤圭洰鐘舵��
+     * @param po
+     * @param
+     * @return
+     */
+    @Operation(summary = "淇敼椤圭洰鐘舵��", description = "淇敼椤圭洰鐘舵��")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = Boolean.class))}
+            )
+    })
+    @PostMapping(path = "update_state", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @Transactional(rollbackFor = Exception.class)
+    @SsoAop()
+    public BaseResponse<Boolean> update_state(@RequestBody IrProject po){
+        try {
+            Integer rec = Optional.ofNullable(projectSv.updateProjectState(po)).orElse(0);
+            if (rec == 0) {
+                return BaseResponseUtils.buildFail(IrrigateResultCode.UPDATE_PROJECT_FAIL.getMessage());
+            }
+        } catch (Exception e) {
+            log.error("淇敼椤圭洰寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage());
+        }
+        return BaseResponseUtils.buildSuccess(true);
+    }
+
+    /**
+     * 鑾峰彇涓�涓」鐩暟鎹�
+     *
+     * @return 鑾峰彇涓�涓」鐩暟鎹�
+     */
+    @Operation(summary = "鑾峰彇涓�涓」鐩暟鎹�", description = "鑾峰彇涓�涓」鐩暟鎹�")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "鑾峰彇涓�涓」鐩暟鎹紙BaseResponse.content:{}锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = IrProject.class))}
+            )
+    })
+    @GetMapping(path = "one")
+    @SsoAop()
+    public BaseResponse<IrProject> one(@RequestParam Long id) {
+        IrProject irProject = this.projectSv.selectById(id);
+        if (irProject == null) {
+            return BaseResponseUtils.buildFail(IrrigateResultCode.NO_PROJECT.getMessage());
+        } else {
+            return BaseResponseUtils.buildSuccess(irProject);
+        }
+    }
+
+    /**
+     * 鍒嗛〉鏌ヨ
+     * @param vo
+     * @return
+     */
+    @Operation(summary = "鑾峰緱涓�椤甸」鐩褰�", description = "鑾峰緱涓�椤甸」鐩褰�")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "鑾峰緱涓�椤甸」鐩褰曪紙BaseResponse.content:QueryResultVo[{}]锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = VoActiveCard.class))}
+            )
+    })
+    @GetMapping(path = "some")
+    @SsoAop()
+    public BaseResponse<QueryResultVo<List<VoProject>>> getIntakes(QueryVo vo) {
+        try {
+            QueryResultVo<List<VoProject>> res = projectSv.getProjects(vo);
+            if (res == null) {
+                return BaseResponseUtils.buildFail(IrrigateResultCode.NO_PROJECT.getMessage());
+            }
+            return BaseResponseUtils.buildSuccess(res);
+        } catch (Exception e) {
+            log.error("鑾峰彇椤圭洰璁板綍寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage());
+        }
+    }
+}
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;
+    }
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/QueryVo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/QueryVo.java
new file mode 100644
index 0000000..a8985ea
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/QueryVo.java
@@ -0,0 +1,26 @@
+package com.dy.pipIrrIrrigate.project;
+
+import com.dy.common.webUtil.QueryConditionVo;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+
+/**
+ * @author :WuZeYu
+ * @Date :2024/5/15  21:11
+ * @LastEditTime :2024/5/15  21:11
+ * @Description
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@ToString(callSuper = true)
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+@Schema(name = "椤圭洰鏌ヨ鏉′欢")
+public class QueryVo extends QueryConditionVo {
+    @Schema(description = "椤圭洰鍚嶇О")
+    public String projectName;
+
+    @Schema(description = "椤圭洰鐘舵��")
+    public String projectState;
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/result/IrrigateResultCode.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/result/IrrigateResultCode.java
index 8c3ec6c..8d4670b 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/result/IrrigateResultCode.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/result/IrrigateResultCode.java
@@ -14,11 +14,13 @@
 @AllArgsConstructor
 public enum IrrigateResultCode {
     /**
-     * 鐢伴棿鐏屾簤椤圭洰
+     * 椤圭洰
      */
-    DIVIDE_FAIL(10001, "鍒嗘按鎴挎坊鍔犲け璐�"),
-    DELETE_DIVIDE_FAIL(10001, "鍒嗘按鎴垮垹闄ゅけ璐�"),
-    NO_DIVIDES(10001, "鏃犵鍚堟潯浠剁殑鍒嗘按鎴胯褰�");
+    ADD_PROJECT_FAIL(10001, "椤圭洰娣诲姞澶辫触"),
+    PLEASE_INPUT_PROJECT_ID(10002, "璇疯緭鍏ラ」鐩甀D"),
+    DELETE_PROJECT_FAIL(10003, "椤圭洰鍒犻櫎澶辫触"),
+    UPDATE_PROJECT_FAIL(10004, "椤圭洰淇敼澶辫触"),
+    NO_PROJECT(10005, "鏃犵鍚堟潯浠剁殑椤圭洰璁板綍");
 
 
     private final Integer code;

--
Gitblit v1.8.0