dev798
parent
2d2b0541ff
commit
1f6c718fed
|
@ -12,6 +12,7 @@ import com.muyu.product.domain.Resp.ProductResp;
|
||||||
import com.muyu.product.domain.req.ProductReq;
|
import com.muyu.product.domain.req.ProductReq;
|
||||||
import com.muyu.product.domain.req.QueryProductReq;
|
import com.muyu.product.domain.req.QueryProductReq;
|
||||||
import com.muyu.common.core.domain.R;
|
import com.muyu.common.core.domain.R;
|
||||||
|
import com.muyu.product.domain.vo.ProductVo;
|
||||||
import com.muyu.product.service.ProductService;
|
import com.muyu.product.service.ProductService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
@ -96,4 +97,11 @@ public class ProductController {
|
||||||
}
|
}
|
||||||
return error("上传图片异常,请联系管理员");
|
return error("上传图片异常,请联系管理员");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("测试商品信息")
|
||||||
|
@GetMapping("/queryProductDetails/{id}")
|
||||||
|
public R<ProductVo> queryProductDetails(@PathVariable Integer id){
|
||||||
|
ProductVo productVo = productService.queryProductDetails(id);
|
||||||
|
return R.ok(productVo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.product.mapper;
|
||||||
import com.muyu.product.domain.DTO.Product;
|
import com.muyu.product.domain.DTO.Product;
|
||||||
import com.muyu.product.domain.Resp.ProductResp;
|
import com.muyu.product.domain.Resp.ProductResp;
|
||||||
import com.muyu.product.domain.req.QueryProductReq;
|
import com.muyu.product.domain.req.QueryProductReq;
|
||||||
|
import com.muyu.product.domain.vo.ProductVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -22,4 +23,6 @@ public interface ProductMapper {
|
||||||
|
|
||||||
|
|
||||||
Integer deleteProduct(Integer id);
|
Integer deleteProduct(Integer id);
|
||||||
|
|
||||||
|
ProductVo queryProductDetails(Integer id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.muyu.product.domain.DTO.ProductSkuAttr;
|
||||||
import com.muyu.product.domain.Resp.ProductResp;
|
import com.muyu.product.domain.Resp.ProductResp;
|
||||||
import com.muyu.product.domain.req.ProductReq;
|
import com.muyu.product.domain.req.ProductReq;
|
||||||
import com.muyu.product.domain.req.QueryProductReq;
|
import com.muyu.product.domain.req.QueryProductReq;
|
||||||
|
import com.muyu.product.domain.vo.ProductVo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: wangxinyuan
|
* @Author: wangxinyuan
|
||||||
|
@ -21,4 +22,6 @@ public interface ProductService {
|
||||||
Integer deleteProduct(Integer id);
|
Integer deleteProduct(Integer id);
|
||||||
|
|
||||||
void productUpdate(ProductReq productReq);
|
void productUpdate(ProductReq productReq);
|
||||||
|
|
||||||
|
ProductVo queryProductDetails(Integer id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import com.muyu.product.domain.Resp.ProductResp;
|
||||||
import com.muyu.product.domain.req.ProductReq;
|
import com.muyu.product.domain.req.ProductReq;
|
||||||
import com.muyu.product.domain.req.ProductSkuNew;
|
import com.muyu.product.domain.req.ProductSkuNew;
|
||||||
import com.muyu.product.domain.req.QueryProductReq;
|
import com.muyu.product.domain.req.QueryProductReq;
|
||||||
|
import com.muyu.product.domain.vo.ProductVo;
|
||||||
import com.muyu.product.mapper.ProductMapper;
|
import com.muyu.product.mapper.ProductMapper;
|
||||||
import com.muyu.product.mapper.ProductSkuMapper;
|
import com.muyu.product.mapper.ProductSkuMapper;
|
||||||
import com.muyu.product.mapper.PromotionMapper;
|
import com.muyu.product.mapper.PromotionMapper;
|
||||||
|
@ -149,6 +150,11 @@ public class ProductServiceImpl implements ProductService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ProductVo queryProductDetails(Integer id) {
|
||||||
|
return productMapper.queryProductDetails(id);
|
||||||
|
}
|
||||||
|
|
||||||
private void insertProductSku(ProductReq productReq) {
|
private void insertProductSku(ProductReq productReq) {
|
||||||
List<ProductSku> productSkuList = productReq.getProductSkus();
|
List<ProductSku> productSkuList = productReq.getProductSkus();
|
||||||
String createBy = SecurityUtils.getUsername();
|
String createBy = SecurityUtils.getUsername();
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
product_recommended,details_title,details_information,details_key_word,details_remark,
|
product_recommended,details_title,details_information,details_key_word,details_remark,
|
||||||
method_type,t_product_brand.brand_name,t_product_type.type_name,sale_price,images_url,sales
|
method_type,t_product_brand.brand_name,t_product_type.type_name,sale_price,images_url,sales
|
||||||
</sql>
|
</sql>
|
||||||
<insert id="insertProduct">
|
<insert id="insertProduct" useGeneratedKeys="true" keyProperty="id">
|
||||||
INSERT INTO `t_product` (
|
INSERT INTO `t_product` (
|
||||||
`product_name`,
|
`product_name`,
|
||||||
`product_number`,
|
`product_number`,
|
||||||
|
@ -112,6 +112,34 @@
|
||||||
select count(id) from t_product where id_delete = 1 and product_number = #{productNumber}
|
select count(id) from t_product where id_delete = 1 and product_number = #{productNumber}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="queryProductDetails" resultType="com.muyu.product.domain.vo.ProductVo">
|
||||||
|
SELECT
|
||||||
|
p.id,
|
||||||
|
product_name,
|
||||||
|
p.product_information,
|
||||||
|
details_title,
|
||||||
|
details_information,
|
||||||
|
brand_name,
|
||||||
|
sale_price,
|
||||||
|
promotion_price,
|
||||||
|
images_url,
|
||||||
|
GROUP_CONCAT( service_name ) service_name ,
|
||||||
|
type_name
|
||||||
|
FROM
|
||||||
|
t_product p
|
||||||
|
LEFT JOIN t_product_brand pb ON p.brand_id = pb.id
|
||||||
|
LEFT JOIN t_product_category pc ON p.category_id = pc.id
|
||||||
|
LEFT JOIN t_product_images pi ON pi.product_id =p.id
|
||||||
|
LEFT JOIN t_product_service_middle psm ON p.id = psm.product_id
|
||||||
|
LEFT JOIN t_product_service psr ON psm.service_id = psr.id
|
||||||
|
LEFT JOIN t_product_sku ps ON ps.product_id = p.id
|
||||||
|
LEFT JOIN t_product_sku_attr psa ON psa.sku_id = ps.id
|
||||||
|
LEFT JOIN t_product_type pt ON pt.id = p.type_id
|
||||||
|
where p.id = #{id}
|
||||||
|
GROUP BY
|
||||||
|
p.id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<!-- 添加其他操作方法如插入、更新、删除等 -->
|
<!-- 添加其他操作方法如插入、更新、删除等 -->
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,7 @@
|
||||||
|
|
||||||
|
|
||||||
<insert id="insertProductService">
|
<insert id="insertProductService">
|
||||||
insert into t_product_service_middle(product_id, service_id)
|
insert into t_product_service_middle(product_id, service_id) values (1, 2);
|
||||||
values
|
|
||||||
<foreach collection="serviceIds" item="serviceId" separator=",">
|
|
||||||
(#{id}, #{serviceId})
|
|
||||||
</foreach>
|
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue