From a42c2d24721a08b0066089ebcdf49c569676735d Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期日, 12 十一月 2023 17:29:10 +0800
Subject: [PATCH] 1、添加权限验证注解、事务注解 2、用户管理中增加功能:保存、修改、删除

---
 pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockSv.java         |    5 
 pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserCtrl.java         |  112 +++++++++++
 pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictSv.java   |   58 +++--
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaUserMapper.java               |   78 ++++---
 pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictCtrl.java |    2 
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDistrictMapper.xml                          |   20 +-
 pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockCtrl.java       |    2 
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml                              |  192 +++++-------------
 pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserSv.java           |   32 +++
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaDistrictMapper.java           |   58 +++--
 10 files changed, 322 insertions(+), 237 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaDistrictMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaDistrictMapper.java
index 07963e0..45af66a 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaDistrictMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaDistrictMapper.java
@@ -10,34 +10,6 @@
 @Mapper
 public interface BaDistrictMapper extends BaseMapper<BaPrivilege> {
     /**
-     * delete by primary key
-     * @param id primaryKey
-     * @return deleteCount
-     */
-    int deleteByPrimaryKey(Long id);
-
-    /**
-     * 閫昏緫鍒犻櫎
-     * @param id primaryKey
-     * @return update count
-     */
-    int deleteLogicById(Long id);
-
-    /**
-     * insert record to table
-     * @param record the record
-     * @return insert count
-     */
-    int insert(BaDistrict record);
-
-    /**
-     * insert record to table selective
-     * @param record the record
-     * @return insert count
-     */
-    int insertSelective(BaDistrict record);
-
-    /**
      * select by primary key
      * @param id primary key
      * @return object by primary key
@@ -59,6 +31,21 @@
     List<BaDistrict> selectBySupperId(Long supperId) ;
 
     /**
+     * insert record to table
+     * @param record the record
+     * @return insert count
+     */
+    int insert(BaDistrict record);
+
+    /**
+     * insert record to table selective
+     * @param record the record
+     * @return insert count
+     */
+    int insertSelective(BaDistrict record);
+
+
+    /**
      * update record selective
      * @param record the updated record
      * @return update count
@@ -71,4 +58,19 @@
      * @return update count
      */
     int updateByPrimaryKey(BaDistrict record);
+
+    /**
+     * delete by primary key
+     * @param id primaryKey
+     * @return deleteCount
+     */
+    int deleteByPrimaryKey(Long id);
+
+    /**
+     * 閫昏緫鍒犻櫎
+     * @param id primaryKey
+     * @return update count
+     */
+    int deleteLogicById(Long id);
+
 }
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaUserMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaUserMapper.java
index af709fd..48f6d23 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaUserMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaUserMapper.java
@@ -1,7 +1,6 @@
 package com.dy.pipIrrGlobal.daoBa;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.dy.pipIrrGlobal.pojoBa.BaBlock;
 import com.dy.pipIrrGlobal.pojoBa.BaUser;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -36,39 +35,46 @@
     List<BaUser> selectSome(Map<?, ?> params) ;
 
 
