diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 13dd3dd6..00000000 --- a/.gitignore +++ /dev/null @@ -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 diff --git a/pig-admin-service/src/main/java/com/github/pig/admin/controller/UserController.java b/pig-admin-service/src/main/java/com/github/pig/admin/controller/UserController.java index 70c90475..b1c3e1fd 100644 --- a/pig-admin-service/src/main/java/com/github/pig/admin/controller/UserController.java +++ b/pig-admin-service/src/main/java/com/github/pig/admin/controller/UserController.java @@ -91,9 +91,20 @@ public class UserController extends BaseController { */ @DeleteMapping("/{id}") public Boolean userDel(@PathVariable Integer id) { - SysUser sysUser = userService.selectById(id); - sysUser.setDelFlag(CommonConstant.STATUS_DEL); - return userService.updateById(sysUser); +// SysUser sysUser = userService.selectById(id); +// sysUser.setDelFlag(CommonConstant.STATUS_DEL); +// 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; + } } /** diff --git a/pig-admin-service/src/main/java/com/github/pig/admin/mapper/SysUserRoleMapper.java b/pig-admin-service/src/main/java/com/github/pig/admin/mapper/SysUserRoleMapper.java index a12b5189..ed8f70ed 100644 --- a/pig-admin-service/src/main/java/com/github/pig/admin/mapper/SysUserRoleMapper.java +++ b/pig-admin-service/src/main/java/com/github/pig/admin/mapper/SysUserRoleMapper.java @@ -3,6 +3,7 @@ package com.github.pig.admin.mapper; import com.baomidou.mybatisplus.mapper.BaseMapper; import com.github.pig.admin.entity.SysUserRole; +import org.apache.ibatis.annotations.Param; /** *

@@ -13,5 +14,13 @@ import com.github.pig.admin.entity.SysUserRole; * @since 2017-10-29 */ public interface SysUserRoleMapper extends BaseMapper { - + /** + * 根据用户Id删除该用户的角色关系 + * + * @param userId 用户ID + * @return boolean + * @author 寻欢·李 + * @date 2017年12月7日 16:31:38 + */ + Boolean deleteByUserId(@Param("userId") Integer userId); } \ No newline at end of file diff --git a/pig-admin-service/src/main/java/com/github/pig/admin/service/SysUserRoleService.java b/pig-admin-service/src/main/java/com/github/pig/admin/service/SysUserRoleService.java index e19ec1f3..cc55bfef 100644 --- a/pig-admin-service/src/main/java/com/github/pig/admin/service/SysUserRoleService.java +++ b/pig-admin-service/src/main/java/com/github/pig/admin/service/SysUserRoleService.java @@ -13,5 +13,14 @@ import com.github.pig.admin.entity.SysUserRole; * @since 2017-10-29 */ public interface SysUserRoleService extends IService { - + + /** + * 根据用户Id删除该用户的角色关系 + * + * @author 寻欢·李 + * @date 2017年12月7日 16:31:38 + * @param userId 用户ID + * @return boolean + */ + Boolean deleteByUserId(Integer userId); } diff --git a/pig-admin-service/src/main/java/com/github/pig/admin/service/impl/SysUserRoleServiceImpl.java b/pig-admin-service/src/main/java/com/github/pig/admin/service/impl/SysUserRoleServiceImpl.java index 9c97037f..c7cf5fa3 100644 --- a/pig-admin-service/src/main/java/com/github/pig/admin/service/impl/SysUserRoleServiceImpl.java +++ b/pig-admin-service/src/main/java/com/github/pig/admin/service/impl/SysUserRoleServiceImpl.java @@ -16,5 +16,17 @@ import org.springframework.stereotype.Service; */ @Service public class SysUserRoleServiceImpl extends ServiceImpl 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); + } } diff --git a/pig-admin-service/src/main/resources/mapper/SysRoleMenuMapper.xml b/pig-admin-service/src/main/resources/mapper/SysRoleMenuMapper.xml index 3eb0a256..bcfe5bac 100644 --- a/pig-admin-service/src/main/resources/mapper/SysRoleMenuMapper.xml +++ b/pig-admin-service/src/main/resources/mapper/SysRoleMenuMapper.xml @@ -1,6 +1,6 @@ - + diff --git a/pig-admin-service/src/main/resources/mapper/SysUserRoleMapper.xml b/pig-admin-service/src/main/resources/mapper/SysUserRoleMapper.xml index 0fac0dbb..7a48b749 100644 --- a/pig-admin-service/src/main/resources/mapper/SysUserRoleMapper.xml +++ b/pig-admin-service/src/main/resources/mapper/SysUserRoleMapper.xml @@ -1,6 +1,6 @@ - + @@ -8,4 +8,9 @@ + + + DELETE FROM sys_user_role WHERE user_id = #{userId} + + diff --git a/pig-config/src/main/resources/application.yml b/pig-config/src/main/resources/application.yml deleted file mode 100644 index 4e5512d1..00000000 --- a/pig-config/src/main/resources/application.yml +++ /dev/null @@ -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 -