|
@ -21,6 +21,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.dao.GovRoleDao; |
|
|
import com.epmet.dao.GovRoleDao; |
|
@ -74,8 +76,10 @@ public class GovRoleServiceImpl extends BaseServiceImpl<GovRoleDao, GovRoleEntit |
|
|
private QueryWrapper<GovRoleEntity> getWrapper(Map<String, Object> params){ |
|
|
private QueryWrapper<GovRoleEntity> getWrapper(Map<String, Object> params){ |
|
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
|
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
|
|
String name = (String)params.get(FieldConstant.NAME_HUMP); |
|
|
String name = (String)params.get(FieldConstant.NAME_HUMP); |
|
|
|
|
|
String customerId = (String)params.get(FieldConstant.CUSTOMER_ID_HUMP); |
|
|
QueryWrapper<GovRoleEntity> wrapper = new QueryWrapper<>(); |
|
|
QueryWrapper<GovRoleEntity> wrapper = new QueryWrapper<>(); |
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id).like(StringUtils.isNotBlank(name), FieldConstant.NAME, name); |
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id).like(StringUtils.isNotBlank(name), FieldConstant.NAME, name) |
|
|
|
|
|
.eq(StringUtils.isNotBlank(customerId), FieldConstant.CUSTOMER_ID_HUMP, customerId); |
|
|
|
|
|
|
|
|
return wrapper; |
|
|
return wrapper; |
|
|
} |
|
|
} |
|
@ -107,7 +111,11 @@ public class GovRoleServiceImpl extends BaseServiceImpl<GovRoleDao, GovRoleEntit |
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void delete(String[] ids) { |
|
|
public void delete(String[] ids) { |
|
|
// 逻辑删除(@TableLogic 注解)
|
|
|
//查询角色信息,管理员角色不允许删除
|
|
|
|
|
|
GovRoleEntity entity = baseDao.selectById(ids[NumConstant.ZERO]); |
|
|
|
|
|
if (null != entity && "管理员".equals(entity.getName())) { |
|
|
|
|
|
throw new RenException("9999", "管理员角色为默认角色,不允许删除"); |
|
|
|
|
|
} |
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
|
|
|
|
|
|
govRoleMenuService.deleteByRoleIds(ids); |
|
|
govRoleMenuService.deleteByRoleIds(ids); |
|
|