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.utils.MapUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.domain.ArchiveCategory;
|
import com.ruoyi.domain.ArchivePlaceName;
|
|
import com.ruoyi.service.IArchivePlaceNameService;
|
|
import org.springframework.stereotype.Service;
|
|
import com.ruoyi.mapper.ArchivePlaceNameMapper;
|
@Service
|
public class ArchivePlaceNameServiceImpl extends ServiceImpl<ArchivePlaceNameMapper, ArchivePlaceName> implements IArchivePlaceNameService {
|
private LambdaQueryWrapper<ArchivePlaceName> buildCondition(ArchivePlaceName archivePlaceName){
|
LambdaQueryWrapper<ArchivePlaceName> lqw = new LambdaQueryWrapper<>();
|
lqw.like(!StringUtils.isEmpty(archivePlaceName.getName()), ArchivePlaceName::getName, archivePlaceName.getName())
|
.like(!StringUtils.isEmpty(archivePlaceName.getNnumber()), ArchivePlaceName::getNnumber, archivePlaceName.getNnumber());
|
lqw.orderByDesc(ArchivePlaceName::getCreateTime);
|
System.out.println("ssssssssssssddd0000000000000000");
|
return lqw;
|
|
}
|
|
@Override
|
public AjaxResult selectDataList(ArchivePlaceName archivePlaceName, Integer pageNum, Integer pageSize) {
|
LambdaQueryWrapper<ArchivePlaceName> lqw = buildCondition(archivePlaceName);
|
|
|
Page<ArchivePlaceName> zfClanPage = new Page<>(pageNum, pageSize);
|
Page<ArchivePlaceName> pageResult = page(zfClanPage, lqw);
|
|
List<ArchivePlaceName> beanRecords = pageResult.getRecords();//得到查询出来的数据
|
|
|
|
// List<ArchiveRecords> beanRecords = list(lqw);
|
// log.info("从数据库中查到的为:{}", beanRecords);
|
// return markOwnData(familyId, fatherFaId, motherFaId, beanRecords);
|
HashMap<String, Object> data = MapUtils.getResult(pageResult, beanRecords);
|
|
|
return AjaxResult.success(data);
|
}
|
|
/**
|
* 查询【请填写功能名称】
|
*
|
* @param id 【请填写功能名称】主键
|
* @return 【请填写功能名称】
|
*/
|
@Override
|
public ArchivePlaceName selectArchivePlaceNameById(Long id)
|
{
|
LambdaQueryWrapper<ArchivePlaceName> lqw = new LambdaQueryWrapper<>();
|
lqw.eq(id!=null, ArchivePlaceName::getId, id);
|
List<ArchivePlaceName> records = list(lqw);
|
if(!records.isEmpty())
|
return records.get(0);
|
else
|
return null;
|
}
|
|
/**
|
* 查询【请填写功能名称】列表
|
*
|
* @param archivePlaceName 【请填写功能名称】
|
* @return 【请填写功能名称】
|
*/
|
@Override
|
public List<ArchivePlaceName> selectArchivePlaceNameList(ArchivePlaceName archivePlaceName)
|
{
|
LambdaQueryWrapper<ArchivePlaceName> lambdaQueryWrapper = buildCondition(archivePlaceName);
|
List<ArchivePlaceName> beanRecords = list(lambdaQueryWrapper);
|
System.out.println(beanRecords.size());
|
return beanRecords;
|
}
|
|
/**
|
* 新增【请填写功能名称】
|
*
|
* @param archivePlaceName 【请填写功能名称】
|
* @return 结果
|
*/
|
@Override
|
public int insertArchivePlaceName(ArchivePlaceName archivePlaceName)
|
{
|
LocalDateTime time = LocalDateTime.now();
|
|
Date date = Date.from(time.atZone(ZoneId.systemDefault()).toInstant());
|
archivePlaceName.setCreateTime(date);
|
boolean res = this.save(archivePlaceName);
|
if(res)
|
return 1;
|
else
|
return 0;
|
|
}
|
|
/**
|
* 修改【请填写功能名称】
|
*
|
* @param archivePlaceName 【请填写功能名称】
|
* @return 结果
|
*/
|
@Override
|
public int updateArchivePlaceName(ArchivePlaceName archivePlaceName)
|
{
|
boolean result = updateById(archivePlaceName);
|
if(result)
|
return 1;
|
else
|
return 0;
|
}
|
|
/**
|
* 批量删除【请填写功能名称】
|
*
|
* @param ids 需要删除的【请填写功能名称】主键
|
* @return 结果
|
*/
|
@Override
|
public int deleteArchivePlaceNameByIds(Long[] ids)
|
{
|
if (this.removeByIds(Arrays.asList(ids))) {
|
return 1;
|
}
|
else
|
return 0;
|
|
}
|
|
/**
|
* 删除【请填写功能名称】信息
|
*
|
* @param id 【请填写功能名称】主键
|
* @return 结果
|
*/
|
@Override
|
public int deleteArchivePlaceNameById(Long id)
|
{
|
return 0;
|
}
|
}
|