Browse Source

Merge remote-tracking branch 'cloud-schoolapi/ywx'

tags/正式3.2.0
王宁 2 years ago
parent
commit
fc0adb5045

+ 3
- 4
suser/src/main/java/com/xhkjedu/suser/controller/system/UsecretController.java View File

@@ -60,7 +60,7 @@ public class UsecretController {
60 60
     public ResultVo delete(@RequestBody TUsecret usecret) {
61 61
         Integer usid = usecret.getUsid();
62 62
         N_Utils.validation(new Object[]{usid, "密保问题id", 1});
63
-        return usecretService.deleteById(usid);
63
+        return usecretService.deleteById(usid, usecret.getSchoolid());
64 64
     }
65 65
 
66 66
     /**
@@ -72,8 +72,8 @@ public class UsecretController {
72 72
       */
73 73
     @PostMapping("/list")
74 74
     public ResultVo list(@RequestBody TUsecret usecret) {
75
-        N_Utils.validation(new Object[]{usecret.getPage(), "显示页码", 1, usecret.getPageSize(), "显示条数", 1, usecret.getSchoolid(), "学校id", 1});
76
-        PageHelper.startPage(usecret.getPage(),usecret.getPageSize());
75
+        N_Utils.validation(new Object[]{usecret.getPage(), "显示页码", 1, usecret.getPageSize(), "显示条数", 1});
76
+        PageHelper.startPage(usecret.getPage(), usecret.getPageSize());
77 77
         List<Map> list = usecretService.findAll(usecret);
78 78
         PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
79 79
         return new ResultVo(0,"获取列表成功",pageResult);
@@ -89,7 +89,6 @@ public class UsecretController {
89 89
     @PostMapping("/list_sel")
90 90
     public ResultVo listForSel(@RequestBody TUsecret usecret) {
91 91
         Integer schoolid = usecret.getSchoolid();
92
-        N_Utils.validation(new Object[]{schoolid, "学校id", 1});
93 92
         List<Map> list = usecretService.listForSel(schoolid);
94 93
         return new ResultVo(0,"获取列表成功",list);
95 94
     }

+ 4
- 1
suser/src/main/java/com/xhkjedu/suser/mapper/system/UsecretMapper.java View File

@@ -14,5 +14,8 @@ public interface UsecretMapper extends TkMapper<TUsecret> {
14 14
     List<Map> findAll(@Param("usecret") TUsecret usecret);
15 15
 
16 16
     //获取密保问题选择列表
17
-    List<Map> listForSel(Integer schoolid);
17
+    List<Map> listForSel(@Param("schoolid") Integer schoolid);
18
+
19
+    //获取密保问题数量
20
+    Integer getNumBySchoolId(@Param("schoolid") Integer schoolid);
18 21
 }

+ 3
- 0
suser/src/main/java/com/xhkjedu/suser/model/system/TUsecret.java View File

@@ -19,6 +19,9 @@ public class TUsecret extends BaseBean {
19 19
     //密保问题排序
20 20
     private Integer sorder;
21 21
 
22
+    //归属1平台3学校
23
+    private Integer belong;
24
+
22 25
     //创建人id
23 26
     private Integer createid;
24 27
 

+ 13
- 9
suser/src/main/java/com/xhkjedu/suser/service/system/UsecretService.java View File

@@ -47,17 +47,21 @@ public class UsecretService {
47 47
     }
48 48
 
49 49
     /**
50
-      * 删除
51
-      * @param [usid]
52
-      * @author ywx
53
-      * @date 2022/3/30 11:41
54
-      * @return com.xhkjedu.vo.ResultVo
55
-      */
56
-    public ResultVo deleteById(Integer usid) {
50
+     * 删除
51
+     *
52
+     * @param [usid]
53
+     * @param schoolid
54
+     * @return com.xhkjedu.vo.ResultVo
55
+     * @author ywx
56
+     * @date 2022/3/30 11:41
57
+     */
58
+    public ResultVo deleteById(Integer usid, Integer schoolid) {
57 59
         Integer usenum = userUsecretMapper.getUseNumByUsId(usid);//获取密保问题使用频次
58
-        if (usenum != 0) return new ResultVo(1,"该密保问题被使用禁止删除");
60
+        if (usenum != 0) return new ResultVo(1, "该密保问题被使用禁止删除");
61
+        Integer num = usecretMapper.getNumBySchoolId(schoolid);//获取密保问题数量
62
+        if (num.compareTo(2) != 1) return new ResultVo(1, "密保问题少于两个禁止删除");
59 63
         usecretMapper.deleteByPrimaryKey(usid);
60
-        return new ResultVo(0,"删除成功");
64
+        return new ResultVo(0, "删除成功");
61 65
     }
62 66
 
63 67
     /**

+ 21
- 4
suser/src/main/resources/mapper/system/UsecertMapper.xml View File

@@ -3,14 +3,31 @@
3 3
 <mapper namespace="com.xhkjedu.suser.mapper.system.UsecretMapper">
4 4
     <!--获取密保问题列表-->
5 5
     <select id="findAll" resultType="java.util.Map">
6
-        select u.usid,u.sname,u.sorder,u.createtime,u2.username createname
6
+        select u.usid,u.sname,u.sorder,u.belong,u.createtime,u2.username createname
7 7
         ,(select count(uu.uusid) from t_user_usecret uu where uu.usid=u.usid)usenum
8 8
         from t_usecret u left join t_user u2 on u2.userid=u.createid
9
-        where u.schoolid=#{usecret.schoolid}
10
-        order by u.createtime desc
9
+        where u.belong=1
10
+        <if test="usecret.schoolid!=null and usecret.schoolid!=0">
11
+            or (u.schoolid=#{usecret.schoolid} and belong=3)
12
+        </if>
13
+        order by u.sorder
11 14
     </select>
12 15
     <!--获取密保问题选择列表-->
13 16
     <select id="listForSel" resultType="java.util.Map">
14
-        select u.usid,u.sname from t_usecret u where u.schoolid=#{schoolid} order by u.sorder
17
+        select u.usid,u.sname from t_usecret u
18
+        where u.belong=1
19
+        <if test="schoolid!=null and schoolid!=0">
20
+            or (u.schoolid=#{schoolid} and belong=3)
21
+        </if>
22
+        order by u.sorder
23
+    </select>
24
+    <!--获取密保问题数量-->
25
+    <select id="getNumBySchoolId" resultType="java.lang.Integer">
26
+        select count(u.usid) from t_usecret u
27
+        where u.belong=1
28
+        <if test="schoolid!=null and schoolid!=0">
29
+            or (u.schoolid=#{schoolid} and belong=3)
30
+        </if>
31
+        order by u.sorder
15 32
     </select>
16 33
 </mapper>

Loading…
Cancel
Save