Commit 14893ac8 by fsn

删除字典业务的完成

parent edaa696d
package com.stylefeng.guns.modular.system.controller; package com.stylefeng.guns.modular.system.controller;
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.stylefeng.guns.common.annotion.log.BussinessLog; import com.stylefeng.guns.common.annotion.log.BussinessLog;
import com.stylefeng.guns.common.controller.BaseController; import com.stylefeng.guns.common.controller.BaseController;
import com.stylefeng.guns.common.exception.BizExceptionEnum; import com.stylefeng.guns.common.exception.BizExceptionEnum;
...@@ -83,9 +82,7 @@ public class DictController extends BaseController { ...@@ -83,9 +82,7 @@ public class DictController extends BaseController {
if (ToolUtil.isOneEmpty(dictName, dictValues)) { if (ToolUtil.isOneEmpty(dictName, dictValues)) {
throw new BussinessException(BizExceptionEnum.REQUEST_NULL); throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
} }
this.dictService.addDict(dictName, dictValues); this.dictService.addDict(dictName, dictValues);
return SUCCESS_TIP; return SUCCESS_TIP;
} }
...@@ -129,15 +126,7 @@ public class DictController extends BaseController { ...@@ -129,15 +126,7 @@ public class DictController extends BaseController {
@RequestMapping(value = "/delete/{dictId}") @RequestMapping(value = "/delete/{dictId}")
@ResponseBody @ResponseBody
public Object delete(@PathVariable("dictId") Integer dictId) { public Object delete(@PathVariable("dictId") Integer dictId) {
this.dictService.delteDict(dictId);
//删除这个字典的子词典
Wrapper<Dict> dictEntityWrapper = new EntityWrapper<>();
dictEntityWrapper = dictEntityWrapper.eq("pid", dictId);
dictMapper.delete(dictEntityWrapper);
//删除这个词典
dictMapper.deleteById(dictId);
return SUCCESS_TIP; return SUCCESS_TIP;
} }
......
...@@ -24,4 +24,12 @@ public interface IDictService { ...@@ -24,4 +24,12 @@ public interface IDictService {
*/ */
void editDict(String dicts); void editDict(String dicts);
/**
* 删除字典
*
* @author fengshuonan
* @Date 2017/4/28 11:39
*/
void delteDict(Integer dictId);
} }
package com.stylefeng.guns.modular.system.service.impl; package com.stylefeng.guns.modular.system.service.impl;
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.stylefeng.guns.common.exception.BizExceptionEnum; import com.stylefeng.guns.common.exception.BizExceptionEnum;
import com.stylefeng.guns.common.exception.BussinessException; import com.stylefeng.guns.common.exception.BussinessException;
import com.stylefeng.guns.modular.system.dao.DictDao; import com.stylefeng.guns.modular.system.dao.DictDao;
...@@ -68,4 +69,16 @@ public class DictServiceImpl implements IDictService { ...@@ -68,4 +69,16 @@ public class DictServiceImpl implements IDictService {
dict.updateById(); dict.updateById();
} }
} }
@Override
public void delteDict(Integer dictId) {
//删除这个字典的子词典
Wrapper<Dict> dictEntityWrapper = new EntityWrapper<>();
dictEntityWrapper = dictEntityWrapper.eq("pid", dictId);
dictMapper.delete(dictEntityWrapper);
//删除这个词典
dictMapper.deleteById(dictId);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment