dingxin 6 лет назад
Родитель
Сommit
a09e1d61c5

+ 6
- 1
CODE/smart-community/operate-api/pom.xml Просмотреть файл

@@ -141,8 +141,13 @@
141 141
 			<artifactId>okhttp</artifactId>
142 142
 			<version>3.11.0</version>
143 143
 		</dependency>
144
+        <dependency>
145
+            <groupId>org.apache.poi</groupId>
146
+            <artifactId>poi</artifactId>
147
+            <version>RELEASE</version>
148
+        </dependency>
144 149
 
145
-	</dependencies>
150
+    </dependencies>
146 151
 
147 152
 	<dependencyManagement>
148 153
 		<dependencies>

+ 10
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/UserController.java Просмотреть файл

@@ -85,5 +85,15 @@ public class UserController extends BaseController {
85 85
         responseBean.addSuccess("退出成功!");
86 86
         return responseBean;
87 87
     }
88
+    @ApiOperation(value = "用户成员列表", notes = "用户成员列表")
89
+    @ApiImplicitParams({
90
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "loginName:手机号, " +
91
+                    "userName:用户名,pageNum:第几页,pageSize:每页长度")
92
+    })
93
+    @RequestMapping(value = "/user/userList", method = RequestMethod.POST)
94
+    public ResponseBean userList(@RequestBody String parameter){
95
+        ResponseBean  responseBean = iToUserService.userList(parameter);
96
+        return responseBean;
97
+    }
88 98
 
89 99
 }

+ 12
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/ToUserMapper.java Просмотреть файл

@@ -3,6 +3,9 @@ package com.community.huiju.dao;
3 3
 import com.community.huiju.model.ToUser;
4 4
 import org.apache.ibatis.annotations.Mapper;
5 5
 import org.apache.ibatis.annotations.Param;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+
8
+import java.util.List;
6 9
 
7 10
 @Mapper
