package com.stylefeng.guns.modular.system.service.impl; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.stylefeng.guns.core.node.ZTreeNode; import com.stylefeng.guns.modular.system.dao.DeptMapper; import com.stylefeng.guns.modular.system.model.Dept; import com.stylefeng.guns.modular.system.service.IDeptService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.List; import java.util.Map; @Service @Transactional public class DeptServiceImpl extends ServiceImpl implements IDeptService { @Resource private DeptMapper deptMapper; @Override public void deleteDept(Integer deptId) { Dept dept = deptMapper.selectById(deptId); Wrapper wrapper = new EntityWrapper<>(); wrapper = wrapper.like("pids", "%[" + dept.getId() + "]%"); List subDepts = deptMapper.selectList(wrapper); for (Dept temp : subDepts) { temp.deleteById(); } dept.deleteById(); } @Override public List tree() { return this.baseMapper.tree(); } @Override public List> list(String condition) { return this.baseMapper.list(condition); } }