-//
-//    /**
-//     * 鎻掑叆涓�鏉¤褰�
-//     * @param userPo
-//     * @return
-//     */
-//    long insertSelective(BaUser userPo);
-//
-//    /**
-//     * 鎻掑叆涓�鏉¤褰曪紝濡傛灉鍞竴閿啿绐佸垯鏇存柊
-//     * @param userPo
-//     * @return
-//     */
-//    long insertOnDuplicateUpdate(BaUser userPo);
-//
-//    /**
-//     * 鏇存柊涓�鏉¤褰�
-//     * @param userPo
-//     * @return
-//     */
-//    int updateSelective(BaUser userPo);
-//
-//    /**
-//     * 鎵归噺鎻掑叆
-//     * @param userPoList
-//     * @return
-//     */
-//    int batchInsert(List<BaUser> userPoList);
-//
-//    /**
-//     * 鎵归噺鏇存柊
-//     * @param userPoList
-//     * @return
-//     */
-//    int batchUpdate(List<BaUser> userPoList);
+    /**
+     * insert record to table
+     * @param record the record
+     * @return insert count
+     */
+    int insert(BaUser record);
+
+    /**
+     * insert record to table selective
+     * @param record the record
+     * @return insert count
+     */
+    int insertSelective(BaUser record);
+
+
+    /**
+     * update record selective
+     * @param record the updated record
+     * @return update count
+     */
+    int updateByPrimaryKeySelective(BaUser record);
+
+    /**
+     * update record
+     * @param record the updated record
+     * @return update count
+     */
+    int updateByPrimaryKey(BaUser record);
+
+    /**
+     * delete by primary key
+     * @param id primaryKey
+     * @return deleteCount
+     */
+    int deleteByPrimaryKey(Long id);
+
+    /**
+     * 閫昏緫鍒犻櫎
+     * @param id primaryKey
+     * @return update count
+     */
+    int deleteLogicById(Long id);
 }
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDistrictMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDistrictMapper.xml
index f8679a0..356b51d 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDistrictMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDistrictMapper.xml
@@ -35,16 +35,6 @@
     from ba_district
     where supperId = #{supperId,jdbcType=BIGINT}
   </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
-    <!--@mbg.generated-->
-    delete from ba_district
-    where id = #{id,jdbcType=BIGINT}
-  </delete>
-  <delete id="deleteLogicById" parameterType="java.lang.Long">
-    <!--@mbg.generated-->
-    update ba_district set deleted = 1
-    where id = #{id,jdbcType=BIGINT}
-  </delete>
   <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDistrict">
     <!--@mbg.generated-->
     insert into ba_district (id, supperId, `name`, `level`, deleted)
@@ -121,4 +111,14 @@
         deleted = #{deleted,jdbcType=TINYINT}
     where id = #{id,jdbcType=BIGINT}
   </update>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    <!--@mbg.generated-->
+    delete from ba_district
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
+  <delete id="deleteLogicById" parameterType="java.lang.Long">
+    <!--@mbg.generated-->
+    update ba_district set deleted = 1
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
 </mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml
index dde6a32..efab302 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml
@@ -90,74 +90,26 @@
             </if>
         </trim>
     </select>
-    <!--
-    <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser">
-        <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long" id="selectKey">
-            SELECT LAST_INSERT_ID()
-        </selectKey>
-        insert into  ba_user
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="id != null">
-                id,
-            </if>
-            <if test="name != null">
-                name,
-            </if>
-            <if test="phone != null">
-                phone,
-            </if>
-           <if test="password != null">
-               password,
-            </if>
-           <if test="orgTag != null">
-               orgTag,
-            </if>
-           <if test="supperAdmin != null">
-               supperAdmin,
-            </if>
-           <if test="disabled != null">
-               disabled,
-            </if>
-          <if test="deleted != null">
-              deleted,
-            </if>
-        </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="id != null">
-                #{id, jdbcType=BIGINT},
-            </if>
-            <if test="name != null">
-                #{name, jdbcType=VARCHAR},
-            </if>
-            <if test="phone != null">
-                #{phone, jdbcType=VARCHAR},
-            </if>
-           <if test="password != null">
-                #{password, jdbcType=VARCHAR},
-            </if>
-           <if test="orgTag != null">
-                #{orgTag, jdbcType=VARCHAR},
-            </if>
-           <if test="supperAdmin != null">
-                #{supperAdmin, jdbcType=SMALLINT},
-            </if>
-           <if test="disabled != null">
-                #{disabled, jdbcType=SMALLINT},
-            </if>
-           <if test="deleted != null">
-                #{deleted, jdbcType=SMALLINT},
-            </if>
-        </trim>
+    <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser">
+        insert into ba_user (<include refid="Base_Column_List" />)
+        values (#{id,jdbcType=BIGINT},
+        #{name,jdbcType=VARCHAR},
+        #{phone,jdbcType=VARCHAR},
+        #{password,jdbcType=VARCHAR},
+        #{orgTag,jdbcType=VARCHAR},
+        #{supperAdmin,jdbcType=TINYINT},
+        #{disabled,jdbcType=TINYINT},
+        #{deleted,jdbcType=TINYINT}
+        )
     </insert>