8 11
 public interface ToUserMapper {
@@ -19,4 +22,13 @@ public interface ToUserMapper {
19 22
     int updateByPrimaryKey(ToUser record);
20 23
 
21 24
     ToUser selectByLoginName(@Param(value = "loginName") String loginName);
25
+
26
+    List<ToUser> userList(@Param("loginName") String loginName, @Param("userName") String userName);
27
+
28
+    /**
29
+     * 查询创建人或者修改人
30
+     * @param createUser
31
+     * @return
32
+     */
33
+    String selectByIdUserName(Integer createUser);
22 34
 }

+ 40
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToUser.java Просмотреть файл

@@ -1,6 +1,7 @@
1 1
 package com.community.huiju.model;
2 2
 
3 3
 import java.util.Date;
4
+import java.util.List;
4 5
 
5 6
 public class ToUser {
6 7
     private Integer id;
@@ -27,6 +28,45 @@ public class ToUser {
27 28
 
28 29
     private Date updateDate;
29 30
 
31
+    private  String roleName;
32
+
33
+    /**
34
+     * 创建人
35
+     * @return
36
+     */
37
+    private String createNmae;
38
+
39
+    /**
40
+     * 修改人
41
+     * @return
42
+     */
43
+    private String updateNmae;
44
+
45
+
46
+    public String getCreateNmae() {
47
+        return createNmae;
48
+    }
49
+
50
+    public void setCreateNmae(String createNmae) {
51
+        this.createNmae = createNmae;
52
+    }
53
+
54
+    public void setUpdateNmae(String updateNmae) {
55
+        this.updateNmae = updateNmae;
56
+    }
57
+
58
+    public String getUpdateNmae() {
59
+        return updateNmae;
60
+    }
61
+
62
+    public String getRoleName() {
63
+        return roleName;
64
+    }
65
+
66
+    public void setRoleName(String roleName) {
67
+        this.roleName = roleName;
68
+    }
69
+
30 70
     public Integer getId() {
31 71
         return id;
32 72
     }

+ 6
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/IToUserService.java Просмотреть файл

@@ -23,4 +23,10 @@ public interface IToUserService {
23 23
      */
24 24
     ResponseBean getInfo(Integer userId);
25 25
 
26
+    /**
27
+     * 获取成员列表
28
+     * @param parameter
29
+     * @return
30
+     */
31
+    ResponseBean userList(String parameter);
26 32
 }

+ 38
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/ToUserServerImpl.java Просмотреть файл

@@ -1,5 +1,7 @@
1 1
 package com.community.huiju.service.impl;
2 2
 
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.beust.jcommander.internal.Maps;
3 5
 import com.community.commom.mode.ResponseBean;
4 6
 import com.community.commom.utils.AccountValidatorUtil;
5 7
 import com.community.huiju.common.code.cache.AppkeyCache;
@@ -9,6 +11,8 @@ import com.community.huiju.model.ToSysRole;
9 11
 import com.community.huiju.model.ToUser;
10 12
 import com.community.huiju.service.IToUserService;
11 13
 import com.community.huiju.vo.ToUserVO;
14
+import com.github.pagehelper.Page;
15
+import com.github.pagehelper.PageHelper;
12 16
 import lombok.extern.slf4j.Slf4j;
13 17
 import org.apache.commons.lang.StringUtils;
14 18
 import org.springframework.beans.BeanUtils;
@@ -16,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
16 20
 import org.springframework.stereotype.Service;
17 21
 
18 22
 import java.util.List;
23
+import java.util.Map;
19 24
 
20 25
 @Service("iToUserServer")
21 26
 @Slf4j
@@ -82,4 +87,37 @@ public class ToUserServerImpl implements IToUserService {
82 87
 
83 88
         return response;
84 89
     }
90
+
91
+    @Override
92
+    public ResponseBean userList(String parameter) {
93
+        ResponseBean response= new ResponseBean<>();
94
+        JSONObject object= JSONObject.parseObject(parameter);
95
+        String loginName= object.getString("loginName");
96
+        String userName = object.getString("userName");
97
+
98
+        Integer pageNum = object.getInteger("pageNum");
99
+        Integer pageSize = object.getInteger("pageSize");
100
+
101
+        pageNum=pageNum==null?1:pageNum;
102
+        pageSize=pageSize==null?10:pageSize;
103
+
104
+        Page<ToUser> page = PageHelper.startPage(pageNum,pageSize);
105
+        List<ToUser> userList=toUserMapper.userList(loginName,userName);
106
+
107
+        for (ToUser toUser:userList){
108
+            // 创建人
109
+            String createNmae=toUserMapper.selectByIdUserName(toUser.getCreateUser());
110
+            // 修改人
111
+            String updateNmae=toUserMapper.selectByIdUserName(toUser.getUpdateUser());
112
+
113
+            toUser.setCreateNmae(createNmae);
114
+            toUser.setUpdateNmae(updateNmae);
115
+        }
116
+
117
+        Map<String,Object> map = Maps.newHashMap();
118
+        map.put("item",userList);
119
+        map.put("total",page.getTotal());
120
+        response.addSuccess(map);
121
+        return response;
122
+    }
85 123
 }

+ 37
- 0
CODE/smart-community/operate-api/src/main/resources/mapper/ToUserMapper.xml Просмотреть файл

@@ -14,6 +14,7 @@
14 14
     <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
15 15
     <result column="update_user" property="updateUser" jdbcType="INTEGER" />
16 16
     <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
17
+    <result column="role_name" property="roleName" jdbcType="VARCHAR" />
17 18
   </resultMap>
18 19
   <sql id="Base_Column_List" >
19 20
     id, user_name, login_name, login_password, email, head_portrait, remark, status, 
@@ -181,4 +182,40 @@
181 182
     from to_user where login_name = #{loginName,jdbcType=VARCHAR}
182 183
   </select>
183 184
 
185
+  <select id="userList" parameterType="com.community.huiju.model.ToUser" resultMap="BaseResultMap" >
186
+    SELECT
187
+    sr.role_name,
188
+    sr.description,
189
+    sr.create_user,
190
+    sr.create_date,
191
+    sr.update_date,
192
+    sr.update_user,
193
+    tu.user_name,
194
+    tu.remark,
195
+    tu.login_name,
196
+    tu.remark,
197
+    tu.status,
198
+    tu.id
199
+    FROM
200
+    to_user tu
201
+    LEFT JOIN to_sys_user_role ON tu.id = to_sys_user_role.user_id
202
+    LEFT JOIN to_sys_role sr ON to_sys_user_role.role_id = sr.id
203
+    <where>
204
+    <if test="loginName != null and loginName !=''" >
205
+      and tu.login_name = #{loginName,jdbcType=VARCHAR}
206
+    </if>
207
+    <if test="userName != null and userName !=''" >
208
+      and tu.user_name like concat('%',#{userName,jdbcType=VARCHAR},'%')
209
+    </if>
210
+    </where>
211
+  </select>
212
+
213
+  <select id="selectByIdUserName" parameterType="int" resultType="string">
214
+    SELECT
215
+    user_name
216
+    FROM
217
+    to_user
218
+    WHERE id=#{id,jdbcType=INTEGER}
219
+  </select>
220
+
184 221
 </mapper>

+ 16
- 0
VUECODE/smart-operate-manage/src/api/user.js Просмотреть файл

@@ -0,0 +1,16 @@
1
+import request from '@/utils/request'
2
+
3
+// 根据条件查询成员
4
+export function employeesList(data) {
5
+  return request({
6
+    url: '/user/userList',
7
+    method: 'post',
8
+    data: {
9
+      loginName: data.loginName,
10
+      userName: data.userName,
11
+      pageNum: data.pageNum,
12
+      pageSize: data.pageSize
13
+    }
14
+  })
15
+}
16
+

+ 12
- 0
VUECODE/smart-operate-manage/src/store/modules/user.js Просмотреть файл

@@ -1,5 +1,6 @@
1 1
 import { login, logOut, getInfo, sendCode } from '@/api/login'
2 2
 import { getToken, setToken, removeToken } from '@/utils/auth'
3
+import { employeesList } from '@/api/user'
3 4
 
4 5
 const user = {
5 6
   state: {
@@ -98,6 +99,17 @@ const user = {
98 99
         removeToken()
99 100
         resolve()
100 101
       })
102
+    },
103
+    // 根据条件查询 employeesList
104
+    EmployeesList({ commit }, listQuery) {
105
+      return new Promise((resolve, reject) => {
106
+        employeesList(listQuery).then(response => {
107
+          const data = response.data
108
+          resolve(data)
109
+        }).catch(error => {
110
+          reject(error)
111
+        })
112
+      })
101 113
     }
102 114
   }
103 115
 }

+ 193
- 2
VUECODE/smart-operate-manage/src/views/account/user/index.vue Просмотреть файл

@@ -1,10 +1,201 @@
1 1
 <template>
2
-    <div>员工管理</div>
2
+  <div class="root">
3
+    <el-form :inline="true" :model="listQuery" class="form-listQuery">
4
+      <el-form-item class="filter-item" label="姓名">
5
+        <el-input v-model.trim="listQuery.userName" placeholder="姓名" />
6
+      </el-form-item>
7
+      <el-form-item class="filter-item" label="手机号" >
8
+        <el-input v-model.trim="listQuery.loginName" onkeyup="this.value=this.value.replace(/\D/g,'')" placeholder="手机号" />
9
+      </el-form-item>
10
+      <el-form-item>
11
+        <el-button type="info" class="filter-item" @click="handleFilter">清空</el-button>
12
+        <el-button type="primary" @click="search">查询</el-button>
13
+      </el-form-item>
14
+    </el-form>
15
+    <div class="button">
16
+      <el-button type="primary">添加</el-button>
17
+      <el-button type="warning" >修改</el-button>
18
+    </div>
19
+    <el-table
20
+      v-loading="listLoading"
21
+      ref="multipleTable"
22
+      :data="listDate"
23
+      border
24
+      tooltip-effect="dark"
25
+      style="width: 100%; margin-top: 20px;"
26
+      @selection-change="handleSelectionChange">
27
+      <el-table-column
28
+        type="selection"
29
+        width="55"/>
30
+      <el-table-column prop="userName" label="姓名" align="center"/>
31
+      <el-table-column prop="roleName" label="角色" align="center"/>
32
+      <el-table-column prop="loginName" label="手机号" align="center"/>
33
+      <el-table-column prop="remark" label="备注" align="center"/>
34
+      <el-table-column prop="createNmae" label="创建人" align="center"/>
35
+      <el-table-column prop="createDate" label="创建时间" align="center"><template slot-scope="scope">{{ formatDate(scope.row.createDate) }}</template></el-table-column>
36
+      <el-table-column prop="updateNmae" label="修改人" align="center"/>
37
+      <el-table-column prop="updateDate" label="修改时间" align="center" ><template slot-scope="scope">{{ formatDate(scope.row.updateDate) }}</template></el-table-column>
38
+      <el-table-column prop="id" label="操作" align="center">
39
+          <template slot-scope="scope"><a><span style="color: #63B8FF" @click="clickTitle(scope.row.id)">{{ scope.row.status =='1' ? '停用账号':'启用账号' }}</span></a></template>
40
+
41
+      <!-- <a><template slot-scope="scope">
42
+          <span v-if="scope.row.status==1">{{ '停用账号' }}</span>
43
+          <span v-if="scope.row.status==0">{{ '启用账号' }}</span>
44
+     </template></a> -->
45
+          </el-table-column>
46
+    </el-table>
47
+    <div class="block">
48
+      <el-pagination
49
+        :current-page.sync="listQuery.pageNum"
50
+        :page-sizes="[10, 20, 50, 100]"
51
+        :page-size.sync="listQuery.pageSize"
52
+        :total="total"
53
+        layout="total, sizes, prev, pager, next, jumper"
54
+        @size-change="handleSizeChange"
55
+        @current-change="handleCurrentChange"/>
56
+    </div>
57
+  </div>
3 58
 </template>
4 59
 
5 60
 <script>
61
+import { mapActions } from 'vuex'
62
+
6 63
 export default {
7
-    
64
+  data() {
65
+    return {
66
+      listQuery: {
67
+        id: '',
68
+        userName: '',
69
+        loginName:'',
70
+        roleName: '',
71
+        createUser: '',
72
+        updateUser: '',
73
+        updateDate: '',
74
+        pageNum: 1,
75
+        pageSize: 10
76
+      },
77
+      total: 0, // 数据总数
78
+      listDate: [],
79
+      deleteIds: [], // 选择的id集合
80
+      listLoading: true // 加载圈
81
+    }
82
+  },
83
+  mounted() {
84
+    // 获取数据
85
+    this.dataQuery()
86
+  },
87
+  methods: {
88
+    ...mapActions('listAnnouncement', [
89
+      'BserPassCertification'
90
+    ]),
91
+    handleSizeChange(val) {
92
+      console.log(`每页 ${val} 条`)
93
+      this.listQuery.pageSize = val
94
+      this.dataQuery()
95
+    },
96
+    handleCurrentChange(val) {
97
+      console.log(`当前页: ${val}`)
98
+      this.listQuery.pageNum = val
99
+      this.dataQuery()
100
+    },
101
+    padDate(value) {
102
+      value = value < 10 ? '0' + value : value
103
+      return value
104
+    },
105
+    getStatus(row) { // 获取状态
106
+      let statusName = ''
107
+
108
+      // 判断状态
109
+      switch (row.status) {
110
+        case '0':
111
+          statusName = '已作废'
112
+          break
113
+        case '1':
114
+          statusName = '已发布'
115
+          break
116
+        case '2':
117
+          statusName = '草稿'
118
+          break
119
+      }
120
+
121
+      // 如果修改时间和创建时间不一致, 就显示已修改
122
+      if (row.status === '1' && (row.updateDate > row.createDate)) {
123
+        statusName = '已修改'
124
+      }
125
+
126
+      return statusName
127
+    },
128
+    dataQuery() { // 查询数据
129
+      this.listLoading = true
130
+      this.$store.dispatch('EmployeesList', this.listQuery).then((res) => {
131
+         this.listDate = res.item
132
+        console.log('resData1',this.listDate)
133
+        this.list = res.item
134
+        this.total = res.total
135
+        this.listLoading = false
136
+      }).catch(() => {
137
+        this.listLoading = false
138
+        console.log('error EmployeesList')
139
+      })
140
+    },
141
+    handleSelectionChange(data) {
142
+      // 设置为 空
143
+      this.deleteIds = []
144
+      for (let i = 0; i < data.length; i++) {
145
+        this.deleteIds.push(data[i].id)
146
+      }
147
+    },
148
+	  search() {
149
+      this.listQuery.pageNum = 1
150
+      this.dataQuery()
151
+    },
152
+    handleFilter() {
153
+      this.listQuery.pageNum = 1
154
+      this.listQuery.pageSize = 10
155
+      this.listQuery.ownerName =''
156
+      this.listQuery.userName=''
157
+      this.listQuery.loginName=''
158
+      this.dataQuery()
159
+    },
160
+    clickTitle(id) {
161
+      this.$router.push({ name: 'contentParticulars-details', params: { id: id }})
162
+    },
163
+    formatDate(val) {
164
+      if (val === null) {
165
+        return ''
166
+      }
167
+      var value = new Date(val)
168
+      var year = value.getFullYear()
169
+      var month = value.getMonth() + 1
170
+      var day = value.getDate()
171
+      return year + '-' + month + '-' + day
172
+    }
173
+  }
8 174
 }
9 175
 </script>
10 176
 
177
+<style scoped>
178
+.root{
179
+  display: flex;
180
+  flex-flow: column;
181
+}
182
+.form-listQuery{
183
+  margin-top: 20px;
184
+  margin-left: 30px;
185
+}
186
+.operation{
187
+  display: flex;
188
+  justify-content: space-between;
189
+  margin-left: 20px;
190
+  margin-right: 20px;
191
+}
192
+.block{
193
+  display: flex;
194
+  justify-content: flex-end;
195
+  margin-top: 10px;
196
+}
197
+.button {
198
+  margin-left: 20px;
199
+}
200
+</style>
201
+