🎨 产品信息编辑功能

This commit is contained in:
ronger 2024-02-16 14:23:03 +08:00
parent 96e36b8989
commit 2061074571
4 changed files with 15 additions and 5 deletions

View File

@ -38,5 +38,5 @@ public interface ProductMapper extends Mapper<Product> {
* @param type * @param type
* @return * @return
*/ */
ProductDTO selectProductDTOById(@Param("idProduct") Integer idProduct, @Param("type") Integer type); ProductDTO selectProductDTOById(@Param("idProduct") Long idProduct, @Param("type") Integer type);
} }

View File

@ -28,5 +28,5 @@ public interface ProductService extends Service<Product> {
* @param type * @param type
* @return * @return
*/ */
ProductDTO findProductDTOById(Integer idProduct, Integer type); ProductDTO findProductDTOById(Long idProduct, Integer type);
} }

View File

@ -29,7 +29,7 @@ public class ProductServiceImpl extends AbstractService<Product> implements Prod
} }
@Override @Override
public ProductDTO findProductDTOById(Integer idProduct, Integer type) { public ProductDTO findProductDTOById(Long idProduct, Integer type) {
return productMapper.selectProductDTOById(idProduct, type); return productMapper.selectProductDTOById(idProduct, type);
} }
} }

View File

@ -1,8 +1,10 @@
package com.rymcu.forest.web.api.product; package com.rymcu.forest.web.api.product;
import com.rymcu.forest.core.result.GlobalResult;
import com.rymcu.forest.core.result.GlobalResultGenerator;
import com.rymcu.forest.dto.ProductDTO;
import com.rymcu.forest.service.ProductService; import com.rymcu.forest.service.ProductService;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -20,4 +22,12 @@ public class ProductController {
@Resource @Resource
private ProductService productService; private ProductService productService;
@GetMapping("/detail/{idProduct}")
public GlobalResult<ProductDTO> detail(@PathVariable Long idProduct, @RequestParam(defaultValue = "2") Integer type) {
ProductDTO dto = productService.findProductDTOById(idProduct, type);
return GlobalResultGenerator.genSuccessResult(dto);
}
} }