|
@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.xt.js.gkaq.common.BaseCtl;
|
|
import com.xt.js.gkaq.common.BaseCtl;
|
|
import com.xt.js.gkaq.frame.model.MenuModel;
|
|
import com.xt.js.gkaq.frame.model.MenuModel;
|
|
|
|
+import com.xt.js.gkaq.frame.service.ButtonService;
|
|
import com.xt.js.gkaq.frame.service.MenuService;
|
|
import com.xt.js.gkaq.frame.service.MenuService;
|
|
import com.xt.js.gkaq.web.vo.MenuVo;
|
|
import com.xt.js.gkaq.web.vo.MenuVo;
|
|
import com.yuanxd.tools.utils.WebJsonResult;
|
|
import com.yuanxd.tools.utils.WebJsonResult;
|
|
@@ -23,6 +24,8 @@ import com.yuanxd.tools.utils.string.StringUtils;
|
|
public class MenuCtl extends BaseCtl {
|
|
public class MenuCtl extends BaseCtl {
|
|
@Autowired
|
|
@Autowired
|
|
private MenuService menuService;
|
|
private MenuService menuService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ButtonService buttonService;
|
|
|
|
|
|
@RequestMapping("")
|
|
@RequestMapping("")
|
|
public String index(Model model) {
|
|
public String index(Model model) {
|
|
@@ -44,6 +47,7 @@ public class MenuCtl extends BaseCtl {
|
|
@RequestMapping("getRecord")
|
|
@RequestMapping("getRecord")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
public MenuVo getRecord(String id) {
|
|
public MenuVo getRecord(String id) {
|
|
|
|
+
|
|
MenuModel menuModel = menuService.findById(id);
|
|
MenuModel menuModel = menuService.findById(id);
|
|
MenuVo menuVo = new MenuVo();
|
|
MenuVo menuVo = new MenuVo();
|
|
BeanUtils.copyProperties(menuModel, menuVo);
|
|
BeanUtils.copyProperties(menuModel, menuVo);
|
|
@@ -54,13 +58,19 @@ public class MenuCtl extends BaseCtl {
|
|
@ResponseBody
|
|
@ResponseBody
|
|
@Transactional
|
|
@Transactional
|
|
public int delRecodes(String ids) {
|
|
public int delRecodes(String ids) {
|
|
- int cnt = 0;
|
|
|
|
|
|
+
|
|
|
|
+ int cnt = 0;
|
|
if (StringUtils.isNotEmpty(ids)) {
|
|
if (StringUtils.isNotEmpty(ids)) {
|
|
String[] idArr = ids.split(",");
|
|
String[] idArr = ids.split(",");
|
|
for (String id : idArr) {
|
|
for (String id : idArr) {
|
|
if (StringUtils.isNotEmpty(id)) {
|
|
if (StringUtils.isNotEmpty(id)) {
|
|
- // 先删除关联的子菜单
|
|
|
|
|
|
+ // 删除按钮
|
|
|
|
+ cnt += buttonService.deleteByID(id);
|
|
|
|
+ // 删除末级菜单关联的按钮
|
|
|
|
+ cnt += buttonService.deleteByMenu(id);
|
|
|
|
+ // 删除非末级菜单关联的子菜单
|
|
cnt += menuService.deleteByPid(id);
|
|
cnt += menuService.deleteByPid(id);
|
|
|
|
+ // 删除菜单
|
|
cnt += menuService.deleteByID(id);
|
|
cnt += menuService.deleteByID(id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -76,8 +86,9 @@ public class MenuCtl extends BaseCtl {
|
|
@RequestMapping("save")
|
|
@RequestMapping("save")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
public WebJsonResult save(MenuVo menuVo) {
|
|
public WebJsonResult save(MenuVo menuVo) {
|
|
- // 新增
|
|
|
|
|
|
+
|
|
if(StringUtils.isEmpty(menuVo.getId())) {
|
|
if(StringUtils.isEmpty(menuVo.getId())) {
|
|
|
|
+ // 新增
|
|
MenuModel menuModel = new MenuModel();
|
|
MenuModel menuModel = new MenuModel();
|
|
BeanUtils.copyProperties(menuVo, menuModel);
|
|
BeanUtils.copyProperties(menuVo, menuModel);
|
|
menuService.add(menuModel);
|
|
menuService.add(menuModel);
|