|
|
|
|
@ -10,13 +10,21 @@ import org.springblade.core.mp.base.BaseEntity; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
|
import org.springblade.core.mp.support.Query; |
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
|
import org.springblade.lims.entry.InspectionRecord; |
|
|
|
|
import org.springblade.lims.entry.Instrument; |
|
|
|
|
import org.springblade.lims.mapper.InspectionRecordMapper; |
|
|
|
|
import org.springblade.lims.service.IInspectionRecordService; |
|
|
|
|
import org.springblade.lims.service.IInstrumentService; |
|
|
|
|
import org.springblade.system.cache.SysCache; |
|
|
|
|
import org.springblade.system.entity.Dept; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @author swj |
|
|
|
|
@ -30,8 +38,15 @@ public class InspectionRecordServiceImpl extends BaseServiceImpl<InspectionRecor |
|
|
|
|
@Override |
|
|
|
|
public IPage<InspectionRecord> findPage(InspectionRecord entry, Query query) { |
|
|
|
|
LambdaQueryWrapper<InspectionRecord> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
if(entry.getCreateDept() != null){ |
|
|
|
|
wrapper.eq(BaseEntity::getCreateDept,entry.getCreateDept()); |
|
|
|
|
List<String> roles = Arrays.asList(AuthUtil.getUserRole().split(",")); |
|
|
|
|
if(!roles.contains("admin") && !roles.contains("政府")){ |
|
|
|
|
List<Long> deptIds = new ArrayList<>(); |
|
|
|
|
List<Dept> depts = SysCache.getDeptChild(Long.parseLong(AuthUtil.getDeptId())); |
|
|
|
|
if(CollectionUtils.isNotEmpty(depts)){ |
|
|
|
|
deptIds = depts.stream().map(Dept::getId).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
deptIds.add(Long.parseLong(AuthUtil.getDeptId())); |
|
|
|
|
wrapper.in(BaseEntity::getCreateDept,deptIds); |
|
|
|
|
} |
|
|
|
|
wrapper.eq(BaseEntity::getIsDeleted, 0); |
|
|
|
|
wrapper.orderByDesc(InspectionRecord::getCreateTime); |
|
|
|
|
|