|
@@ -129,7 +129,7 @@ public class KwsMenuService {
|
|
|
* @date: 2023/6/25
|
|
* @date: 2023/6/25
|
|
|
*/
|
|
*/
|
|
|
public void deleteByKey(String ids) throws SystemException {
|
|
public void deleteByKey(String ids) throws SystemException {
|
|
|
- List<Long> list = Arrays.stream(ids.split(",")).map(Long::parseLong).toList();
|
|
|
|
|
|
|
+ List<Long> list = Arrays.stream(ids.split(Global.COMMA)).map(Long::parseLong).toList();
|
|
|
/*1、删除菜单*/
|
|
/*1、删除菜单*/
|
|
|
List<KwsMenu> kwsMenus = kwsMenuDao.selectByKeys(list);
|
|
List<KwsMenu> kwsMenus = kwsMenuDao.selectByKeys(list);
|
|
|
if (CollectionUtils.isEmpty(kwsMenus)) {
|
|
if (CollectionUtils.isEmpty(kwsMenus)) {
|
|
@@ -320,31 +320,30 @@ public class KwsMenuService {
|
|
|
return kwsMenuDao.selectAll();
|
|
return kwsMenuDao.selectAll();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Transactional()
|
|
|
|
|
|
|
+ @Transactional(rollbackFor = {})
|
|
|
public void moveMenu(MoveMenuReqVo reqVo) {
|
|
public void moveMenu(MoveMenuReqVo reqVo) {
|
|
|
KwsMenu kwsMenu = kwsMenuDao.selectByKey(reqVo.getId());
|
|
KwsMenu kwsMenu = kwsMenuDao.selectByKey(reqVo.getId());
|
|
|
if (Objects.isNull(kwsMenu)) {
|
|
if (Objects.isNull(kwsMenu)) {
|
|
|
throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.MENU_NOT_EXISTS);
|
|
throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.MENU_NOT_EXISTS);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// //查出要被换位置的按钮
|
|
|
|
|
-// KwsMenu targetMenu = getTargetMenu(reqVo.getMoveType(), kwsMenu);
|
|
|
|
|
-//
|
|
|
|
|
-// //修改要换位置的按钮
|
|
|
|
|
|
|
+ //查出要被换位置的按钮
|
|
|
|
|
+ KwsMenu targetMenu = getTargetMenu(reqVo.getMoveType(), kwsMenu);
|
|
|
|
|
+ if (Objects.isNull(targetMenu)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //修改要换位置的按钮
|
|
|
kwsMenu.setSort(kwsMenu.getSort() + reqVo.getMoveType());
|
|
kwsMenu.setSort(kwsMenu.getSort() + reqVo.getMoveType());
|
|
|
if (kwsMenuDao.update(kwsMenu) <= 0) {
|
|
if (kwsMenuDao.update(kwsMenu) <= 0) {
|
|
|
throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
|
|
throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
|
|
|
}
|
|
}
|
|
|
-//
|
|
|
|
|
-// if (Objects.isNull(targetMenu)) {
|
|
|
|
|
-// return;
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// //更新被换位置的按钮
|
|
|
|
|
-// targetMenu.setSort(targetMenu.getSort() - reqVo.getMoveType());
|
|
|
|
|
-// if (kwsMenuDao.update(targetMenu) <= 0) {
|
|
|
|
|
-// throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ //更新被换位置的按钮
|
|
|
|
|
+ targetMenu.setSort(targetMenu.getSort() - reqVo.getMoveType());
|
|
|
|
|
+ if (kwsMenuDao.update(targetMenu) <= 0) {
|
|
|
|
|
+ throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|