|
@@ -6,13 +6,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.qmth.sop.business.bean.result.SysCustomResult;
|
|
|
import com.qmth.sop.business.entity.SysCustom;
|
|
|
-import com.qmth.sop.business.entity.SysCustomRole;
|
|
|
-import com.qmth.sop.business.entity.SysLevelRole;
|
|
|
import com.qmth.sop.business.entity.SysUser;
|
|
|
import com.qmth.sop.business.mapper.SysCustomMapper;
|
|
|
-import com.qmth.sop.business.service.SysCustomRoleService;
|
|
|
import com.qmth.sop.business.service.SysCustomService;
|
|
|
-import com.qmth.sop.common.contant.SystemConstant;
|
|
|
+import com.qmth.sop.business.service.SysLevelRoleService;
|
|
|
import com.qmth.sop.common.enums.ProductTypeEnum;
|
|
|
import com.qmth.sop.common.util.ServletUtil;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -34,7 +31,7 @@ import java.util.Objects;
|
|
|
@Service
|
|
|
public class SysCustomServiceImpl extends ServiceImpl<SysCustomMapper, SysCustom> implements SysCustomService {
|
|
|
@Resource
|
|
|
- SysCustomRoleService sysCustomRoleService;
|
|
|
+ SysLevelRoleService sysLevelRoleService;
|
|
|
|
|
|
/**
|
|
|
* 查询列表
|
|
@@ -46,34 +43,24 @@ public class SysCustomServiceImpl extends ServiceImpl<SysCustomMapper, SysCustom
|
|
|
public IPage<SysCustomResult> query(Page<Map> iPage, ProductTypeEnum type, Long managerId, String name, Long levelId) {
|
|
|
IPage<SysCustomResult> sysCustomResultIPage = this.baseMapper.query(iPage, Objects.nonNull(type) ? type.name() : null, Objects.nonNull(managerId) ? managerId : null, name, Objects.nonNull(levelId) ? levelId : null);
|
|
|
sysCustomResultIPage.getRecords().forEach(e -> {
|
|
|
- e.setRoleList(sysCustomRoleService.getList(e.getId()));
|
|
|
+ e.setRoleList(sysLevelRoleService.getList(e.getId()));
|
|
|
});
|
|
|
return sysCustomResultIPage;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public void add(SysCustomResult sysCustom) {
|
|
|
+ public void add(SysCustom sysCustom) {
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
sysCustom.setCreateId(sysUser.getId());
|
|
|
sysCustom.setCreateTime(System.currentTimeMillis());
|
|
|
this.saveOrUpdate(sysCustom);
|
|
|
- sysCustom.getRoleList().forEach(e->{
|
|
|
- e.setCustomId(sysCustom.getId());
|
|
|
- sysCustomRoleService.saveOrUpdate(e);
|
|
|
- });
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public void update(SysCustomResult sysCustom) {
|
|
|
- sysCustomRoleService.remove(new QueryWrapper<SysCustomRole>().lambda().eq(SysCustomRole::getCustomId, sysCustom.getId()));
|
|
|
- sysCustom.getRoleList().forEach(e->{
|
|
|
- e.setCustomId(sysCustom.getId());
|
|
|
- sysCustomRoleService.saveOrUpdate(e);
|
|
|
- });
|
|
|
-
|
|
|
+ public void update(SysCustom sysCustom) {
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
sysCustom.setUpdateId(sysUser.getId());
|
|
|
sysCustom.setUpdateTime(System.currentTimeMillis());
|
|
@@ -84,7 +71,6 @@ public class SysCustomServiceImpl extends ServiceImpl<SysCustomMapper, SysCustom
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void delete(Long id) {
|
|
|
- sysCustomRoleService.remove(new QueryWrapper<SysCustomRole>().lambda().eq(SysCustomRole::getCustomId, id));
|
|
|
this.removeById(id);
|
|
|
}
|
|
|
|