From 22fee1efabe983c7c9ea9d3ee627e2a4319c0fc5 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期一, 04 十二月 2023 15:30:06 +0800
Subject: [PATCH] *Mapper.java和*Mapper.xml中的insert方法改名为putin,哪果不改运行时会产生警告,警告insert已经加载过了,实际是MyBattisPlus的默认实现BaseMapper.java中已经存有instert方法

---
 pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleSv.java |   38 ++++++++++++++++++++++++++++----------
 1 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleSv.java
index 4d8e31c..d67b381 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleSv.java
@@ -5,6 +5,7 @@
 import com.dy.pipIrrGlobal.daoBa.BaRoleMapper;
 import com.dy.pipIrrGlobal.daoBa.BaRolePrivilegeMapper;
 import com.dy.pipIrrGlobal.pojoBa.BaRole;
+import com.dy.pipIrrGlobal.pojoBa.BaRolePrivilege;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.common.utils.PojoUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -36,11 +37,9 @@
      * 寰楀埌鎵�鏈夎鑹�
      * @return 鎵�鏈夎鑹查泦鍚�
      */
-    @SuppressWarnings("unchecked")
-    public QueryResultVo<List<BaRole>> selectAll(QueryVo vo){
-        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo) ;
+    public QueryResultVo<List<BaRole>> selectAll(){
         QueryResultVo<List<BaRole>> rsVo = new QueryResultVo<>() ;
-        rsVo.obj = this.dao.selectAll(params) ;
+        rsVo.obj = this.dao.selectAll() ;
         return rsVo ;
     }
 
@@ -81,7 +80,7 @@
      */
     @Transactional
     public int save(BaRole po){
-        return this.dao.insert(po) ;
+        return this.dao.putin(po) ;
     }
 
     /**
@@ -95,17 +94,36 @@
     }
 
     /**
+     * 璁剧疆瑙掕壊鏉冮檺
+     * @param roleId 瑙掕壊id
+     * @param priviIds 閫夋嫨鐨勬潈闄恑d闆嗗悎
+     * @return 鎻掑叆瑙掕壊涓庢潈闄愬叧鑱旇褰曟暟閲�
+     */
+    public int setRoles(Long roleId, Long[] priviIds){
+        this.rolePrivDao.deleteByRoleId(roleId) ;
+        int count = 0 ;
+        if(priviIds != null && priviIds.length > 0){
+            for(Long privId : priviIds){
+                count += this.rolePrivDao.insertSelective(new BaRolePrivilege(roleId, privId)) ;
+            }
+        }
+        return count ;
+    }
+
+    /**
      * 淇濆瓨淇敼瀹炰綋
      * @param id 瀹炰綋ID
      * @return 褰卞搷璁板綍鏁伴噺
      */
     @Transactional
     public int delete(Long id){
-        int count = this.dao.deleteLogicById(id) ;
-        if(count > 0){
-            this.rolePrivDao.deleteByRoleId(id) ;
-        }
-        return count ;
+        //int count = this.dao.deleteLogicById(id) ;
+        //閫昏緫鍒犻櫎锛屾墍浠ヤ笉瀹為檯鍒犻櫎鍏跺叧鑱旂殑鏉冮檺
+        //if(count > 0){
+        //    this.rolePrivDao.deleteByRoleId(id) ;
+        //}
+        //return count ;
+        return this.dao.deleteLogicById(id) ;
     }
 
 

--
Gitblit v1.8.0