|
@@ -2,6 +2,8 @@ package com.ruoyi.zdsz.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.ruoyi.common.core.domain.PageQuery;
|
|
@@ -241,16 +243,29 @@ public class ZEngineeringIndustryServiceImpl implements IZEngineeringIndustrySer
|
|
|
|
|
|
@Override
|
|
|
public TableDataInfo<ZEngineeringIndustryVo> queryNameByType(ZEngineeringIndustryBo bo, PageQuery pageQuery) {
|
|
|
- LambdaQueryWrapper<ZEngineeringIndustry> lqw = buildListByType(bo);
|
|
|
- Page<ZEngineeringIndustryVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
- return TableDataInfo.build(result);
|
|
|
+ QueryWrapper<ZEngineeringIndustry> zEngineeringIndustryQueryWrapper = buildListByType(bo);
|
|
|
+
|
|
|
+ IPage<ZEngineeringIndustry> page = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize());
|
|
|
+ IPage<ZEngineeringIndustry> result = baseMapper.selectPage(page, zEngineeringIndustryQueryWrapper);
|
|
|
+
|
|
|
+ List<ZEngineeringIndustryVo> voList = result.getRecords().stream()
|
|
|
+ .map(record -> {
|
|
|
+ ZEngineeringIndustryVo vo = new ZEngineeringIndustryVo();
|
|
|
+ vo.setId(record.getId());
|
|
|
+ vo.setEnginName(record.getEnginName());
|
|
|
+ return vo;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ return new TableDataInfo<>(voList, (int)result.getTotal());
|
|
|
}
|
|
|
|
|
|
- private LambdaQueryWrapper<ZEngineeringIndustry> buildListByType(ZEngineeringIndustryBo bo) {
|
|
|
- LambdaQueryWrapper<ZEngineeringIndustry> lqw = Wrappers.lambdaQuery();
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getEnginType()), ZEngineeringIndustry::getEnginType, bo.getEnginType());
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getType()), ZEngineeringIndustry::getType, bo.getType());
|
|
|
- return lqw;
|
|
|
+ private QueryWrapper<ZEngineeringIndustry> buildListByType(ZEngineeringIndustryBo bo) {
|
|
|
+ QueryWrapper<ZEngineeringIndustry> queryWrapper = new QueryWrapper<ZEngineeringIndustry>()
|
|
|
+ .select("id", "engin_name")
|
|
|
+ .eq("engin_type", bo.getEnginType())
|
|
|
+ .eq("type", bo.getType());
|
|
|
+ return queryWrapper;
|
|
|
}
|
|
|
|
|
|
|