diff --git a/src/main/java/com/rymcu/forest/entity/Product.java b/src/main/java/com/rymcu/forest/entity/Product.java index 0686465..d6fcded 100644 --- a/src/main/java/com/rymcu/forest/entity/Product.java +++ b/src/main/java/com/rymcu/forest/entity/Product.java @@ -58,5 +58,7 @@ public class Product implements Serializable, Cloneable { @JSONField(format = "yyyy-MM-dd HH:mm:ss") private Date updatedTime; + private Integer status; + private String tags; } diff --git a/src/main/java/com/rymcu/forest/mapper/ProductMapper.java b/src/main/java/com/rymcu/forest/mapper/ProductMapper.java index 173657a..ef57bd0 100644 --- a/src/main/java/com/rymcu/forest/mapper/ProductMapper.java +++ b/src/main/java/com/rymcu/forest/mapper/ProductMapper.java @@ -17,26 +17,32 @@ public interface ProductMapper extends Mapper { /** * 保存产品详情 * - * @param idProduct - * @param productContent - * @param productContentHtml - * @return + * @param idProduct 产品主键 + * @param productContent 产品详情 markdown + * @param productContentHtml 产品详情 html + * @return 更新数量 */ Integer insertProductContent(@Param("idProduct") Integer idProduct, @Param("productContent") String productContent, @Param("productContentHtml") String productContentHtml); /** * 查询产品列表 * - * @return + * @return 产品列表 */ List selectProducts(); /** * 获取产品详情 * - * @param idProduct - * @param type - * @return + * @param idProduct 产品 ID + * @param type 获取类型 + * @return 产品信息 */ ProductDTO selectProductDTOById(@Param("idProduct") Long idProduct, @Param("type") Integer type); + + /** + * 获取在线产品 + * @return 产品信息 + */ + List selectOnlineProducts(); } diff --git a/src/main/java/com/rymcu/forest/service/ProductService.java b/src/main/java/com/rymcu/forest/service/ProductService.java index fa14811..1cf4d47 100644 --- a/src/main/java/com/rymcu/forest/service/ProductService.java +++ b/src/main/java/com/rymcu/forest/service/ProductService.java @@ -29,4 +29,10 @@ public interface ProductService extends Service { * @return */ ProductDTO findProductDTOById(Long idProduct, Integer type); + + /** + * 获取在线商品 + * @return + */ + List findOnlineProducts(); } diff --git a/src/main/java/com/rymcu/forest/service/impl/ProductServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/ProductServiceImpl.java index 35f53b5..64c8cf8 100644 --- a/src/main/java/com/rymcu/forest/service/impl/ProductServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/ProductServiceImpl.java @@ -32,4 +32,9 @@ public class ProductServiceImpl extends AbstractService implements Prod public ProductDTO findProductDTOById(Long idProduct, Integer type) { return productMapper.selectProductDTOById(idProduct, type); } + + @Override + public List findOnlineProducts() { + return productMapper.selectOnlineProducts(); + } } diff --git a/src/main/java/com/rymcu/forest/web/api/common/CommonApiController.java b/src/main/java/com/rymcu/forest/web/api/common/CommonApiController.java index 8d7c562..5a3bdd9 100644 --- a/src/main/java/com/rymcu/forest/web/api/common/CommonApiController.java +++ b/src/main/java/com/rymcu/forest/web/api/common/CommonApiController.java @@ -141,14 +141,14 @@ public class CommonApiController { @GetMapping("/products") public GlobalResult> products(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "12") Integer rows) { PageHelper.startPage(page, rows); - List list = productService.findProducts(); + List list = productService.findOnlineProducts(); PageInfo pageInfo = new PageInfo<>(list); return GlobalResultGenerator.genSuccessResult(pageInfo); } @GetMapping("/product/{id}") @VisitLogger - public GlobalResult product(@PathVariable Integer id) { + public GlobalResult product(@PathVariable Long id) { ProductDTO productDTO = productService.findProductDTOById(id, 1); return GlobalResultGenerator.genSuccessResult(productDTO); } diff --git a/src/main/java/mapper/ProductMapper.xml b/src/main/java/mapper/ProductMapper.xml index 3a8230f..2c07b6b 100644 --- a/src/main/java/mapper/ProductMapper.xml +++ b/src/main/java/mapper/ProductMapper.xml @@ -8,6 +8,8 @@ + + @@ -23,12 +25,12 @@ sysdate()) +