Selaa lähdekoodia

项目删除,同时删除账户

zhaoxian 2 vuotta sitten
vanhempi
commit
7d630d284b

+ 2 - 0
ruixuan-live/src/main/java/com/ruixuan/jinniu/mapper/KuaishouAccountMapper.java

@@ -72,4 +72,6 @@ public interface KuaishouAccountMapper {
     void insertRecord(JSONObject o);
 
     List<JSONObject> getAccountNameByProjectId(@Param("projectId") Long projectId);
+
+    int deleteKuaishouAccountByProjectId(@Param("projectId") Long projectId);
 }

+ 3 - 0
ruixuan-live/src/main/java/com/ruixuan/jinniu/service/IKuaishouAccountService.java

@@ -34,6 +34,7 @@ public interface IKuaishouAccountService {
     public List<KuaishouAccount> selectKuaishouAccountList(KuaishouAccount kuaishouAccount);
 
     List<KuaishouAccount> getAccountByProjectId(Long projectId);
+
     /**
      * 新增账户
      *
@@ -63,4 +64,6 @@ public interface IKuaishouAccountService {
     Result<Object> edit(KuaishouAccount kuaishouAccount);
 
     List<JSONObject> getAccountNameByProjectId(Long projectId);
+
+    int deleteKuaishouAccountByProjectId(Long id);
 }

+ 5 - 0
ruixuan-live/src/main/java/com/ruixuan/jinniu/service/impl/KuaishouAccountServiceImpl.java

@@ -176,6 +176,11 @@ public class KuaishouAccountServiceImpl implements IKuaishouAccountService {
         return kuaishouAccountMapper.getAccountNameByProjectId(projectId);
     }
 
+    @Override
+    public int deleteKuaishouAccountByProjectId(Long id) {
+        return kuaishouAccountMapper.deleteKuaishouAccountByProjectId(id);
+    }
+
     private void insertAccountRecord(KuaishouAccount account, Long userId, int type) {
         JSONObject o = new JSONObject();
         o.put("accountId", account.getAccountId());

+ 3 - 1
ruixuan-live/src/main/java/com/ruixuan/jinniu/service/impl/KuaishouProjectServiceImpl.java

@@ -151,7 +151,9 @@ public class KuaishouProjectServiceImpl implements IKuaishouProjectService {
      */
     @Override
     public int deleteKuaishouProjectById(Long id) {
-        return projectMapper.deleteKuaishouProjectById(id);
+        projectMapper.deleteKuaishouProjectById(id);
+        return kuaishouAccountService.deleteKuaishouAccountByProjectId(id);
+
     }
 
     @Override

+ 6 - 0
ruixuan-live/src/main/resources/mapper/jinniu/KuaishouAccountMapper.xml

@@ -212,6 +212,12 @@
         where id = #{id}
     </delete>
 
+    <delete id="deleteKuaishouAccountByProjectId" parameterType="Long">
+        delete
+        from kuaishou_account
+        where project_id = #{projectId}
+    </delete>
+
     <select id="selectUnboundAccountList" resultType="com.alibaba.fastjson.JSONObject">
         SELECT *
         FROM (