feat: 菜单删除功能完成
This commit is contained in:
parent
8e63cb4ef9
commit
a75c4c3bd5
@ -42,5 +42,13 @@ public class SystemController {
|
||||
public ResponseEntity addMenu(@RequestBody MenuDataItem menuDataItem) {
|
||||
return ResponseEntity.ok(systemService.addMenu(menuDataItem));
|
||||
}
|
||||
@DeleteMapping("menu-del")
|
||||
public ResponseEntity delMenu(@RequestBody MenuDataItem menuDataItem) {
|
||||
return ResponseEntity.ok(systemService.delMenu(menuDataItem));
|
||||
}
|
||||
@DeleteMapping("menu-del-realy")
|
||||
public ResponseEntity delMenuRealy(@RequestBody MenuDataItem menuDataItem) {
|
||||
return ResponseEntity.ok(systemService.delMenuRealy(menuDataItem));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,14 +15,14 @@ public interface SystemMapper extends BaseMapper<MenuDataItem> {
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
@Select("""
|
||||
SELECT * from menu_data_item where id in (select system_role_menu.menu_id from system_role_menu where role_id=#{roleId} and deleted!=1)""")
|
||||
@Select("SELECT * from menu_data_item where (deleted!=1 or deleted is null) and id in (select system_role_menu.menu_id from system_role_menu where role_id=#{roleId})")
|
||||
List<MenuDataItem> getMenus(String roleId);
|
||||
|
||||
/**
|
||||
* 查询所有菜单,不区分角色
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT * from menu_data_item where deleted!=1")
|
||||
@Select("SELECT * from menu_data_item")
|
||||
List<MenuDataItem> getMenusAll();
|
||||
|
||||
}
|
||||
|
@ -11,4 +11,8 @@ public interface SystemService {
|
||||
ResponseResult updateMenu(MenuDataItem menuDataItem);
|
||||
|
||||
ResponseResult addMenu(MenuDataItem menuDataItem);
|
||||
|
||||
ResponseResult delMenu(MenuDataItem menuDataItem);
|
||||
|
||||
ResponseResult delMenuRealy(MenuDataItem menuDataItem);
|
||||
}
|
||||
|
@ -77,4 +77,15 @@ public class SystemServiceImpl implements SystemService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult delMenu(MenuDataItem menuDataItem) {
|
||||
menuDataItem.setDeleted(1);
|
||||
return ResponseResult.success(systemMapper.updateById(menuDataItem));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult delMenuRealy(MenuDataItem menuDataItem) {
|
||||
return ResponseResult.success(systemMapper.deleteById(menuDataItem));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user