mirror of
https://github.com/zykzhangyukang/Xinguan.git
synced 2024-09-20 06:46:03 +08:00
修改删除逻辑
This commit is contained in:
parent
2dcde12a3c
commit
6f78a2fe75
|
@ -2,41 +2,18 @@
|
|||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="bc0098de-1555-475b-b0df-4f7e5b9cd099" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/enums/RoleStatusEnum.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/ConsumerController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/ConsumerController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/HealthController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/HealthController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/InStockController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/InStockController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/NcovAPIController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/NcovAPIController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/OutStockController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/OutStockController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/ProductCategoryController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/ProductCategoryController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/ProductController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/ProductController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/SupplierController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/SupplierController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/service/imp/InStockServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/service/imp/InStockServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/service/imp/OutStockServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/service/imp/OutStockServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/aspect/ControllerEndpointAspect.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/aspect/ControllerEndpointAspect.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/config/shiro/JWTFilter.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/config/shiro/JWTFilter.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/config/shiro/UserRealm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/config/shiro/UserRealm.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/config/web/GlobalExceptionHandler.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/config/web/GlobalExceptionHandler.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/exception/ErrorCodeEnum.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/exception/ErrorCodeEnum.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/utils/JWTUtils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/utils/JWTUtils.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/bean/ActiveUser.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/bean/ActiveUser.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/bean/ResponseBean.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/bean/ResponseBean.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/DepartmentController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/DepartmentController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/FileUploadController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/FileUploadController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/LogController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/LogController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/LoginLogController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/LoginLogController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/MenuController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/MenuController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/RoleController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/RoleController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/UserController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/UserController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/MenuService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/MenuService.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/RoleService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/RoleService.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/UserService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/UserService.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/DepartmentServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/DepartmentServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/LogServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/LogServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/LoginLogServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/LoginLogServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/MenuServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/MenuServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/RoleServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/RoleServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/UserServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/UserServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/vo/UserVO.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/vo/UserVO.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -2485,7 +2462,7 @@
|
|||
<workItem from="1590723506721" duration="570000" />
|
||||
<workItem from="1590724085074" duration="3820000" />
|
||||
<workItem from="1590727928932" duration="6419000" />
|
||||
<workItem from="1590741932410" duration="3987000" />
|
||||
<workItem from="1590741932410" duration="12223000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
@ -2522,10 +2499,10 @@
|
|||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state x="498" y="206" key="#com.intellij.ide.util.TreeClassChooserDialog/0.0.1536.834@0.0.1536.834" timestamp="1588079205110" />
|
||||
<state x="361" y="340" key="#com.intellij.refactoring.move.MoveHandler.SelectRefactoringDialog" timestamp="1590735213148">
|
||||
<state x="361" y="340" key="#com.intellij.refactoring.move.MoveHandler.SelectRefactoringDialog" timestamp="1590756895047">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state x="361" y="340" key="#com.intellij.refactoring.move.MoveHandler.SelectRefactoringDialog/0.0.1536.834@0.0.1536.834" timestamp="1590735213148" />
|
||||
<state x="361" y="340" key="#com.intellij.refactoring.move.MoveHandler.SelectRefactoringDialog/0.0.1536.834@0.0.1536.834" timestamp="1590756895047" />
|
||||
<state x="539" y="284" width="457" height="273" key="#com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackagesDialog.classes" timestamp="1590727325009">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
|
@ -2538,54 +2515,54 @@
|
|||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state x="524" y="119" key="#xdebugger.evaluate/0.0.1536.834@0.0.1536.834" timestamp="1588300742809" />
|
||||
<state width="1495" height="310" key="GridCell.Tab.0.bottom" timestamp="1590745829038">
|
||||
<state width="1495" height="425" key="GridCell.Tab.0.bottom" timestamp="1590754991705">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1495" height="310" key="GridCell.Tab.0.bottom/0.0.1536.834@0.0.1536.834" timestamp="1590745829038" />
|
||||
<state width="1495" height="310" key="GridCell.Tab.0.center" timestamp="1590745829037">
|
||||
<state width="1495" height="425" key="GridCell.Tab.0.bottom/0.0.1536.834@0.0.1536.834" timestamp="1590754991705" />
|
||||
<state width="1495" height="425" key="GridCell.Tab.0.center" timestamp="1590754991705">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1495" height="310" key="GridCell.Tab.0.center/0.0.1536.834@0.0.1536.834" timestamp="1590745829037" />
|
||||
<state width="1495" height="310" key="GridCell.Tab.0.left" timestamp="1590745829037">
|
||||
<state width="1495" height="425" key="GridCell.Tab.0.center/0.0.1536.834@0.0.1536.834" timestamp="1590754991705" />
|
||||
<state width="1495" height="425" key="GridCell.Tab.0.left" timestamp="1590754991705">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1495" height="310" key="GridCell.Tab.0.left/0.0.1536.834@0.0.1536.834" timestamp="1590745829037" />
|
||||
<state width="1495" height="310" key="GridCell.Tab.0.right" timestamp="1590745829038">
|
||||
<state width="1495" height="425" key="GridCell.Tab.0.left/0.0.1536.834@0.0.1536.834" timestamp="1590754991705" />
|
||||
<state width="1495" height="425" key="GridCell.Tab.0.right" timestamp="1590754991705">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1495" height="310" key="GridCell.Tab.0.right/0.0.1536.834@0.0.1536.834" timestamp="1590745829038" />
|
||||
<state width="1495" height="310" key="GridCell.Tab.1.bottom" timestamp="1590745829038">
|
||||
<state width="1495" height="425" key="GridCell.Tab.0.right/0.0.1536.834@0.0.1536.834" timestamp="1590754991705" />
|
||||
<state width="1495" height="425" key="GridCell.Tab.1.bottom" timestamp="1590754991705">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1495" height="310" key="GridCell.Tab.1.bottom/0.0.1536.834@0.0.1536.834" timestamp="1590745829038" />
|
||||
<state width="1495" height="310" key="GridCell.Tab.1.center" timestamp="1590745829038">
|
||||
<state width="1495" height="425" key="GridCell.Tab.1.bottom/0.0.1536.834@0.0.1536.834" timestamp="1590754991705" />
|
||||
<state width="1495" height="425" key="GridCell.Tab.1.center" timestamp="1590754991705">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1495" height="310" key="GridCell.Tab.1.center/0.0.1536.834@0.0.1536.834" timestamp="1590745829038" />
|
||||
<state width="1495" height="310" key="GridCell.Tab.1.left" timestamp="1590745829038">
|
||||
<state width="1495" height="425" key="GridCell.Tab.1.center/0.0.1536.834@0.0.1536.834" timestamp="1590754991705" />
|
||||
<state width="1495" height="425" key="GridCell.Tab.1.left" timestamp="1590754991705">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1495" height="310" key="GridCell.Tab.1.left/0.0.1536.834@0.0.1536.834" timestamp="1590745829038" />
|
||||
<state width="1495" height="310" key="GridCell.Tab.1.right" timestamp="1590745829038">
|
||||
<state width="1495" height="425" key="GridCell.Tab.1.left/0.0.1536.834@0.0.1536.834" timestamp="1590754991705" />
|
||||
<state width="1495" height="425" key="GridCell.Tab.1.right" timestamp="1590754991705">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1495" height="310" key="GridCell.Tab.1.right/0.0.1536.834@0.0.1536.834" timestamp="1590745829038" />
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.bottom" timestamp="1590744261569">
|
||||
<state width="1495" height="425" key="GridCell.Tab.1.right/0.0.1536.834@0.0.1536.834" timestamp="1590754991705" />
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.bottom" timestamp="1590746457535">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.bottom/0.0.1536.834@0.0.1536.834" timestamp="1590744261569" />
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.center" timestamp="1590744261569">
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.bottom/0.0.1536.834@0.0.1536.834" timestamp="1590746457535" />
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.center" timestamp="1590746457535">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.center/0.0.1536.834@0.0.1536.834" timestamp="1590744261569" />
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.left" timestamp="1590744261569">
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.center/0.0.1536.834@0.0.1536.834" timestamp="1590746457535" />
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.left" timestamp="1590746457535">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.left/0.0.1536.834@0.0.1536.834" timestamp="1590744261569" />
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.right" timestamp="1590744261569">
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.left/0.0.1536.834@0.0.1536.834" timestamp="1590746457535" />
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.right" timestamp="1590746457535">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.right/0.0.1536.834@0.0.1536.834" timestamp="1590744261569" />
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.right/0.0.1536.834@0.0.1536.834" timestamp="1590746457535" />
|
||||
<state width="212" height="477" key="HiddenNamespacesPopup" timestamp="1589459548093">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
|
@ -2603,6 +2580,17 @@
|
|||
</state>
|
||||
<state x="178" y="27" key="new project wizard/0.0.1536.834@0.0.1536.834" timestamp="1589592795583" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/com/coderman/api/common/config/shiro/UserRealm.java</url>
|
||||
<line>84</line>
|
||||
<option name="timeStamp" value="3" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
<component name="antWorkspaceConfiguration">
|
||||
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
|
||||
<option name="FILTER_TARGETS" value="false" />
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package com.coderman.api.system.controller;
|
||||
|
||||
import com.coderman.api.common.utils.CommonFileUtil;
|
||||
import com.coderman.api.common.bean.ResponseBean;
|
||||
import com.coderman.api.system.mapper.ImageAttachmentMapper;
|
||||
import com.coderman.api.common.exception.ServiceException;
|
||||
import com.coderman.api.common.pojo.system.ImageAttachment;
|
||||
import com.coderman.api.common.utils.CommonFileUtil;
|
||||
import com.coderman.api.system.mapper.ImageAttachmentMapper;
|
||||
import com.coderman.api.system.vo.ImageAttachmentVO;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
@ -127,6 +128,9 @@ public class FileUploadController {
|
|||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseBean delete(@PathVariable Long id){
|
||||
ImageAttachment imageAttachment = imageAttachmentMapper.selectByPrimaryKey(id);
|
||||
if (imageAttachment==null){
|
||||
throw new ServiceException("该附件不存在");
|
||||
}
|
||||
imageAttachmentMapper.deleteByPrimaryKey(id);
|
||||
commonFileUtil.deleteFile(imageAttachment.getPath());
|
||||
return ResponseBean.success();
|
||||
|
|
|
@ -49,7 +49,7 @@ public class RoleController {
|
|||
@RequiresPermissions({"role:authority"})
|
||||
@PostMapping("/authority/{id}")
|
||||
public ResponseBean authority(@PathVariable Long id, @RequestBody Long[] mids) {
|
||||
menuService.authority(id, mids);
|
||||
roleService.authority(id, mids);
|
||||
return ResponseBean.success();
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,6 @@ public class UserController {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
@RequiresAuthentication
|
||||
@ApiOperation(value = "加载菜单", notes = "用户登入后,根据角色加载菜单树")
|
||||
@GetMapping("/findMenu")
|
||||
public ResponseBean findMenu() {
|
||||
|
@ -182,8 +181,7 @@ public class UserController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 添加用户
|
||||
*
|
||||
* 添加用户信息
|
||||
* @param userVO
|
||||
* @return
|
||||
*/
|
||||
|
|
|
@ -49,11 +49,6 @@ public interface MenuService {
|
|||
*/
|
||||
List<Long> findOpenIds();
|
||||
|
||||
/**
|
||||
* 角色授权
|
||||
* @param mids
|
||||
*/
|
||||
void authority(Long id,Long[] mids);
|
||||
|
||||
/**
|
||||
* 获取所有菜单
|
||||
|
|
|
@ -67,4 +67,10 @@ public interface RoleService {
|
|||
* @return
|
||||
*/
|
||||
List<Long> findMenuIdsByRoleId(Long id);
|
||||
|
||||
/**
|
||||
* 角色授权
|
||||
* @param mids
|
||||
*/
|
||||
void authority(Long id,Long[] mids);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,8 @@ import java.util.List;
|
|||
public interface UserService {
|
||||
|
||||
/**
|
||||
* 查询用户
|
||||
* 根据用户名查询用户
|
||||
*
|
||||
* @param name 用户名
|
||||
* @return
|
||||
*/
|
||||
|
@ -23,20 +24,24 @@ public interface UserService {
|
|||
|
||||
/**
|
||||
* 查询用户角色
|
||||
* @param id 用户ID
|
||||
*
|
||||
* @param id 用户id
|
||||
* @return
|
||||
*/
|
||||
List<Role> findRolesById(Long id);
|
||||
|
||||
/**
|
||||
* 查询用户的权限(permissionCode)
|
||||
* 根据用户角色查询用户的菜单
|
||||
* 菜单: menu+button
|
||||
*
|
||||
* @param roles 用户的角色
|
||||
* @return
|
||||
*/
|
||||
List<Menu> findMenuByRoles(List<Role> roles);
|
||||
|
||||
/**
|
||||
* 加载用户菜单
|
||||
* 加载菜单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<MenuNodeVO> findMenu();
|
||||
|
@ -49,13 +54,15 @@ public interface UserService {
|
|||
PageVO<UserVO> findUserList(Integer pageNum,Integer pageSize,UserVO userVO);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* 删除用户
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 更新用户状态
|
||||
* 更新状态
|
||||
*
|
||||
* @param id
|
||||
* @param status
|
||||
*/
|
||||
|
@ -68,7 +75,8 @@ public interface UserService {
|
|||
void add(UserVO userVO);
|
||||
|
||||
/**
|
||||
* 更新用户信息
|
||||
* 更新用户
|
||||
*
|
||||
* @param id
|
||||
* @param userVO
|
||||
*/
|
||||
|
@ -76,13 +84,15 @@ public interface UserService {
|
|||
|
||||
/**
|
||||
* 编辑用户
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
UserEditVO edit(Long id);
|
||||
|
||||
/**
|
||||
* 用户拥有的角色ID
|
||||
* 已拥有的角色ids
|
||||
*
|
||||
* @param id 用户id
|
||||
* @return
|
||||
*/
|
||||
|
@ -90,19 +100,22 @@ public interface UserService {
|
|||
|
||||
/**
|
||||
* 分配角色
|
||||
*
|
||||
* @param id
|
||||
* @param rids
|
||||
*/
|
||||
void assignRoles(Long id, Long[] rids);
|
||||
|
||||
/**
|
||||
* 全部用户
|
||||
* 所有用户
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<User> findAll();
|
||||
|
||||
/**
|
||||
* 用户登入
|
||||
*
|
||||
* @param username
|
||||
* @param password
|
||||
* @return
|
||||
|
@ -111,7 +124,8 @@ public interface UserService {
|
|||
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
* 用户详情
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
UserInfoVO info();
|
||||
|
|
|
@ -156,7 +156,7 @@ public class DepartmentServiceImpl implements DepartmentService {
|
|||
}
|
||||
}
|
||||
if(!isMgr){
|
||||
throw new ServiceException("不存在该部门主任");
|
||||
throw new ServiceException("该用户已无部门主任身份");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,13 +29,26 @@ public class LogServiceImpl implements LogService {
|
|||
@Autowired
|
||||
private LogMapper logMapper;
|
||||
|
||||
/**
|
||||
* 保存登入日志
|
||||
* @param log
|
||||
*/
|
||||
@Override
|
||||
public void saveLog(Log log) {
|
||||
logMapper.insert(log);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除操作日志
|
||||
* @param id
|
||||
*/
|
||||
@Override
|
||||
public void delete(Long id) {
|
||||
Log log = logMapper.selectByPrimaryKey(id);
|
||||
if(log==null){
|
||||
throw new ServiceException("要删除的操作日志不存在");
|
||||
}
|
||||
logMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package com.coderman.api.system.service.impl;
|
||||
|
||||
import com.coderman.api.common.exception.ServiceException;
|
||||
import com.coderman.api.common.pojo.system.Role;
|
||||
import com.coderman.api.system.converter.MenuConverter;
|
||||
import com.coderman.api.system.mapper.MenuMapper;
|
||||
import com.coderman.api.system.mapper.RoleMapper;
|
||||
import com.coderman.api.system.mapper.RoleMenuMapper;
|
||||
import com.coderman.api.common.pojo.system.Menu;
|
||||
import com.coderman.api.common.pojo.system.RoleMenu;
|
||||
|
@ -17,6 +19,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.util.CollectionUtils;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.rmi.ServerException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -36,8 +39,12 @@ public class MenuServiceImpl implements MenuService {
|
|||
@Autowired
|
||||
private RoleMenuMapper roleMenuMapper;
|
||||
|
||||
@Autowired
|
||||
private RoleMapper roleMapper;
|
||||
|
||||
/**
|
||||
* 加载菜单树(按钮和菜单)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
@ -49,6 +56,7 @@ public class MenuServiceImpl implements MenuService {
|
|||
|
||||
/**
|
||||
* 添加菜单
|
||||
*
|
||||
* @param menuVO
|
||||
*/
|
||||
@Override
|
||||
|
@ -62,24 +70,44 @@ public class MenuServiceImpl implements MenuService {
|
|||
return menu;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
* @param id
|
||||
*/
|
||||
@Override
|
||||
public void delete(Long id) {
|
||||
Menu menu = menuMapper.selectByPrimaryKey(id);
|
||||
if(menu==null){
|
||||
throw new ServiceException("菜单节点不存在");
|
||||
throw new ServiceException("要删除的菜单不存在");
|
||||
}
|
||||
menuMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑菜单
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public MenuVO edit(Long id) {
|
||||
Menu menu = menuMapper.selectByPrimaryKey(id);
|
||||
MenuVO menuVO = MenuConverter.converterToMenuVO(menu);
|
||||
return menuVO;
|
||||
if(menu==null){
|
||||
throw new ServiceException("该编辑的菜单不存在");
|
||||
}
|
||||
return MenuConverter.converterToMenuVO(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新菜单
|
||||
* @param id
|
||||
* @param menuVO
|
||||
*/
|
||||
@Override
|
||||
public void update(Long id, MenuVO menuVO) {
|
||||
Menu dbMenu = menuMapper.selectByPrimaryKey(id);
|
||||
if(dbMenu==null){
|
||||
throw new ServiceException("要更新的菜单不存在");
|
||||
}
|
||||
Menu menu = new Menu();
|
||||
BeanUtils.copyProperties(menuVO,menu);
|
||||
menu.setId(id);
|
||||
|
@ -88,6 +116,11 @@ public class MenuServiceImpl implements MenuService {
|
|||
menuMapper.updateByPrimaryKeySelective(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取展开项
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Long> findOpenIds() {
|
||||
List<Long> ids=new ArrayList<>();
|
||||
|
@ -102,23 +135,7 @@ public class MenuServiceImpl implements MenuService {
|
|||
return ids;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void authority(Long id,Long[] mids) {
|
||||
//先删除原来的权限
|
||||
Example o = new Example(RoleMenu.class);
|
||||
o.createCriteria().andEqualTo("roleId",id);
|
||||
roleMenuMapper.deleteByExample(o);
|
||||
|
||||
if(mids.length>0){
|
||||
for (Long mid : mids) {
|
||||
RoleMenu roleMenu = new RoleMenu();
|
||||
roleMenu.setRoleId(id);
|
||||
roleMenu.setMenuId(mid);
|
||||
roleMenuMapper.insertSelective(roleMenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有菜单
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package com.coderman.api.system.service.impl;
|
||||
|
||||
import com.coderman.api.common.exception.ServiceException;
|
||||
import com.coderman.api.common.pojo.system.Menu;
|
||||
import com.coderman.api.common.pojo.system.Role;
|
||||
import com.coderman.api.common.pojo.system.RoleMenu;
|
||||
import com.coderman.api.system.converter.RoleConverter;
|
||||
import com.coderman.api.system.enums.RoleStatusEnum;
|
||||
import com.coderman.api.system.mapper.MenuMapper;
|
||||
import com.coderman.api.system.mapper.RoleMapper;
|
||||
import com.coderman.api.system.mapper.RoleMenuMapper;
|
||||
import com.coderman.api.system.service.RoleService;
|
||||
|
@ -38,6 +40,10 @@ public class RoleServiceImpl implements RoleService {
|
|||
@Autowired
|
||||
private RoleMenuMapper roleMenuMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
private MenuMapper menuMapper;
|
||||
|
||||
/**
|
||||
* 角色列表
|
||||
* @param pageNum
|
||||
|
@ -171,6 +177,10 @@ public class RoleServiceImpl implements RoleService {
|
|||
*/
|
||||
@Override
|
||||
public List<Long> findMenuIdsByRoleId(Long id) {
|
||||
Role role = roleMapper.selectByPrimaryKey(id);
|
||||
if(role==null){
|
||||
throw new ServiceException("该角色已不存在");
|
||||
}
|
||||
List<Long> ids=new ArrayList<>();
|
||||
Example o = new Example(RoleMenu.class);
|
||||
o.createCriteria().andEqualTo("roleId",id);
|
||||
|
@ -183,4 +193,36 @@ public class RoleServiceImpl implements RoleService {
|
|||
return ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色授权
|
||||
* @param id
|
||||
* @param mids
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public void authority(Long id,Long[] mids) {
|
||||
Role role = roleMapper.selectByPrimaryKey(id);
|
||||
if(role==null){
|
||||
throw new ServiceException("该角色不存在");
|
||||
}
|
||||
//先删除原来的权限
|
||||
Example o = new Example(RoleMenu.class);
|
||||
o.createCriteria().andEqualTo("roleId",id);
|
||||
roleMenuMapper.deleteByExample(o);
|
||||
//增加现在分配的角色
|
||||
if(mids.length>0){
|
||||
for (Long mid : mids) {
|
||||
Menu menu = menuMapper.selectByPrimaryKey(mid);
|
||||
if(menu==null){
|
||||
throw new ServiceException("menuId="+mid+",菜单权限不存在");
|
||||
}else {
|
||||
RoleMenu roleMenu = new RoleMenu();
|
||||
roleMenu.setRoleId(id);
|
||||
roleMenu.setMenuId(mid);
|
||||
roleMenuMapper.insertSelective(roleMenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -70,12 +70,7 @@ public class UserServiceImpl implements UserService {
|
|||
public User findUserByName(String name) {
|
||||
User t = new User();
|
||||
t.setUsername(name);
|
||||
List<User> select = userMapper.select(t);
|
||||
if(!CollectionUtils.isEmpty(select)){
|
||||
return select.get(0);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
return userMapper.selectOne(t);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -215,9 +210,16 @@ public class UserServiceImpl implements UserService {
|
|||
@Override
|
||||
public void deleteById(Long id) {
|
||||
User user = userMapper.selectByPrimaryKey(id);
|
||||
ActiveUser activeUser = (ActiveUser) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
if(user==null){
|
||||
throw new ServiceException("要删除的用户不存在");
|
||||
}
|
||||
|
||||
if(user.getId().equals(activeUser.getUser().getId())){
|
||||
throw new ServiceException("不能删除当前登入用户");
|
||||
}
|
||||
|
||||
userMapper.deleteByPrimaryKey(id);
|
||||
//删除对应[用户-角色]记录
|
||||
Example o = new Example(UserRole.class);
|
||||
|
@ -435,6 +437,7 @@ public class UserServiceImpl implements UserService {
|
|||
|
||||
/**
|
||||
* 用户详情
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue