weiximei пре 6 година
родитељ
комит
76f145ce76

+ 23
- 2
CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/SysRoleController.java Прегледај датотеку

@@ -1,10 +1,17 @@
1 1
 package com.community.huiju.controller;
2 2
 
3
+import com.community.commom.mode.ResponseBean;
3 4
 import com.community.huiju.common.base.BaseController;
5
+import com.community.huiju.service.IToSysRoleService;
4 6
 import io.swagger.annotations.Api;
7
+import io.swagger.annotations.ApiImplicitParam;
8
+import io.swagger.annotations.ApiImplicitParams;
9
+import io.swagger.annotations.ApiOperation;
10
+import org.springframework.beans.factory.annotation.Autowired;
5 11
 import org.springframework.cloud.context.config.annotation.RefreshScope;
6
-import org.springframework.web.bind.annotation.RequestMapping;
7
-import org.springframework.web.bind.annotation.RestController;
12
+import org.springframework.web.bind.annotation.*;
13
+
14
+import javax.servlet.http.HttpSession;
8 15
 
9 16
 @RefreshScope
10 17
 @RestController
@@ -12,6 +19,20 @@ import org.springframework.web.bind.annotation.RestController;
12 19
 @Api(value = "运营角色 API", description = "运营角色 API")
13 20
 public class SysRoleController extends BaseController {
14 21
 
22
+    @Autowired
23
+    private IToSysRoleService iToSysRoleService;
24
+
25
+    @RequestMapping(value = "/role/list", method = RequestMethod.POST)
26
+    @ApiOperation(value = "获取所有角色", notes = "获取所有角色")
27
+    @ApiImplicitParams({
28
+            @ApiImplicitParam(dataTypeClass = String.class, paramType = "body", name = "parameter", value = "pageNum第几页;pageSize一页多少行;roleName角色名称(可选)")
29
+    })
30
+    public ResponseBean getRoleAll(@RequestBody String parameter,
31
+                                   HttpSession session){
32
+        ResponseBean responseBean = new ResponseBean();
33
+        responseBean = iToSysRoleService.getAll(parameter);
34
+        return responseBean;
35
+    }
15 36
 
16 37
 
17 38
 }

+ 1
- 1
CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/ToSysRoleMapper.java Прегледај датотеку

@@ -33,5 +33,5 @@ public interface ToSysRoleMapper {
33 33
      *
34 34
      * @return
35 35
      */
36
-    List<ToSysRole> selectAll();
36
+    List<ToSysRole> selectAll(String roleName);
37 37
 }

+ 3
- 1
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/IToSysRoleService.java Прегледај датотеку

@@ -19,7 +19,9 @@ public interface IToSysRoleService {
19 19
 
20 20
     /**
21 21
      * 获取所有的角色
22
+     *
23
+     * @param parameter
22 24
      * @return
23 25
      */
24
-    ResponseBean getAll();
26
+    ResponseBean getAll(String parameter);
25 27
 }

+ 12
- 2
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/ToSysRoleServiceImpl.java Прегледај датотеку

@@ -1,9 +1,11 @@
1 1
 package com.community.huiju.service.impl;
2 2
 
3
+import com.alibaba.fastjson.JSONObject;
3 4
 import com.community.commom.mode.ResponseBean;
4 5
 import com.community.huiju.dao.ToSysRoleMapper;
5 6
 import com.community.huiju.model.ToSysRole;
6 7
 import com.community.huiju.service.IToSysRoleService;
8
+import com.github.pagehelper.PageHelper;
7 9
 import lombok.extern.slf4j.Slf4j;
8 10
 import org.springframework.beans.factory.annotation.Autowired;
9 11
 import org.springframework.stereotype.Service;
@@ -24,9 +26,17 @@ public class ToSysRoleServiceImpl implements IToSysRoleService {
24 26
     }
25 27
 
26 28
     @Override
27
-    public ResponseBean getAll() {
29
+    public ResponseBean getAll(String parameter) {
28 30
         ResponseBean responseBean = new ResponseBean();
29
-        responseBean.addSuccess(toSysRoleMapper.selectAll());
31
+
32
+        JSONObject jsonObject = JSONObject.parseObject(parameter);
33
+        Integer pageNum = jsonObject.getInteger("pageNum");
34
+        Integer pageSize = jsonObject.getInteger("pageSize");
35
+        String roleName = jsonObject.getString("roleName").trim();
36
+
37
+        PageHelper.startPage(pageNum, pageSize);
38
+        List<ToSysRole> roleList = toSysRoleMapper.selectAll(roleName);
39
+        responseBean.addSuccess(roleList);
30 40
         return responseBean;
31 41
     }
32 42
 }

+ 6
- 1
CODE/smart-community/operate-api/src/main/resources/mapper/ToSysRoleMapper.xml Прегледај датотеку

@@ -135,6 +135,11 @@
135 135
   <select id="selectAll" resultMap="BaseResultMap">
136 136
     select
137 137
     <include refid="Base_Column_List"/>
138
-    from to_sys_role where id != 1
138
+    from to_sys_role
139
+    <where>
140
+      <if test="roleName != null and roleName != ''">
141
+        role_name = #{roleName,jdbcType=VARCHAR}
142
+      </if>
143
+    </where>
139 144
   </select>
140 145
 </mapper>

+ 10
- 0
VUECODE/smart-operate-manage/src/api/role.js Прегледај датотеку

@@ -0,0 +1,10 @@
1
+import request from '@/utils/request'
2
+
3
+// 获取所有角色列表
4
+export function getRoleList(data) {
5
+  return request({
6
+    url: '/role/list',
7
+    method: 'post',
8
+    data
9
+  })
10
+}

+ 14
- 0
VUECODE/smart-operate-manage/src/store/modules/role.js Прегледај датотеку

@@ -0,0 +1,14 @@
1
+import { getRoleList } from "@/api/role";
2
+
3
+const role = {
4
+
5
+  actions: {
6
+    GetRoleList() {
7
+      getRoleList().then().catch((err)=>{
8
+        
9
+      })
10
+    }
11
+  }
12
+}
13
+
14
+export default role