Commit 67eaf2ca by 黄超华

商品详情接口

1 parent 4c908c1f
......@@ -210,9 +210,4 @@ public class Goods extends BaseEntity {
*/
private Integer height;
/**
* 商品图文详情描述信息
*/
private String goodsDescribe;
}
\ No newline at end of file
package cn.com.glsx.admin.modules.entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
@Table(name = "shopmall_goods_desc_detail")
public class GoodsDescDetail implements Serializable {
/**
* 主键
*/
@Id
private Integer id;
/**
* 商品Sku编码
*/
@Column(name = "goods_sku_code")
private String goodsSkuCode;
/**
* 是否删除 0=正常 -1=删除
*/
@Column(name = "del_flag")
private Byte delFlag;
/**
* 创建时间
*/
@Column(name = "created_date")
private Date createdDate;
/**
* 创建人用户id
*/
@Column(name = "created_by")
private Integer createdBy;
/**
* 更新时间
*/
@Column(name = "updated_date")
private Date updatedDate;
/**
* 更新人用户id
*/
@Column(name = "updated_by")
private Integer updatedBy;
/**
* 商品图文详情描述信息
*/
@Column(name = "goods_describe")
private String goodsDescribe;
private static final long serialVersionUID = 1L;
/**
* 获取主键
*
* @return id - 主键
*/
public Integer getId() {
return id;
}
/**
* 设置主键
*
* @param id 主键
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取商品Sku编码
*
* @return goods_sku_code - 商品Sku编码
*/
public String getGoodsSkuCode() {
return goodsSkuCode;
}
/**
* 设置商品Sku编码
*
* @param goodsSkuCode 商品Sku编码
*/
public void setGoodsSkuCode(String goodsSkuCode) {
this.goodsSkuCode = goodsSkuCode == null ? null : goodsSkuCode.trim();
}
/**
* 获取是否删除 0=正常 -1=删除
*
* @return del_flag - 是否删除 0=正常 -1=删除
*/
public Byte getDelFlag() {
return delFlag;
}
/**
* 设置是否删除 0=正常 -1=删除
*
* @param delFlag 是否删除 0=正常 -1=删除
*/
public void setDelFlag(Byte delFlag) {
this.delFlag = delFlag;
}
/**
* 获取创建时间
*
* @return created_date - 创建时间
*/
public Date getCreatedDate() {
return createdDate;
}
/**
* 设置创建时间
*
* @param createdDate 创建时间
*/
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
/**
* 获取创建人用户id
*
* @return created_by - 创建人用户id
*/
public Integer getCreatedBy() {
return createdBy;
}
/**
* 设置创建人用户id
*
* @param createdBy 创建人用户id
*/
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
/**
* 获取更新时间
*
* @return updated_date - 更新时间
*/
public Date getUpdatedDate() {
return updatedDate;
}
/**
* 设置更新时间
*
* @param updatedDate 更新时间
*/
public void setUpdatedDate(Date updatedDate) {
this.updatedDate = updatedDate;
}
/**
* 获取更新人用户id
*
* @return updated_by - 更新人用户id
*/
public Integer getUpdatedBy() {
return updatedBy;
}
/**
* 设置更新人用户id
*
* @param updatedBy 更新人用户id
*/
public void setUpdatedBy(Integer updatedBy) {
this.updatedBy = updatedBy;
}
/**
* 获取商品图文详情描述信息
*
* @return goods_describe - 商品图文详情描述信息
*/
public String getGoodsDescribe() {
return goodsDescribe;
}
/**
* 设置商品图文详情描述信息
*
* @param goodsDescribe 商品图文详情描述信息
*/
public void setGoodsDescribe(String goodsDescribe) {
this.goodsDescribe = goodsDescribe == null ? null : goodsDescribe.trim();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", goodsSkuCode=").append(goodsSkuCode);
sb.append(", delFlag=").append(delFlag);
sb.append(", createdDate=").append(createdDate);
sb.append(", createdBy=").append(createdBy);
sb.append(", updatedDate=").append(updatedDate);
sb.append(", updatedBy=").append(updatedBy);
sb.append(", goodsDescribe=").append(goodsDescribe);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
package cn.com.glsx.admin.modules.mapper;
import cn.com.glsx.admin.modules.entity.GoodsDescDetail;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
public interface GoodsDescDetailMapper extends CommonBaseMapper<GoodsDescDetail> {
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ 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 cn.com.glsx.admin.modules.model.cloudcrane.response.QueryGoodsDetailResponse;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
......@@ -15,4 +16,6 @@ public interface GoodsMapper extends CommonBaseMapper<Goods> {
List<GoodsSkuListItem> queryGoodsList();
List<GoodsSkuListSearchItem> queryGoodsListByCondition(QueryGoodsListByConditionRequest req);
List<QueryGoodsDetailResponse> queryGoodsDetail(List<String> goodsSkuCodes);
}
\ No newline at end of file
......@@ -4,7 +4,6 @@ import cn.com.glsx.admin.modules.converter.BaseBrandConverter;
import cn.com.glsx.admin.modules.entity.BaseBrand;
import cn.com.glsx.admin.modules.mapper.BaseBrandMapper;
import cn.com.glsx.admin.modules.model.cloudcrane.response.QueryBrandListResponse;
import com.glsx.plat.constant.CacheNameTimeConstant;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
......
......@@ -7,7 +7,6 @@ import cn.com.glsx.admin.modules.model.cloudcrane.response.QueryCategoryListResp
import cn.com.glsx.admin.modules.model.cloudcrane.response.QueryOneCategoryListResponse;
import cn.com.glsx.admin.modules.model.cloudcrane.response.QuerySecondCategoryListResponse;
import cn.com.glsx.admin.modules.model.cloudcrane.response.QueryThreeCategoryListResponse;
import com.glsx.plat.constant.CacheNameTimeConstant;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
......
......@@ -5,7 +5,6 @@ import cn.com.glsx.admin.modules.entity.BaseDistrict;
import cn.com.glsx.admin.modules.mapper.BaseDistrictMapper;
import cn.com.glsx.admin.modules.model.cloudcrane.response.*;
import cn.com.glsx.admin.modules.model.dto.BaseDistrictBO;
import com.glsx.plat.constant.CacheNameTimeConstant;
import com.glsx.plat.context.utils.validator.AssertUtils;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
......
......@@ -4,7 +4,6 @@ import cn.com.glsx.admin.modules.converter.BaseExpressConverter;
import cn.com.glsx.admin.modules.entity.BaseExpress;
import cn.com.glsx.admin.modules.mapper.BaseExpressMapper;
import cn.com.glsx.admin.modules.model.cloudcrane.response.QueryExpressListResponse;
import com.glsx.plat.constant.CacheNameTimeConstant;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
......
......@@ -4,12 +4,14 @@ import cn.com.glsx.admin.modules.mapper.GoodsMapper;
import cn.com.glsx.admin.modules.model.cloudcrane.request.QueryGoodsListByConditionRequest;
import cn.com.glsx.admin.modules.model.cloudcrane.request.QueryGoodsListRequest;
import cn.com.glsx.admin.modules.model.cloudcrane.response.*;
import cn.com.glsx.framework.core.util.RpcAssert;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import java.util.List;
......@@ -22,6 +24,13 @@ public class GoodsService {
@Autowired
private CloudCraneService cloudCraneService;
/**
* 商品列表查询
* @param req:
* @return com.github.pagehelper.PageInfo<cn.com.glsx.admin.modules.model.cloudcrane.response.GoodsSkuListItem>
* @author huangch
* @date 2023/4/11 10:12
*/
public PageInfo<GoodsSkuListItem> queryGoodsList(QueryGoodsListRequest req) {
Page<GoodsSkuListItem> pages = PageHelper.startPage(req.getPageNum(), req.getPageSize());
goodsMapper.queryGoodsList();
......@@ -29,6 +38,13 @@ public class GoodsService {
return new PageInfo(pages);
}
/**
* 商品检索
* @param req:
* @return com.github.pagehelper.PageInfo<cn.com.glsx.admin.modules.model.cloudcrane.response.GoodsSkuListSearchItem>
* @author huangch
* @date 2023/4/11 10:12
*/
public PageInfo<GoodsSkuListSearchItem> queryGoodsListByCondition(QueryGoodsListByConditionRequest req) {
Page<GoodsSkuListSearchItem> pages = PageHelper.startPage(req.getPageNum(), req.getPageSize());
goodsMapper.queryGoodsListByCondition(req);
......@@ -36,8 +52,17 @@ public class GoodsService {
return new PageInfo(pages);
}
/**
* 查询商品详情
* @param goodsSkuCodes:
* @return java.util.List<cn.com.glsx.admin.modules.model.cloudcrane.response.QueryGoodsDetailResponse>
* @author huangch
* @date 2023/4/11 10:12
*/
public List<QueryGoodsDetailResponse> queryGoodsDetail(List<String> goodsSkuCodes) {
return cloudCraneService.queryGoodsDetail(goodsSkuCodes);
Assert.notEmpty(goodsSkuCodes, "goodsSkuCodes can not be null.");
// cloudCraneService.queryGoodsDetail(goodsSkuCodes);
return goodsMapper.queryGoodsDetail(goodsSkuCodes);
}
public List<QueryGoodsImageListResponse> queryGoodsImageList(List<String> goodsSkuCodes) {
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.com.glsx.admin.modules.mapper.GoodsDescDetailMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.admin.modules.entity.GoodsDescDetail">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="goods_sku_code" jdbcType="VARCHAR" property="goodsSkuCode" />
<result column="del_flag" jdbcType="TINYINT" property="delFlag" />
<result column="created_date" jdbcType="TIMESTAMP" property="createdDate" />
<result column="created_by" jdbcType="INTEGER" property="createdBy" />
<result column="updated_date" jdbcType="TIMESTAMP" property="updatedDate" />
<result column="updated_by" jdbcType="INTEGER" property="updatedBy" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="cn.com.glsx.admin.modules.entity.GoodsDescDetail">
<!--
WARNING - @mbg.generated
-->
<result column="goods_describe" jdbcType="LONGVARCHAR" property="goodsDescribe" />
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, goods_sku_code, del_flag, created_date, created_by, updated_date, updated_by
</sql>
<sql id="Blob_Column_List">
<!--
WARNING - @mbg.generated
-->
goods_describe
</sql>
</mapper>
\ No newline at end of file
......@@ -46,12 +46,6 @@
<result column="updated_date" jdbcType="TIMESTAMP" property="updatedDate" />
<result column="updated_by" jdbcType="INTEGER" property="updatedBy" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="cn.com.glsx.admin.modules.entity.Goods">
<!--
WARNING - @mbg.generated
-->
<result column="goods_describe" jdbcType="LONGVARCHAR" property="goodsDescribe" />
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
......@@ -71,6 +65,22 @@
goods_describe
</sql>
<resultMap id="GoodsDetailMap" extends="BaseResultMap" type="cn.com.glsx.admin.modules.model.cloudcrane.response.QueryGoodsDetailResponse">
<association property="descDetail" javaType="cn.com.glsx.admin.modules.model.cloudcrane.response.GoodsDescDetailModel">
<result column="goods_describe" jdbcType="VARCHAR" property="goodsDescribe"/>
</association>
<collection property="specList" javaType="cn.com.glsx.admin.modules.model.cloudcrane.response.GoodsSpecListItem">
<result column="spec_name" jdbcType="VARCHAR" property="specName" />
<result column="spec_value" jdbcType="VARCHAR" property="specValue" />
</collection>
<collection property="attributeList" javaType="cn.com.glsx.admin.modules.model.cloudcrane.response.GoodsAttributeListItem">
<result column="attribute_code" jdbcType="VARCHAR" property="attributeCode" />
<result column="attribute_name" jdbcType="VARCHAR" property="attributeName" />
<result column="attribute_value_code" jdbcType="VARCHAR" property="attributeValueCode" />
<result column="attribute_value_name" jdbcType="VARCHAR" property="attributeValueName" />
</collection>
</resultMap>
<select id="queryGoodsList" resultType="cn.com.glsx.admin.modules.model.cloudcrane.response.GoodsSkuListItem">
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
......@@ -82,16 +92,58 @@
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)
where sg.del_flag = 0
<if test="goodsSkuCode != null and goodsSkuCode != ''">
and sg.goods_sku_code = #{goodsSkuCode}
</if>
<if test="goodsSkuName != null and goodsSkuName != ''">
and sg.goods_sku_name like concat('%',#{goodsSkuName},'%')
</if>
<if test="brandCode != null and brandCode != ''">
and sg.brand_code = #{brandCode}
</if>
<if test="categoryCode != null and categoryCode != ''">
and sg.last_category_code = #{categoryCode}
</if>
<if test="startSellPrice != null">
and sg.sell_price &gt;= #{startSellPrice}
</if>
<if test="endSellPrice != null">
and sg.sell_price &lt; #{endSellPrice}
</if>
<if test="shelvesStatus != null">
and sg.shelves_status = #{shelvesStatus}
</if>
<if test="stockStatus != null">
and sgs.stock_status = #{stockStatus}
</if>
<if test="provinceId != null">
and find_in_set(#{provinceId}, sgsl.province_ids)
</if>
<if test="cityId != null">
and find_in_set(#{cityId}, sgsl.city_ids)
</if>
<if test="areaId != null">
and find_in_set(#{areaId}, sgsl.area_ids)
</if>
</select>
<select id="queryGoodsDetail" resultMap="GoodsDetailMap">
select sg.goods_sku_name,sg.goods_sku_title,sg.sell_price,sg.market_price,
sg.start_qty,sg.shelves_status,sg.tax_code,sg.tax_rate,sg.bar_code,sg.is_deleted,sg.brand_code,
sg.brand_code,sg.first_category_code,sg.first_category_name,sg.second_category_code,sg.second_category_name,
sg.first_category_code,sg.first_category_name,sg.return_goods_rules,sg.goods_characteristic,sg.goods_unit,
sg.model_number,sg.product_place,sg.have_shelf_life,sg.fragile_goods,sg.gross_weight,sg.gross_weight_unit,
sg.density,sg.extent,sg.width,sg.height,sgs.spec_name,sgs.spec_value,sgdd.goods_describe,
sga.attribute_code,sga.attribute_name,sga.attribute_value_code,sga.attribute_value_name
from shopmall_goods sg
left join shopmall_goods_specification sgs on sg.goods_sku_code=sgs.goods_sku_code
left join shopmall_goods_desc_detail sgdd on sg.goods_sku_code=sgdd.goods_sku_code
left join shopmall_goods_attribute sga on sg.goods_sku_code=sga.goods_sku_code
where sg.del_flag = 0
and sg.goods_sku_code in
<foreach collection="goodsSkuCodes" separator="," item="item" open="(" close=")">
#{item}
</foreach>
</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!