Commit 9c413dc8 by 陶光胜

Merge branch 'developer' of…

Merge branch 'developer' of http://115.159.76.241/base_platform_enterprise/gic-platform-auth into developer
parents 2fead9b6 6ee234b5
......@@ -19,7 +19,7 @@ public class RoleListDTO implements Serializable{
/**
* 管理员角色名称
*/
private Integer roleName;
private String roleName;
/**
* 授权管理员数量
......@@ -34,11 +34,11 @@ public class RoleListDTO implements Serializable{
this.roleId = roleId;
}
public Integer getRoleName() {
public String getRoleName() {
return roleName;
}
public void setRoleName(Integer roleName) {
public void setRoleName(String roleName) {
this.roleName = roleName;
}
......
......@@ -18,6 +18,10 @@ public class UserListQO extends PageQO{
private Integer enterpriseId;
private Integer roleId;
private Integer resourceId;
public String getSearch() {
return search;
}
......@@ -33,4 +37,20 @@ public class UserListQO extends PageQO{
public void setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public Integer getResourceId() {
return resourceId;
}
public void setResourceId(Integer resourceId) {
this.resourceId = resourceId;
}
}
......@@ -5,6 +5,9 @@ import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.dto.RoleDTO;
import com.gic.auth.dto.RoleListDTO;
import com.gic.auth.qo.RoleListQO;
import java.util.List;
/**
* 角色权限接口
* @ClassName: RoleApiService

......@@ -45,6 +48,16 @@ public interface RoleApiService {
ServiceResponse<RoleDTO> getById(Integer id);
/**
* 逻辑删除
* @Title: delete

* @Description:

 * @author guojuxing
* @param id

* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


 */
ServiceResponse<Void> delete(Integer id);
/**
* 分页查询列表
* @Title: pageRole

* @Description:
......@@ -53,4 +66,14 @@ public interface RoleApiService {
* @return com.gic.api.base.commons.ServiceResponse<com.gic.api.base.commons.Page<com.gic.auth.dto.RoleDTO>>


 */
ServiceResponse<Page<RoleListDTO>> pageRole(RoleListQO params);
/**
* 角色列表
* @Title: listRole

* @Description:

 * @author guojuxing
* @param enterpriseId

* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.auth.dto.RoleDTO>>


 */
ServiceResponse<List<RoleDTO>> listRole(Integer enterpriseId);
}
......@@ -39,6 +39,16 @@ public interface UserApiService {
ServiceResponse<UserDTO> getUserById(Integer userId);
/**
* 删除
* @Title: delete

* @Description:

 * @author guojuxing
* @param userId

* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


 */
ServiceResponse<Void> delete(Integer userId);
/**
* 企业查询超级管理员
* @param enterpriseId
* @return
......
......@@ -75,4 +75,6 @@ public interface TabSysRoleMapper {
* @return int


 */
int deleteByRoleId(@Param("roleId") Integer roleId);
List<TabSysRole> listRoleNoPage(@Param("enterpriseId") Integer enterpriseId);
}
\ No newline at end of file
......@@ -82,4 +82,14 @@ public interface TabSysUserMapper {
* @return java.util.List<com.gic.auth.entity.TabSysUser>


 */
List<UserListDTO> listUser(UserListQO params);
/**
* 逻辑删除
* @Title: deleteById

* @Description:

 * @author guojuxing
* @param userId

* @return int


 */
int deleteById(@Param("userId") Integer userId);
}
\ No newline at end of file
......@@ -5,6 +5,9 @@ import com.gic.auth.dto.RoleListDTO;
import com.gic.auth.entity.TabSysRole;
import com.gic.auth.qo.RoleListQO;
import com.github.pagehelper.Page;
import java.util.List;
/**
* 角色权限接口
* @ClassName: RoleService

......@@ -55,4 +58,14 @@ public interface RoleService {
Page<RoleListDTO> pageRole(RoleListQO params);
TabSysRole getById(Integer id);
/**
* 列表查询
* @Title: listRole

* @Description:

 * @author guojuxing
* @param enterpriseId

* @return java.util.List<com.gic.auth.entity.TabSysRole>


 */