-
-    <insert id="insertOnDuplicateUpdate" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser">
+    <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser">
         insert into ba_user
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="id != null">
                 id,
             </if>
             <if test="name != null">
-                name,
+                `name`,
             </if>
             <if test="phone != null">
                 phone,
@@ -171,109 +123,77 @@
             <if test="supperAdmin != null">
                 supperAdmin,
             </if>
-            <if test="disabled != null">
-                disabled,
+           <if test="disabled != null">
+               disabled,
             </if>
-            <if test="deleted != null">
+           <if test="deleted != null">
                 deleted,
             </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">
-                #{id, jdbcType=BIGINT},
+                #{id,jdbcType=BIGINT},
             </if>
             <if test="name != null">
-                #{name, jdbcType=VARCHAR},
+                #{name,jdbcType=VARCHAR},
             </if>
             <if test="phone != null">
-                #{phone, jdbcType=VARCHAR},
+                #{phone,jdbcType=VARCHAR},
             </if>
             <if test="password != null">
-                #{password, jdbcType=VARCHAR},
+                #{password,jdbcType=VARCHAR},
             </if>
             <if test="orgTag != null">
-                #{orgTag, jdbcType=VARCHAR},
+                #{orgTag,jdbcType=VARCHAR},
             </if>
             <if test="supperAdmin != null">
-                #{supperAdmin, jdbcType=SMALLINT},
+                #{supperAdmin,jdbcType=TINYINT},
             </if>
             <if test="disabled != null">
-                #{disabled, jdbcType=SMALLINT},
+                #{disabled,jdbcType=TINYINT},
             </if>
             <if test="deleted != null">
-                #{deleted, jdbcType=SMALLINT},
-            </if>
-        </trim>
-        ON DUPLICATE KEY UPDATE
-        <trim suffixOverrides="," >
-            <if test="id != null" >
-                id = #{id, jdbcType=BIGINT},
+                #{deleted,jdbcType=TINYINT},
             </if>
         </trim>
     </insert>
 
-    <update id="updateSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser" >
-        UPDATE ba_user
-        <set >
-            <if test="name != null" >
-                name = #{name, jdbcType=VARCHAR},
+    <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser">
+        update ba_user
+        <set>
+            <if test="name != null">
+                `name` = #{name,jdbcType=VARCHAR},
             </if>
-            <if test="phone != null" >
-                phone = #{phone, jdbcType=VARCHAR},
+            <if test="phone != null">
+                phone = #{phone,jdbcType=VARCHAR},
             </if>
-            <if test="password != null" >
-                phone = #{password, jdbcType=VARCHAR},
+            <if test="password != null">
+                password = #{password,jdbcType=VARCHAR},
+            </if>
+            <if test="disabled != null">
+                disabled = #{disabled,jdbcType=TINYINT},
+            </if>
+            <if test="deleted != null">
+                deleted = #{deleted,jdbcType=TINYINT},
             </if>
         </set>
-        WHERE
-        <trim prefixOverrides="and | or">
-            <if test="id != null">
-                AND id = #{id,jdbcType=BIGINT}
-            </if>
-        </trim>
+        where id = #{id,jdbcType=BIGINT}
     </update>
