mirror of https://gitee.com/maxjhandsome/pig
增加删除管理员功能
This commit is contained in:
parent
33249fde7f
commit
4c8023ffca
|
@ -1,25 +0,0 @@
|
||||||
target/
|
|
||||||
!.mvn/wrapper/maven-wrapper.jar
|
|
||||||
|
|
||||||
### STS ###
|
|
||||||
.apt_generated
|
|
||||||
.classpath
|
|
||||||
.factorypath
|
|
||||||
.project
|
|
||||||
.settings
|
|
||||||
.springBeans
|
|
||||||
|
|
||||||
### IntelliJ IDEA ###
|
|
||||||
.idea
|
|
||||||
*.iws
|
|
||||||
*.iml
|
|
||||||
*.ipr
|
|
||||||
|
|
||||||
### NetBeans ###
|
|
||||||
nbproject/private/
|
|
||||||
build/
|
|
||||||
nbbuild/
|
|
||||||
dist/
|
|
||||||
nbdist/
|
|
||||||
.nb-gradle/
|
|
||||||
logs
|
|
|
@ -91,9 +91,20 @@ public class UserController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
public Boolean userDel(@PathVariable Integer id) {
|
public Boolean userDel(@PathVariable Integer id) {
|
||||||
SysUser sysUser = userService.selectById(id);
|
// SysUser sysUser = userService.selectById(id);
|
||||||
sysUser.setDelFlag(CommonConstant.STATUS_DEL);
|
// sysUser.setDelFlag(CommonConstant.STATUS_DEL);
|
||||||
return userService.updateById(sysUser);
|
// return userService.updateById(sysUser);
|
||||||
|
boolean delUserRole = sysUserRoleService.deleteByUserId(id);
|
||||||
|
if (delUserRole) {
|
||||||
|
boolean delUserInfo = userService.deleteById(id);
|
||||||
|
if (delUserInfo) {
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}else {
|
||||||
|
return Boolean.FALSE;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
return Boolean.FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.github.pig.admin.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||||
import com.github.pig.admin.entity.SysUserRole;
|
import com.github.pig.admin.entity.SysUserRole;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -13,5 +14,13 @@ import com.github.pig.admin.entity.SysUserRole;
|
||||||
* @since 2017-10-29
|
* @since 2017-10-29
|
||||||
*/
|
*/
|
||||||
public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {
|
public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {
|
||||||
|
/**
|
||||||
|
* 根据用户Id删除该用户的角色关系
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return boolean
|
||||||
|
* @author 寻欢·李
|
||||||
|
* @date 2017年12月7日 16:31:38
|
||||||
|
*/
|
||||||
|
Boolean deleteByUserId(@Param("userId") Integer userId);
|
||||||
}
|
}
|
|
@ -13,5 +13,14 @@ import com.github.pig.admin.entity.SysUserRole;
|
||||||
* @since 2017-10-29
|
* @since 2017-10-29
|
||||||
*/
|
*/
|
||||||
public interface SysUserRoleService extends IService<SysUserRole> {
|
public interface SysUserRoleService extends IService<SysUserRole> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户Id删除该用户的角色关系
|
||||||
|
*
|
||||||
|
* @author 寻欢·李
|
||||||
|
* @date 2017年12月7日 16:31:38
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
Boolean deleteByUserId(Integer userId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,5 +16,17 @@ import org.springframework.stereotype.Service;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements SysUserRoleService {
|
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements SysUserRoleService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户Id删除该用户的角色关系
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return boolean
|
||||||
|
* @author 寻欢·李
|
||||||
|
* @date 2017年12月7日 16:31:38
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteByUserId(Integer userId) {
|
||||||
|
return baseMapper.deleteByUserId(userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.github.pig.auth.mapper.SysRoleMenuMapper">
|
<mapper namespace="com.github.pig.admin.mapper.SysRoleMenuMapper">
|
||||||
|
|
||||||
<!-- 通用查询映射结果 -->
|
<!-- 通用查询映射结果 -->
|
||||||
<resultMap id="BaseResultMap" type="com.github.pig.admin.entity.SysRoleMenu">
|
<resultMap id="BaseResultMap" type="com.github.pig.admin.entity.SysRoleMenu">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.github.pig.auth.mapper.SysUserRoleMapper">
|
<mapper namespace="com.github.pig.admin.mapper.SysUserRoleMapper">
|
||||||
|
|
||||||
<!-- 通用查询映射结果 -->
|
<!-- 通用查询映射结果 -->
|
||||||
<resultMap id="BaseResultMap" type="com.github.pig.admin.entity.SysUserRole">
|
<resultMap id="BaseResultMap" type="com.github.pig.admin.entity.SysUserRole">
|
||||||
|
@ -8,4 +8,9 @@
|
||||||
<result column="role_id" property="roleId" />
|
<result column="role_id" property="roleId" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<!--根据用户Id删除该用户的角色关系-->
|
||||||
|
<delete id="deleteByUserId">
|
||||||
|
DELETE FROM sys_user_role WHERE user_id = #{userId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
server:
|
|
||||||
port: 4001
|
|
||||||
|
|
||||||
spring:
|
|
||||||
application:
|
|
||||||
name: pig-config-server
|
|
||||||
cloud:
|
|
||||||
config:
|
|
||||||
server:
|
|
||||||
git:
|
|
||||||
uri: https://github.com/jieblog/pig-config.git
|
|
||||||
bus:
|
|
||||||
trace:
|
|
||||||
enabled: true
|
|
||||||
# rabbitmq:
|
|
||||||
# host: 192.168.1.122
|
|
||||||
# port: 5682
|
|
||||||
# username: guest
|
|
||||||
# password: guest
|
|
||||||
# virtual-host: /
|
|
||||||
|
|
||||||
eureka:
|
|
||||||
instance:
|
|
||||||
prefer-ip-address: true
|
|
||||||
client:
|
|
||||||
serviceUrl:
|
|
||||||
defaultZone: http://pig:gip6666@localhost:1001/eureka
|
|
||||||
|
|
Loading…
Reference in New Issue