mdf:用户,部门去jpa2
This commit is contained in:
@@ -17,6 +17,7 @@ package org.nl.modules.system.rest;
|
|||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import cn.dev33.satoken.secure.SaSecureUtil;
|
import cn.dev33.satoken.secure.SaSecureUtil;
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@@ -74,26 +75,26 @@ public class UserController {
|
|||||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @Log("修改用户")
|
@Log("修改用户")
|
||||||
@ApiOperation("修改用户")
|
@ApiOperation("修改用户")
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@SaCheckPermission("user:edit")
|
@SaCheckPermission("user:edit")
|
||||||
public ResponseEntity<Object> update(@Validated(User.Update.class) @RequestBody User resources) throws Exception {
|
public ResponseEntity<Object> update( @RequestBody User resources) throws Exception {
|
||||||
checkLevel(resources);
|
checkLevel(resources);
|
||||||
userService.update(resources);
|
userService.update(resources);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
/* @Log("修改用户:个人中心")
|
@Log("修改用户:个人中心")
|
||||||
@ApiOperation("修改用户:个人中心")
|
@ApiOperation("修改用户:个人中心")
|
||||||
@PutMapping(value = "center")
|
@PutMapping(value = "center")
|
||||||
public ResponseEntity<Object> center(@Validated(User.Update.class) @RequestBody User resources){
|
public ResponseEntity<Object> center(@RequestBody User resources){
|
||||||
if(!resources.getUser_id().equals(StpUtil.getLoginIdAsLong())){
|
if(!resources.getUser_id().equals(StpUtil.getLoginIdAsLong())){
|
||||||
throw new BadRequestException("不能修改他人资料");
|
throw new BadRequestException("不能修改他人资料");
|
||||||
}
|
}
|
||||||
userService.updateCenter(resources);
|
userService.updateCenter(resources);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
@Log("删除用户")
|
@Log("删除用户")
|
||||||
@ApiOperation("删除用户")
|
@ApiOperation("删除用户")
|
||||||
|
|||||||
@@ -41,8 +41,7 @@ public class UserQueryCriteria implements Serializable {
|
|||||||
|
|
||||||
private Boolean needAll;
|
private Boolean needAll;
|
||||||
|
|
||||||
@Query
|
private String is_used;
|
||||||
private Boolean is_used;
|
|
||||||
|
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
|
|||||||
@@ -297,7 +297,6 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
Set<Long> set = new HashSet<>();
|
Set<Long> set = new HashSet<>();
|
||||||
//添加本级
|
//添加本级
|
||||||
set.add(pid);
|
set.add(pid);
|
||||||
|
|
||||||
//添加子节点
|
//添加子节点
|
||||||
try {
|
try {
|
||||||
List<Entity> list = Db.use((DataSource) SpringContextHolder.getBean("dataSource")).query(sql);
|
List<Entity> list = Db.use((DataSource) SpringContextHolder.getBean("dataSource")).query(sql);
|
||||||
|
|||||||
@@ -81,12 +81,14 @@ public class UserServiceImpl implements UserService {
|
|||||||
}
|
}
|
||||||
JSONObject o = (JSONObject)JSON.toJSON(criteria);
|
JSONObject o = (JSONObject)JSON.toJSON(criteria);
|
||||||
HashMap map = MapOf.of("user_id", MapUtil.getStr(o, "user_id")
|
HashMap map = MapOf.of("user_id", MapUtil.getStr(o, "user_id")
|
||||||
, "blurry", MapUtil.getStr(o, "blurry")
|
|
||||||
, "is_used", MapUtil.getStr(o, "is_used")
|
, "is_used", MapUtil.getStr(o, "is_used")
|
||||||
, "startTime", MapUtil.getStr(o, "startTime")
|
, "startTime", MapUtil.getStr(o, "startTime")
|
||||||
, "endTime", MapUtil.getStr(o, "endTime")
|
, "endTime", MapUtil.getStr(o, "endTime")
|
||||||
, "deptId", MapUtil.getStr(o, "deptId")
|
, "deptId", MapUtil.getStr(o, "deptId")
|
||||||
);
|
);
|
||||||
|
if (ObjectUtil.isNotEmpty(MapUtil.getStr(o, "blurry"))){
|
||||||
|
map.put("blurry","'%"+MapUtil.getStr(o, "blurry")+"%'");
|
||||||
|
}
|
||||||
if (!CollectionUtils.isEmpty(criteria.getDeptIds())){
|
if (!CollectionUtils.isEmpty(criteria.getDeptIds())){
|
||||||
String collectSql = criteria.getDeptIds().stream().map(a -> String.valueOf(a)).collect(Collectors.joining("','"));
|
String collectSql = criteria.getDeptIds().stream().map(a -> String.valueOf(a)).collect(Collectors.joining("','"));
|
||||||
map.put("deptIds","('"+collectSql+"')");
|
map.put("deptIds","('"+collectSql+"')");
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
输入.deptIds TYPEAS f_string
|
输入.deptIds TYPEAS f_string
|
||||||
输入.deptId TYPEAS f_string
|
输入.deptId TYPEAS f_string
|
||||||
输入.id TYPEAS s_string
|
输入.id TYPEAS s_string
|
||||||
输入.blurry TYPEAS s_string
|
输入.blurry TYPEAS f_string
|
||||||
输入.is_used TYPEAS s_string
|
输入.is_used TYPEAS s_string
|
||||||
输入.startTime TYPEAS s_string
|
输入.startTime TYPEAS s_string
|
||||||
输入.endTime TYPEAS s_string
|
输入.endTime TYPEAS s_string
|
||||||
@@ -63,10 +63,10 @@
|
|||||||
sys_user_dept.dept_id in 输入.deptIds
|
sys_user_dept.dept_id in 输入.deptIds
|
||||||
ENDOPTION
|
ENDOPTION
|
||||||
OPTION 输入.blurry <> ""
|
OPTION 输入.blurry <> ""
|
||||||
(email like 输入.blurry or username like 输入.blurry or nickName like 输入.blurry)
|
(email like 输入.blurry or username like 输入.blurry or person_name like 输入.blurry)
|
||||||
ENDOPTION
|
ENDOPTION
|
||||||
OPTION 输入.is_used <> ""
|
OPTION 输入.is_used <> ""
|
||||||
sys_user.is_used = 输入.enabled
|
sys_user.is_used = 输入.is_used
|
||||||
ENDOPTION
|
ENDOPTION
|
||||||
OPTION 输入.deptId <> ""
|
OPTION 输入.deptId <> ""
|
||||||
sys_user_dept.dept_id = 输入.deptId
|
sys_user_dept.dept_id = 输入.deptId
|
||||||
|
|||||||
@@ -8,10 +8,11 @@ export function getDepts(params) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDeptTreee() {
|
export function getDeptTreee(params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/dept/allTree',
|
url: '/api/dept/allTree',
|
||||||
method: 'get'
|
method: 'get',
|
||||||
|
params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
@keyup.enter.native="crud.toQuery"
|
@keyup.enter.native="crud.toQuery"
|
||||||
/>
|
/>
|
||||||
<el-select
|
<el-select
|
||||||
v-model="query.enabled"
|
v-model="query.is_used"
|
||||||
clearable
|
clearable
|
||||||
size="mini"
|
size="mini"
|
||||||
placeholder="状态"
|
placeholder="状态"
|
||||||
@@ -110,6 +110,8 @@
|
|||||||
v-model="roleDatas"
|
v-model="roleDatas"
|
||||||
style="width: 512px"
|
style="width: 512px"
|
||||||
multiple
|
multiple
|
||||||
|
active-value="1"
|
||||||
|
inactive-value="0"
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
@remove-tag="deleteTag"
|
@remove-tag="deleteTag"
|
||||||
@change="changeRole"
|
@change="changeRole"
|
||||||
@@ -242,8 +244,8 @@ export default {
|
|||||||
del: ['admin', 'user:del']
|
del: ['admin', 'user:del']
|
||||||
},
|
},
|
||||||
enabledTypeOptions: [
|
enabledTypeOptions: [
|
||||||
{ key: 'true', display_name: '激活' },
|
{ key: '1', display_name: '激活' },
|
||||||
{ key: 'false', display_name: '锁定' }
|
{ key: '0', display_name: '锁定' }
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
username: [
|
username: [
|
||||||
@@ -337,20 +339,9 @@ export default {
|
|||||||
},
|
},
|
||||||
// 获取左侧部门数据
|
// 获取左侧部门数据
|
||||||
getDeptDatas(node, resolve) {
|
getDeptDatas(node, resolve) {
|
||||||
console.log('node', node)
|
debugger
|
||||||
console.log('resolve', resolve)
|
|
||||||
const sort = 'id,desc'
|
|
||||||
const params = { sort: sort }
|
|
||||||
if (typeof node !== 'object') {
|
|
||||||
if (node) {
|
|
||||||
params['name'] = node
|
|
||||||
}
|
|
||||||
} else if (node.level !== 0) {
|
|
||||||
params['pid'] = node.data.id
|
|
||||||
}
|
|
||||||
console.log('params', params)
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
getDeptTreee().then(res => {
|
getDeptTreee({ name: node }).then(res => {
|
||||||
console.log('res', res)
|
console.log('res', res)
|
||||||
if (resolve) {
|
if (resolve) {
|
||||||
resolve(res.content)
|
resolve(res.content)
|
||||||
|
|||||||
Reference in New Issue
Block a user