xuhy
5 天以前 1a2e22a27627b40689257442cc5a46598c634f8e
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TSamplingRecordController.java
@@ -22,6 +22,7 @@
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
@@ -76,6 +77,19 @@
    @PostMapping(value = "/api/t-sampling-record/pageList")
    public R<PageInfo<TSamplingRecordVO>> pageList(@RequestBody String param) {
        TSamplingRecordQuery query = JSON.parseObject(param, TSamplingRecordQuery.class);
        // 获取当前用户
        Long userId = tokenService.getLoginUser().getUserId();
        Integer roleType = tokenService.getLoginUser().getUser().getRoleType();
        if (roleType != 1){
            query.setUserId(userId);
            // 查询实验参与人员
            List<TExperimentDispatchParticipants> experimentDispatchParticipants = experimentDispatchParticipantsService.list(Wrappers.lambdaQuery(TExperimentDispatchParticipants.class)
                    .eq(TExperimentDispatchParticipants::getUserId, userId));
            if(!CollectionUtils.isEmpty(experimentDispatchParticipants)){
                List<String> dispatchIds = experimentDispatchParticipants.stream().map(TExperimentDispatchParticipants::getDispatchId).distinct().collect(Collectors.toList());
                query.setDispatchIds(dispatchIds);
            }
        }
        return R.ok(samplingRecordService.pageList(query));
    }