-
-    <insert id="batchInsert" parameterType="java.util.List">
-        <selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER" id="batchInsert">
-            SELECT LAST_INSERT_ID()
-        </selectKey>
-        INSERT INTO ba_user(id, name, phone, password, orgTag, supperAdmin, disabled, deleted)
-        VALUES
-        <foreach collection="list" item="it" index="index" separator=",">
-            (
-              #{it.id, jdbcType=BIGINT},
-              #{it.name, jdbcType=VARCHAR},
-              #{it.phone, jdbcType=VARCHAR},
-              #{it.password, jdbcType=VARCHAR},
-              #{it.orgTag, jdbcType=VARCHAR},
-              #{it.supperAdmin, jdbcType=SMALLINT},
-              #{it.disabled, jdbcType=SMALLINT},
-              #{it.deleted, jdbcType=SMALLINT}
-            )
-        </foreach>
-    </insert>
-
-    <update id="batchUpdate" parameterType="java.util.List">
-        <foreach collection="list" item="it"  separator=";">
-            UPDATE ba_user
-            <set >
-                <if test="it.name != null" >
-                    name = #{it.name, jdbcType=VARCHAR},
-                </if>
-                <if test="it.phone != null" >
-                    phone = #{it.phone, jdbcType=VARCHAR},
-                </if>
-                <if test="it.password != null" >
-                    phone = #{it.password, jdbcType=VARCHAR},
-                </if>
-            </set>
-            WHERE
-            <trim prefixOverrides="and | or">
-                <if test="it.id != null">
-                    AND id = #{it.id,jdbcType=BIGINT}
-                </if>
-            </trim>
-        </foreach>
+    <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser">
+        update ba_user
+        set `name` = #{name,jdbcType=VARCHAR},
+        phone = #{phone,jdbcType=VARCHAR},
+        password = #{password,jdbcType=VARCHAR},
+        disabled = #{disabled,jdbcType=TINYINT},
+        deleted = #{deleted,jdbcType=TINYINT}
+        where id = #{id,jdbcType=BIGINT}
     </update>
-    -->
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+        delete from ba_user
+        where id = #{id,jdbcType=BIGINT}
+    </delete>
+    <delete id="deleteLogicById" parameterType="java.lang.Long">
+        update ba_user set deleted = 1
+        where id = #{id,jdbcType=BIGINT}
+    </delete>
 </mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockCtrl.java
index 3b356a9..0480c61 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockCtrl.java
@@ -54,6 +54,7 @@
             )
     })
     @PostMapping(path = "some")
+    @SsoAop("-1")
     public BaseResponse<QueryResultVo<List<BaBlock>>> some(QueryVo vo){
         try {
             QueryResultVo<List<BaBlock>> res = this.sv.selectSome(vo) ;
@@ -78,6 +79,7 @@
             )
     })
     @GetMapping(path = "one")
+    @SsoAop("-1")
     public BaseResponse<BaBlock> one(@Parameter(description = "瀹炰綋id", required = true) Long id){
         return BaseResponseUtils.buildSuccess(this.sv.selectById(id));
     }
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockSv.java
index 581eb20..58c94f4 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockSv.java
@@ -7,6 +7,8 @@
 import org.apache.dubbo.common.utils.PojoUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
 import java.util.Map;
 import java.util.List;
 
@@ -54,6 +56,7 @@
      * @param po 瀹炰綋
      * @return 鏁伴噺
      */
+    @Transactional
     public int save(BaBlock po){
         return this.dao.insert(po) ;
     }
@@ -63,6 +66,7 @@
      * @param po 瀹炰綋
      * @return 鏁伴噺
      */
+    @Transactional
     public int update(BaBlock po){
         return this.dao.updateByPrimaryKeySelective(po) ;
     }
@@ -72,6 +76,7 @@
      * @param id 瀹炰綋ID
      * @return 鏁伴噺
      */
+    @Transactional
     public int delete(Long id){
         return this.dao.deleteLogicById(id) ;
     }
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictCtrl.java
index deaf5a7..507f034 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictCtrl.java
@@ -74,6 +74,7 @@
             )
     })
     @GetMapping(path = "all")
+    @SsoAop("-1")
     public BaseResponse<List<BaDistrict>> all(){
         List<BaDistrict> list = this.sv.selectAllByLevel(DistrictLevel.City.code) ;
         return BaseResponseUtils.buildSuccess(list);
@@ -93,6 +94,7 @@
             )
     })
     @GetMapping(path = "one")
+    @SsoAop("-1")
     public BaseResponse<BaDistrict> one(@Parameter(description = "瀹炰綋id", required = true) Long id){
         return BaseResponseUtils.buildSuccess(this.sv.selectById(id));
     }
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictSv.java
index a8f4ae3..ff2cfeb 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictSv.java
@@ -5,6 +5,7 @@
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.List;
 
