Преглед на файлове

机构关联时,增加互关逻辑

JiangChongBo преди 2 години
родител
ревизия
6ae51d3a5a

+ 2 - 0
src/main/java/com/caimei/mapper/cmMapper/AuthMapper.java

@@ -30,6 +30,8 @@ public interface AuthMapper {
 
     void updateAuthByAuthId(CmBrandAuthPo auth);
 
+    void updateRelaByAuthId(Integer authId,@Param("relationId")String relationId,@Param("relationName")String relationName);
+
     Integer getProductWaitAuditNum(Integer authId);
 
     void updateAuthAuditStatus(@Param("authId") Integer authId, @Param("status") Integer status, @Param("auditStatus") Integer auditStatus, @Param("invalidReason") String invalidReason, @Param("auditBy") Integer auditBy, @Param("auditTime") Date auditTime);

+ 15 - 0
src/main/java/com/caimei/service/auth/impl/AuthServiceImpl.java

@@ -337,6 +337,8 @@ public class AuthServiceImpl implements AuthService {
         if (insertFlag) {
             authMapper.insertAuth(auth);
         } else {
+            //机构互关
+            relaMech(auth);
             authMapper.updateAuthByAuthId(auth);
             // 删除原有的轮播图
             authMapper.deleteBanner(auth.getId());
@@ -363,6 +365,19 @@ public class AuthServiceImpl implements AuthService {
         return ResponseJson.success("保存品牌授权成功", auth);
     }
 
+    /**
+     * 机构互关
+     * @param auth
+     */
+    public void relaMech(CmBrandAuthPo auth){
+              String relaId=auth.getId().toString();
+              String relaName=auth.getAuthParty();
+              String[] relaIdArr = auth.getRelationId().split(",");
+              for(int i=0;i<relaIdArr.length;i++){
+                  Integer id = Integer.valueOf(relaIdArr[i]);
+                  authMapper.updateRelaByAuthId(id,relaId,relaName);
+              }
+    }
     @Override
     public String addWaterMark(String image, Integer type) {
         try {

+ 6 - 0
src/main/resources/mapper/AuthMapper.xml

@@ -60,6 +60,12 @@
             relationName        = #{relationName}
         where id = #{id}
     </update>
+    <update id="updateRelaByAuthId">
+        update cm_brand_auth
+        set relationId          = #{relationId},
+            relationName        = #{relationName}
+        where id = #{authId}
+    </update>
     <update id="updateAuthAuditStatus">
         update cm_brand_auth
         set status        = #{status},