List<TabSysRole> listRole(Integer enterpriseId);
}
......@@ -53,4 +53,14 @@ public interface UserService {
* @return com.github.pagehelper.Page


 */
Page<UserListDTO> pageUser(UserListQO params);
/**
* 逻辑删除
* @Title: delete

* @Description:

 * @author guojuxing
* @param userId

* @return void


 */
void delete(Integer userId);
}
......@@ -53,4 +53,9 @@ public class RoleServiceImpl implements RoleService{
public TabSysRole getById(Integer id) {
return tabSysRoleMapper.selectByPrimaryKey(id);
}
@Override
public List<TabSysRole> listRole(Integer enterpriseId) {
return tabSysRoleMapper.listRoleNoPage(enterpriseId);
}
}
......@@ -75,4 +75,9 @@ public class UserServiceImpl implements UserService {
List<UserListDTO> list = tabSysUserMapper.listUser(params);
return (Page) list;
}
@Override
public void delete(Integer userId) {
tabSysUserMapper.deleteById(userId);
}
}
......@@ -9,6 +9,7 @@ import com.gic.auth.entity.TabSysRole;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.PageHelperUtils;
import com.gic.enterprise.error.ErrorCode;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -97,12 +98,31 @@ public class RoleApiServiceImpl implements RoleApiService{
}
@Override
public ServiceResponse<Void> delete(Integer id) {
TabSysRole record = roleService.getById(id);
if (record == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "角色数据有误,查无数据");
}
roleService.deleteById(id);
return ServiceResponse.success();
}
@Override
public ServiceResponse<Page<RoleListDTO>> pageRole(RoleListQO params) {
com.github.pagehelper.Page page = roleService.pageRole(params);
Page<RoleListDTO> resultPage = PageHelperUtils.changePageHelperToCurrentPage(page);
return ServiceResponse.success(resultPage);
}
@Override
public ServiceResponse<List<RoleDTO>> listRole(Integer enterpriseId) {
List<TabSysRole> list = roleService.listRole(enterpriseId);
if (CollectionUtils.isNotEmpty(list)) {
return ServiceResponse.success(EntityUtil.changeEntityListNew(RoleDTO.class, list));
}
return ServiceResponse.success(new ArrayList<>());
}
private ServiceResponse<Integer> saveMenuRole(Integer roleId, Integer enterpriseId, String menuIds) {
String[] menuIdArr;
ServiceResponse<String[]> menuIdResponse = ValidSplitUtils.validStr(menuIds);
......
......@@ -145,6 +145,16 @@ public class UserApiServiceImpl implements UserApiService {
}
@Override
public ServiceResponse<Void> delete(Integer userId) {
TabSysUser tabUser = userService.getUserById(userId);
if (tabUser == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "用户ID输入有误,无此数据");
}
userService.delete(userId);
return ServiceResponse.success();
}
@Override
public ServiceResponse<UserDTO> getUserByEnterpriseId(Integer enterpriseId) {
TabSysUser tabUser = userService.getUserByEnterpriseId(enterpriseId);
if (enterpriseId == null) {
......
......@@ -108,7 +108,7 @@
select
a.role_id roleId,
a.role_name roleName,
(select count(b.user_id) from tab_sys_user_role b where a.role_id = b.role_id and b.status = 1 group b.user_id) authUserCount
(select count(b.user_id) from tab_sys_user_role b where a.role_id = b.role_id and b.status = 1 group by b.user_id) authUserCount
from tab_sys_role a
where a.status = 1
and a.enterprise_id = #{enterpriseId}
......@@ -122,4 +122,12 @@
where role_id = #{roleId}
and status = 1
</update>
<select id="listRoleNoPage" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_sys_role
where status = 1
and enterprise_id = #{enterpriseId}
</select>
</mapper>
\ No newline at end of file
......@@ -231,5 +231,19 @@
<if test="search != null and search != '' ">
and ( a.user_name like concat('%', #{search}, '%') or a.phone_number like concat('%', #{search}, '%') )
</if>
<if test="roleId != null">
and b.role_id = #{roleId}
</if>
<if test="resourceId != null">
and c.resource_id = #{resourceId}
</if>
</select>
<update id="deleteById">
update tab_sys_user set status = 0
where user_id = #{userId}
and status = 1
</update>
</mapper>
\ No newline at end of file
package com.gic.auth.web.controller;
import com.gic.enterprise.utils.UserDetailUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -9,8 +8,10 @@ import com.gic.auth.dto.RoleDTO;
import com.gic.auth.qo.RoleListQO;
import com.gic.auth.service.RoleApiService;
import com.gic.auth.web.vo.RoleDetailVO;
import com.gic.auth.web.vo.RoleSelectVO;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.utils.UserDetailUtils;
@RestController
@RequestMapping("/role")
......@@ -36,9 +37,20 @@ public class RoleController {
return ResultControllerUtils.commonResult(roleApiService.update(dto));
}
@RequestMapping("/delete")
public RestResponse delete(Integer id) {
return ResultControllerUtils.commonResult(roleApiService.delete(id));
}
@RequestMapping("/list-role")
public RestResponse listRole(RoleListQO params) {
params.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
return ResultControllerUtils.commonResult(roleApiService.pageRole(params));
}
@RequestMapping("/list-role-no-page")
public RestResponse listRoleNoPage() {
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
return ResultControllerUtils.commonResult(roleApiService.listRole(enterpriseId), RoleSelectVO.class);
}
}
......@@ -60,6 +60,11 @@ public class UserController {
return ResultControllerUtils.commonResultOne(userApiService.getUserById(userId), UserDetailVO.class);
}
@RequestMapping("/delete-user-by-id")
public RestResponse delete(Integer userId) {
return ResultControllerUtils.commonResult(userApiService.delete(userId));
}
@RequestMapping("/list-user")
public RestResponse listUser(UserListQO params) {
params.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
......
package com.gic.auth.web.vo;
import java.io.Serializable;
/**
* 下拉框列表
* @ClassName: RoleSelectVO

* @Description: 

* @author guojuxing

* @date 2019/9/3 4:32 PM

*/
public class RoleSelectVO implements Serializable{
private static final long serialVersionUID = 2667055023531890522L;
/**
* id
*/
private Integer roleId;
/**
* 管理员角色名称
*/
private String roleName;
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment