package cn.gistack.sm.sjztmd.wrapper;
|
|
import cn.gistack.sm.sjztmd.entity.AttResBase;
|
import cn.gistack.sm.sjztmd.service.ITbResGeneralInvestigationService;
|
import cn.gistack.sm.sjztmd.vo.AttResBaseGeneralInvestigationVO;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import org.springblade.core.mp.support.BaseEntityWrapper;
|
import org.springblade.core.tool.utils.BeanUtil;
|
import org.springblade.core.tool.utils.SpringUtil;
|
|
import java.util.List;
|
import java.util.Objects;
|
|
/**
|
* @PROJECT_NAME: skjcmanager
|
* @DESCRIPTION:
|
* @USER: aix
|
* @DATE: 2024/1/3 16:00
|
*/
|
public class AttResBaseWrapper extends BaseEntityWrapper<AttResBase, AttResBaseGeneralInvestigationVO> {
|
|
private static final ITbResGeneralInvestigationService tbResGeneralInvestigationService;
|
|
static {
|
tbResGeneralInvestigationService = SpringUtil.getBean(ITbResGeneralInvestigationService.class);
|
}
|
|
public static AttResBaseWrapper build() {
|
return new AttResBaseWrapper();
|
}
|
|
@Override
|
public AttResBaseGeneralInvestigationVO entityVO(AttResBase entity) {
|
AttResBaseGeneralInvestigationVO vo = Objects.requireNonNull(BeanUtil.copy(entity, AttResBaseGeneralInvestigationVO.class));
|
return vo;
|
}
|
|
public IPage<AttResBaseGeneralInvestigationVO> pageVO(IPage<AttResBase> pages) {
|
List<AttResBaseGeneralInvestigationVO> records = listVO(pages.getRecords());
|
|
for (AttResBaseGeneralInvestigationVO vo:records) {
|
QueryWrapper queryWrapper = new QueryWrapper();
|
queryWrapper.eq("\"res_guid\"",vo.getGuid());
|
queryWrapper.ne("\"check_state\"", 0);
|
long tbCount = tbResGeneralInvestigationService.count(queryWrapper);
|
vo.setIsSb(tbCount > 0);
|
}
|
|
IPage<AttResBaseGeneralInvestigationVO> pageVo = new Page<>(pages.getCurrent(), pages.getSize(), pages.getTotal());
|
pageVo.setRecords(records);
|
return pageVo;
|
}
|
}
|