|
|
|
@ -24,6 +24,7 @@ import com.spring.modules.sys.entity.SysUserEntity; |
|
|
|
import com.spring.modules.sys.service.SysRoleService; |
|
|
|
import com.spring.modules.sys.service.SysUserService; |
|
|
|
import org.apache.shiro.SecurityUtils; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
@ -32,6 +33,7 @@ import org.springframework.util.StringUtils; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
@Service |
|
|
|
public class ProjectServiceImpl implements ProjectService { |
|
|
|
@ -93,8 +95,8 @@ public class ProjectServiceImpl implements ProjectService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<PlmUserRoleData> searchUserRoll(PlmUserRoleData data){ |
|
|
|
List<PlmUserRoleData> dataCheckList = data.getCheckList(); |
|
|
|
// 获得请求人 |
|
|
|
SysUserEntity sysUserEntity = (SysUserEntity) SecurityUtils.getSubject().getPrincipal(); |
|
|
|
List<PlmUserRoleData> list=projectDao.searchUserRoll(data); |
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
PlmUserRoleData plmUserRoleData = list.get(i); |
|
|
|
@ -103,6 +105,13 @@ public class ProjectServiceImpl implements ProjectService { |
|
|
|
plmUserRoleData.setDownCheck(false); |
|
|
|
plmUserRoleData.setDeleteCheck(false); |
|
|
|
plmUserRoleData.setCheckAll(false); |
|
|
|
// 新增需要这个 |
|
|
|
if (Objects.nonNull(dataCheckList) && !dataCheckList.isEmpty()){ |
|
|
|
int index = dataCheckList.indexOf(plmUserRoleData); |
|
|
|
if (index != -1){ |
|
|
|
BeanUtils.copyProperties(dataCheckList.get(index), plmUserRoleData); |
|
|
|
} |
|
|
|
} |
|
|
|
if("Y".equals(list.get(i).getSearchFlag()) && "Y".equals(list.get(i).getUpdateFlag()) && "Y".equals(list.get(i).getDownFlag()) && "Y".equals(list.get(i).getDeleteFlag())){ |
|
|
|
list.get(i).setCheckAll(true); |
|
|
|
} |
|
|
|
@ -118,18 +127,6 @@ public class ProjectServiceImpl implements ProjectService { |
|
|
|
if("Y".equals(list.get(i).getDeleteFlag())){ |
|
|
|
list.get(i).setDeleteCheck(true); |
|
|
|
} |
|
|
|
// 如果为新增 找到当前操作人,默认全选 |
|
|
|
if (StringUtils.isEmpty(data.getProjectId()) && plmUserRoleData.getUsername().equals(sysUserEntity.getUsername())){ |
|
|
|
plmUserRoleData.setSearchCheck(true); |
|
|
|
plmUserRoleData.setUpdateCheck(true); |
|
|
|
plmUserRoleData.setDownCheck(true); |
|
|
|
plmUserRoleData.setDeleteCheck(true); |
|
|
|
plmUserRoleData.setCheckAll(true); |
|
|
|
plmUserRoleData.setSearchFlag("Y"); |
|
|
|
plmUserRoleData.setUpdateFlag("Y"); |
|
|
|
plmUserRoleData.setDownFlag("Y"); |
|
|
|
plmUserRoleData.setDeleteFlag("Y"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return list; |
|
|
|
|