Compare commits
13 Commits
d05ceebba0
...
c58caef95f
Author | SHA1 | Date |
---|---|---|
|
c58caef95f | |
|
576ce1dac8 | |
|
acc59fd99b | |
|
fdf531ee56 | |
|
bee6f5678c | |
|
37edeb8aa9 | |
|
2bc592c87e | |
|
e1d039804c | |
|
41d4175d23 | |
|
5cd96727fd | |
|
c76dfb1228 | |
|
2618c29454 | |
|
39b92736fa |
|
@ -15,9 +15,13 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 111.229.102.61:8848
|
||||
#命名空间
|
||||
namespace: muyu
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 111.229.102.61:8848
|
||||
#命名空间
|
||||
namespace: muyu
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
|
@ -1,32 +1,13 @@
|
|||
package com.muyu.common.cache;
|
||||
|
||||
import com.muyu.common.cache.decoration.DecorationKey;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 缓存接口基类
|
||||
* @Date 2024-3-26 下午 03:25
|
||||
*/
|
||||
public interface Cache <K, V> {
|
||||
|
||||
/**
|
||||
* key前缀
|
||||
* @return key前缀
|
||||
*/
|
||||
public String keyPre();
|
||||
|
||||
|
||||
/**
|
||||
* 编码
|
||||
* @param key ID
|
||||
* @return 键
|
||||
*/
|
||||
public String encode(K key);
|
||||
|
||||
/**
|
||||
* 解码
|
||||
* @param redisKey 数据库键
|
||||
* @return ID
|
||||
*/
|
||||
public K decode(String redisKey);
|
||||
public interface Cache <K, V> extends DecorationKey<K> {
|
||||
|
||||
/**
|
||||
* 通过Key获取value值
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
package com.muyu.common.cache;
|
||||
|
||||
import com.muyu.common.cache.decoration.DecorationKey;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: Hash缓存基准
|
||||
* @Date 2024-3-29 下午 03:16
|
||||
*/
|
||||
public interface HashCache <K, HK, HV> extends DecorationKey<K> {
|
||||
|
||||
|
||||
/**
|
||||
* 编码
|
||||
* @param hashKey ID
|
||||
* @return 键
|
||||
*/
|
||||
public String encodeHashKey(HK hashKey);
|
||||
|
||||
/**
|
||||
* 解码
|
||||
* @param redisHashKey 数据库键
|
||||
* @return ID
|
||||
*/
|
||||
public HK decodeHashKey(String redisHashKey);
|
||||
|
||||
/**
|
||||
* 通过Key获取所有的map
|
||||
* @param key 数据库键
|
||||
* @return 所有集合Map
|
||||
*/
|
||||
public Map<HK, HV> get(K key);
|
||||
|
||||
/**
|
||||
* 通过键和hashKey获取数据库hashValue
|
||||
* @param key 键
|
||||
* @param hashKey hash键
|
||||
* @return hash值
|
||||
*/
|
||||
public HV get(K key, HK hashKey);
|
||||
|
||||
/**
|
||||
* 通过键和hashKey获取数据库hashValue
|
||||
* @param key 键
|
||||
* @param hashKeyList hash键集合
|
||||
* @return hash值
|
||||
*/
|
||||
public List<HV> get(K key, HK... hashKeyList);
|
||||
|
||||
/**
|
||||
* 获取hash值集合
|
||||
* @param key 键
|
||||
* @return hash值集合
|
||||
*/
|
||||
public List<HV> getToList(K key);
|
||||
|
||||
/**
|
||||
* 存储数据
|
||||
* @param key redis键
|
||||
* @param map hashMap集合
|
||||
*/
|
||||
public void put(K key, Map<HK, HV> map);
|
||||
|
||||
/**
|
||||
* 存储数据
|
||||
* @param key redis键
|
||||
* @param dataList 数据值
|
||||
* @param hashKey hash键
|
||||
*/
|
||||
public void put(K key, List<HV> dataList, Function<HV, HK> hashKey);
|
||||
|
||||
/**
|
||||
* 存储数据
|
||||
* @param key redis键
|
||||
* @param hashKey hash键
|
||||
* @param hashValue hash值
|
||||
*/
|
||||
public void put(K key, HK hashKey, HV hashValue);
|
||||
|
||||
/**
|
||||
* 通过redis键删除
|
||||
* @param key hash键
|
||||
*/
|
||||
public void remove(K key);
|
||||
|
||||
/**
|
||||
* 通过redis键和hash键删除
|
||||
* @param key redis键
|
||||
* @param hashKey hash键
|
||||
*/
|
||||
public void remove(K key, HK hashKey);
|
||||
|
||||
}
|
|
@ -0,0 +1,170 @@
|
|||
package com.muyu.common.cache.abs;
|
||||
|
||||
import com.muyu.common.cache.HashCache;
|
||||
import com.muyu.common.redis.service.RedisService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: hash缓存抽象类
|
||||
* @Date 2024-3-29 下午 07:40
|
||||
*/
|
||||
public abstract class HashCacheAbs<K, HK, HV> implements HashCache<K, HK, HV> {
|
||||
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*
|
||||
* @param key ID
|
||||
*
|
||||
* @return 键
|
||||
*/
|
||||
@Override
|
||||
public String encode (K key) {
|
||||
return keyPre() + key;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编码
|
||||
* @param hashKey ID
|
||||
* @return 键
|
||||
*/
|
||||
@Override
|
||||
public String encodeHashKey (HK hashKey) {
|
||||
return hashKey.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过Key获取所有的map
|
||||
* @param key 数据库键
|
||||
* @return 所有集合Map
|
||||
*/
|
||||
@Override
|
||||
public Map<HK, HV> get (K key) {
|
||||
return decodeMap(redisService.getCacheMap(encode(key)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过键和hashKey获取数据库hashValue
|
||||
*
|
||||
* @param key 键
|
||||
* @param hashKey hash键
|
||||
*
|
||||
* @return hash值
|
||||
*/
|
||||
@Override
|
||||
public HV get (K key, HK hashKey) {
|
||||
return redisService.getCacheMapValue(encode(key), encodeHashKey(hashKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过键和hashKey获取数据库hashValue
|
||||
*
|
||||
* @param key 键
|
||||
* @param hashKeyList hash键集合
|
||||
*
|
||||
* @return hash值
|
||||
*/
|
||||
@Override
|
||||
public List<HV> get (K key, HK... hashKeyList) {
|
||||
List<String> encodeHashKeyList = Arrays.stream(hashKeyList).map(this::encodeHashKey).toList();
|
||||
return redisService.getMultiCacheMapValue(encode(key), encodeHashKeyList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取hash值集合
|
||||
*
|
||||
* @param key 键
|
||||
*
|
||||
* @return hash值集合
|
||||
*/
|
||||
@Override
|
||||
public List<HV> getToList (K key) {
|
||||
Map<HK, HV> hkhvMap = get(key);
|
||||
return hkhvMap.values().stream().toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储数据
|
||||
*
|
||||
* @param key redis键
|
||||
* @param map hashMap集合
|
||||
*/
|
||||
@Override
|
||||
public void put (K key, Map<HK, HV> map) {
|
||||
redisService.setCacheMap(encode(key), encodeMap(map));
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储数据
|
||||
*
|
||||
* @param key redis键
|
||||
* @param dataList 数据值
|
||||
* @param hashKey hash键
|
||||
*/
|
||||
@Override
|
||||
public void put (K key, List<HV> dataList, Function<HV, HK> hashKey) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储数据
|
||||
*
|
||||
* @param key redis键
|
||||
* @param hashKey hash键
|
||||
* @param hashValue hash值
|
||||
*/
|
||||
@Override
|
||||
public void put (K key, HK hashKey, HV hashValue) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过redis键删除
|
||||
*
|
||||
* @param key hash键
|
||||
*/
|
||||
@Override
|
||||
public void remove (K key) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过redis键和hash键删除
|
||||
*
|
||||
* @param key redis键
|
||||
* @param hashKey hash键
|
||||
*/
|
||||
@Override
|
||||
public void remove (K key, HK hashKey) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 原始数据转编码数据
|
||||
* @param dataMap 原始数据
|
||||
* @return 编码数据
|
||||
*/
|
||||
private Map<String, HV> encodeMap(Map<HK, HV> dataMap){
|
||||
Map<String, HV> encodeDataMap = new HashMap<>();
|
||||
dataMap.forEach((hashKey, HashValue) -> encodeDataMap.put(encodeHashKey(hashKey), HashValue));
|
||||
return encodeDataMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编码数据转原始数据
|
||||
* @param encodeDataMap 编码数据
|
||||
* @return 原始数据
|
||||
*/
|
||||
private Map<HK, HV> decodeMap(Map<String, HV> encodeDataMap){
|
||||
Map<HK, HV> dataMap = new HashMap<>();
|
||||
encodeDataMap.forEach((hashKey, hashValue) -> dataMap.put(decodeHashKey(hashKey), hashValue));
|
||||
return dataMap;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.muyu.common.cache.decoration;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 装饰Key
|
||||
* @Date 2024-3-29 下午 03:19
|
||||
*/
|
||||
public interface DecorationKey <K>{
|
||||
|
||||
/**
|
||||
* key前缀
|
||||
* @return key前缀
|
||||
*/
|
||||
public String keyPre();
|
||||
|
||||
|
||||
/**
|
||||
* 编码
|
||||
* @param key ID
|
||||
* @return 键
|
||||
*/
|
||||
public String encode(K key);
|
||||
|
||||
/**
|
||||
* 解码
|
||||
* @param redisKey 数据库键
|
||||
* @return ID
|
||||
*/
|
||||
public K decode(String redisKey);
|
||||
}
|
|
@ -229,7 +229,7 @@ public class RedisService {
|
|||
*
|
||||
* @return Hash对象集合
|
||||
*/
|
||||
public <T> List<T> getMultiCacheMapValue (final String key, final Collection<Object> hKeys) {
|
||||
public <T> List<T> getMultiCacheMapValue (final String key, final Collection<?> hKeys) {
|
||||
return redisTemplate.opsForHash().multiGet(key, hKeys);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,9 +15,13 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 111.229.102.61:8848
|
||||
#命名空间
|
||||
namespace: muyu
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 111.229.102.61:8848
|
||||
#命名空间
|
||||
namespace: muyu
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,9 +15,13 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 111.229.102.61:8848
|
||||
#命名空间
|
||||
namespace: muyu
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 111.229.102.61:8848
|
||||
#命名空间
|
||||
namespace: muyu
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,9 +15,13 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 111.229.102.61:8848
|
||||
#命名空间
|
||||
namespace: muyu
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 111.229.102.61:8848
|
||||
#命名空间
|
||||
namespace: muyu
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,9 +15,13 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 111.229.102.61:8848
|
||||
#命名空间
|
||||
namespace: muyu
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 111.229.102.61:8848
|
||||
#命名空间
|
||||
namespace: muyu
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
|
@ -1,11 +1,17 @@
|
|||
package com.muyu.product.cache;
|
||||
|
||||
import com.muyu.common.cache.HashCache;
|
||||
import com.muyu.common.cache.abs.CacheAbs;
|
||||
import com.muyu.common.core.text.Convert;
|
||||
import com.muyu.product.cache.datasource.ProjectInfoData;
|
||||
import com.muyu.product.domain.ProjectInfo;
|
||||
import com.muyu.product.domain.ProjectSkuInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
|
@ -15,8 +21,21 @@ import org.springframework.stereotype.Service;
|
|||
@Component
|
||||
public class ProjectInfoCache extends CacheAbs<Long, ProjectInfo> {
|
||||
|
||||
public static void main (String[] args) {
|
||||
Long projectId = 10L;
|
||||
HashCache<Long, Long, ProjectSkuInfo> hashCache = null;
|
||||
List<ProjectSkuInfo> projectSkuInfoList = new ArrayList<>(){{
|
||||
add(new ProjectSkuInfo());
|
||||
add(new ProjectSkuInfo());
|
||||
}};
|
||||
hashCache.put(projectId, projectSkuInfoList, ProjectSkuInfo::getProjectId);
|
||||
Long[] longArr = new Long[]{10L,11L,12L,13L,14L,15L};
|
||||
hashCache.get(projectId, longArr);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ProjectInfoData projectInfoData;
|
||||
|
||||
/**
|
||||
* key前缀
|
||||
*
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package com.muyu.product.cache;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 商品sku基本信息
|
||||
* @Date 2024-3-29 下午 03:06
|
||||
*/
|
||||
public class ProjectSkuCache {
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.muyu.product.cache;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 商品SKU库存缓存
|
||||
* @Date 2024-3-29 下午 03:06
|
||||
*/
|
||||
public class ProjectSkuStockCache {
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.product.cache;
|
||||
package com.muyu.product.cache.datasource;
|
||||
|
||||
import com.muyu.product.domain.ProjectInfo;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package com.muyu.product.cache.impl;
|
||||
|
||||
import com.muyu.product.cache.ProjectInfoData;
|
||||
import com.muyu.product.cache.datasource.ProjectInfoData;
|
||||
import com.muyu.product.domain.ProjectInfo;
|
||||
import com.muyu.product.service.ProjectInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
|
@ -15,9 +15,13 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 111.229.102.61:8848
|
||||
#命名空间
|
||||
namespace: muyu
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 111.229.102.61:8848
|
||||
#命名空间
|
||||
namespace: muyu
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
{ 基本信息: {
|
||||
name: "",
|
||||
introduction: "",
|
||||
mianType: "",
|
||||
parentType: "",
|
||||
type: "",
|
||||
image: "",
|
||||
carouselImages: "",
|
||||
status: "",
|
||||
ruleId: "",
|
||||
branId: "",
|
||||
remark: ""
|
||||
},
|
||||
品类属性: [ {
|
||||
id: "",
|
||||
value: "",
|
||||
} …………
|
||||
],
|
||||
商品规格: [ {
|
||||
SKU: "",(所有的规格属性拼接而成)
|
||||
"images": "",
|
||||
库存: "",
|
||||
价格: "",
|
||||
} …………
|
||||
]
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-shop-cart</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-shop-cart-common</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,105 @@
|
|||
package com.muyu.shop.cart.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.shop.cart.domain.req.CartInfoQueryReq;
|
||||
import com.muyu.shop.cart.domain.req.CartInfoSaveReq;
|
||||
import com.muyu.shop.cart.domain.req.CartInfoEditReq;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 购物车对象 cart_info
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-03-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("cart_info")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "CartInfo", description = "购物车")
|
||||
public class CartInfo extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "主键", value = "主键")
|
||||
private Long id;
|
||||
|
||||
/** 商品 */
|
||||
@Excel(name = "商品")
|
||||
@ApiModelProperty(name = "商品", value = "商品", required = true)
|
||||
private Long projectId;
|
||||
|
||||
/** SKU */
|
||||
@Excel(name = "SKU")
|
||||
@ApiModelProperty(name = "SKU", value = "SKU", required = true)
|
||||
private String projectSku;
|
||||
|
||||
/** 用户 */
|
||||
@Excel(name = "用户")
|
||||
@ApiModelProperty(name = "用户", value = "用户", required = true)
|
||||
private Long userId;
|
||||
|
||||
/** 数量 */
|
||||
@Excel(name = "数量")
|
||||
@ApiModelProperty(name = "数量", value = "数量", required = true)
|
||||
private Long num;
|
||||
|
||||
/** 是否选中 */
|
||||
@Excel(name = "是否选中")
|
||||
@ApiModelProperty(name = "是否选中", value = "是否选中", required = true)
|
||||
private String isSelected;
|
||||
|
||||
/**
|
||||
* 查询构造器
|
||||
*/
|
||||
public static CartInfo queryBuild( CartInfoQueryReq cartInfoQueryReq){
|
||||
return CartInfo.builder()
|
||||
.projectId(cartInfoQueryReq.getProjectId())
|
||||
.projectSku(cartInfoQueryReq.getProjectSku())
|
||||
.userId(cartInfoQueryReq.getUserId())
|
||||
.num(cartInfoQueryReq.getNum())
|
||||
.isSelected(cartInfoQueryReq.getIsSelected())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加构造器
|
||||
*/
|
||||
public static CartInfo saveBuild(CartInfoSaveReq cartInfoSaveReq){
|
||||
return CartInfo.builder()
|
||||
.projectId(cartInfoSaveReq.getProjectId())
|
||||
.projectSku(cartInfoSaveReq.getProjectSku())
|
||||
.userId(cartInfoSaveReq.getUserId())
|
||||
.num(cartInfoSaveReq.getNum())
|
||||
.isSelected(cartInfoSaveReq.getIsSelected())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改构造器
|
||||
*/
|
||||
public static CartInfo editBuild(Long id, CartInfoEditReq cartInfoEditReq){
|
||||
return CartInfo.builder()
|
||||
.id(id)
|
||||
.projectId(cartInfoEditReq.getProjectId())
|
||||
.projectSku(cartInfoEditReq.getProjectSku())
|
||||
.userId(cartInfoEditReq.getUserId())
|
||||
.num(cartInfoEditReq.getNum())
|
||||
.isSelected(cartInfoEditReq.getIsSelected())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package com.muyu.shop.cart.domain.req;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 购物车对象 cart_info
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-03-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "CartInfoEditReq", description = "购物车")
|
||||
public class CartInfoEditReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 商品 */
|
||||
@ApiModelProperty(name = "商品", value = "商品", required = true)
|
||||
private Long projectId;
|
||||
|
||||
/** SKU */
|
||||
@ApiModelProperty(name = "SKU", value = "SKU", required = true)
|
||||
private String projectSku;
|
||||
|
||||
/** 用户 */
|
||||
@ApiModelProperty(name = "用户", value = "用户", required = true)
|
||||
private Long userId;
|
||||
|
||||
/** 数量 */
|
||||
@ApiModelProperty(name = "数量", value = "数量", required = true)
|
||||
private Long num;
|
||||
|
||||
/** 是否选中 */
|
||||
@ApiModelProperty(name = "是否选中", value = "是否选中", required = true)
|
||||
private String isSelected;
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package com.muyu.shop.cart.domain.req;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 购物车对象 cart_info
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-03-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "CartInfoQueryReq", description = "购物车")
|
||||
public class CartInfoQueryReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 商品 */
|
||||
@ApiModelProperty(name = "商品", value = "商品")
|
||||
private Long projectId;
|
||||
|
||||
/** SKU */
|
||||
@ApiModelProperty(name = "SKU", value = "SKU")
|
||||
private String projectSku;
|
||||
|
||||
/** 用户 */
|
||||
@ApiModelProperty(name = "用户", value = "用户")
|
||||
private Long userId;
|
||||
|
||||
/** 数量 */
|
||||
@ApiModelProperty(name = "数量", value = "数量")
|
||||
private Long num;
|
||||
|
||||
/** 是否选中 */
|
||||
@ApiModelProperty(name = "是否选中", value = "是否选中")
|
||||
private String isSelected;
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package com.muyu.shop.cart.domain.req;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 购物车对象 cart_info
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-03-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "CartInfoSaveReq", description = "购物车")
|
||||
public class CartInfoSaveReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
|
||||
@ApiModelProperty(name = "主键", value = "主键")
|
||||
private Long id;
|
||||
|
||||
/** 商品 */
|
||||
|
||||
@ApiModelProperty(name = "商品", value = "商品", required = true)
|
||||
private Long projectId;
|
||||
|
||||
/** SKU */
|
||||
|
||||
@ApiModelProperty(name = "SKU", value = "SKU", required = true)
|
||||
private String projectSku;
|
||||
|
||||
/** 用户 */
|
||||
|
||||
@ApiModelProperty(name = "用户", value = "用户", required = true)
|
||||
private Long userId;
|
||||
|
||||
/** 数量 */
|
||||
|
||||
@ApiModelProperty(name = "数量", value = "数量", required = true)
|
||||
private Long num;
|
||||
|
||||
/** 是否选中 */
|
||||
|
||||
@ApiModelProperty(name = "是否选中", value = "是否选中", required = true)
|
||||
private String isSelected;
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-shop-cart</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-shop-cart-remote</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- 购物车模块 公共依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-shop-cart-common</artifactId>
|
||||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,116 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-shop-cart</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-shop-cart-server</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 购物车模块 公共依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-shop-cart-common</artifactId>
|
||||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- 加入maven deploy插件,当在deploy时,忽略些model-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,22 @@
|
|||
package com.muyu.shop.cart;
|
||||
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 购物车服务
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class MuYuShopCartApplication {
|
||||
public static void main (String[] args) {
|
||||
SpringApplication.run(MuYuShopCartApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package com.muyu.shop.cart.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.shop.cart.domain.CartInfo;
|
||||
import com.muyu.shop.cart.domain.req.CartInfoQueryReq;
|
||||
import com.muyu.shop.cart.domain.req.CartInfoSaveReq;
|
||||
import com.muyu.shop.cart.domain.req.CartInfoEditReq;
|
||||
import com.muyu.shop.cart.service.CartInfoService;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 购物车Controller
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-03-29
|
||||
*/
|
||||
@Api(tags = "购物车")
|
||||
@RestController
|
||||
@RequestMapping("/Info")
|
||||
public class CartInfoController extends BaseController {
|
||||
@Autowired
|
||||
private CartInfoService cartInfoService;
|
||||
|
||||
/**
|
||||
* 查询购物车列表
|
||||
*/
|
||||
@ApiOperation("获取购物车列表")
|
||||
@RequiresPermissions("shopCart:Info:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<CartInfo>> list(CartInfoQueryReq cartInfoQueryReq) {
|
||||
startPage();
|
||||
List<CartInfo> list = cartInfoService.list(CartInfo.queryBuild(cartInfoQueryReq));
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出购物车列表
|
||||
*/
|
||||
@ApiOperation("导出购物车列表")
|
||||
@RequiresPermissions("shopCart:Info:export")
|
||||
@Log(title = "购物车", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, CartInfo cartInfo) {
|
||||
List<CartInfo> list = cartInfoService.list(cartInfo);
|
||||
ExcelUtil<CartInfo> util = new ExcelUtil<CartInfo>(CartInfo.class);
|
||||
util.exportExcel(response, list, "购物车数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取购物车详细信息
|
||||
*/
|
||||
@ApiOperation("获取购物车详细信息")
|
||||
@RequiresPermissions("shopCart:Info:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||
public Result<CartInfo> getInfo(@PathVariable("id") Long id) {
|
||||
return Result.success(cartInfoService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增购物车
|
||||
*/
|
||||
@RequiresPermissions("shopCart:Info:add")
|
||||
@Log(title = "购物车", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增购物车")
|
||||
public Result<String> add(@RequestBody CartInfoSaveReq cartInfoSaveReq) {
|
||||
return toAjax(cartInfoService.save(CartInfo.saveBuild(cartInfoSaveReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改购物车
|
||||
*/
|
||||
@RequiresPermissions("shopCart:Info:edit")
|
||||
@Log(title = "购物车", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation("修改购物车")
|
||||
public Result<String> edit(@PathVariable Long id, @RequestBody CartInfoEditReq cartInfoEditReq) {
|
||||
return toAjax(cartInfoService.updateById(CartInfo.editBuild(id,cartInfoEditReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除购物车
|
||||
*/
|
||||
@RequiresPermissions("shopCart:Info:remove")
|
||||
@Log(title = "购物车", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除购物车")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||
public Result<String> remove(@PathVariable List<Long> ids) {
|
||||
return toAjax(cartInfoService.removeBatchByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.shop.cart.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.shop.cart.domain.CartInfo;
|
||||
|
||||
/**
|
||||
* 购物车Mapper接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-03-29
|
||||
*/
|
||||
public interface CartInfoMapper extends BaseMapper<CartInfo> {
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.muyu.shop.cart.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.shop.cart.domain.CartInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 购物车Service接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-03-29
|
||||
*/
|
||||
public interface CartInfoService extends IService<CartInfo> {
|
||||
/**
|
||||
* 查询购物车列表
|
||||
*
|
||||
* @param cartInfo 购物车
|
||||
* @return 购物车集合
|
||||
*/
|
||||
public List<CartInfo> list(CartInfo cartInfo);
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.muyu.shop.cart.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.muyu.common.core.utils.ObjUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.shop.cart.mapper.CartInfoMapper;
|
||||
import com.muyu.shop.cart.domain.CartInfo;
|
||||
import com.muyu.shop.cart.service.CartInfoService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
/**
|
||||
* 购物车Service业务层处理
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-03-29
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class CartInfoServiceImpl extends ServiceImpl<CartInfoMapper, CartInfo> implements CartInfoService {
|
||||
|
||||
/**
|
||||
* 查询购物车列表
|
||||
*
|
||||
* @param cartInfo 购物车
|
||||
* @return 购物车
|
||||
*/
|
||||
@Override
|
||||
public List<CartInfo> list(CartInfo cartInfo) {
|
||||
LambdaQueryWrapper<CartInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
|
||||
if (ObjUtils.notNull(cartInfo.getProjectId())){
|
||||
queryWrapper.eq(CartInfo::getProjectId, cartInfo.getProjectId());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(cartInfo.getProjectSku())){
|
||||
queryWrapper.eq(CartInfo::getProjectSku, cartInfo.getProjectSku());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(cartInfo.getUserId())){
|
||||
queryWrapper.eq(CartInfo::getUserId, cartInfo.getUserId());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(cartInfo.getNum())){
|
||||
queryWrapper.eq(CartInfo::getNum, cartInfo.getNum());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(cartInfo.getIsSelected())){
|
||||
queryWrapper.eq(CartInfo::getIsSelected, cartInfo.getIsSelected());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return list(queryWrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,32 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9506
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: muyu-shop-cart
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 111.229.102.61:8848
|
||||
#命名空间
|
||||
namespace: muyu
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 111.229.102.61:8848
|
||||
#命名空间
|
||||
namespace: muyu
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
level:
|
||||
com.muyu.shop.cart.mapper: DEBUG
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/muyu-system"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.muyu" level="info"/>
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn"/>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info"/>
|
||||
<appender-ref ref="file_error"/>
|
||||
</root>
|
||||
</configuration>
|
|
@ -0,0 +1,24 @@
|
|||
<?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.muyu.shop.cart.mapper.CartInfoMapper">
|
||||
|
||||
<resultMap type="com.muyu.shop.cart.domain.CartInfo" id="CartInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="projectId" column="project_id" />
|
||||
<result property="projectSku" column="project_sku" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="num" column="num" />
|
||||
<result property="isSelected" column="is_selected" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCartInfoVo">
|
||||
select id, project_id, project_sku, user_id, num, is_selected, remark, create_by, create_time, update_by, update_time from cart_info
|
||||
</sql>
|
||||
</mapper>
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-modules</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-shop-cart</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>muyu-shop-cart-common</module>
|
||||
<module>muyu-shop-cart-remote</module>
|
||||
<module>muyu-shop-cart-server</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -15,9 +15,13 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 111.229.102.61:8848
|
||||
#命名空间
|
||||
namespace: muyu
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 111.229.102.61:8848
|
||||
#命名空间
|
||||
namespace: muyu
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<module>muyu-job</module>
|
||||
<module>muyu-file</module>
|
||||
<module>muyu-product</module>
|
||||
<module>muyu-shop-cart</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>muyu-modules</artifactId>
|
||||
|
|
|
@ -15,9 +15,13 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 111.229.102.61:8848
|
||||
#命名空间
|
||||
namespace: muyu
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 111.229.102.61:8848
|
||||
#命名空间
|
||||
namespace: muyu
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
14
pom.xml
14
pom.xml
|
@ -234,6 +234,20 @@
|
|||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 购物车模块 公共依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-shop-cart-common</artifactId>
|
||||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 购物车模块 远程客户端 依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-shop-cart-remote</artifactId>
|
||||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
|
Loading…
Reference in New Issue