Commit d06cc956 by 黄超华

商品列表和商品搜索接口开发

1 parent 0eab144a
......@@ -30,7 +30,7 @@ public interface ShopmallGoodsApiService {
* @return
*/
@GetMapping(value = "/queryGoodsListByCondition")
public QueryGoodsListByConditionResponse queryGoodsListByCondition(@SpringQueryMap QueryGoodsListByConditionRequest req);
public Pages<GoodsSkuListSearchItem> queryGoodsListByCondition(@SpringQueryMap QueryGoodsListByConditionRequest req);
/**
* 获取商品详情信息接口
......
package cn.com.glsx.admin.modules.model.cloudcrane.request;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
public class QueryGoodsListByConditionRequest extends AbstractCloudCraneRequest {
@NotNull
private Integer pageNum;
@NotNull
private Integer pageSize;
private String goodsSkuCode;
private String goodsSkuName;
......
package cn.com.glsx.admin.modules.model.cloudcrane.response;
import lombok.Data;
/**
* @author huangch
* @version V1.0
* @Title: GoodsSkuListSearchItem
* @Description:
* @Company: Didihu.com.cn
* @Date 2023/4/10 17:08
*/
@Data
public class GoodsSkuListSearchItem extends GoodsSkuListItem {
private String imgUrl;
private Integer stockStatus;
private Double marketPrice;
}
......@@ -48,6 +48,10 @@
<artifactId>rpc-scrm-proxy-api</artifactId>
<version>3.7.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
</dependencies>
<build>
......
......@@ -11,10 +11,12 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.List;
@Slf4j
......@@ -30,13 +32,14 @@ public class GoodsApiController implements ShopmallGoodsApiService {
@Operation(summary = "获取商品信息列表接口", description = "分页查询获取云中鹤平台商城商品信息列表")
@Override
@PostMapping("/queryGoodsList")
public Pages<GoodsSkuListItem> queryGoodsList(QueryGoodsListRequest req) {
public Pages<GoodsSkuListItem> queryGoodsList(@Valid QueryGoodsListRequest req) {
return goodsService.queryGoodsList(req);
}
@Operation(summary = "检索商品信息列表接口", description = "分页按照条件检索查询获取云中鹤平台商城商品信息列表")
@Override
public QueryGoodsListByConditionResponse queryGoodsListByCondition(QueryGoodsListByConditionRequest req) {
@PostMapping(value = "/queryGoodsListByCondition")
public Pages<GoodsSkuListSearchItem> queryGoodsListByCondition(@Valid QueryGoodsListByConditionRequest req) {
return goodsService.queryGoodsListByCondition(req);
}
......
package cn.com.glsx.admin.modules.mapper;
import cn.com.glsx.admin.modules.entity.Goods;
import cn.com.glsx.admin.modules.model.cloudcrane.request.QueryGoodsListByConditionRequest;
import cn.com.glsx.admin.modules.model.cloudcrane.response.GoodsSkuListItem;
import cn.com.glsx.admin.modules.model.cloudcrane.response.GoodsSkuListSearchItem;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.w3c.dom.stylesheets.LinkStyle;
......@@ -12,4 +14,6 @@ import java.util.List;
public interface GoodsMapper extends CommonBaseMapper<Goods> {
List<GoodsSkuListItem> queryGoodsList();
List<GoodsSkuListSearchItem> queryGoodsListByCondition(QueryGoodsListByConditionRequest req);
}
\ No newline at end of file
......@@ -26,11 +26,15 @@ public class GoodsService {
public Pages<GoodsSkuListItem> queryGoodsList(QueryGoodsListRequest req) {
Page<GoodsSkuListItem> pages = PageHelper.startPage(req.getPageNum(), req.getPageSize());
goodsMapper.queryGoodsList();
// cloudCraneService.queryGoodsList(req);
return new Pages(pages);
}
public QueryGoodsListByConditionResponse queryGoodsListByCondition(QueryGoodsListByConditionRequest req) {
return cloudCraneService.queryGoodsListByCondition(req);
public Pages<GoodsSkuListSearchItem> queryGoodsListByCondition(QueryGoodsListByConditionRequest req) {
Page<GoodsSkuListSearchItem> pages = PageHelper.startPage(req.getPageNum(), req.getPageSize());
goodsMapper.queryGoodsListByCondition(req);
// cloudCraneService.queryGoodsListByCondition(req);
return new Pages(pages);
}
public List<QueryGoodsDetailResponse> queryGoodsDetail(List<String> goodsSkuCodes) {
......
......@@ -56,12 +56,12 @@
<!--
WARNING - @mbg.generated
-->
id, goods_code, goods_sku_code, goods_sku_name, goods_sku_title, sell_price, market_price,
start_qty, shelves_status, tax_code, tax_rate, bar_code, is_deleted, brand_code,
brand_name, first_category_code, first_category_name, second_category_code, second_category_name,
last_category_code, last_category_name, return_goods_rules, goods_characteristic,
goods_unit, model_number, product_place, have_shelf_life, shelf_life, fragile_goods,
gross_weight, gross_weight_unit, density, extent, width, height, del_flag, created_date,
id, goods_code, goods_sku_code, goods_sku_name, goods_sku_title, sell_price, market_price,
start_qty, shelves_status, tax_code, tax_rate, bar_code, is_deleted, brand_code,
brand_name, first_category_code, first_category_name, second_category_code, second_category_name,
last_category_code, last_category_name, return_goods_rules, goods_characteristic,
goods_unit, model_number, product_place, have_shelf_life, shelf_life, fragile_goods,
gross_weight, gross_weight_unit, density, extent, width, height, del_flag, created_date,
created_by, updated_date, updated_by
</sql>
<sql id="Blob_Column_List">
......@@ -75,4 +75,23 @@
select sg.goods_code,sg.goods_sku_code,sg.goods_sku_name,sg.sell_price,sg.start_qty,sg.shelves_status
from shopmall_goods sg
</select>
<select id="queryGoodsListByCondition" resultType="cn.com.glsx.admin.modules.model.cloudcrane.response.GoodsSkuListSearchItem">
select sg.goods_code,sg.goods_sku_code,sg.goods_sku_name,sgi.img_url,sgs.stock_status,sg.sell_price,sg.market_price,sg.start_qty,sg.shelves_status
from shopmall_goods sg
left join shopmall_goods_image sgi on sg.goods_sku_code = sgi.goods_sku_code and img_main=1
left join shopmall_goods_stock sgs on sg.goods_sku_code = sgs.goods_sku_code
left join shopmall_goods_sale_limit sgsl on sg.goods_sku_code = sgsl.goods_sku_code
where sg.goods_sku_code = ''
and sg.goods_sku_name like concat('%','','%')
and sg.brand_code = ''
and sg.last_category_code = ''
and sg.sell_price &gt;= 0
and sg.sell_price &lt; 1
and sg.shelves_status = 1
and sgs.stock_status = 1001
and find_in_set('',sgsl.province_ids)
and find_in_set('',sgsl.city_ids)
and find_in_set('',sgsl.area_ids)
</select>
</mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!