Commit 244d4271 by tyfanchz

Add APIs for querying all records.

1 parent e041c7c1
...@@ -28,13 +28,25 @@ public class ProductController { ...@@ -28,13 +28,25 @@ public class ProductController {
private SmartProductService productService; private SmartProductService productService;
/** /**
* 获取产品列表。 * 分页获取产品列表。
*
* @param req 请求体
* @return 结果
*/
@RequestMapping(value = "/getPageList", method = {RequestMethod.GET, RequestMethod.POST})
public PageInfo<SmartProduct> getPageList(SmartProduct req) {
log.info("$$$$ /product/getPageList param: {}", JSON.toJSONString(req));
return productService.getPageList(req);
}
/**
* 获取产品列表,不分页。
* *
* @param req 请求体 * @param req 请求体
* @return 结果 * @return 结果
*/ */
@RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST}) @RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST})
public PageInfo<SmartProduct> getList(SmartProduct req) { public List<SmartProduct> getList(SmartProduct req) {
log.info("$$$$ /product/getList param: {}", JSON.toJSONString(req)); log.info("$$$$ /product/getList param: {}", JSON.toJSONString(req));
return productService.getList(req); return productService.getList(req);
} }
......
...@@ -28,13 +28,25 @@ public class ProductTypeController { ...@@ -28,13 +28,25 @@ public class ProductTypeController {
private SmartProductTypeService productTypeService; private SmartProductTypeService productTypeService;
/** /**
* 获取产品类型列表。 * 分页获取产品类型列表。
*
* @param req 请求
* @return 结果
*/
@RequestMapping(value = "/getPageList", method = {RequestMethod.GET, RequestMethod.POST})
public PageInfo<SmartProductType> getPageList(SmartProductType req) {
log.info("$$$$ /productType/getPageList param: {}", JSON.toJSONString(req));
return productTypeService.getPageList(req);
}
/**
* 获取产品类型列表,不分页。
* *
* @param req 请求 * @param req 请求
* @return 结果 * @return 结果
*/ */
@RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST}) @RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST})
public PageInfo<SmartProductType> getList(SmartProductType req) { public List<SmartProductType> getList(SmartProductType req) {
log.info("$$$$ /productType/getList param: {}", JSON.toJSONString(req)); log.info("$$$$ /productType/getList param: {}", JSON.toJSONString(req));
return productTypeService.getList(req); return productTypeService.getList(req);
} }
......
...@@ -14,7 +14,9 @@ import com.glsx.smart.dao.entity.SmartProduct; ...@@ -14,7 +14,9 @@ import com.glsx.smart.dao.entity.SmartProduct;
*/ */
public interface SmartProductService { public interface SmartProductService {
PageInfo<SmartProduct> getList(SmartProduct product); PageInfo<SmartProduct> getPageList(SmartProduct product);
List<SmartProduct> getList(SmartProduct product);
SmartProduct getById(Long id); SmartProduct getById(Long id);
......
...@@ -14,7 +14,9 @@ import com.glsx.smart.dao.entity.SmartProductType; ...@@ -14,7 +14,9 @@ import com.glsx.smart.dao.entity.SmartProductType;
*/ */
public interface SmartProductTypeService { public interface SmartProductTypeService {
PageInfo<SmartProductType> getList(SmartProductType productType); PageInfo<SmartProductType> getPageList(SmartProductType productType);
List<SmartProductType> getList(SmartProductType productType);
SmartProductType getById(Long id); SmartProductType getById(Long id);
......
...@@ -41,11 +41,15 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct ...@@ -41,11 +41,15 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct
* @return 结果 * @return 结果
*/ */
@Override @Override
public PageInfo<SmartProduct> getList(SmartProduct product) { public PageInfo<SmartProduct> getPageList(SmartProduct product) {
super.startPagination(product); super.startPagination(product);
return PageInfo.of(this.getList(product));
}
@Override
public List<SmartProduct> getList(SmartProduct product) {
List<SmartProduct> productList = productMapper.getList(product); List<SmartProduct> productList = productMapper.getList(product);
PageInfo<SmartProduct> pageInfo = PageInfo.of(productList); return productList;
return pageInfo;
} }
/** /**
......
...@@ -34,17 +34,27 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro ...@@ -34,17 +34,27 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro
private SmartProductTypeMapper productTypeMapper; private SmartProductTypeMapper productTypeMapper;
/** /**
* 获取产品类型列表。 * 分页获取产品类型列表。
* *
* @param productType 请求 * @param productType 请求
* @return 结果 * @return 结果
*/ */
@Override @Override
public PageInfo<SmartProductType> getList(SmartProductType productType) { public PageInfo<SmartProductType> getPageList(SmartProductType productType) {
super.startPagination(productType); super.startPagination(productType);
return PageInfo.of(this.getList(productType));
}
/**
* 获取产品类型列表,不分页。
*
* @param productType 请求
* @return 结果
*/
@Override
public List<SmartProductType> getList(SmartProductType productType) {
List<SmartProductType> productTypeList = productTypeMapper.getList(productType); List<SmartProductType> productTypeList = productTypeMapper.getList(productType);
PageInfo<SmartProductType> pageInfo = PageInfo.of(productTypeList); return productTypeList;
return pageInfo;
} }
/** /**
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!