完善基础代码(用户组)
This commit is contained in:
parent
9817f9b84b
commit
887c8e3875
@ -24,7 +24,7 @@ public interface IDepartmentUserBaseService {
|
||||
* @param departmentId 部门ID
|
||||
* @return
|
||||
*/
|
||||
List<String> listUserIdByDepartmentId(String departmentId);
|
||||
List<String> listUserId(String departmentId);
|
||||
|
||||
/**
|
||||
* 用户ID列表
|
||||
@ -32,7 +32,7 @@ public interface IDepartmentUserBaseService {
|
||||
* @param departmentIds 部门ID列表
|
||||
* @return
|
||||
*/
|
||||
List<String> listUserIdByDepartmentIds(List<String> departmentIds);
|
||||
List<String> listUserId(List<String> departmentIds);
|
||||
|
||||
/**
|
||||
* 用户列表
|
||||
|
@ -0,0 +1,45 @@
|
||||
package ink.wgink.interfaces.group;
|
||||
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.group.GroupUserDTO;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: IGroupUserService
|
||||
* @Description: 组用户
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/1/24 13:00
|
||||
* @Version: 1.0
|
||||
**/
|
||||
public interface IGroupUserBaseService {
|
||||
|
||||
/**
|
||||
* 用户ID列表
|
||||
*
|
||||
* @param groupId 用户组ID
|
||||
* @return
|
||||
*/
|
||||
List<String> listUserId(String groupId);
|
||||
|
||||
/**
|
||||
* 用户ID列表
|
||||
*
|
||||
* @param groupIds 用户组ID列表
|
||||
* @return
|
||||
*/
|
||||
List<String> listUserId(List<String> groupIds);
|
||||
|
||||
/**
|
||||
* 分页用户组用户
|
||||
*
|
||||
* @param groupId
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<GroupUserDTO>> listPage(String groupId, ListPage page);
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package ink.wgink.interfaces.user;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: IGroupUserService
|
||||
* @Description: 组用户
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/1/24 13:00
|
||||
* @Version: 1.0
|
||||
**/
|
||||
public interface IGroupUserService {
|
||||
|
||||
|
||||
|
||||
}
|
@ -84,5 +84,5 @@ public interface IUserBaseService {
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<UserDTO>> listPageByExcludeUserIds(List<String> excludeUserIds, ListPage page);
|
||||
SuccessResultList<List<UserDTO>> listPageByExcludeIds(List<String> excludeUserIds, ListPage page);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package ink.wgink.pojo.dtos.group;
|
||||
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
import java.io.Serializable;
|
||||
@ -26,6 +27,21 @@ public class GroupUserDTO implements Serializable {
|
||||
private Integer userState;
|
||||
private String userAvatar;
|
||||
|
||||
public GroupUserDTO() {
|
||||
|
||||
}
|
||||
|
||||
public GroupUserDTO(UserDTO userDTO) {
|
||||
this.userId = userDTO.getUserId();
|
||||
this.userUsername = userDTO.getUserUsername();
|
||||
this.userName = userDTO.getUserName();
|
||||
this.userPhone = userDTO.getUserPhone();
|
||||
this.userEmail = userDTO.getUserEmail();
|
||||
this.userType = userDTO.getUserType();
|
||||
this.userState = userDTO.getUserState();
|
||||
this.userAvatar = userDTO.getUserAvatar();
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId == null ? "" : userId.trim();
|
||||
}
|
||||
|
@ -41,13 +41,6 @@
|
||||
</dependency>
|
||||
<!-- springboot end -->
|
||||
|
||||
<!-- durid start -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
</dependency>
|
||||
<!-- durid end -->
|
||||
|
||||
<!-- pagerhelper start -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
@ -59,9 +52,22 @@
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>cglib</groupId>
|
||||
<artifactId>cglib</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- easyexcel end -->
|
||||
|
||||
<!-- cglib start -->
|
||||
<dependency>
|
||||
<groupId>cglib</groupId>
|
||||
<artifactId>cglib</artifactId>
|
||||
</dependency>
|
||||
<!-- cglib end -->
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
13
pom.xml
13
pom.xml
@ -32,7 +32,8 @@
|
||||
<spring.version>5.2.8.RELEASE</spring.version>
|
||||
<spring-boot.version>2.3.3.RELEASE</spring-boot.version>
|
||||
<fastjson.version>1.2.24</fastjson.version>
|
||||
<easyexcel.version>2.0.5</easyexcel.version>
|
||||
<easyexcel.version>2.2.7</easyexcel.version>
|
||||
<cglib.version>3.2.3</cglib.version>
|
||||
<mysql.version>5.1.47</mysql.version>
|
||||
<durid.version>1.0.31</durid.version>
|
||||
<pagehelper.version>5.1.1</pagehelper.version>
|
||||
@ -49,7 +50,7 @@
|
||||
<commons-text.version>1.6</commons-text.version>
|
||||
<common-pool2.version>2.6.0</common-pool2.version>
|
||||
<commonLang3.version>3.4</commonLang3.version>
|
||||
<common-io.version>2.4</common-io.version>
|
||||
<common-io.version>2.2</common-io.version>
|
||||
<common-net.version>3.3</common-net.version>
|
||||
<common-fileupload.version>1.3.1</common-fileupload.version>
|
||||
<common-codec.version>1.12</common-codec.version>
|
||||
@ -154,6 +155,14 @@
|
||||
</dependency>
|
||||
<!-- easyexcel end -->
|
||||
|
||||
<!-- cglib start -->
|
||||
<dependency>
|
||||
<groupId>cglib</groupId>
|
||||
<artifactId>cglib</artifactId>
|
||||
<version>${cglib.version}</version>
|
||||
</dependency>
|
||||
<!-- cglib end -->
|
||||
|
||||
<!-- MySQL start -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
|
@ -82,7 +82,7 @@ public class DepartmentUserController extends DefaultBaseController {
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listuseridbydepartmentid/{departmentId}")
|
||||
public List<String> listUserIdByDepartmentId(@PathVariable("departmentId") String departmentId) {
|
||||
return departmentUserService.listUserIdByDepartmentId(departmentId);
|
||||
return departmentUserService.listUserId(departmentId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -449,7 +449,7 @@ public class DepartmentServiceImpl extends DefaultBaseService implements IDepart
|
||||
*/
|
||||
private List<String> removeByIdReturnDeletedUserIds(String departmentId, String departmentName) {
|
||||
// 获取用户ID
|
||||
List<String> userIds = departmentUserService.listUserIdByDepartmentId(departmentId);
|
||||
List<String> userIds = departmentUserService.listUserId(departmentId);
|
||||
// 删除组织用户
|
||||
departmentUserService.deleteByDepartmentIdAndUserIds(departmentId, departmentName, userIds);
|
||||
// 删除组织
|
||||
|
@ -114,14 +114,14 @@ public class DepartmentUserServiceImpl extends DefaultBaseService implements IDe
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> listUserIdByDepartmentId(String departmentId) {
|
||||
public List<String> listUserId(String departmentId) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("departmentId", departmentId);
|
||||
return departmentUserDao.listUserId(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> listUserIdByDepartmentIds(List<String> departmentIds) {
|
||||
public List<String> listUserId(List<String> departmentIds) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("departmentIds", departmentIds);
|
||||
return departmentUserDao.listUserId(params);
|
||||
@ -131,9 +131,9 @@ public class DepartmentUserServiceImpl extends DefaultBaseService implements IDe
|
||||
public SuccessResultList<List<DepartmentUserDTO>> listPage(String departmentId, ListPage page) {
|
||||
SuccessResultList<List<UserDTO>> successResultList;
|
||||
if (StringUtils.equals(departmentId, ISystemConstant.TREE_BASE_ROOT_ID_VALUE)) {
|
||||
successResultList = listPageUserDTOByExcludeDepartmentId(page);
|
||||
successResultList = listPageUserByExcludeDepartment(page);
|
||||
} else {
|
||||
successResultList = listPageUserDTOByDepartmentId(departmentId, page);
|
||||
successResultList = listPageUser(departmentId, page);
|
||||
}
|
||||
List<UserDTO> userDTOs = successResultList.getRows();
|
||||
List<DepartmentUserDTO> departmentUserDTOs = new ArrayList<>();
|
||||
@ -155,9 +155,9 @@ public class DepartmentUserServiceImpl extends DefaultBaseService implements IDe
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
private SuccessResultList<List<UserDTO>> listPageUserDTOByExcludeDepartmentId(ListPage page) {
|
||||
List<String> hasDepartmentIdUserIds = listGroupUserId(new HashMap<>(0));
|
||||
return userBaseService.listPageByExcludeUserIds(hasDepartmentIdUserIds, page);
|
||||
private SuccessResultList<List<UserDTO>> listPageUserByExcludeDepartment(ListPage page) {
|
||||
List<String> hasDepartmentUserIds = listGroupUserId(new HashMap<>(0));
|
||||
return userBaseService.listPageByExcludeIds(hasDepartmentUserIds, page);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -167,8 +167,8 @@ public class DepartmentUserServiceImpl extends DefaultBaseService implements IDe
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
private SuccessResultList<List<UserDTO>> listPageUserDTOByDepartmentId(String departmentId, ListPage page) {
|
||||
List<String> userIds = listUserIdByDepartmentId(departmentId);
|
||||
private SuccessResultList<List<UserDTO>> listPageUser(String departmentId, ListPage page) {
|
||||
List<String> userIds = listUserId(departmentId);
|
||||
if (userIds.isEmpty()) {
|
||||
return new SuccessResultList<>(new ArrayList<>(), 1, 0L);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `user_id_idx` (`user_id`) USING BTREE,
|
||||
KEY `department_id_idx` (`department_id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
</update>
|
||||
|
||||
<!-- 新增组织用户 -->
|
||||
|
@ -221,9 +221,14 @@
|
||||
onClose: function() {
|
||||
var selectedUsers = top.dialog.dialogData.selectedDepartmentUsers;
|
||||
if(selectedUsers != null && selectedUsers.length > 0) {
|
||||
var selectedUserIds = [];
|
||||
var selectedUserIds = '';
|
||||
var ids = [];
|
||||
for (var i = 0, item; item = selectedUsers[i++];) {
|
||||
selectedUserIds.push(item.userId);
|
||||
if ('' != selectedUserIds) {
|
||||
selectedUserIds += '_';
|
||||
}
|
||||
selectedUserIds += item.userId;
|
||||
ids.push(item.userId);
|
||||
}
|
||||
top.dialog.msg(top.dataMessage.update, {
|
||||
time: 0,
|
||||
@ -232,7 +237,7 @@
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.put(top.restAjax.path('api/department/user/update/{departmentId}', [departmentId]), {
|
||||
ids: selectedUserIds
|
||||
ids: ids
|
||||
}, null, function (code, data) {
|
||||
top.dialog.msg(top.dataMessage.updated);
|
||||
$('#selectedUserIds').val(selectedUserIds);
|
||||
|
@ -15,7 +15,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>ink.wgink</groupId>
|
||||
<artifactId>common</artifactId>
|
||||
<artifactId>service-user</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
@ -1,7 +1,7 @@
|
||||
package ink.wgink.module.group.controller.api;
|
||||
package ink.wgink.service.group.controller.api;
|
||||
|
||||
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.exceptions.ParamsException;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.ZTreeDTO;
|
||||
@ -9,8 +9,9 @@ import ink.wgink.pojo.dtos.group.GroupDTO;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.module.group.pojo.vos.GroupVO;
|
||||
import ink.wgink.module.group.service.IGroupService;
|
||||
import ink.wgink.pojo.vos.IdsVO;
|
||||
import ink.wgink.service.group.pojo.vos.GroupVO;
|
||||
import ink.wgink.service.group.service.IGroupService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -37,11 +38,11 @@ public class GroupController extends DefaultBaseController {
|
||||
|
||||
@ApiOperation(value = "组新增", notes = "组新增接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("savegroup")
|
||||
@PostMapping("save")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResult saveGroup(@RequestBody GroupVO groupVO) {
|
||||
Map<String, Object> params = getParams();
|
||||
checkParams(groupVO, params);
|
||||
return groupService.saveGroup(params);
|
||||
groupService.save(groupVO);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "组删除", notes = "通过id列表批量删除组接口")
|
||||
@ -49,11 +50,10 @@ public class GroupController extends DefaultBaseController {
|
||||
@ApiImplicitParam(name = "ids", value = "组ID列表,用下划线分隔", paramType = "path", example = "1_2_3")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@DeleteMapping("removegroup/{ids}")
|
||||
@DeleteMapping("remove/{ids}")
|
||||
public SuccessResult removeGroup(@PathVariable("ids") String ids) {
|
||||
Map<String, Object> params = getParams();
|
||||
params.put("groupIds", ids);
|
||||
return groupService.removeGroup(params);
|
||||
groupService.remove(Arrays.asList(ids.split("\\_")));
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "组修改", notes = "组修改接口")
|
||||
@ -61,33 +61,11 @@ public class GroupController extends DefaultBaseController {
|
||||
@ApiImplicitParam(name = "groupId", value = "组ID", paramType = "path")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("updategroup/{groupId}")
|
||||
public SuccessResult updateGroup(@PathVariable("groupId") String groupId, @RequestBody GroupVO groupVO) {
|
||||
Map<String, Object> params = getParams();
|
||||
params.put("groupId", groupId);
|
||||
checkParams(groupVO, params);
|
||||
return groupService.updateGroup(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数校验
|
||||
*
|
||||
* @param groupVO
|
||||
* @param params
|
||||
* @throws ParamsException
|
||||
*/
|
||||
private void checkParams(GroupVO groupVO, Map<String, Object> params) {
|
||||
if (StringUtils.isBlank(groupVO.getGroupParentId())) {
|
||||
throw new ParamsException("父ID不能为空");
|
||||
}
|
||||
params.put("groupParentId", groupVO.getGroupParentId());
|
||||
|
||||
if (StringUtils.isBlank(groupVO.getGroupName())) {
|
||||
throw new ParamsException("组名称不能为空");
|
||||
}
|
||||
params.put("groupName", groupVO.getGroupName());
|
||||
|
||||
params.put("groupSummary", groupVO.getGroupSummary());
|
||||
@PutMapping("update/{groupId}")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResult update(@PathVariable("groupId") String groupId, @RequestBody GroupVO groupVO) {
|
||||
groupService.update(groupId, groupVO);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "组列表", notes = "组列表接口")
|
||||
@ -95,11 +73,9 @@ public class GroupController extends DefaultBaseController {
|
||||
@ApiImplicitParam(name = "groupParentId", value = "组上级ID", paramType = "path")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listgroup/{groupParentId}")
|
||||
public List<GroupDTO> listGroup(@PathVariable("groupParentId") String groupParentId) {
|
||||
Map<String, Object> params = getParams();
|
||||
params.put("groupParentId", groupParentId);
|
||||
return groupService.listGroupAllJson(params);
|
||||
@GetMapping("listallbyparentid/{groupParentId}")
|
||||
public List<GroupDTO> listAllByParentId(@PathVariable("groupParentId") String groupParentId) {
|
||||
return groupService.listAllByParentId(groupParentId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "组详情", notes = "组详情接口")
|
||||
@ -107,11 +83,11 @@ public class GroupController extends DefaultBaseController {
|
||||
@ApiImplicitParam(name = "groupId", value = "组ID", paramType = "path")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("getgroup/{groupId}")
|
||||
public GroupDTO getGroup(@PathVariable("groupId") String groupId) {
|
||||
@GetMapping("get/{groupId}")
|
||||
public GroupDTO get(@PathVariable("groupId") String groupId) {
|
||||
Map<String, Object> params = getParams();
|
||||
params.put("groupId", groupId);
|
||||
return groupService.getGroup(params);
|
||||
return groupService.get(params);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "zTree列表", notes = "zTree列表接口")
|
||||
@ -119,15 +95,15 @@ public class GroupController extends DefaultBaseController {
|
||||
@ApiImplicitParam(name = "id", value = "父ID", paramType = "query", dataType = "String")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listztreegroup")
|
||||
public List<ZTreeDTO> listZTreeGroup() {
|
||||
@GetMapping("listztree")
|
||||
public List<ZTreeDTO> listZTree() {
|
||||
Map<String, Object> params = requestParams();
|
||||
String groupParentId = "0";
|
||||
if (!StringUtils.isBlank(params.get("id") == null ? null : params.get("id").toString())) {
|
||||
groupParentId = params.get("id").toString();
|
||||
if (!StringUtils.isBlank(params.get(ISystemConstant.PARAMS_ID) == null ? null : params.get(ISystemConstant.PARAMS_ID).toString())) {
|
||||
groupParentId = params.get(ISystemConstant.PARAMS_ID).toString();
|
||||
}
|
||||
params.put("groupParentId", groupParentId);
|
||||
return groupService.listZTreeGroup(params);
|
||||
return groupService.listZTree(params);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页组列表", notes = "分页组列表接口")
|
||||
@ -140,8 +116,8 @@ public class GroupController extends DefaultBaseController {
|
||||
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpagegroup")
|
||||
public SuccessResultList<List<GroupDTO>> listPageGroup(ListPage page) {
|
||||
@GetMapping("listpage")
|
||||
public SuccessResultList<List<GroupDTO>> listPage(ListPage page) {
|
||||
Map<String, Object> params = requestParams();
|
||||
String groupParentId = "0";
|
||||
if (!StringUtils.isBlank(params.get("parentId") == null ? null : params.get("parentId").toString())) {
|
||||
@ -149,21 +125,7 @@ public class GroupController extends DefaultBaseController {
|
||||
}
|
||||
params.put("groupParentId", groupParentId);
|
||||
page.setParams(params);
|
||||
return groupService.listPageGroups(page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "角色组删除", notes = "角色组删除接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "path"),
|
||||
@ApiImplicitParam(name = "ids", value = "组ID列表,用下划线分隔", paramType = "path", example = "1_2_3")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@DeleteMapping("removerolegroup/{roleId}/{ids}")
|
||||
public SuccessResult removeRoleGroup(@PathVariable("roleId") String roleId, @PathVariable("ids") String ids) {
|
||||
Map<String, Object> params = getParams();
|
||||
params.put("roleId", roleId);
|
||||
params.put("groupIds", ids);
|
||||
return groupService.removeRoleGroup(params);
|
||||
return groupService.listPage(page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过ID列表获取组列表", notes = "通过ID列表获取用户组接口")
|
||||
@ -171,11 +133,11 @@ public class GroupController extends DefaultBaseController {
|
||||
@ApiImplicitParam(name = "groupIds", value = "组ID列表,用下划线分隔,如:1_2_3", paramType = "path")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listgroupbyids/{groupIds}")
|
||||
public List<GroupDTO> listGroupByIds(@PathVariable("groupIds") String groupIds) {
|
||||
@PostMapping("listbyids/{groupIds}")
|
||||
public List<GroupDTO> listByIds(@RequestBody IdsVO idsVO) {
|
||||
Map<String, Object> params = getParams();
|
||||
params.put("groupIds", Arrays.asList(groupIds.split("_")));
|
||||
return groupService.listGroup(params);
|
||||
params.put("groupIds", idsVO.getIds());
|
||||
return groupService.list(params);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package ink.wgink.service.group.controller.api;
|
||||
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.group.GroupUserDTO;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.service.group.service.IGroupUserService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: GroupUserController
|
||||
* @Description: 用户组用户
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/2/16 11:31 上午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "组织部门用户")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/group/user")
|
||||
public class GroupUserController {
|
||||
|
||||
@Autowired
|
||||
private IGroupUserService groupUserService;
|
||||
|
||||
@ApiOperation(value = "组人员列表", notes = "组人员列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "groupId", value = "组ID", paramType = "path", dataType = "String"),
|
||||
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
|
||||
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpage/{groupId}")
|
||||
public SuccessResultList<List<GroupUserDTO>> listPage(@PathVariable("groupId") String groupId, ListPage page) {
|
||||
return groupUserService.listPage(groupId, page);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package ink.wgink.service.group.controller.route;
|
||||
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: GroupRouteController
|
||||
* @Description: 用户组路由
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/2/15 9:07 上午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "用户组路由接口")
|
||||
@Controller
|
||||
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/group")
|
||||
public class GroupRouteController {
|
||||
|
||||
@GetMapping("save")
|
||||
public ModelAndView save() {
|
||||
return new ModelAndView("group/save");
|
||||
}
|
||||
|
||||
@GetMapping("update")
|
||||
public ModelAndView update() {
|
||||
return new ModelAndView("group/update");
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
public ModelAndView list() {
|
||||
return new ModelAndView("group/list");
|
||||
}
|
||||
|
||||
@GetMapping("list-tree")
|
||||
public ModelAndView listTree() {
|
||||
return new ModelAndView("group/list-tree");
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package ink.wgink.service.group.controller.route;
|
||||
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: GroupUserRouteController
|
||||
* @Description: 用户组用户路由
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/2/16 11:45 上午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "用户组路由接口")
|
||||
@Controller
|
||||
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/group/user")
|
||||
public class GroupUserRouteController {
|
||||
|
||||
@GetMapping("list")
|
||||
public ModelAndView list() {
|
||||
return new ModelAndView("group/user/list");
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.group.dao;
|
||||
package ink.wgink.service.group.dao;
|
||||
|
||||
import ink.wgink.exceptions.RemoveException;
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
@ -7,7 +7,7 @@ import ink.wgink.exceptions.UpdateException;
|
||||
import ink.wgink.pojo.bos.GroupBO;
|
||||
import ink.wgink.pojo.dtos.ZTreeDTO;
|
||||
import ink.wgink.pojo.dtos.group.GroupDTO;
|
||||
import ink.wgink.module.group.pojo.pos.GroupPO;
|
||||
import ink.wgink.service.group.pojo.pos.GroupPO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
@ -23,13 +23,20 @@ import java.util.Map;
|
||||
@Repository
|
||||
public interface IGroupDao {
|
||||
|
||||
/**
|
||||
* 建表
|
||||
*
|
||||
* @throws UpdateException
|
||||
*/
|
||||
void createTable() throws UpdateException;
|
||||
|
||||
/**
|
||||
* 新增组
|
||||
*
|
||||
* @param params
|
||||
* @throws SaveException
|
||||
*/
|
||||
void saveGroup(Map<String, Object> params) throws SaveException;
|
||||
void save(Map<String, Object> params) throws SaveException;
|
||||
|
||||
/**
|
||||
* 删除组
|
||||
@ -37,7 +44,7 @@ public interface IGroupDao {
|
||||
* @param params
|
||||
* @throws RemoveException
|
||||
*/
|
||||
void removeGroup(Map<String, Object> params) throws RemoveException;
|
||||
void remove(Map<String, Object> params) throws RemoveException;
|
||||
|
||||
/**
|
||||
* 修改组
|
||||
@ -45,7 +52,7 @@ public interface IGroupDao {
|
||||
* @param params
|
||||
* @throws UpdateException
|
||||
*/
|
||||
void updateGroup(Map<String, Object> params) throws UpdateException;
|
||||
void update(Map<String, Object> params) throws UpdateException;
|
||||
|
||||
/**
|
||||
* 组列表
|
||||
@ -54,7 +61,7 @@ public interface IGroupDao {
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<GroupDTO> listGroups(Map<String, Object> params) throws SearchException;
|
||||
List<GroupDTO> list(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 组详情
|
||||
@ -90,7 +97,7 @@ public interface IGroupDao {
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<ZTreeDTO> listZTreeGroups(Map<String, Object> params) throws SearchException;
|
||||
List<ZTreeDTO> listZTree(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 子列表个数
|
||||
@ -101,28 +108,4 @@ public interface IGroupDao {
|
||||
*/
|
||||
Integer countByParentId(String id) throws SearchException;
|
||||
|
||||
/**
|
||||
* 删除角色组
|
||||
*
|
||||
* @param params
|
||||
* @throws RemoveException
|
||||
*/
|
||||
void removeRoleGroup(Map<String, Object> params) throws RemoveException;
|
||||
|
||||
/**
|
||||
* 添加角色组
|
||||
*
|
||||
* @param params
|
||||
* @throws SaveException
|
||||
*/
|
||||
void saveRoleGroup(Map<String, Object> params) throws SaveException;
|
||||
|
||||
/**
|
||||
* 通过用户获取用户组
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<GroupBO> listGroupBOByUser(Map<String, Object> params) throws SearchException;
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package ink.wgink.service.group.dao;
|
||||
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.exceptions.UpdateException;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: IGroupUserDao
|
||||
* @Description: 用户组用户
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/2/16 12:07 下午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Repository
|
||||
public interface IGroupUserDao {
|
||||
|
||||
/**
|
||||
* 建表
|
||||
*
|
||||
* @throws UpdateException
|
||||
*/
|
||||
void createTable() throws UpdateException;
|
||||
|
||||
/**
|
||||
* 用户ID列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<String> listUserId(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 用户ID列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<String> listGroupUserId(Map<String, Object> params) throws SearchException;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.group.pojo.pos;
|
||||
package ink.wgink.service.group.pojo.pos;
|
||||
|
||||
/**
|
||||
* @ClassName: GroupDTO
|
@ -1,5 +1,6 @@
|
||||
package ink.wgink.module.group.pojo.vos;
|
||||
package ink.wgink.service.group.pojo.vos;
|
||||
|
||||
import ink.wgink.annotation.CheckEmptyAnnotation;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ -14,8 +15,10 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
public class GroupVO {
|
||||
|
||||
@ApiModelProperty(name = "groupParentId", value = "组上级ID")
|
||||
@CheckEmptyAnnotation(name = "组上级ID")
|
||||
private String groupParentId;
|
||||
@ApiModelProperty(name = "groupName", value = "组名称")
|
||||
@CheckEmptyAnnotation(name = "组名称")
|
||||
private String groupName;
|
||||
@ApiModelProperty(name = "groupSummary", value = "组说明")
|
||||
private String groupSummary;
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.group.service;
|
||||
package ink.wgink.service.group.service;
|
||||
|
||||
import ink.wgink.interfaces.group.IGroupBaseService;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
@ -7,6 +7,7 @@ import ink.wgink.pojo.dtos.ZTreeDTO;
|
||||
import ink.wgink.pojo.dtos.group.GroupDTO;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.service.group.pojo.vos.GroupVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -26,7 +27,7 @@ public interface IGroupService extends IGroupBaseService {
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
SuccessResult saveGroup(Map<String, Object> params);
|
||||
void save(GroupVO groupVO);
|
||||
|
||||
/**
|
||||
* 删除组
|
||||
@ -34,7 +35,7 @@ public interface IGroupService extends IGroupBaseService {
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
SuccessResult removeGroup(Map<String, Object> params);
|
||||
void remove(List<String> ids);
|
||||
|
||||
/**
|
||||
* 修改组
|
||||
@ -42,15 +43,15 @@ public interface IGroupService extends IGroupBaseService {
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
SuccessResult updateGroup(Map<String, Object> params);
|
||||
void update(String groupId, GroupVO groupVO);
|
||||
|
||||
/**
|
||||
* 全部组JSON列表
|
||||
*
|
||||
* @param params
|
||||
* @param groupParentId
|
||||
* @return
|
||||
*/
|
||||
List<GroupDTO> listGroupAllJson(Map<String, Object> params);
|
||||
List<GroupDTO> listAllByParentId(String groupParentId);
|
||||
|
||||
/**
|
||||
* 组列表,递归获取全部内容
|
||||
@ -58,7 +59,7 @@ public interface IGroupService extends IGroupBaseService {
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<GroupDTO> listGroupsAll(Map<String, Object> params);
|
||||
List<GroupDTO> listAll(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 组详情
|
||||
@ -66,7 +67,7 @@ public interface IGroupService extends IGroupBaseService {
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
GroupDTO getGroup(Map<String, Object> params);
|
||||
GroupDTO get(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 组zTree列表
|
||||
@ -74,7 +75,7 @@ public interface IGroupService extends IGroupBaseService {
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<ZTreeDTO> listZTreeGroup(Map<String, Object> params);
|
||||
List<ZTreeDTO> listZTree(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 组EasyUI列表
|
||||
@ -82,34 +83,7 @@ public interface IGroupService extends IGroupBaseService {
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<GroupDTO>> listPageGroups(ListPage page);
|
||||
|
||||
/**
|
||||
* 更新角色组列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws RemoveException
|
||||
* @throws SaveException
|
||||
*/
|
||||
SuccessResult updateRoleGroup(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 删除角色组
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws RemoveException
|
||||
*/
|
||||
SuccessResult removeRoleGroup(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 通过用户获取用户组
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<GroupBO> listGroupBOByUser(Map<String, Object> params);
|
||||
SuccessResultList<List<GroupDTO>> listPage(ListPage page);
|
||||
|
||||
/**
|
||||
* 组列表
|
||||
@ -117,5 +91,5 @@ public interface IGroupService extends IGroupBaseService {
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<GroupDTO> listGroup(Map<String, Object> params);
|
||||
List<GroupDTO> list(Map<String, Object> params);
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package ink.wgink.service.group.service;
|
||||
|
||||
import ink.wgink.interfaces.group.IGroupUserBaseService;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: IGroupUserService
|
||||
* @Description: 用户组用户
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/2/16 11:32 上午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface IGroupUserService extends IGroupUserBaseService {
|
||||
}
|
@ -1,22 +1,21 @@
|
||||
package ink.wgink.module.group.service.impl;
|
||||
package ink.wgink.service.group.service.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.bos.GroupBO;
|
||||
import ink.wgink.pojo.dtos.ZTreeDTO;
|
||||
import ink.wgink.pojo.dtos.group.GroupDTO;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.module.group.dao.IGroupDao;
|
||||
import ink.wgink.module.group.service.IGroupService;
|
||||
import ink.wgink.service.group.dao.IGroupDao;
|
||||
import ink.wgink.service.group.pojo.vos.GroupVO;
|
||||
import ink.wgink.service.group.service.IGroupService;
|
||||
import ink.wgink.util.UUIDUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import ink.wgink.util.map.HashMapUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -34,10 +33,11 @@ public class GroupServiceImpl extends DefaultBaseService implements IGroupServic
|
||||
private IGroupDao groupDao;
|
||||
|
||||
@Override
|
||||
public SuccessResult saveGroup(Map<String, Object> params) {
|
||||
public void save(GroupVO groupVO) {
|
||||
String parentCode = null;
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(groupVO);
|
||||
String groupParentId = params.get("groupParentId").toString();
|
||||
if (!"0".equals(groupParentId)) {
|
||||
if (!ISystemConstant.TREE_ROOT_ID.equals(groupParentId)) {
|
||||
params.put("groupId", groupParentId);
|
||||
GroupDTO groupDTO = groupDao.getGroup(params);
|
||||
parentCode = groupDTO.getGroupCode();
|
||||
@ -46,45 +46,46 @@ public class GroupServiceImpl extends DefaultBaseService implements IGroupServic
|
||||
params.put("groupCode", groupCode);
|
||||
params.put("groupId", UUIDUtil.getUUID());
|
||||
setSaveInfo(params);
|
||||
groupDao.saveGroup(params);
|
||||
return new SuccessResult();
|
||||
groupDao.save(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResult removeGroup(Map<String, Object> params) {
|
||||
params.put("groupIds", Arrays.asList(params.get("groupIds").toString().split("_")));
|
||||
public void remove(List<String> ids) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("groupIds", ids);
|
||||
setUpdateInfo(params);
|
||||
groupDao.removeGroup(params);
|
||||
return new SuccessResult();
|
||||
groupDao.remove(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResult updateGroup(Map<String, Object> params) {
|
||||
public void update(String groupId, GroupVO groupVO) {
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(groupVO);
|
||||
setUpdateInfo(params);
|
||||
groupDao.updateGroup(params);
|
||||
return new SuccessResult();
|
||||
groupDao.update(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GroupDTO> listGroupAllJson(Map<String, Object> params) {
|
||||
return listGroupsAll(params);
|
||||
public List<GroupDTO> listAllByParentId(String groupParentId) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("groupParentId", groupParentId);
|
||||
return listAll(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GroupDTO> listGroupsAll(Map<String, Object> params) {
|
||||
List<GroupDTO> groupDTOs = groupDao.listGroups(params);
|
||||
public List<GroupDTO> listAll(Map<String, Object> params) {
|
||||
List<GroupDTO> groupDTOs = list(params);
|
||||
listSubGroups(groupDTOs, params);
|
||||
return groupDTOs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GroupDTO getGroup(Map<String, Object> params) {
|
||||
public GroupDTO get(Map<String, Object> params) {
|
||||
return groupDao.getGroup(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ZTreeDTO> listZTreeGroup(Map<String, Object> params) {
|
||||
List<ZTreeDTO> zTreeDTOs = groupDao.listZTreeGroups(params);
|
||||
public List<ZTreeDTO> listZTree(Map<String, Object> params) {
|
||||
List<ZTreeDTO> zTreeDTOs = groupDao.listZTree(params);
|
||||
for (ZTreeDTO zTreeDTO : zTreeDTOs) {
|
||||
Integer subCount = groupDao.countByParentId(zTreeDTO.getId());
|
||||
setZTreeInfo(zTreeDTO, subCount);
|
||||
@ -93,42 +94,16 @@ public class GroupServiceImpl extends DefaultBaseService implements IGroupServic
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<GroupDTO>> listPageGroups(ListPage page) {
|
||||
public SuccessResultList<List<GroupDTO>> listPage(ListPage page) {
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
List<GroupDTO> groupDTOs = groupDao.listGroups(page.getParams());
|
||||
List<GroupDTO> groupDTOs = list(page.getParams());
|
||||
PageInfo<GroupDTO> pageInfo = new PageInfo<>(groupDTOs);
|
||||
return new SuccessResultList<>(groupDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResult updateRoleGroup(Map<String, Object> params) {
|
||||
groupDao.removeRoleGroup(params);
|
||||
if (!StringUtils.isBlank(params.get("selectedGroupIds") == null ? null : params.get("selectedGroupIds").toString())) {
|
||||
String[] selectedUserIds = params.get("selectedGroupIds").toString().split("_");
|
||||
params.remove("selectedGroupIds");
|
||||
for (String userId : selectedUserIds) {
|
||||
params.put("groupId", userId);
|
||||
groupDao.saveRoleGroup(params);
|
||||
}
|
||||
}
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResult removeRoleGroup(Map<String, Object> params) {
|
||||
params.put("groupIds", Arrays.asList(params.get("groupIds").toString().split("_")));
|
||||
groupDao.removeRoleGroup(params);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GroupBO> listGroupBOByUser(Map<String, Object> params) {
|
||||
return groupDao.listGroupBOByUser(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GroupDTO> listGroup(Map<String, Object> params) {
|
||||
return groupDao.listGroups(params);
|
||||
public List<GroupDTO> list(Map<String, Object> params) {
|
||||
return groupDao.list(params);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -140,7 +115,7 @@ public class GroupServiceImpl extends DefaultBaseService implements IGroupServic
|
||||
private void listSubGroups(List<GroupDTO> groupDTOs, Map<String, Object> params) {
|
||||
for (GroupDTO groupDTO : groupDTOs) {
|
||||
params.put("groupParentId", groupDTO.getGroupId());
|
||||
List<GroupDTO> subGroupDTOs = groupDao.listGroups(params);
|
||||
List<GroupDTO> subGroupDTOs = list(params);
|
||||
groupDTO.setSubGroups(subGroupDTOs);
|
||||
listSubGroups(subGroupDTOs, params);
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
package ink.wgink.service.group.service.impl;
|
||||
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.interfaces.user.IUserBaseService;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.group.GroupUserDTO;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.service.group.dao.IGroupUserDao;
|
||||
import ink.wgink.service.group.service.IGroupUserService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: GroupUserServiceImpl
|
||||
* @Description: 用户组用户
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/2/16 11:32 上午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Service
|
||||
public class GroupUserServiceImpl extends DefaultBaseService implements IGroupUserService {
|
||||
|
||||
@Autowired
|
||||
private IGroupUserDao groupUserDao;
|
||||
@Autowired
|
||||
private IUserBaseService userBaseService;
|
||||
|
||||
@Override
|
||||
public List<String> listUserId(String groupId) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("groupId", groupId);
|
||||
return groupUserDao.listUserId(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> listUserId(List<String> groupIds) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("groupIds", groupIds);
|
||||
return groupUserDao.listUserId(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<GroupUserDTO>> listPage(String groupId, ListPage page) {
|
||||
SuccessResultList<List<UserDTO>> successResultList;
|
||||
if (StringUtils.equals(groupId, ISystemConstant.TREE_BASE_ROOT_ID_VALUE)) {
|
||||
successResultList = listPageUserDTOByExcludeGroup(page);
|
||||
} else {
|
||||
successResultList = listPageUser(groupId, page);
|
||||
}
|
||||
List<UserDTO> userDTOs = successResultList.getRows();
|
||||
List<GroupUserDTO> groupUserDTOs = new ArrayList<>();
|
||||
for (UserDTO userDTO : userDTOs) {
|
||||
GroupUserDTO groupUserDTO = new GroupUserDTO(userDTO);
|
||||
groupUserDTOs.add(groupUserDTO);
|
||||
}
|
||||
return new SuccessResultList<>(groupUserDTOs, successResultList.getPage(), successResultList.getTotal());
|
||||
}
|
||||
|
||||
|
||||
private List<String> listGroupUserId(Map<String, Object> params) {
|
||||
return groupUserDao.listGroupUserId(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 没有用户组的用户分页列表
|
||||
*
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
private SuccessResultList<List<UserDTO>> listPageUserDTOByExcludeGroup(ListPage page) {
|
||||
List<String> hasGroupUserIds = listGroupUserId(new HashMap<>(0));
|
||||
return userBaseService.listPageByExcludeIds(hasGroupUserIds, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户组的用户分页列表
|
||||
*
|
||||
* @param groupId 用户组ID
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
private SuccessResultList<List<UserDTO>> listPageUser(String groupId, ListPage page) {
|
||||
List<String> userIds = listUserId(groupId);
|
||||
if (userIds.isEmpty()) {
|
||||
return new SuccessResultList<>(new ArrayList<>(), 1, 0L);
|
||||
}
|
||||
return userBaseService.listPageByIds(userIds, page);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package ink.wgink.service.group.startup;
|
||||
|
||||
import ink.wgink.service.group.dao.IGroupDao;
|
||||
import ink.wgink.service.group.dao.IGroupUserDao;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: ServiceGroupStartUp
|
||||
* @Description: 用户组启动
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/2/15 9:11 上午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Component
|
||||
public class ServiceGroupStartUp implements ApplicationRunner {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ServiceGroupStartUp.class);
|
||||
|
||||
@Autowired
|
||||
private IGroupDao groupDao;
|
||||
@Autowired
|
||||
private IGroupUserDao groupUserDao;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
initTable();
|
||||
}
|
||||
|
||||
private void initTable() {
|
||||
LOG.debug("创建 sys_group 表");
|
||||
groupDao.createTable();
|
||||
|
||||
LOG.debug("创建 sys_group_user 表");
|
||||
groupUserDao.createTable();
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cm.serviceusercenter.dao.system.group.IGroupDao">
|
||||
<mapper namespace="ink.wgink.service.group.dao.IGroupDao">
|
||||
|
||||
<resultMap id="groupDTO" type="ink.wgink.pojo.dtos.group.GroupDTO">
|
||||
<id property="groupId" column="group_id"/>
|
||||
@ -11,7 +11,7 @@
|
||||
<result property="groupCode" column="group_code"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="groupPO" type="ink.wgink.module.group.pojo.pos.GroupPO">
|
||||
<resultMap id="groupPO" type="ink.wgink.service.group.pojo.pos.GroupPO">
|
||||
<id property="groupId" column="group_id"/>
|
||||
<result property="groupParentId" column="group_parent_id"/>
|
||||
<result property="groupName" column="group_name"/>
|
||||
@ -31,97 +31,26 @@
|
||||
<result property="name" column="group_name"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="roleGroupDTO" type="com.cm.serviceusercenter.pojo.dtos.RoleGroupDTO">
|
||||
<id property="groupId" column="group_id"/>
|
||||
<result property="groupName" column="group_name"/>
|
||||
<result property="groupSummary" column="group_summary"/>
|
||||
<result property="groupCode" column="group_code"/>
|
||||
<result property="roleId" column="role_id"/>
|
||||
<result property="roleName" column="role_name"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 添加角色人员 -->
|
||||
<insert id="saveRoleGroup" parameterType="map">
|
||||
INSERT INTO sys_role_group(
|
||||
group_id,
|
||||
role_id
|
||||
) VALUES(
|
||||
#{groupId},
|
||||
#{roleId}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 删除组人员 -->
|
||||
<delete id="removeRoleGroup" parameterType="map">
|
||||
delete from
|
||||
sys_role_group
|
||||
where
|
||||
1 = 1
|
||||
<if test="roleId != null and roleId != ''">
|
||||
AND
|
||||
role_id = #{roleId}
|
||||
</if>
|
||||
<if test="groupId != null and groupId != ''">
|
||||
AND
|
||||
group_id = #{groupId}
|
||||
</if>
|
||||
<if test="groupIds != null and groupIds.size > 0">
|
||||
AND
|
||||
group_id IN
|
||||
<foreach collection="groupIds" index="index" open="(" separator="," close=")">
|
||||
#{groupIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
</delete>
|
||||
|
||||
<!-- 角色组列表 -->
|
||||
<select id="listRoleGroups" parameterType="map" resultMap="roleGroupDTO">
|
||||
SELECT
|
||||
t2.group_id,
|
||||
t2.group_name,
|
||||
t2.group_summary,
|
||||
t2.group_code,
|
||||
t3.role_id,
|
||||
t3.role_name
|
||||
FROM
|
||||
sys_role_group t1
|
||||
INNER JOIN
|
||||
sys_group t2
|
||||
ON
|
||||
t1.group_id = t2.group_id
|
||||
INNER JOIN
|
||||
sys_role t3
|
||||
ON
|
||||
t1.role_id = t3.role_id
|
||||
WHERE
|
||||
t2.is_delete = 0 AND t3.is_delete = 0
|
||||
<if test="roleId != null and roleId != ''">
|
||||
AND
|
||||
t1.role_id = #{roleId}
|
||||
</if>
|
||||
<if test="keywords != null and keywords != ''">
|
||||
AND
|
||||
group_name LIKE CONCAT('%', #{keywords}, '%')
|
||||
</if>
|
||||
<choose>
|
||||
<when test="sort != null and (sort == 'groupName' or sort == 'groupCode')">
|
||||
ORDER BY
|
||||
<if test="sort == 'groupName'">
|
||||
group_name ${order}
|
||||
</if>
|
||||
<if test="sort == 'groupCode'">
|
||||
group_code ${order}
|
||||
</if>
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY
|
||||
t2.gmt_create desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
<!-- 建表 -->
|
||||
<update id="createTable">
|
||||
CREATE TABLE IF NOT EXISTS `sys_group` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`group_id` char(36) NOT NULL,
|
||||
`group_parent_id` char(36) DEFAULT '0' COMMENT '组上级ID',
|
||||
`group_name` varchar(255) DEFAULT NULL COMMENT '组名称',
|
||||
`group_summary` varchar(255) DEFAULT NULL COMMENT '组说明',
|
||||
`group_code` varchar(255) DEFAULT NULL COMMENT '组编码',
|
||||
`creator` char(36) DEFAULT NULL,
|
||||
`gmt_create` datetime DEFAULT NULL,
|
||||
`modifier` char(36) DEFAULT NULL,
|
||||
`gmt_modified` datetime DEFAULT NULL,
|
||||
`is_delete` int(2) DEFAULT '0',
|
||||
PRIMARY KEY (`id`,`group_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
</update>
|
||||
|
||||
<!-- 新增组 -->
|
||||
<insert id="saveGroup" parameterType="map">
|
||||
<insert id="save" parameterType="map">
|
||||
INSERT INTO sys_group(
|
||||
group_id,
|
||||
group_parent_id,
|
||||
@ -148,7 +77,7 @@
|
||||
</insert>
|
||||
|
||||
<!-- 删除组 -->
|
||||
<update id="removeGroup" parameterType="map">
|
||||
<update id="remove" parameterType="map">
|
||||
UPDATE
|
||||
sys_group
|
||||
SET
|
||||
@ -163,7 +92,7 @@
|
||||
</update>
|
||||
|
||||
<!-- 修改组 -->
|
||||
<update id="updateGroup" parameterType="map">
|
||||
<update id="update" parameterType="map">
|
||||
UPDATE
|
||||
sys_group
|
||||
SET
|
||||
@ -183,7 +112,7 @@
|
||||
</update>
|
||||
|
||||
<!-- ztree列表 -->
|
||||
<select id="listZTreeGroups" parameterType="map" resultMap="groupZTreeDTO">
|
||||
<select id="listZTree" parameterType="map" resultMap="groupZTreeDTO">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
@ -197,7 +126,7 @@
|
||||
</select>
|
||||
|
||||
<!-- 组列表 -->
|
||||
<select id="listGroups" parameterType="map" resultMap="groupDTO">
|
||||
<select id="list" parameterType="map" resultMap="groupDTO">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
@ -304,24 +233,4 @@
|
||||
LIMIT 0, 1
|
||||
</select>
|
||||
|
||||
<!-- 通过用户获取用户组 -->
|
||||
<select id="listGroupBOByUser" parameterType="map" resultMap="groupBO">
|
||||
SELECT
|
||||
t2.group_id,
|
||||
t2.group_name,
|
||||
t2.group_summary
|
||||
FROM
|
||||
sys_group_user t1
|
||||
LEFT JOIN
|
||||
sys_group t2
|
||||
ON
|
||||
t1.group_id = t2.group_id
|
||||
WHERE
|
||||
t2.is_delete = 0
|
||||
<if test="userId != null and userId != ''">
|
||||
AND
|
||||
t1.user_id = #{userId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="ink.wgink.service.group.dao.IGroupUserDao">
|
||||
|
||||
<cache flushInterval="3600000"/>
|
||||
|
||||
<!-- 建表 -->
|
||||
<update id="createTable">
|
||||
CREATE TABLE IF NOT EXISTS `sys_group_user` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`group_id` char(36) NOT NULL COMMENT '组ID',
|
||||
`user_id` char(36) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `user_id_idx` (`user_id`) USING BTREE,
|
||||
KEY `group_id_idx` (`group_id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
</update>
|
||||
|
||||
<!-- 用户ID列表 -->
|
||||
<select id="listUserId" parameterType="map" resultType="java.lang.String">
|
||||
SELECT
|
||||
user_id
|
||||
FROM
|
||||
sys_group_user
|
||||
WHERE
|
||||
<if test="groupId != null and groupId != ''">
|
||||
group_id = #{groupId}
|
||||
</if>
|
||||
<if test="groupIds != null and groupIds.size > 0">
|
||||
group_id IN (
|
||||
<foreach collection="groupIds" index="index" open="(" separator="," close=")">
|
||||
#{groupIds[${index}]}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 用户ID列表 -->
|
||||
<select id="listGroupUserId" parameterType="map" resultType="java.lang.String">
|
||||
SELECT
|
||||
user_id
|
||||
FROM
|
||||
sys_group_user
|
||||
WHERE
|
||||
1 = 1
|
||||
GROUP BY
|
||||
user_id
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
@ -49,7 +49,7 @@
|
||||
|
||||
// 初始化IFrame
|
||||
function initIFrame() {
|
||||
$('#listContent').attr('src', top.restAjax.path('route/system/group/list.html?parentId={parentId}', [parentId]));
|
||||
$('#listContent').attr('src', top.restAjax.path('route/group/list?parentId={parentId}', [parentId]));
|
||||
}
|
||||
// 初始化大小
|
||||
function initSize() {
|
||||
@ -68,7 +68,7 @@
|
||||
enable: true,
|
||||
autoLoad: false,
|
||||
type: 'get',
|
||||
url: top.restAjax.path('api/group/listztreegroup', []),
|
||||
url: top.restAjax.path('api/group/listztree', []),
|
||||
autoParam: ['id'],
|
||||
otherParam: {},
|
||||
dataFilter: function (treeId, parentNode, childNodes) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
@ -57,13 +57,14 @@
|
||||
var admin = layui.admin;
|
||||
var laydate = layui.laydate;
|
||||
var parentId = top.restAjax.params(window.location.href).parentId;
|
||||
var tableUrl = 'api/group/listpage?parentId={parentId}';
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
table.render({
|
||||
elem: '#dataTable',
|
||||
id: 'dataTable',
|
||||
url: top.restAjax.path('api/group/listpagegroup?parentId={parentId}', [parentId]),
|
||||
url: top.restAjax.path(tableUrl, [parentId]),
|
||||
width: admin.screen() > 1 ? '100%' : '',
|
||||
height: $win.height() - 60,
|
||||
limit: 20,
|
||||
@ -73,18 +74,20 @@
|
||||
pageName: 'page',
|
||||
limitName: 'rows'
|
||||
},
|
||||
cols: [[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field:'users', width:100, title: '人员列表', align:'center',
|
||||
templet: function(item) {
|
||||
return '<button type="button" class="layui-btn layui-btn-xs" lay-event="userEvent"><i class="fa fa-users"></i> 查看</button>';
|
||||
}
|
||||
},
|
||||
{field:'groupName', width:170, title: '组名称', align:'center',},
|
||||
{field:'groupSummary', width:170, title: '组说明', align:'center',},
|
||||
{field:'groupCode', width:170, title: '组编码', align:'center',},
|
||||
]],
|
||||
cols: [
|
||||
[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field:'users', width:100, title: '人员列表', align:'center',
|
||||
templet: function(item) {
|
||||
return '<button type="button" class="layui-btn layui-btn-xs" lay-event="userEvent"><i class="fa fa-users"></i> 查看</button>';
|
||||
}
|
||||
},
|
||||
{field:'groupName', width:170, title: '组名称', align:'center',},
|
||||
{field:'groupSummary', width:170, title: '组说明', align:'center',},
|
||||
{field:'groupCode', width:170, title: '组编码', align:'center',}
|
||||
]
|
||||
],
|
||||
page: true,
|
||||
parseData: function(data) {
|
||||
return {
|
||||
@ -99,7 +102,7 @@
|
||||
// 重载表格
|
||||
function reloadTable(currentPage) {
|
||||
table.reload('dataTable', {
|
||||
url: top.restAjax.path('api/group/listpagegroup?parentId={parentId}', [parentId]),
|
||||
url: top.restAjax.path(tableUrl, [parentId]),
|
||||
where: {
|
||||
keywords: $('#keywords').val(),
|
||||
},
|
||||
@ -109,10 +112,6 @@
|
||||
height: $win.height() - 60,
|
||||
});
|
||||
}
|
||||
function refreshTable() {
|
||||
parent.common.refreshTree('leftTree');
|
||||
reloadTable();
|
||||
}
|
||||
// 初始化日期
|
||||
function initDate() {}
|
||||
// 删除
|
||||
@ -124,10 +123,10 @@
|
||||
yes: function (index) {
|
||||
top.dialog.close(index);
|
||||
var layIndex;
|
||||
top.restAjax.delete(top.restAjax.path('api/group/removegroup/{ids}', [ids]), {}, null, function (code, data) {
|
||||
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000}, function () {
|
||||
refreshTable();
|
||||
});
|
||||
top.restAjax.delete(top.restAjax.path('api/group/remove/{ids}', [ids]), {}, null, function (code, data) {
|
||||
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000});
|
||||
parent.common.refreshTree('leftTree');
|
||||
reloadTable();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function () {
|
||||
@ -162,9 +161,9 @@
|
||||
area: ['100%', '100%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/system/group/save.html?groupParentId={parentId}', [parentId]),
|
||||
content: top.restAjax.path('route/group/save?groupParentId={parentId}', [parentId]),
|
||||
end: function() {
|
||||
refreshTable();
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
} else if(layEvent === 'update') {
|
||||
@ -180,9 +179,9 @@
|
||||
area: ['100%', '100%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/system/group/update.html?groupId={groupId}', [checkDatas[0].groupId]),
|
||||
content: top.restAjax.path('route/group/update?groupId={groupId}', [checkDatas[0].groupId]),
|
||||
end: function() {
|
||||
refreshTable();
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -206,7 +205,7 @@
|
||||
var layEvent = obj.event;
|
||||
if(layEvent === 'userEvent') {
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/system/user/list-group-user.html?groupId={groupId}', [data.groupId]),
|
||||
url: top.restAjax.path('route/group/user/list?groupId={groupId}', [data.groupId]),
|
||||
title: '用户组用户列表',
|
||||
width: '800px',
|
||||
height: '500px',
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
@ -79,7 +79,7 @@
|
||||
return;
|
||||
}
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/group/getgroup/{groupParentId}', [groupParentId]), {}, null, function(code, data) {
|
||||
top.restAjax.get(top.restAjax.path('api/group/get/{groupParentId}', [groupParentId]), {}, null, function(code, data) {
|
||||
form.val('dataForm', {
|
||||
groupParentName: data.groupName
|
||||
});
|
||||
@ -99,7 +99,8 @@
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.post(top.restAjax.path('api/group/savegroup', []), formData.field, null, function(code, data) {
|
||||
top.restAjax.post(top.restAjax.path('api/group/save', []), formData.field, null, function(code, data) {
|
||||
parent.parent.common.refreshTree('leftTree');
|
||||
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
|
@ -1,166 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="assets/js/vendor/zTree3/css/metroStyle/metroStyle.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein" style="padding: 0;">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body" style="padding: 0px;">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-xs12">
|
||||
<div id="selectGroups" class="layui-btn-container selector-title-wrapper"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-xs12">
|
||||
<div class="selector-tree-wrapper">
|
||||
<ul id="nodeTree" class="ztree"></ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button type="button" class="layui-btn confirm">确认</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary close">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
index: 'lib/index'
|
||||
}).use(['index', 'ztree', 'common'], function() {
|
||||
var $ = layui.$;
|
||||
var $win = $(window);
|
||||
var common = layui.common;
|
||||
var selectedNodeIds = top.dialog.dialogData.selectedNodeIds;
|
||||
var selectTreeNodeArray = [];
|
||||
function closeBox() {
|
||||
top.dialog.closeBox();
|
||||
}
|
||||
function initFrame() {
|
||||
var height = $win.height() - 160;
|
||||
$('.selector-tree-wrapper').css({
|
||||
height: height +'px',
|
||||
border: '1px dotted silver'
|
||||
});
|
||||
$('.selector-body-wrapper').css({
|
||||
height: height +'px',
|
||||
border: '1px dotted silver'
|
||||
});
|
||||
}
|
||||
// 初始化树
|
||||
function initThree() {
|
||||
var setting = {
|
||||
async: {
|
||||
enable: true,
|
||||
autoLoad: false,
|
||||
type: 'get',
|
||||
url: top.restAjax.path('api/group/listztreegroup', []),
|
||||
autoParam:['id'],
|
||||
otherParam:{},
|
||||
dataFilter: function(treeId, parentNode, childNodes) {
|
||||
if (!childNodes) return null;
|
||||
for (var i=0, l=childNodes.length; i<l; i++) {
|
||||
childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
|
||||
}
|
||||
return childNodes;
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: function(event, treeId, treeNode) {
|
||||
if(0 != treeNode.id) {
|
||||
selectTreeNode(treeNode.id, treeNode.name);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
view: {
|
||||
fontCss: {'color': 'black'}
|
||||
}
|
||||
};
|
||||
var zTree = $.fn.zTree.init($('#nodeTree'), setting);
|
||||
zTree.addNodes(null, {id: '0', pId: '-1', name: top.dataMessage.tree.rootName, url: 'javascript:void(0);', isParent: 'true'});
|
||||
common.refreshTree('nodeTree');
|
||||
}
|
||||
function initSelectedTreeNodes() {
|
||||
if(selectedNodeIds != '') {
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/group/listgroupbyids/{selectedNodeIds}', [selectedNodeIds]), {}, null, function(code, data) {
|
||||
for(var i = 0, item; item = data[i++]; ) {
|
||||
selectTreeNode(item.groupId, item.groupName);
|
||||
}
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
}
|
||||
}
|
||||
initFrame();
|
||||
initThree();
|
||||
initSelectedTreeNodes();
|
||||
// 节点是否已经选择
|
||||
function isTreeNodeSelected(nodeId) {
|
||||
var isSelected = false;
|
||||
for(var i = 0, item; item = selectTreeNodeArray[i++];) {
|
||||
if(item.nodeId == nodeId) {
|
||||
isSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return isSelected;
|
||||
}
|
||||
// 删除已经选择的节点
|
||||
function removeSelectedTreeNode(nodeId) {
|
||||
for(var i = 0, item; item = selectTreeNodeArray[i]; i++) {
|
||||
if(item.nodeId == nodeId) {
|
||||
selectTreeNodeArray.splice(i, 1);
|
||||
$('#selected_tree_node_'+ nodeId).remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 选择节点
|
||||
function selectTreeNode(nodeId, nodeName) {
|
||||
if(!isTreeNodeSelected(nodeId)) {
|
||||
selectTreeNodeArray.push({
|
||||
nodeId: nodeId,
|
||||
nodeName: nodeName
|
||||
});
|
||||
$('#selectGroups').append('<a id="selected_tree_node_'+ nodeId +'" href="javascript:void(0);" class="layui-btn layui-btn-xs">'+ nodeName +' <i class="fa fa-close" lay-click-removenode data-nodeid="'+ nodeId +'"></i></a>');
|
||||
}
|
||||
}
|
||||
$(document.body).on('click', '*[lay-click-removenode]', null, function() {
|
||||
var data = this.dataset;
|
||||
removeSelectedTreeNode(data.nodeid);
|
||||
});
|
||||
$('.close').on('click', function() {
|
||||
closeBox();
|
||||
});
|
||||
$('.confirm').on('click', function() {
|
||||
top.dialog.dialogData.selectTreeNodes = selectTreeNodeArray;
|
||||
top.dialog.dialogData.selectedNodeIds = null;
|
||||
closeBox();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,7 +1,7 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
@ -69,7 +69,7 @@
|
||||
// 初始化
|
||||
function initData() {
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/group/getgroup/{groupId}', [groupId]), {}, null, function(code, data) {
|
||||
top.restAjax.get(top.restAjax.path('api/group/get/{groupId}', [groupId]), {}, null, function(code, data) {
|
||||
form.val('dataForm', {
|
||||
groupParentName: data.groupParentName == '' ? '根节点' : data.groupParentName,
|
||||
groupParentId: data.groupParentId,
|
||||
@ -92,7 +92,8 @@
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.put(top.restAjax.path('api/group/updategroup/{groupId}', [groupId]), formData.field, null, function(code, data) {
|
||||
top.restAjax.put(top.restAjax.path('api/group/update/{groupId}', [groupId]), formData.field, null, function(code, data) {
|
||||
parent.parent.common.refreshTree('leftTree');
|
||||
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
|
@ -1,11 +1,11 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, group-scalable=0">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
@ -42,7 +42,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input id="selectedGroupIds" type="hidden"/>
|
||||
<input id="selectedUserIds" type="hidden"/>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
@ -55,15 +55,16 @@
|
||||
var table = layui.table;
|
||||
var admin = layui.admin;
|
||||
var common = layui.common;
|
||||
var roleId = top.restAjax.params(window.location.href).roleId;
|
||||
var groupId = top.restAjax.params(window.location.href).groupId;
|
||||
var resizeTimeout = null;
|
||||
var tableUrl = 'api/group/user/listpage/{groupId}';
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
table.render({
|
||||
elem: '#dataTable',
|
||||
id: 'dataTable',
|
||||
url: top.restAjax.path('api/group/listrolegroup/{roleId}', [roleId]),
|
||||
url: top.restAjax.path(tableUrl, [groupId]),
|
||||
width: admin.screen() > 1 ? '100%' : '',
|
||||
height: $win.height() - 60,
|
||||
limit: 20,
|
||||
@ -73,18 +74,54 @@
|
||||
pageName: 'page',
|
||||
limitName: 'rows'
|
||||
},
|
||||
cols: [[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field:'users', width:100, title: '用户列表', align:'center',
|
||||
templet: function(item) {
|
||||
return '<button type="button" class="layui-btn layui-btn-xs" lay-event="userEvent"><i class="fa fa-users"></i> 查看</button>';
|
||||
}
|
||||
},
|
||||
{field:'groupName', width:170, title: '组名称', align:'center',},
|
||||
{field:'groupSummary', width:170, title: '组说明', align:'center',},
|
||||
{field:'groupCode', width:170, title: '组编码', align:'center',},
|
||||
]],
|
||||
cols: [
|
||||
[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:80, title: '序号', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field:'userUsername', width:140, title: '用户名', align:'center'},
|
||||
{field:'userName', width:140, title: '昵称', align:'center'},
|
||||
{field:'userPhone', width:140, title: '手机', align:'center',
|
||||
templet: function(item) {
|
||||
if(!item.userPhone) {
|
||||
return '-';
|
||||
}
|
||||
return item.userPhone;
|
||||
}
|
||||
},
|
||||
{field:'userEmail', width: 160, title: '邮箱', align:'center',
|
||||
templet: function(item) {
|
||||
if(!item.userEmail) {
|
||||
return '-';
|
||||
}
|
||||
return item.userEmail;
|
||||
}
|
||||
},
|
||||
{field:'userState', width:80, title: '状态', align:'center',
|
||||
templet: function(item) {
|
||||
var value;
|
||||
switch (item.userState) {
|
||||
case 1:
|
||||
value = '冻结';
|
||||
break;
|
||||
case 2:
|
||||
value = '锁定';
|
||||
break;
|
||||
default:
|
||||
value = '正常';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
{field:'groupName', width:200, title: '组', align:'center',
|
||||
templet: function(item) {
|
||||
if(!item.groupName) {
|
||||
return '-';
|
||||
}
|
||||
return item.groupName;
|
||||
}
|
||||
},
|
||||
]
|
||||
],
|
||||
page: true,
|
||||
parseData: function(data) {
|
||||
return {
|
||||
@ -99,7 +136,7 @@
|
||||
// 重载表格
|
||||
function reloadTable(currentPage) {
|
||||
table.reload('dataTable', {
|
||||
url: top.restAjax.path('api/group/listrolegroup/{roleId}', [roleId]),
|
||||
url: top.restAjax.path(tableUrl, [groupId]),
|
||||
where: {
|
||||
keywords: $('#keywords').val(),
|
||||
},
|
||||
@ -118,12 +155,12 @@
|
||||
yes: function(index) {
|
||||
top.dialog.close(index);
|
||||
var layIndex;
|
||||
top.restAjax.delete(top.restAjax.path('api/group/removerolegroup/{roleId}/{ids}', [roleId, ids]), {}, null, function(code, data) {
|
||||
top.restAjax.delete(top.restAjax.path('api/group/user/remove/{groupId}/{ids}', [groupId, ids]), {}, null, function(code, data) {
|
||||
top.dialog.msg(top.dataMessage.deleteSuccess);
|
||||
var deleteGroupIds = ids.split('_');
|
||||
var selectedGroupIds = $('#selectedGroupIds').val().split('_');
|
||||
var tempIds = common.resultIdsOfDeleteIds(deleteGroupIds, selectedGroupIds);
|
||||
$('#selectedGroupIds').val(tempIds);
|
||||
var deleteUserIds = ids.split('_');
|
||||
var selectedUserIds = $('#selectedUserIds').val().split('_');
|
||||
var tempIds = common.resultIdsOfDeleteIds(deleteUserIds, selectedUserIds);
|
||||
$('#selectedUserIds').val(tempIds);
|
||||
reloadTable();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
@ -138,15 +175,15 @@
|
||||
// 初始化角色用户ID列表
|
||||
function initSelectUserIds() {
|
||||
var layIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/group/listselectrolegroup/{roleId}', [roleId]), {}, null, function(code, data) {
|
||||
var selectedGroupIds = '';
|
||||
top.restAjax.get(top.restAjax.path('api/group/user/listuseridbygroupid/{groupId}', [groupId]), {}, null, function(code, data) {
|
||||
var selectedUserIds = '';
|
||||
for(var i = 0, item; item = data[i++]; ) {
|
||||
if('' != selectedGroupIds) {
|
||||
selectedGroupIds += '_';
|
||||
if('' != selectedUserIds) {
|
||||
selectedUserIds += '_';
|
||||
}
|
||||
selectedGroupIds += item.groupId;
|
||||
selectedUserIds += item.userId;
|
||||
}
|
||||
$('#selectedGroupIds').val(selectedGroupIds);
|
||||
$('#selectedUserIds').val(selectedUserIds);
|
||||
initTable();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
@ -175,21 +212,23 @@
|
||||
var checkStatus = table.checkStatus('dataTable');
|
||||
var checkDatas = checkStatus.data;
|
||||
if(layEvent === 'saveEvent') {
|
||||
top.dialog.dialogData.selectedNodeIds = $('#selectedGroupIds').val();
|
||||
top.dialog.dialogData.selectedUserIds = $('#selectedUserIds').val();
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/system/group/select-group.html', []),
|
||||
url: top.restAjax.path('route/department/user/select-user', []),
|
||||
title: '选择组织部门人员',
|
||||
width: '500px',
|
||||
height: '500px',
|
||||
onClose: function() {
|
||||
var selectTreeNodes = top.dialog.dialogData.selectTreeNodes;
|
||||
if(selectTreeNodes != null && selectTreeNodes.length > 0) {
|
||||
var selectedGroupIds = '';
|
||||
for (var i = 0, item; item = selectTreeNodes[i++];) {
|
||||
if ('' != selectedGroupIds) {
|
||||
selectedGroupIds += '_';
|
||||
var selectedUsers = top.dialog.dialogData.selectedDepartmentUsers;
|
||||
if(selectedUsers != null && selectedUsers.length > 0) {
|
||||
var selectedUserIds = '';
|
||||
var ids = [];
|
||||
for (var i = 0, item; item = selectedUsers[i++];) {
|
||||
if ('' != selectedUserIds) {
|
||||
selectedUserIds += '_';
|
||||
}
|
||||
selectedGroupIds += item.nodeId;
|
||||
selectedUserIds += item.userId;
|
||||
ids.push(item.userId);
|
||||
}
|
||||
top.dialog.msg(top.dataMessage.update, {
|
||||
time: 0,
|
||||
@ -197,11 +236,11 @@
|
||||
yes: function (index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.put(top.restAjax.path('api/group/updaterolegroup/{roleId}', [roleId]), {
|
||||
selectedGroupIds: selectedGroupIds
|
||||
top.restAjax.put(top.restAjax.path('api/group/user/update/{groupId}', [groupId]), {
|
||||
ids: ids
|
||||
}, null, function (code, data) {
|
||||
top.dialog.msg(top.dataMessage.updated);
|
||||
$('#selectedGroupIds').val(selectedGroupIds);
|
||||
$('#selectedUserIds').val(selectedUserIds);
|
||||
reloadTable();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
@ -228,25 +267,12 @@
|
||||
if(i > 1) {
|
||||
ids += '_';
|
||||
}
|
||||
ids += item.groupId;
|
||||
ids += item.userId;
|
||||
}
|
||||
removeData(ids);
|
||||
}
|
||||
}
|
||||
});
|
||||
table.on('tool(dataTable)', function(obj) {
|
||||
var data = obj.data;
|
||||
var layEvent = obj.event;
|
||||
if(layEvent === 'userEvent') {
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/system/user/list-group-user.html?groupId={groupId}', [data.groupId]),
|
||||
title: '用户组用户列表',
|
||||
width: '800px',
|
||||
height: '500px',
|
||||
onClose: function() {}
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.ZTreeDTO;
|
||||
import ink.wgink.pojo.dtos.menu.MenuDTO;
|
||||
@ -119,7 +120,7 @@ public class MenuServiceImpl extends DefaultBaseService implements IMenuService
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(menuVO);
|
||||
String parentCode = null;
|
||||
String menuParentId = params.get("menuParentId").toString();
|
||||
if (!"0".equals(menuParentId)) {
|
||||
if (!ISystemConstant.TREE_ROOT_ID.equals(menuParentId)) {
|
||||
params.put("menuId", menuParentId);
|
||||
MenuDTO menuDTO = menuDao.get(params);
|
||||
parentCode = menuDTO.getMenuCode();
|
||||
|
@ -223,7 +223,8 @@ public class ServiceMenuStartUp implements ApplicationRunner {
|
||||
menuId = menuDTO.getMenuId();
|
||||
}
|
||||
initUserManage(params, menuId);
|
||||
initMenuDepartment(params, menuId);
|
||||
initDepartmentManage(params, menuId);
|
||||
initGroupManage(params, menuId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -256,7 +257,13 @@ public class ServiceMenuStartUp implements ApplicationRunner {
|
||||
}
|
||||
}
|
||||
|
||||
private void initMenuDepartment(Map<String, Object> params, String menuParentId) {
|
||||
/**
|
||||
* 组织机构管理
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initDepartmentManage(Map<String, Object> params, String menuParentId) {
|
||||
LOG.debug("初始化菜单:组织机构管理");
|
||||
if (departmentCheckService == null) {
|
||||
return;
|
||||
@ -280,15 +287,40 @@ public class ServiceMenuStartUp implements ApplicationRunner {
|
||||
}
|
||||
}
|
||||
|
||||
private void initMenuGroup() {
|
||||
/**
|
||||
* 用户组管理
|
||||
*
|
||||
* @param params
|
||||
* @param menuParentId
|
||||
*/
|
||||
private void initGroupManage(Map<String, Object> params, String menuParentId) {
|
||||
LOG.debug("初始化菜单:用户组管理");
|
||||
LOG.debug("初始化菜单:职位管理");
|
||||
LOG.debug("初始化菜单:权限管理");
|
||||
LOG.debug("初始化菜单:角色管理");
|
||||
if (departmentCheckService == null) {
|
||||
return;
|
||||
}
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000100020003");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId = UUIDUtil.getUUID();
|
||||
if (menuDTO == null) {
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "用户组管理");
|
||||
params.put("menuSummary", "用户组管理");
|
||||
params.put("menuUrl", "/route/group/list-tree");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-users");
|
||||
params.put("menuOrder", "3");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
private void initMenuPosition() {
|
||||
|
||||
LOG.debug("初始化菜单:职位管理");
|
||||
LOG.debug("初始化菜单:权限管理");
|
||||
LOG.debug("初始化菜单:角色管理");
|
||||
}
|
||||
|
||||
private void initMenuPermission() {
|
||||
|
@ -387,7 +387,7 @@ public class RoleServiceImpl extends DefaultBaseService implements IRoleService
|
||||
for (DepartmentBO departmentBO : departmentBOs) {
|
||||
departmentIds.add(departmentBO.getDepartmentId());
|
||||
}
|
||||
return departmentUserService.listUserIdByDepartmentIds(departmentIds);
|
||||
return departmentUserService.listUserId(departmentIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -254,7 +254,7 @@ public class UserServiceImpl extends DefaultBaseService implements IUserService
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<UserDTO>> listPageByExcludeUserIds(List<String> excludeUserIds, ListPage page) {
|
||||
public SuccessResultList<List<UserDTO>> listPageByExcludeIds(List<String> excludeUserIds, ListPage page) {
|
||||
page.getParams().put("excludeUserIds", excludeUserIds);
|
||||
return listPage(page);
|
||||
}
|
||||
|
@ -146,14 +146,14 @@
|
||||
|
||||
$('#avatarImage').on('click', function() {
|
||||
top.dialog.open({
|
||||
url: 'route/file/uploadimage/v2?fileId='+ $('#userAvatar').val(),
|
||||
url: 'route/file/uploadimage?fileId='+ $('#userAvatar').val(),
|
||||
title: '上传头像',
|
||||
width: '800px',
|
||||
height: '470px',
|
||||
onClose: function() {
|
||||
var uploadImage = top.dialog.dialogData.uploadImage;
|
||||
if(typeof(uploadImage) != 'undefined' && null != uploadImage && '' != uploadImage) {
|
||||
$('#avatarImage').attr('src', 'route/file/downloadfile/false/' + uploadImage);
|
||||
$('#avatarImage').attr('src', 'route/file/download/false/' + uploadImage);
|
||||
$('#userAvatar').val(uploadImage);
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@
|
||||
});
|
||||
form.render(null, 'dataForm');
|
||||
if($('#userAvatar').val() != '') {
|
||||
$('#avatarImage').attr('src', 'route/file/downloadfile/false/' + $('#userAvatar').val());
|
||||
$('#avatarImage').attr('src', 'route/file/download/true/' + $('#userAvatar').val());
|
||||
} else {
|
||||
$('#userAvatar').val($('#userAvatar').val());
|
||||
}
|
||||
@ -176,14 +176,14 @@
|
||||
|
||||
$('#avatarImage').on('click', function() {
|
||||
top.dialog.open({
|
||||
url: 'route/file/uploadimage/v2?fileId='+ $('#userAvatar').val(),
|
||||
url: 'route/file/uploadimage?fileId='+ $('#userAvatar').val(),
|
||||
title: '上传头像',
|
||||
width: '800px',
|
||||
height: '470px',
|
||||
onClose: function() {
|
||||
var uploadImage = top.dialog.dialogData.uploadImage;
|
||||
if(typeof(uploadImage) != 'undefined' && null != uploadImage && '' != uploadImage) {
|
||||
$('#avatarImage').attr('src', 'route/file/downloadfile/false/' + uploadImage);
|
||||
$('#avatarImage').attr('src', 'route/file/download/true/' + uploadImage);
|
||||
$('#userAvatar').val(uploadImage);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user