update qms检测项类别分页查询

master
yinq 4 days ago
parent 91898b2d83
commit e3fabbf5dc

@ -8,6 +8,7 @@ import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.dromara.common.excel.core.DefaultExcelListener;
import org.dromara.common.excel.core.ExcelResult;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
@ -47,9 +48,8 @@ public class QcInspectionItemCategoryController extends BaseController {
*/
@SaCheckPermission("qms:qcInspectionItemCategory:list")
@GetMapping("/list")
public R<List<QcInspectionItemCategoryVo>> list(QcInspectionItemCategoryBo bo) {
List<QcInspectionItemCategoryVo> list = qcInspectionItemCategoryService.queryList(bo);
return R.ok(list);
public TableDataInfo<QcInspectionItemCategoryVo> list(QcInspectionItemCategoryBo bo, PageQuery pageQuery) {
return qcInspectionItemCategoryService.queryPageList(bo, pageQuery);
}
/**

@ -24,6 +24,7 @@ public class QcInspectionItemCategory extends TenantEntity {
/**
*
*/
@TableId(value = "category_id", type = IdType.ASSIGN_ID)
private Long categoryId;
/**

@ -1,5 +1,7 @@
package org.dromara.qms.service;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.qms.domain.QcInspectionItemCategory;
import org.dromara.qms.domain.vo.QcInspectionItemCategoryVo;
import org.dromara.qms.domain.bo.QcInspectionItemCategoryBo;
@ -32,6 +34,15 @@ public interface IQcInspectionItemCategoryService {
*/
List<QcInspectionItemCategoryVo> queryList(QcInspectionItemCategoryBo bo);
/**
*
*
* @param bo
* @param pageQuery
* @return
*/
TableDataInfo<QcInspectionItemCategoryVo> queryPageList(QcInspectionItemCategoryBo bo, PageQuery pageQuery);
/**
*
*

@ -1,5 +1,6 @@
package org.dromara.qms.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
@ -7,6 +8,8 @@ import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.qms.domain.QcInspectionType;
import org.springframework.stereotype.Service;
import org.dromara.qms.domain.bo.QcInspectionItemCategoryBo;
@ -43,6 +46,19 @@ public class QcInspectionItemCategoryServiceImpl implements IQcInspectionItemCat
return baseMapper.selectVoById(categoryId);
}
/**
*
*
* @param bo
* @param pageQuery
* @return
*/
@Override
public TableDataInfo<QcInspectionItemCategoryVo> queryPageList(QcInspectionItemCategoryBo bo, PageQuery pageQuery) {
MPJLambdaWrapper<QcInspectionItemCategory> lqw = buildQueryWrapper(bo);
Page<QcInspectionItemCategoryVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
*
@ -60,11 +76,9 @@ public class QcInspectionItemCategoryServiceImpl implements IQcInspectionItemCat
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<QcInspectionItemCategory> lqw = JoinWrappers.lambda(QcInspectionItemCategory.class)
.selectAll(QcInspectionItemCategory.class)
// 查询检测类型列表
.select(QcInspectionType::getTypeName)
.leftJoin(QcInspectionType.class, QcInspectionType::getTypeId, QcInspectionItemCategory::getTypeId)
.eq(bo.getCategoryId() != null, QcInspectionItemCategory::getCategoryId, bo.getCategoryId())
.eq(bo.getParentId() != null, QcInspectionItemCategory::getParentId, bo.getParentId())
.eq(StringUtils.isNotBlank(bo.getAncestors()), QcInspectionItemCategory::getAncestors, bo.getAncestors())
@ -72,7 +86,7 @@ public class QcInspectionItemCategoryServiceImpl implements IQcInspectionItemCat
.like(StringUtils.isNotBlank(bo.getCategoryName()), QcInspectionItemCategory::getCategoryName, bo.getCategoryName())
.eq(bo.getTypeId() != null, QcInspectionItemCategory::getTypeId, bo.getTypeId())
.eq(StringUtils.isNotBlank(bo.getDescription()), QcInspectionItemCategory::getDescription, bo.getDescription())
.orderByDesc(QcInspectionItemCategory::getCreateTime);
.orderByAsc(QcInspectionItemCategory::getCreateTime);
return lqw;
}

Loading…
Cancel
Save