libo 4 anos atrás
pai
commit
15de49849f

+ 13 - 5
src/main/java/com/tdba/cxb/ares/api/controller/UserController.java

@@ -90,6 +90,19 @@ public class UserController {
90 90
         return buildSuccess("");
91 91
     }
92 92
 
93
+    /**
94
+     * 解绑用户
95
+     * @param baseUser
96
+     * @return
97
+     */
98
+    @PostMapping("bind_remove")
99
+    public TDBAResponse bind_remove(@RequestBody @Validated BindUserRemove param, BaseUser baseUser){
100
+        Objects.requireNonNull(baseUser, "请登录后操作");
101
+//        userService.teamAdd(param, baseUser);
102
+        return buildSuccess("");
103
+    }
104
+
105
+
93 106
     @GetMapping("data_total")
94 107
     public TDBAResponse data_total(BaseUser baseUser){
95 108
         Objects.requireNonNull(baseUser, "请登录后操作");
@@ -135,9 +148,4 @@ public class UserController {
135 148
         Objects.requireNonNull(baseUser, "请登录后操作");
136 149
         return buildSuccess("退出成功");
137 150
     }
138
-
139
-    public static void main(String[] args) {
140
-        System.out.println(LocalDateTime.of(2022, 06, 10, 00, 00, 00).toEpochSecond(ZoneOffset.ofHours(8)));
141
-        System.out.println(LocalDateTime.of(2022, 06, 10, 23, 59, 59).toEpochSecond(ZoneOffset.ofHours(8)));
142
-    }
143 151
 }

+ 23 - 0
src/main/java/com/tdba/cxb/ares/api/model/BindUserRemove.java

@@ -0,0 +1,23 @@
1
+package com.tdba.cxb.ares.api.model;
2
+
3
+import javax.validation.constraints.NotEmpty;
4
+
5
+/**
6
+ * @program: order-web
7
+ * @description:
8
+ * @author: libo
9
+ * @create: 2022-06-13 17:44:16
10
+ */
11
+public class BindUserRemove {
12
+
13
+    @NotEmpty(message = "团队成员ID不能为空")
14
+    private Integer id;
15
+
16
+    public Integer getId() {
17
+        return id;
18
+    }
19
+
20
+    public void setId(Integer id) {
21
+        this.id = id;
22
+    }
23
+}

+ 3 - 0
src/main/java/com/tdba/cxb/ares/api/repository/UserBindMapper.java

@@ -22,4 +22,7 @@ public interface UserBindMapper {
22 22
     UserBind selectByUid(@Param("uid") Integer uid);
23 23
 
24 24
     List<Integer> selectUid(@Param("bindUid") Integer bindUid);
25
+
26
+    UserBind selectById(@Param("bindUid") Integer bindUid,
27
+                        @Param("uid") Integer uid);
25 28
 }

+ 16 - 0
src/main/java/com/tdba/cxb/ares/api/service/UserService.java

@@ -437,6 +437,22 @@ public class UserService {
437 437
     }
438 438
 
439 439
     /**
440
+     * 解绑成员
441
+     * @param param
442
+     * @param baseUser
443
+     */
444
+    public void teamRemove(BindUserRemove param, BaseUser baseUser){
445
+
446
+//        UserBind userBind = userBindMapper.selectById(param, );
447
+        if(userBindMapper.selectUid(baseUser.getId()).stream().noneMatch(row -> row.equals(param.getId()))){
448
+            throw new TDBAException("运营商未关联该用户");
449
+        }
450
+
451
+
452
+
453
+    }
454
+
455
+    /**
440 456
      * 团队用户数据详情
441 457
      * @param uid       用户ID
442 458
      * @param userType  用户类型

+ 5 - 1
src/main/resources/mapper/UserBindMapper.xml

@@ -77,6 +77,10 @@
77 77
     </select>
78 78
 
79 79
     <select id="selectUid" resultType="java.lang.Integer">
80
-        select uid from user_bind where del_flag = 0 and type = 0 and bind_uid = #{bindUid}
80
+        select uid from user_bind where del_flag = 0 and bind_uid = #{bindUid}
81
+    </select>
82
+
83
+    <select id="selectById" resultType="com.tdba.cxb.ares.api.model.UserBind">
84
+        select * from user_bind where del_flag = 0 and type = 0 and bind_uid = #{bindUid} and uid = #{uid}
81 85
     </select>
82 86
 </mapper>