@@ -17,33 +18,6 @@
     @Autowired
     private void setDao(BaDistrictMapper dao){
         this.dao = dao;
-    }
-
-    /**
-     * 淇濆瓨瀹炰綋
-     * @param po 瀹炰綋
-     * @return 鏁伴噺
-     */
-    public int save(BaDistrict po){
-        return this.dao.insert(po) ;
-    }
-
-    /**
-     * 淇濆瓨淇敼瀹炰綋
-     * @param po 瀹炰綋
-     * @return 鏁伴噺
-     */
-    public int update(BaDistrict po){
-        return this.dao.updateByPrimaryKeySelective(po) ;
-    }
-
-    /**
-     * 淇濆瓨淇敼瀹炰綋
-     * @param id 瀹炰綋ID
-     * @return 鏁伴噺
-     */
-    public int delete(Long id){
-        return this.dao.deleteLogicById(id) ;
     }
 
     /**
@@ -71,6 +45,36 @@
     }
 
     /**
+     * 淇濆瓨瀹炰綋
+     * @param po 瀹炰綋
+     * @return 鏁伴噺
+     */
+    @Transactional
+    public int save(BaDistrict po){
+        return this.dao.insert(po) ;
+    }
+
+    /**
+     * 淇濆瓨淇敼瀹炰綋
+     * @param po 瀹炰綋
+     * @return 鏁伴噺
+     */
+    @Transactional
+    public int update(BaDistrict po){
+        return this.dao.updateByPrimaryKeySelective(po) ;
+    }
+
+    /**
+     * 淇濆瓨淇敼瀹炰綋
+     * @param id 瀹炰綋ID
+     * @return 鏁伴噺
+     */
+    @Transactional
+    public int delete(Long id){
+        return this.dao.deleteLogicById(id) ;
+    }
+
+    /**
      * 寰楀埌涓嬬骇琛屾斂鍖哄垝
      * @param po 涓婄骇琛屾斂鍖哄垝
      */
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserCtrl.java
index 01b01bb..e38a597 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserCtrl.java
@@ -1,5 +1,6 @@
 package com.dy.pipIrrBase.user;
 
+import com.dy.common.aop.SsoAop;
 import com.dy.common.webUtil.BaseResponse;
 import com.dy.common.webUtil.BaseResponseUtils;
 import com.dy.common.webUtil.QueryResultVo;
@@ -12,15 +13,18 @@
 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.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
+import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
+import java.util.Objects;
 
 @Slf4j
 @Tag(name = "鐢ㄦ埛绠$悊", description = "鐢ㄦ埛澧炲垹鏀规煡绛夋搷浣�")
@@ -50,6 +54,7 @@
             )
     })
     @PostMapping(path = "some")
+    @SsoAop("-1")
     public BaseResponse<QueryResultVo<List<BaUser>>> some(QueryVo vo){
         try {
             QueryResultVo<List<BaUser>> res = this.sv.selectSome(vo) ;
@@ -74,8 +79,115 @@
             )
     })
     @GetMapping(path = "one")
+    @SsoAop("-1")
     public BaseResponse<BaUser> one(@Parameter(description = "瀹炰綋id", required = true) Long id){
         return BaseResponseUtils.buildSuccess(this.sv.selectById(id));
     }
 
