首页接口完成及其其他
This commit is contained in:
1 parent
a5b8ef4579
commit
35b267e744
40 files changed
+1354
-19
No files matched your search
+17
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.app.common.persistence.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.app.common.persistence.model.StoreGoodsAttr;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品关联的属性表(与商品相关) Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-09-07
|
||||
*/
|
||||
public interface StoreGoodsAttrMapper extends BaseMapper<StoreGoodsAttr> {
|
||||
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.app.common.persistence.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.app.common.persistence.model.StoreGoodsAttribute;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品的属性表(独立) Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-09-07
|
||||
*/
|
||||
public interface StoreGoodsAttributeMapper extends BaseMapper<StoreGoodsAttribute> {
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.app.common.persistence.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.app.common.persistence.model.StoreGoodsCollect;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品收藏表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-09-07
|
||||
*/
|
||||
@Mapper
|
||||
public interface StoreGoodsCollectMapper extends BaseMapper<StoreGoodsCollect> {
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.ruoyi.app.common.persistence.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.app.common.persistence.model.StoreGoods;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
/**
|
||||
@@ -12,6 +13,7 @@ import com.ruoyi.app.common.persistence.model.StoreGoods;
|
||||
* @author hupeng
|
||||
* @since 2019-09-05
|
||||
*/
|
||||
@Mapper
|
||||
public interface StoreGoodsMapper extends BaseMapper<StoreGoods> {
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.ruoyi.app.common.persistence.dao;
|
||||
|
||||
import com.ruoyi.app.common.persistence.model.StoreSpecGoodsPrice;
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品规格关联价格表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-09-07
|
||||
*/
|
||||
public interface StoreSpecGoodsPriceMapper extends BaseMapper<StoreSpecGoodsPrice> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.ruoyi.app.common.persistence.dao;
|
||||
|
||||
import com.ruoyi.app.common.persistence.model.StoreSpecItem;
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 规格项 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-09-07
|
||||
*/
|
||||
public interface StoreSpecItemMapper extends BaseMapper<StoreSpecItem> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.ruoyi.app.common.persistence.dao;
|
||||
|
||||
import com.ruoyi.app.common.persistence.model.StoreSpec;
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品规格表(独立) Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-09-07
|
||||
*/
|
||||
public interface StoreSpecMapper extends BaseMapper<StoreSpec> {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
<?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="com.ruoyi.app.common.persistence.dao.StoreGoodsAttrMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.app.common.persistence.model.StoreGoodsAttr">
|
||||
<id column="goods_attr_id" property="goodsAttrId" />
|
||||
<result column="goods_id" property="goodsId" />
|
||||
<result column="attr_id" property="attrId" />
|
||||
<result column="attr_value" property="attrValue" />
|
||||
<result column="attr_price" property="attrPrice" />
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
<?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="com.ruoyi.app.common.persistence.dao.StoreGoodsAttributeMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.app.common.persistence.model.StoreGoodsAttribute">
|
||||
<id column="attr_id" property="attrId" />
|
||||
<result column="attr_name" property="attrName" />
|
||||
<result column="type_id" property="typeId" />
|
||||
<result column="attr_index" property="attrIndex" />
|
||||
<result column="attr_type" property="attrType" />
|
||||
<result column="attr_input_type" property="attrInputType" />
|
||||
<result column="attr_values" property="attrValues" />
|
||||
<result column="sort" property="sort" />
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
<?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="com.ruoyi.app.common.persistence.dao.StoreGoodsCollectMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.app.common.persistence.model.StoreGoodsCollect">
|
||||
<id column="collect_id" property="collectId" />
|
||||
<result column="user_id" property="userId" />
|
||||
<result column="goods_id" property="goodsId" />
|
||||
<result column="add_time" property="addTime" />
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
<?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="com.ruoyi.app.common.persistence.dao.StoreSpecGoodsPriceMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.app.common.persistence.model.StoreSpecGoodsPrice">
|
||||
<id column="item_id" property="itemId" />
|
||||
<result column="goods_id" property="goodsId" />
|
||||
<result column="key" property="key" />
|
||||
<result column="key_name" property="keyName" />
|
||||
<result column="price" property="price" />
|
||||
<result column="market_price" property="marketPrice" />
|
||||
<result column="store_count" property="storeCount" />
|
||||
<result column="bar_code" property="barCode" />
|
||||
<result column="sku" property="sku" />
|
||||
<result column="spec_img" property="specImg" />
|
||||
<result column="prom_id" property="promId" />
|
||||
<result column="prom_type" property="promType" />
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?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="com.ruoyi.app.common.persistence.dao.StoreSpecItemMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.app.common.persistence.model.StoreSpecItem">
|
||||
<id column="id" property="id" />
|
||||
<result column="spec_id" property="specId" />
|
||||
<result column="item" property="item" />
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
<?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="com.ruoyi.app.common.persistence.dao.StoreSpecMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.app.common.persistence.model.StoreSpec">
|
||||
<id column="id" property="id" />
|
||||
<result column="type_id" property="typeId" />
|
||||
<result column="name" property="name" />
|
||||
<result column="sort" property="sort" />
|
||||
<result column="search_index" property="searchIndex" />
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.ruoyi.app.common.persistence.model;
|
||||
|
||||
import com.baomidou.mybatisplus.enums.IdType;
|
||||
import com.baomidou.mybatisplus.annotations.TableId;
|
||||
import com.baomidou.mybatisplus.annotations.TableField;
|
||||
import com.baomidou.mybatisplus.activerecord.Model;
|
||||
import com.baomidou.mybatisplus.annotations.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package com.ruoyi.app.common.persistence.model;
|
||||
|
||||
import com.baomidou.mybatisplus.enums.IdType;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotations.TableId;
|
||||
import com.baomidou.mybatisplus.annotations.TableField;
|
||||
import com.baomidou.mybatisplus.activerecord.Model;
|
||||
import com.baomidou.mybatisplus.annotations.TableName;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.ruoyi.app.common.persistence.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品关联的属性表(与商品相关)
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-09-07
|
||||
*/
|
||||
@TableName("store_goods_attr")
|
||||
public class StoreGoodsAttr extends Model<StoreGoodsAttr> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 商品属性id自增
|
||||
*/
|
||||
@TableId(value = "goods_attr_id", type = IdType.AUTO)
|
||||
private Integer goodsAttrId;
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
@TableField("goods_id")
|
||||
private Integer goodsId;
|
||||
/**
|
||||
* 属性id
|
||||
*/
|
||||
@TableField("attr_id")
|
||||
private Integer attrId;
|
||||
/**
|
||||
* 属性值
|
||||
*/
|
||||
@TableField("attr_value")
|
||||
private String attrValue;
|
||||
/**
|
||||
* 属性价格
|
||||
*/
|
||||
@TableField("attr_price")
|
||||
private String attrPrice;
|
||||
|
||||
|
||||
public Integer getGoodsAttrId() {
|
||||
return goodsAttrId;
|
||||
}
|
||||
|
||||
public void setGoodsAttrId(Integer goodsAttrId) {
|
||||
this.goodsAttrId = goodsAttrId;
|
||||
}
|
||||
|
||||
public Integer getGoodsId() {
|
||||
return goodsId;
|
||||
}
|
||||
|
||||
public void setGoodsId(Integer goodsId) {
|
||||
this.goodsId = goodsId;
|
||||
}
|
||||
|
||||
public Integer getAttrId() {
|
||||
return attrId;
|
||||
}
|
||||
|
||||
public void setAttrId(Integer attrId) {
|
||||
this.attrId = attrId;
|
||||
}
|
||||
|
||||
public String getAttrValue() {
|
||||
return attrValue;
|
||||
}
|
||||
|
||||
public void setAttrValue(String attrValue) {
|
||||
this.attrValue = attrValue;
|
||||
}
|
||||
|
||||
public String getAttrPrice() {
|
||||
return attrPrice;
|
||||
}
|
||||
|
||||
public void setAttrPrice(String attrPrice) {
|
||||
this.attrPrice = attrPrice;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.goodsAttrId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StoreGoodsAttr{" +
|
||||
", goodsAttrId=" + goodsAttrId +
|
||||
", goodsId=" + goodsId +
|
||||
", attrId=" + attrId +
|
||||
", attrValue=" + attrValue +
|
||||
", attrPrice=" + attrPrice +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
package com.ruoyi.app.common.persistence.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品的属性表(独立)
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-09-07
|
||||
*/
|
||||
@TableName("store_goods_attribute")
|
||||
public class StoreGoodsAttribute extends Model<StoreGoodsAttribute> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 属性id
|
||||
*/
|
||||
@TableId(value = "attr_id", type = IdType.AUTO)
|
||||
private Integer attrId;
|
||||
/**
|
||||
* 属性名称
|
||||
*/
|
||||
@TableField("attr_name")
|
||||
private String attrName;
|
||||
/**
|
||||
* 属性分类id(商品模型id)
|
||||
*/
|
||||
@TableField("type_id")
|
||||
private Integer typeId;
|
||||
/**
|
||||
* 0不需要检索 1关键字检索 2范围检索
|
||||
*/
|
||||
@TableField("attr_index")
|
||||
private Integer attrIndex;
|
||||
/**
|
||||
* 0唯一属性 1单选属性 2复选属性
|
||||
*/
|
||||
@TableField("attr_type")
|
||||
private Integer attrType;
|
||||
/**
|
||||
* 0 手工录入 1从列表中选择 2多行文本框
|
||||
*/
|
||||
@TableField("attr_input_type")
|
||||
private Integer attrInputType;
|
||||
/**
|
||||
* 可选值列表
|
||||
*/
|
||||
@TableField("attr_values")
|
||||
private String attrValues;
|
||||
/**
|
||||
* 属性排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
|
||||
public Integer getAttrId() {
|
||||
return attrId;
|
||||
}
|
||||
|
||||
public void setAttrId(Integer attrId) {
|
||||
this.attrId = attrId;
|
||||
}
|
||||
|
||||
public String getAttrName() {
|
||||
return attrName;
|
||||
}
|
||||
|
||||
public void setAttrName(String attrName) {
|
||||
this.attrName = attrName;
|
||||
}
|
||||
|
||||
public Integer getTypeId() {
|
||||
return typeId;
|
||||
}
|
||||
|
||||
public void setTypeId(Integer typeId) {
|
||||
this.typeId = typeId;
|
||||
}
|
||||
|
||||
public Integer getAttrIndex() {
|
||||
return attrIndex;
|
||||
}
|
||||
|
||||
public void setAttrIndex(Integer attrIndex) {
|
||||
this.attrIndex = attrIndex;
|
||||
}
|
||||
|
||||
public Integer getAttrType() {
|
||||
return attrType;
|
||||
}
|
||||
|
||||
public void setAttrType(Integer attrType) {
|
||||
this.attrType = attrType;
|
||||
}
|
||||
|
||||
public Integer getAttrInputType() {
|
||||
return attrInputType;
|
||||
}
|
||||
|
||||
public void setAttrInputType(Integer attrInputType) {
|
||||
this.attrInputType = attrInputType;
|
||||
}
|
||||
|
||||
public String getAttrValues() {
|
||||
return attrValues;
|
||||
}
|
||||
|
||||
public void setAttrValues(String attrValues) {
|
||||
this.attrValues = attrValues;
|
||||
}
|
||||
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public void setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.attrId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StoreGoodsAttribute{" +
|
||||
", attrId=" + attrId +
|
||||
", attrName=" + attrName +
|
||||
", typeId=" + typeId +
|
||||
", attrIndex=" + attrIndex +
|
||||
", attrType=" + attrType +
|
||||
", attrInputType=" + attrInputType +
|
||||
", attrValues=" + attrValues +
|
||||
", sort=" + sort +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.ruoyi.app.common.persistence.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品收藏表
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-09-07
|
||||
*/
|
||||
@TableName("store_goods_collect")
|
||||
public class StoreGoodsCollect extends Model<StoreGoodsCollect> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 表id
|
||||
*/
|
||||
@TableId(value = "collect_id", type = IdType.AUTO)
|
||||
private Integer collectId;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableField("user_id")
|
||||
private Integer userId;
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
@TableField("goods_id")
|
||||
private Integer goodsId;
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
@TableField("add_time")
|
||||
private Integer addTime;
|
||||
|
||||
|
||||
public Integer getCollectId() {
|
||||
return collectId;
|
||||
}
|
||||
|
||||
public void setCollectId(Integer collectId) {
|
||||
this.collectId = collectId;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Integer getGoodsId() {
|
||||
return goodsId;
|
||||
}
|
||||
|
||||
public void setGoodsId(Integer goodsId) {
|
||||
this.goodsId = goodsId;
|
||||
}
|
||||
|
||||
public Integer getAddTime() {
|
||||
return addTime;
|
||||
}
|
||||
|
||||
public void setAddTime(Integer addTime) {
|
||||
this.addTime = addTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.collectId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StoreGoodsCollect{" +
|
||||
", collectId=" + collectId +
|
||||
", userId=" + userId +
|
||||
", goodsId=" + goodsId +
|
||||
", addTime=" + addTime +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.ruoyi.app.common.persistence.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品规格表(独立)
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-09-07
|
||||
*/
|
||||
@TableName("store_spec")
|
||||
public class StoreSpec extends Model<StoreSpec> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 规格表
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
/**
|
||||
* 规格类型
|
||||
*/
|
||||
@TableField("type_id")
|
||||
private Integer typeId;
|
||||
/**
|
||||
* 规格名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 是否需要检索:1是,0否
|
||||
*/
|
||||
@TableField("search_index")
|
||||
private Integer searchIndex;
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getTypeId() {
|
||||
return typeId;
|
||||
}
|
||||
|
||||
public void setTypeId(Integer typeId) {
|
||||
this.typeId = typeId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public void setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public Integer getSearchIndex() {
|
||||
return searchIndex;
|
||||
}
|
||||
|
||||
public void setSearchIndex(Integer searchIndex) {
|
||||
this.searchIndex = searchIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StoreSpec{" +
|
||||
", id=" + id +
|
||||
", typeId=" + typeId +
|
||||
", name=" + name +
|
||||
", sort=" + sort +
|
||||
", searchIndex=" + searchIndex +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
+202
@@ -0,0 +1,202 @@
|
||||
package com.ruoyi.app.common.persistence.model;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品规格关联价格表
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-09-07
|
||||
*/
|
||||
@TableName("store_spec_goods_price")
|
||||
public class StoreSpecGoodsPrice extends Model<StoreSpecGoodsPrice> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 规格商品id
|
||||
*/
|
||||
@TableId(value = "item_id", type = IdType.AUTO)
|
||||
private Long itemId;
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
@TableField("goods_id")
|
||||
private Integer goodsId;
|
||||
/**
|
||||
* 规格键名
|
||||
*/
|
||||
private String key;
|
||||
/**
|
||||
* 规格键名中文
|
||||
*/
|
||||
@TableField("key_name")
|
||||
private String keyName;
|
||||
/**
|
||||
* 价格(供货价格)
|
||||
*/
|
||||
private BigDecimal price;
|
||||
/**
|
||||
* 零售价格
|
||||
*/
|
||||
@TableField("market_price")
|
||||
private Double marketPrice;
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
@TableField("store_count")
|
||||
private Integer storeCount;
|
||||
/**
|
||||
* 商品条形码
|
||||
*/
|
||||
@TableField("bar_code")
|
||||
private String barCode;
|
||||
/**
|
||||
* SKU
|
||||
*/
|
||||
private String sku;
|
||||
/**
|
||||
* 规格商品主图
|
||||
*/
|
||||
@TableField("spec_img")
|
||||
private String specImg;
|
||||
/**
|
||||
* 活动id
|
||||
*/
|
||||
@TableField("prom_id")
|
||||
private Integer promId;
|
||||
/**
|
||||
* 参加活动类型
|
||||
*/
|
||||
@TableField("prom_type")
|
||||
private Integer promType;
|
||||
|
||||
|
||||
public Long getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
public void setItemId(Long itemId) {
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
public Integer getGoodsId() {
|
||||
return goodsId;
|
||||
}
|
||||
|
||||
public void setGoodsId(Integer goodsId) {
|
||||
this.goodsId = goodsId;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getKeyName() {
|
||||
return keyName;
|
||||
}
|
||||
|
||||
public void setKeyName(String keyName) {
|
||||
this.keyName = keyName;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(BigDecimal price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public Double getMarketPrice() {
|
||||
return marketPrice;
|
||||
}
|
||||
|
||||
public void setMarketPrice(Double marketPrice) {
|
||||
this.marketPrice = marketPrice;
|
||||
}
|
||||
|
||||
public Integer getStoreCount() {
|
||||
return storeCount;
|
||||
}
|
||||
|
||||
public void setStoreCount(Integer storeCount) {
|
||||
this.storeCount = storeCount;
|
||||
}
|
||||
|
||||
public String getBarCode() {
|
||||
return barCode;
|
||||
}
|
||||
|
||||
public void setBarCode(String barCode) {
|
||||
this.barCode = barCode;
|
||||
}
|
||||
|
||||
public String getSku() {
|
||||
return sku;
|
||||
}
|
||||
|
||||
public void setSku(String sku) {
|
||||
this.sku = sku;
|
||||
}
|
||||
|
||||
public String getSpecImg() {
|
||||
return specImg;
|
||||
}
|
||||
|
||||
public void setSpecImg(String specImg) {
|
||||
this.specImg = specImg;
|
||||
}
|
||||
|
||||
public Integer getPromId() {
|
||||
return promId;
|
||||
}
|
||||
|
||||
public void setPromId(Integer promId) {
|
||||
this.promId = promId;
|
||||
}
|
||||
|
||||
public Integer getPromType() {
|
||||
return promType;
|
||||
}
|
||||
|
||||
public void setPromType(Integer promType) {
|
||||
this.promType = promType;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.itemId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StoreSpecGoodsPrice{" +
|
||||
", itemId=" + itemId +
|
||||
", goodsId=" + goodsId +
|
||||
", key=" + key +
|
||||
", keyName=" + keyName +
|
||||
", price=" + price +
|
||||
", marketPrice=" + marketPrice +
|
||||
", storeCount=" + storeCount +
|
||||
", barCode=" + barCode +
|
||||
", sku=" + sku +
|
||||
", specImg=" + specImg +
|
||||
", promId=" + promId +
|
||||
", promType=" + promType +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.ruoyi.app.common.persistence.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 规格项
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-09-07
|
||||
*/
|
||||
@TableName("store_spec_item")
|
||||
public class StoreSpecItem extends Model<StoreSpecItem> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 规格项id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
/**
|
||||
* 规格id
|
||||
*/
|
||||
@TableField("spec_id")
|
||||
private Integer specId;
|
||||
/**
|
||||
* 规格项
|
||||
*/
|
||||
private String item;
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getSpecId() {
|
||||
return specId;
|
||||
}
|
||||
|
||||
public void setSpecId(Integer specId) {
|
||||
this.specId = specId;
|
||||
}
|
||||
|
||||
public String getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public void setItem(String item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StoreSpecItem{" +
|
||||
", id=" + id +
|
||||
", specId=" + specId +
|
||||
", item=" + item +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -1,11 +1,11 @@
|
||||
package com.ruoyi.app.common.persistence.model;
|
||||
|
||||
import com.baomidou.mybatisplus.enums.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotations.TableId;
|
||||
import com.baomidou.mybatisplus.annotations.TableField;
|
||||
import com.baomidou.mybatisplus.activerecord.Model;
|
||||
import com.baomidou.mybatisplus.annotations.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.ruoyi.app.modular.shop.controller;
|
||||
|
||||
import com.itmuch.lightsecurity.jwt.UserOperator;
|
||||
import com.ruoyi.app.common.R;
|
||||
import com.ruoyi.app.modular.member.service.IMemberService;
|
||||
import com.ruoyi.app.modular.shop.service.dto.AdsDTO;
|
||||
import com.ruoyi.app.modular.shop.service.dto.GoodsDTO;
|
||||
import com.ruoyi.app.modular.shop.service.dto.NewsDTO;
|
||||
import com.ruoyi.app.modular.shop.service.impl.AdServiceImpl;
|
||||
import com.ruoyi.app.modular.shop.service.impl.GoodsServiceImpl;
|
||||
import com.ruoyi.app.modular.shop.service.impl.NewsServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName IndexController
|
||||
* @Author hupeng <610796224@qq.com>
|
||||
* @Date 2019/9/7
|
||||
**/
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class IndexController {
|
||||
private final UserOperator userOperator;
|
||||
private final GoodsServiceImpl goodsService;
|
||||
private final NewsServiceImpl newsService;
|
||||
private final AdServiceImpl adService;
|
||||
|
||||
@GetMapping("/shop/index-list")
|
||||
public R index(){
|
||||
int userId = userOperator.getUser().getId();
|
||||
|
||||
List<GoodsDTO> recommedGoods = goodsService.getList(0,1,3,userId,"",1);
|
||||
List<GoodsDTO> newGoods = goodsService.getList(0,1,6,userId,"",2);
|
||||
List<NewsDTO> newsList = newsService.getList(1,3);
|
||||
List<AdsDTO> ads = adService.getList();
|
||||
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("recommedGoods",recommedGoods);
|
||||
map.put("newGoods",newGoods);
|
||||
map.put("newsList",newsList);
|
||||
map.put("ads",ads);
|
||||
|
||||
return R.success(map);
|
||||
//return null;
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,12 @@ package com.ruoyi.app.modular.shop.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.app.common.persistence.model.StoreAds;
|
||||
import com.ruoyi.app.modular.shop.service.dto.AdsDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface IAdService extends IService<StoreAds> {
|
||||
public List<AdsDTO> getList();
|
||||
|
||||
}
|
||||
@@ -5,8 +5,14 @@ package com.ruoyi.app.modular.shop.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.app.common.persistence.model.StoreGoods;
|
||||
import com.ruoyi.app.modular.shop.service.dto.GoodsDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface IGoodsService extends IService<StoreGoods> {
|
||||
public List<GoodsDTO> getList(int cateId,int page,int limit,
|
||||
int userId,String keywords,int order);
|
||||
|
||||
public boolean isCollect(int goodsId,int userId);
|
||||
}
|
||||
@@ -5,8 +5,13 @@ package com.ruoyi.app.modular.shop.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.app.common.persistence.model.WechatNewsArticle;
|
||||
import com.ruoyi.app.modular.shop.service.dto.NewsDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface INewsService extends IService<WechatNewsArticle> {
|
||||
|
||||
public List<NewsDTO> getList(int page,int limit);
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.ruoyi.app.modular.shop.service;
|
||||
|
||||
import com.ruoyi.app.common.persistence.model.StoreGoodsAttr;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品关联的属性表(与商品相关) 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-09-07
|
||||
*/
|
||||
public interface IStoreGoodsAttrService extends IService<StoreGoodsAttr> {
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.ruoyi.app.modular.shop.service;
|
||||
|
||||
import com.ruoyi.app.common.persistence.model.StoreGoodsAttribute;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品的属性表(独立) 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-09-07
|
||||
*/
|
||||
public interface IStoreGoodsAttributeService extends IService<StoreGoodsAttribute> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.ruoyi.app.modular.shop.service.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class AdsDTO implements Serializable {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String videoUrl;
|
||||
|
||||
/**
|
||||
* 轮播图片地址
|
||||
*/
|
||||
private String url;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.ruoyi.app.modular.shop.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class GoodsDTO implements Serializable {
|
||||
|
||||
|
||||
private Integer goodsId;
|
||||
|
||||
private Integer cateId;
|
||||
|
||||
private String goodsSn;
|
||||
|
||||
private String goodsName;
|
||||
|
||||
private Integer storeCount;
|
||||
|
||||
private BigDecimal marketPrice;
|
||||
/**
|
||||
* 本店价(供货价)
|
||||
*/
|
||||
private BigDecimal shopPrice;
|
||||
|
||||
/**
|
||||
* 商品关键词
|
||||
*/
|
||||
private String keywords;
|
||||
/**
|
||||
* 商品简单描述
|
||||
*/
|
||||
private String goodsRemark;
|
||||
/**
|
||||
* 商品详细描述
|
||||
*/
|
||||
private String goodsContent;
|
||||
|
||||
/**
|
||||
* 商品上传原始图(主图)
|
||||
*/
|
||||
private String goodsLogo;
|
||||
|
||||
/**
|
||||
* 商品销量
|
||||
*/
|
||||
private Integer salesSum;
|
||||
|
||||
private Boolean isCollect;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.ruoyi.app.modular.shop.service.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
@Data
|
||||
public class NewsDTO implements Serializable {
|
||||
|
||||
|
||||
private Long id;
|
||||
|
||||
private String title;
|
||||
|
||||
private String localUrl;
|
||||
/**
|
||||
* 作者
|
||||
*/
|
||||
private String author;
|
||||
/**
|
||||
* 摘要内容
|
||||
*/
|
||||
private String digest;
|
||||
/**
|
||||
* 图文内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
|
||||
}
|
||||
@@ -2,15 +2,31 @@ package com.ruoyi.app.modular.shop.service.impl;
|
||||
|
||||
|
||||
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.app.common.persistence.dao.StoreAdsMapper;
|
||||
import com.ruoyi.app.common.persistence.model.StoreAds;
|
||||
import com.ruoyi.app.modular.shop.service.IAdService;
|
||||
|
||||
import com.ruoyi.app.modular.shop.service.dto.AdsDTO;
|
||||
import com.ruoyi.app.modular.shop.service.mapper.AdsMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class AdServiceImpl extends ServiceImpl<StoreAdsMapper,StoreAds> implements IAdService {
|
||||
|
||||
private final AdsMapper adsMapper;
|
||||
|
||||
@Override
|
||||
public List<AdsDTO> getList() {
|
||||
QueryWrapper<StoreAds> wrapper = new QueryWrapper<>();
|
||||
wrapper.orderByDesc("create_time");
|
||||
return adsMapper.toDto(baseMapper.selectList(wrapper));
|
||||
}
|
||||
}
|
||||
@@ -3,14 +3,93 @@ package com.ruoyi.app.modular.shop.service.impl;
|
||||
|
||||
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.app.common.persistence.dao.StoreGoodsCollectMapper;
|
||||
import com.ruoyi.app.common.persistence.dao.StoreGoodsMapper;
|
||||
import com.ruoyi.app.common.persistence.model.StoreGoods;
|
||||
import com.ruoyi.app.common.persistence.model.StoreGoodsCollect;
|
||||
import com.ruoyi.app.modular.shop.service.IGoodsService;
|
||||
import com.ruoyi.app.modular.shop.service.dto.GoodsDTO;
|
||||
import com.ruoyi.app.modular.shop.service.mapper.GoodsMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class GoodsServiceImpl extends ServiceImpl<StoreGoodsMapper, StoreGoods> implements IGoodsService {
|
||||
|
||||
private final GoodsMapper goodsMapper;
|
||||
private final StoreGoodsMapper storeGoodsMapper;
|
||||
private final StoreGoodsCollectMapper storeGoodsCollectMapper;
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
* @param cateId
|
||||
* @param page
|
||||
* @param limit
|
||||
* @param userId
|
||||
* @param keywords
|
||||
* @param order
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<GoodsDTO> getList(int cateId, int page, int limit, int userId,
|
||||
String keywords,int order) {
|
||||
|
||||
QueryWrapper<StoreGoods> wrapper = new QueryWrapper<>();
|
||||
|
||||
if(cateId > 0){
|
||||
wrapper.eq("cate_id",cateId);
|
||||
}
|
||||
if(StrUtil.isNotEmpty(keywords)){
|
||||
wrapper.like("goods_name",keywords);
|
||||
}
|
||||
|
||||
//todo order = 1 推荐 order=2 新品
|
||||
switch (order){
|
||||
case 1:
|
||||
wrapper.eq("is_recommend",1);
|
||||
break;
|
||||
case 2:
|
||||
wrapper.eq("is_new",1);
|
||||
break;
|
||||
}
|
||||
Page<StoreGoods> pageModel = new Page<>(page, limit);
|
||||
|
||||
IPage<StoreGoods> pageList = storeGoodsMapper.selectPage(pageModel,wrapper);
|
||||
|
||||
List<GoodsDTO> list = goodsMapper.toDto(pageList.getRecords());
|
||||
|
||||
for (GoodsDTO goodsDTO : list) {
|
||||
goodsDTO.setIsCollect(isCollect(goodsDTO.getGoodsId(),userId));
|
||||
}
|
||||
|
||||
return list;
|
||||
//return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 收藏判断
|
||||
* @param goodsId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isCollect(int goodsId, int userId) {
|
||||
QueryWrapper<StoreGoodsCollect> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("goods_id",goodsId).eq("user_id",userId);
|
||||
StoreGoodsCollect goodsCollect = storeGoodsCollectMapper.selectOne(wrapper);
|
||||
if(ObjectUtil.isNotNull(goodsCollect)) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+27
-3
@@ -3,17 +3,41 @@ package com.ruoyi.app.modular.shop.service.impl;
|
||||
|
||||
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.app.common.persistence.dao.StoreAdsMapper;
|
||||
import com.ruoyi.app.common.persistence.dao.WechatNewsArticleMapper;
|
||||
import com.ruoyi.app.common.persistence.model.StoreAds;
|
||||
import com.ruoyi.app.common.persistence.model.WechatNewsArticle;
|
||||
import com.ruoyi.app.modular.shop.service.IAdService;
|
||||
import com.ruoyi.app.modular.shop.service.INewsService;
|
||||
import com.ruoyi.app.modular.shop.service.dto.NewsDTO;
|
||||
import com.ruoyi.app.modular.shop.service.mapper.NewsMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class NewsServiceImpl extends ServiceImpl<WechatNewsArticleMapper, WechatNewsArticle> implements INewsService {
|
||||
|
||||
private final NewsMapper newsMapper;
|
||||
|
||||
/**
|
||||
* 新闻列表
|
||||
* @param page
|
||||
* @param limit
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<NewsDTO> getList(int page, int limit) {
|
||||
QueryWrapper<WechatNewsArticle> wrapper = new QueryWrapper<>();
|
||||
wrapper.orderByDesc("id");
|
||||
Page<WechatNewsArticle> pageModel = new Page<>(page, limit);
|
||||
IPage<WechatNewsArticle> pageList = baseMapper.selectPage(pageModel,wrapper);
|
||||
|
||||
return newsMapper.toDto(pageList.getRecords());
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.ruoyi.app.modular.shop.service.impl;
|
||||
|
||||
import com.ruoyi.app.common.persistence.model.StoreGoodsAttr;
|
||||
import com.ruoyi.app.common.persistence.dao.StoreGoodsAttrMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.app.modular.shop.service.IStoreGoodsAttrService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品关联的属性表(与商品相关) 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-09-07
|
||||
*/
|
||||
@Service
|
||||
public class StoreGoodsAttrServiceImpl extends ServiceImpl<StoreGoodsAttrMapper, StoreGoodsAttr> implements IStoreGoodsAttrService {
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.app.modular.shop.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.app.common.persistence.model.StoreGoodsAttribute;
|
||||
import com.ruoyi.app.common.persistence.dao.StoreGoodsAttributeMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品的属性表(独立) 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-09-07
|
||||
*/
|
||||
@Service
|
||||
public class StoreGoodsAttributeServiceImpl extends ServiceImpl<StoreGoodsAttributeMapper, StoreGoodsAttribute> implements IStoreGoodsAttributeService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.app.modular.shop.service.mapper;
|
||||
|
||||
|
||||
import com.ruoyi.app.common.persistence.model.StoreAds;
|
||||
import com.ruoyi.app.modular.mapper.EntityMapper;
|
||||
import com.ruoyi.app.modular.shop.service.dto.AdsDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-09-07
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface AdsMapper extends EntityMapper<AdsDTO, StoreAds> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.app.modular.shop.service.mapper;
|
||||
|
||||
|
||||
import com.ruoyi.app.common.persistence.model.StoreGoods;
|
||||
import com.ruoyi.app.modular.mapper.EntityMapper;
|
||||
import com.ruoyi.app.modular.shop.service.dto.GoodsDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-09-07
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface GoodsMapper extends EntityMapper<GoodsDTO, StoreGoods> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.app.modular.shop.service.mapper;
|
||||
|
||||
|
||||
import com.ruoyi.app.common.persistence.model.WechatNewsArticle;
|
||||
import com.ruoyi.app.modular.mapper.EntityMapper;
|
||||
import com.ruoyi.app.modular.shop.service.dto.NewsDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-09-07
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface NewsMapper extends EntityMapper<NewsDTO, WechatNewsArticle> {
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ruoyi.generator;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.generator.AutoGenerator;
|
||||
import com.baomidou.mybatisplus.generator.AutoGenerator;
|
||||
import com.baomidou.mybatisplus.generator.InjectionConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
|
||||
@@ -57,7 +58,7 @@ public class EntityGenerator {
|
||||
StrategyConfig strategy = new StrategyConfig();
|
||||
//strategy.setTablePrefix(new String[]{"_"});// 此处可以修改为您的表前缀
|
||||
strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略
|
||||
strategy.setInclude(new String[]{"store_goods","wechat_news_article"});
|
||||
strategy.setInclude(new String[]{"store_goods_collect","store_spec","store_spec_goods_price","store_spec_item"});
|
||||
mpg.setStrategy(strategy);
|
||||
|
||||
// 包配置
|
||||
|
||||
Reference in new issue
Block a user