产品新增描述字段

This commit is contained in:
XinanXf 2025-06-19 09:37:18 +08:00
parent 56d9969cbd
commit 5d5523e321
8 changed files with 21 additions and 9 deletions

View File

@ -34,7 +34,7 @@ public class ProductController {
}
@PostMapping("/queryList")
@ApiOperation("分页查询产品列表")
@ApiOperation("查询产品列表")
public Result<List<ProductVO>> queryList(@RequestBody ProductDTO dto){
return Result.success(productService.queryList(dto)) ;
}

View File

@ -20,7 +20,7 @@ public class SolutionController {
@PostMapping("/addContact")
@ApiOperation("提交联系信息")
public Result addContact(@Valid @RequestBody SolutionContactDTO contact){
public Result addContact(@RequestBody SolutionContactDTO contact){
solutionService.addContact(contact);
return Result.success() ;
}

View File

@ -32,6 +32,7 @@ public class ProductConvert {
productVO.setSeoKeywords(product.getSeoKeywords());
productVO.setCreateTime(product.getCreateTime());
productVO.setUpdateTime(product.getUpdateTime());
productVO.setDesc(product.getDesc());
return productVO;
}

View File

@ -70,5 +70,7 @@ public class Product {
@ApiModelProperty(value = "修改时间")
private Date updateTime;
@ApiModelProperty(value = "产品描述")
private String desc;
}

View File

@ -12,4 +12,6 @@ public interface ProductMapper extends BaseMapper<Product> {
Integer getCount(@Param("dto") ProductDTO dto);
List<Product> queryList(@Param("dto") ProductDTO dto);
Product getById(Integer id);
}

View File

@ -20,10 +20,7 @@ import com.shenghua.vo.ProductVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
@Service
@ -44,7 +41,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
@Override
public ProductVO getDetail(Integer id) {
Product product = this.getById(id);
Product product = productMapper.getById(id);
if (Objects.isNull(product)){
// 可以根据实际情况处理例如抛出异常或者返回 null
throw new RuntimeException("产品不存在");
@ -70,6 +67,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
List<String> imgs = groupedByType.getOrDefault(1, Collections.emptyList()).stream()
.map(ProductImg::getUrl)
.collect(Collectors.toList());
imgs.add(product.getCover());
productVO.setImgs(imgs);

View File

@ -83,6 +83,10 @@ public class ProductVO {
@ApiModelProperty(value = "规格参数图-详情")
private List<String> specsImgs;
@TableField("desc")
@ApiModelProperty(value = "产品描述")
private String desc;
// @ApiModelProperty(value = "通用规格")
// private ProductSpecs productSpecs;

View File

@ -18,7 +18,8 @@
p.seo_description AS seoDescription,
p.seo_keywords AS seoKeywords,
p.create_time AS createTime,
p.update_time AS updateTime
p.update_time AS updateTime,
p.desc AS `desc`
FROM product AS p
</sql>
@ -42,7 +43,11 @@
</if>
</if>
</where>
ORDER BY p.id DESC
</select>
<select id="getById" resultType="com.shenghua.entitys.product.Product">
SELECT * FROM product WHERE id = #{id};
</select>
</mapper>