This commit is contained in:
于连琛 2022-07-05 09:52:58 +08:00
parent 8159ffc509
commit 0dc10a669f
4 changed files with 39 additions and 2 deletions

View File

@ -1,8 +1,14 @@
package com.cnbm.basic.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cnbm.basic.dto.ProductTypeDTO;
import com.cnbm.common.dao.BaseDao;
import com.cnbm.basic.entity.ProductType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
/**
* 产品类型
@ -12,5 +18,5 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ProductTypeMapper extends BaseDao<ProductType> {
IPage<ProductTypeDTO> page(Page<Object> objectPage, @Param("param") Map<String, Object> params);
}

View File

@ -1,9 +1,12 @@
package com.cnbm.basic.service;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.CrudService;
import com.cnbm.basic.dto.ProductTypeDTO;
import com.cnbm.basic.entity.ProductType;
import java.util.Map;
/**
* 产品类型
*
@ -11,5 +14,5 @@ import com.cnbm.basic.entity.ProductType;
* @since 2022-06-30
*/
public interface IProductTypeService extends CrudService<ProductType, ProductTypeDTO> {
PageData<ProductTypeDTO> page (Map<String, Object> params);
}

View File

@ -1,12 +1,16 @@
package com.cnbm.basic.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.basic.dto.ProductTypeDTO;
import com.cnbm.basic.entity.ProductType;
import com.cnbm.basic.mapper.ProductTypeMapper;
import com.cnbm.basic.service.IProductTypeService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
@ -20,6 +24,10 @@ import java.util.Map;
@Service
public class ProductTypeServiceImpl extends CrudServiceImpl<ProductTypeMapper, ProductType, ProductTypeDTO> implements IProductTypeService {
@Autowired
private ProductTypeMapper productTypeMapper;
@Override
public QueryWrapper<ProductType> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
@ -30,5 +38,13 @@ public class ProductTypeServiceImpl extends CrudServiceImpl<ProductTypeMapper, P
return wrapper;
}
@Override
public PageData<ProductTypeDTO> page (Map<String, Object> params){
PageData<ProductTypeDTO> data = null;
QueryWrapper<ProductTypeDTO> wrapper = new QueryWrapper<>();
wrapper.eq("id",params.get("id"));
IPage<ProductTypeDTO> page = productTypeMapper.page(new Page<>((Long) params.get("current"),(Long)params.get("size")), params);
return data;
}
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cnbm.basic.mapper.ProductTypeMapper">
<select id="page" resultType="com.cnbm.basic.dto.ProductTypeDTO">
select *
from product_type
<where>
id = #{params.get("id")}
</where>
</select>
</mapper>