| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.domain.ArchiveRecords; |
| | | import com.ruoyi.domain.Archiverecordstouser; |
| | | import com.ruoyi.domain.vo.AnalysisResult; |
| | | import com.ruoyi.domain.vo.ArchiveInfoVo; |
| | | import com.ruoyi.domain.vo.ArchiveRecordSmall; |
| | | import com.ruoyi.mapper.ArchiveRecordsMapper; |
| | | import com.ruoyi.mapper.ArchiverecordstouserMapper; |
| | | import com.ruoyi.service.IArchiveRecordsService; |
| | | import com.ruoyi.service.IArchiverecordstouserService; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | // @Autowired |
| | | // private ArchiveRecordsMapper archiveRecordsMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private IArchiverecordstouserService archiverecordstouserService; |
| | | @Autowired |
| | | private ArchiverecordstouserMapper archiverecordstouserMapper; |
| | | |
| | |
| | | if(userId==1) |
| | | |
| | | lqw.orderByDesc(ArchiveRecords::getCreateTime); |
| | | // else |
| | | // lqw.eq(userId!=null, ArchiveRecords::getUserId, userId); |
| | | System.out.println("ssssssssssssddd0000000000000000"); |
| | | return lqw; |
| | | |
| | |
| | | Page<ArchiveRecords> page = new Page<>(pageNum, pageSize); |
| | | |
| | | // 使用自定义的分页查询方法,先连接再分页 |
| | | Page<ArchiveRecords> pageResult = this.baseMapper.selectJoinUserPage(page, userid, lqw); |
| | | |
| | | Page<ArchiveRecords> pageResult = new Page<>(); |
| | | if(userid==1) |
| | | pageResult = this.baseMapper.selectJoinUserPage(page, userid, lqw); |
| | | else |
| | | pageResult = this.baseMapper.selectJoinCommonUserPage(page, userid, lqw); |
| | | |
| | | //selectJoinUserPage(page, lqw); |
| | | |
| | |
| | | // log.info("从数据库中查到的为:{}", beanRecords); |
| | | // return markOwnData(familyId, fatherFaId, motherFaId, beanRecords); |
| | | |
| | | |
| | | List<ArchiveRecords> beanUserRecords = new ArrayList<>(); |
| | | beanRecords.forEach(record ->{ |
| | | if(record.isArchiveRecordsId()!=null&&record.getUserId()==userid) |
| | | { |
| | | record.setOwnData(true); |
| | | beanUserRecords.add(record); |
| | | } |
| | | else |
| | | record.setOwnData(false); |
| | |
| | | //不是管理员进行排序 |
| | | // if(userid != 1) |
| | | // Collections.sort(beanRecords, Comparator.comparing(ArchiveRecords::isOwnData)); |
| | | HashMap<String, Object> data = MapUtils.getResult(pageResult, beanRecords); |
| | | HashMap<String, Object> data = new HashMap<>(); |
| | | if(userid==1) |
| | | data = MapUtils.getResult(pageResult, beanRecords); |
| | | else |
| | | data = MapUtils.getResult(pageResult, beanUserRecords); |
| | | // System.out.println(data.get("data")); |
| | | // System.out.println(data.get("pageNum")); |
| | | // System.out.println(data.get("total")); |
| | |
| | | Long userid = SecurityUtils.getUserId(); |
| | | LambdaQueryWrapper<ArchiveRecords> lambdaQueryWrapper = buildCondition(archiveRecords,userid); |
| | | List<ArchiveRecords> beanRecords = list(lambdaQueryWrapper); |
| | | |
| | | // 为记录设置序号,从1开始 |
| | | for (int i = 0; i < beanRecords.size(); i++) { |
| | | ArchiveRecords record = beanRecords.get(i); |
| | | record.setNum(String.valueOf(i + 1)); |
| | | } |
| | | |
| | | return beanRecords; |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public int updateArchiveById(String status, Long id) { |
| | | |
| | | // 获取当前用户ID |
| | | Long userId = SecurityUtils.getUserId(); |
| | | // 可以在这里使用userId进行授权操作 |
| | | archiverecordstouserService.deleteArchiverecordstouserByRecordId(id, userId); |
| | | this.baseMapper.updateStatusById(status, id); |
| | | return 0; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public AjaxResult mySave(ArchiveRecords archiveRecords) { |
| | | |
| | | |
| | | //检查是否有重复数据插入 |
| | | // 检查是否有重复数据插入 |
| | | LambdaQueryWrapper<ArchiveRecords> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(!StringUtils.isEmpty(archiveRecords.getRecordId()), ArchiveRecords::getRecordId,archiveRecords.getRecordId()); |
| | | List<ArchiveRecords> list = list(lqw); |
| | | if (list.size() > 0) { |
| | | if (!list.isEmpty()) { |
| | | // throw new RuntimeException("请勿新增重复数据"); |
| | | //如果有重复数据,则根据recordId进行数据修改 |
| | | // if() |
| | |
| | | return this.baseMapper.whether(recordId); |
| | | } |
| | | } |
| | | |