+    /**
+     * 淇濆瓨鐢ㄦ埛
+     * @param po 淇濆瓨鐢ㄦ埛form琛ㄥ崟瀵硅薄
+     * @return 鏄惁鎴愬姛
+     */
+    @Operation(summary = "淇濆瓨鐢ㄦ埛", description = "鎻愪氦鐢ㄦ埛鏁版嵁锛坒orm琛ㄥ崟锛夛紝杩涜淇濆瓨")
+    @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 = "save", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    @SsoAop("-1")//@SsoAop(power = "-1")
+    public BaseResponse<Boolean> save(@Parameter(description = "form琛ㄥ崟鏁版嵁", required = true) @Valid BaUser po, @Parameter(hidden = true) BindingResult bindingResult){
+        if(bindingResult != null && bindingResult.hasErrors()){
+            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+        }
+        po.id = null ;
+        int count;
+        try {
+            count = this.sv.save(po);
+        } catch (Exception e) {
+            log.error("淇濆瓨鐢ㄦ埛寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage()) ;
+        }
+        if(count <= 0){
+            return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ;
+        }else{
+            return BaseResponseUtils.buildSuccess(true) ;
+        }
+    }
+
+    /**
+     * 缂栬緫淇敼鐢ㄦ埛
+     * @param po 淇濆瓨鐢ㄦ埛form琛ㄥ崟瀵硅薄
+     * @return 鏄惁鎴愬姛
+     */
+    @Operation(summary = "缂栬緫淇敼鐢ㄦ埛", description = "鎻愪氦鐢ㄦ埛鏁版嵁锛坒orm琛ㄥ崟锛夛紝杩涜淇敼")
+    @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.MULTIPART_FORM_DATA_VALUE)
+    @SsoAop("-1")//@SsoAop(power = "-1")
+    public BaseResponse<Boolean> update(@Parameter(description = "form琛ㄥ崟鏁版嵁", required = true) @Valid BaUser po, @Parameter(hidden = true) BindingResult bindingResult){
+        if(bindingResult != null && bindingResult.hasErrors()){
+            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+        }
+        if(po.id == null){
+            return BaseResponseUtils.buildFail("鏃犳暟鎹疄浣揑D") ;
+        }
+        int count;
+        try {
+            count = this.sv.update(po);
+        } catch (Exception e) {
+            log.error("淇濆瓨鐢ㄦ埛寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage()) ;
+        }
+        if(count <= 0){
+            return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ;
+        }else{
+            return BaseResponseUtils.buildSuccess(true) ;
+        }
+    }
+
+
+    /**
+     * 鍒犻櫎鐢ㄦ埛
+     * @param id 鐢ㄦ埛ID
+     * @return 鏄惁鎴愬姛
+     */
+    @Operation(summary = "鍒犻櫎鐢ㄦ埛", description = "鎻愪氦鐢ㄦ埛ID锛岃繘琛岄�昏緫鍒犻櫎")
+    @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))}
+            )
+    })
+    @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE)
+    @SsoAop("-1")//@SsoAop(power = "-1")
+    public BaseResponse<Boolean> delete(@Parameter(description = "瀹炰綋id", required = true) Long id){
+        if(id == null){
+            return BaseResponseUtils.buildFail("id涓嶈兘涓虹┖") ;
+        }
+        int count;
+        try {
+            count = this.sv.delete(id);
+        } catch (Exception e) {
+            log.error("淇濆瓨鐢ㄦ埛寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage()) ;
+        }
+        if(count <= 0){
+            return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ;
+        }else{
+            return BaseResponseUtils.buildSuccess(true) ;
+        }
+    }
 }
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserSv.java
index 3c16852..5a9b75e 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserSv.java
@@ -3,6 +3,7 @@
 
 import com.dy.common.webUtil.QueryResultVo;
 import com.dy.pipIrrGlobal.daoBa.BaUserMapper;
+import com.dy.pipIrrGlobal.pojoBa.BaDistrict;
 import com.dy.pipIrrGlobal.pojoBa.BaUser;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -12,6 +13,7 @@
 import java.util.Map;
 
 import org.apache.dubbo.common.utils.PojoUtils ;
+import org.springframework.transaction.annotation.Transactional;
 
 @Slf4j
 @Service
@@ -53,4 +55,34 @@
         return rsVo ;
     }
 
+    /**
+     * 淇濆瓨瀹炰綋
+     * @param po 瀹炰綋
+     * @return 鏁伴噺
+     */
+    @Transactional
+    public int save(BaUser po){
+        return this.dao.insert(po) ;
+    }
+
+    /**
+     * 淇濆瓨淇敼瀹炰綋
+     * @param po 瀹炰綋
+     * @return 鏁伴噺
+     */
+    @Transactional
+    public int update(BaUser po){
+        return this.dao.updateByPrimaryKeySelective(po) ;
+    }
+
+    /**
+     * 淇濆瓨淇敼瀹炰綋
+     * @param id 瀹炰綋ID
+     * @return 鏁伴噺
+     */
+    @Transactional
+    public int delete(Long id){
+        return this.dao.deleteLogicById(id) ;
+    }
+
 }

--
Gitblit v1.8.0