package com.ruoyi.service.impl; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.List; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.utils.MapUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.domain.ArchiveCategory; import com.ruoyi.domain.ArchiveRecords; import com.ruoyi.domain.Archiverecordstouser; import com.ruoyi.mapper.ArchiveCategoryMapper; import com.ruoyi.mapper.ArchiveRecordsMapper; import com.ruoyi.service.IArchiveCategoryService; import com.ruoyi.service.IArchiveRecordsService; import com.ruoyi.service.IDocumentMaterialsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * 【请填写功能名称】Service业务层处理 * * @author ruoyi * @date 2025-07-26 */ @Service public class ArchiveCategoryServiceImpl extends ServiceImpl implements IArchiveCategoryService { private LambdaQueryWrapper buildCondition(ArchiveCategory archiveRecords){ LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); lqw.like(!StringUtils.isEmpty(archiveRecords.getNumb()), ArchiveCategory::getNumb, archiveRecords.getNumb()) .like(!StringUtils.isEmpty(archiveRecords.getNname()), ArchiveCategory::getNname, archiveRecords.getNname()); // lqw.like(!StringUtils.isEmpty(archiveRecords.getProjectName()), ArchiveRecords::getProjectName, archiveRecords.getProjectName()) // .like(!StringUtils.isEmpty(archiveRecords.getFilingNumber()), ArchiveRecords::getFilingNumber, archiveRecords.getFilingNumber()) // .like(!StringUtils.isEmpty(archiveRecords.getArchiveRoomNumber()), ArchiveRecords::getArchiveRoomNumber, archiveRecords.getArchiveRoomNumber()) // .like(!StringUtils.isEmpty(archiveRecords.getRecordId()), ArchiveRecords::getRecordId, archiveRecords.getRecordId()); // // .like(!StringUtils.isEmpty(zfProperty.getLocation()), ZfProperty::getLocation, zfProperty.getLocation()) // .like(!StringUtils.isEmpty(zfProperty.getHolder()), ZfProperty::getHolder, zfProperty.getHolder()) // .like(!StringUtils.isEmpty(zfProperty.getAddress()), ZfProperty::getAddress, zfProperty.getAddress()) // .like(!StringUtils.isEmpty(zfProperty.getRemark()), ZfProperty::getRemark, zfProperty.getRemark()) // .eq(zfProperty.getFamilyId()!=null,ZfProperty::getFamilyId,zfProperty.getFamilyId()) // .in(ZfProperty::getFamilyId,familyIdList) // .eq(zfProperty.getHappenTime()!=null,ZfProperty::getHappenTime,zfProperty.getHappenTime()) // .between(zfProperty.getHappenStartTime() != null && zfProperty.getHappenEndTime() != null, ZfProperty::getHappenTime, zfProperty.getHappenStartTime(), zfProperty.getHappenEndTime()); // lqw.orderByDesc(ZfProperty::getCreateTime); // lqw.orderByDesc(ArchiveRecords::isOwnData); lqw.orderByDesc(ArchiveCategory::getCtime); System.out.println("ssssssssssssddd0000000000000000"); return lqw; } @Override public AjaxResult selectDataList(ArchiveCategory archiveCategory, Integer pageNum, Integer pageSize) { LambdaQueryWrapper lqw = buildCondition(archiveCategory); Page zfClanPage = new Page<>(pageNum, pageSize); Page pageResult = page(zfClanPage, lqw); List beanRecords = pageResult.getRecords();//得到查询出来的数据 // List beanRecords = list(lqw); // log.info("从数据库中查到的为:{}", beanRecords); // return markOwnData(familyId, fatherFaId, motherFaId, beanRecords); HashMap data = MapUtils.getResult(pageResult, beanRecords); return AjaxResult.success(data); } /** * 查询【请填写功能名称】 * * @param id 【请填写功能名称】主键 * @return 【请填写功能名称】 */ @Override public ArchiveCategory selectArchiveCategoryById(Long id) { LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); lqw.eq(id!=null, ArchiveCategory::getId, id); List records = list(lqw); if(!records.isEmpty()) return records.get(0); else return null; } /** * 查询【请填写功能名称】列表 * * @param archiveCategory 【请填写功能名称】 * @return 【请填写功能名称】 */ @Override public List selectArchiveCategoryList(ArchiveCategory archiveCategory) { LambdaQueryWrapper lambdaQueryWrapper = buildCondition(archiveCategory); List beanRecords = list(lambdaQueryWrapper); System.out.println(beanRecords.size()); return beanRecords; } /** * 新增【请填写功能名称】 * * @param archiveCategory 【请填写功能名称】 * @return 结果 */ @Override public int insertArchiveCategory(ArchiveCategory archiveCategory) { LocalDateTime time = LocalDateTime.now(); Date date = Date.from(time.atZone(ZoneId.systemDefault()).toInstant()); archiveCategory.setCtime(date); boolean res = this.save(archiveCategory); if(res) return 1; else return 0; } /** * 修改【请填写功能名称】 * * @param archiveCategory 【请填写功能名称】 * @return 结果 */ @Override public int updateArchiveCategory(ArchiveCategory archiveCategory) { boolean result = updateById(archiveCategory); if(result) return 1; else return 0; } /** * 批量删除【请填写功能名称】 * * @param ids 需要删除的【请填写功能名称】主键 * @return 结果 */ @Override public int deleteArchiveCategoryByIds(Long[] ids) { if (this.removeByIds(Arrays.asList(ids))) { return 1; } else return 0; } /** * 删除【请填写功能名称】信息 * * @param id 【请填写功能名称】主键 * @return 结果 */ @Override public int deleteArchiveCategoryById(Long id) { return 0; } }