yanyang #2
@ -1,8 +1,14 @@
|
|||||||
package com.cnbm.basic.mapper;
|
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.common.dao.BaseDao;
|
||||||
import com.cnbm.basic.entity.ProductType;
|
import com.cnbm.basic.entity.ProductType;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
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
|
@Mapper
|
||||||
public interface ProductTypeMapper extends BaseDao<ProductType> {
|
public interface ProductTypeMapper extends BaseDao<ProductType> {
|
||||||
|
IPage<ProductTypeDTO> page(Page<Object> objectPage, @Param("param") Map<String, Object> params);
|
||||||
}
|
}
|
@ -1,9 +1,12 @@
|
|||||||
package com.cnbm.basic.service;
|
package com.cnbm.basic.service;
|
||||||
|
|
||||||
|
import com.cnbm.common.page.PageData;
|
||||||
import com.cnbm.common.service.CrudService;
|
import com.cnbm.common.service.CrudService;
|
||||||
import com.cnbm.basic.dto.ProductTypeDTO;
|
import com.cnbm.basic.dto.ProductTypeDTO;
|
||||||
import com.cnbm.basic.entity.ProductType;
|
import com.cnbm.basic.entity.ProductType;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 产品类型 表
|
* 产品类型 表
|
||||||
*
|
*
|
||||||
@ -11,5 +14,5 @@ import com.cnbm.basic.entity.ProductType;
|
|||||||
* @since 2022-06-30
|
* @since 2022-06-30
|
||||||
*/
|
*/
|
||||||
public interface IProductTypeService extends CrudService<ProductType, ProductTypeDTO> {
|
public interface IProductTypeService extends CrudService<ProductType, ProductTypeDTO> {
|
||||||
|
PageData<ProductTypeDTO> page (Map<String, Object> params);
|
||||||
}
|
}
|
@ -1,12 +1,16 @@
|
|||||||
package com.cnbm.basic.service.impl;
|
package com.cnbm.basic.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
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.common.service.impl.CrudServiceImpl;
|
||||||
import com.cnbm.basic.dto.ProductTypeDTO;
|
import com.cnbm.basic.dto.ProductTypeDTO;
|
||||||
import com.cnbm.basic.entity.ProductType;
|
import com.cnbm.basic.entity.ProductType;
|
||||||
import com.cnbm.basic.mapper.ProductTypeMapper;
|
import com.cnbm.basic.mapper.ProductTypeMapper;
|
||||||
import com.cnbm.basic.service.IProductTypeService;
|
import com.cnbm.basic.service.IProductTypeService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -20,6 +24,10 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
public class ProductTypeServiceImpl extends CrudServiceImpl<ProductTypeMapper, ProductType, ProductTypeDTO> implements IProductTypeService {
|
public class ProductTypeServiceImpl extends CrudServiceImpl<ProductTypeMapper, ProductType, ProductTypeDTO> implements IProductTypeService {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProductTypeMapper productTypeMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryWrapper<ProductType> getWrapper(Map<String, Object> params){
|
public QueryWrapper<ProductType> getWrapper(Map<String, Object> params){
|
||||||
String id = (String)params.get("id");
|
String id = (String)params.get("id");
|
||||||
@ -30,5 +38,13 @@ public class ProductTypeServiceImpl extends CrudServiceImpl<ProductTypeMapper, P
|
|||||||
return wrapper;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
12
ym-baisc/src/main/resources/ProductTypeMapper.xml
Normal file
12
ym-baisc/src/main/resources/ProductTypeMapper.xml
Normal 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>
|
Loading…
Reference in New Issue
Block a user