重新修改框架,并加入原子序列缓存基准
parent
6c17b06a7c
commit
c7a203441f
|
@ -14,11 +14,11 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 115.159.211.196:8848
|
||||
server-addr: 115.159.81.159:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 115.159.211.196:8848
|
||||
namespace: b8ace5a6-28a3-4126-b109-9b6623c58dc0
|
||||
server-addr: 115.159.81.159:8848
|
||||
namespace: f394dee0-fead-4010-8359-2955bacca31f
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package com.muyu.cache;
|
||||
|
||||
import com.muyu.cache.docoration.DecorationKey;
|
||||
|
||||
/**
|
||||
* 原子序列缓存基准 AtomicSequenceCache
|
||||
*
|
||||
* @author DeKangLiu
|
||||
* on 2024/4/2
|
||||
*/
|
||||
public interface AtomicSequenceCache<K> extends DecorationKey<K>{
|
||||
|
||||
/**
|
||||
* 获取存储的值
|
||||
* @param key 键
|
||||
* @return 值
|
||||
*/
|
||||
public Long get(K key);
|
||||
|
||||
/**
|
||||
* 自增
|
||||
*/
|
||||
public Long increment(K key);
|
||||
|
||||
/**
|
||||
* 自减
|
||||
*/
|
||||
public Long decrement(K key);
|
||||
|
||||
/**
|
||||
* 增加数值
|
||||
*/
|
||||
public Long increment(K key,Long number);
|
||||
|
||||
/**
|
||||
* 减少数值
|
||||
*/
|
||||
public Long decrement(K key,Long number);
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
package com.muyu.cache;
|
||||
|
||||
import com.muyu.cache.docoration.DecorationKey;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* HashCache
|
||||
*
|
||||
* @author DeKangLiu
|
||||
* on 2024/4/1
|
||||
*/
|
||||
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 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,84 @@
|
|||
package com.muyu.cache.abs;
|
||||
|
||||
import com.muyu.cache.AtomicSequenceCache;
|
||||
import com.muyu.common.redis.service.RedisService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* 原子序列缓存抽象类 AtomicSequenceCacheAbs
|
||||
*
|
||||
* @author DeKangLiu
|
||||
* on 2024/4/2
|
||||
*/
|
||||
public abstract class AtomicSequenceCacheAbs<K> implements AtomicSequenceCache<K>{
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
/**
|
||||
* 获取存储的值
|
||||
* @param key 键
|
||||
* @return 值
|
||||
*/
|
||||
@Override
|
||||
public Long get(K key) {
|
||||
return this.redisService.getCacheObject(encode(key));
|
||||
}
|
||||
|
||||
/**
|
||||
* 自增
|
||||
* @param key
|
||||
*/
|
||||
@Override
|
||||
public Long increment(K key) {
|
||||
return this.increment(key,1L);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
自减
|
||||
*/
|
||||
@Override
|
||||
public Long decrement(K key) {
|
||||
return this.decrement(key,1L);
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加数值
|
||||
* @param key
|
||||
* @param number
|
||||
*/
|
||||
@Override
|
||||
public Long increment(K key, Long number) {
|
||||
Long numberValue = redisService.getCacheObject(encode(key));
|
||||
if (numberValue==null){
|
||||
Long data = getData(key);
|
||||
data=data==null?0L:data;
|
||||
redisService.setCacheObject(encode(key), data);
|
||||
}
|
||||
return redisService.increment(encode(key),number);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long decrement(K key, Long number) {
|
||||
Long numberValue = redisService.getCacheObject(encode(key));
|
||||
if (numberValue==null){
|
||||
Long data = getData(key);
|
||||
data=data==null?0L:data;
|
||||
redisService.setCacheObject(encode(key),data);
|
||||
}
|
||||
return redisService.decrement(encode(key),number);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编码
|
||||
* @param key ID
|
||||
* @return 键
|
||||
*/
|
||||
@Override
|
||||
public String encode(K key) {
|
||||
return keyPre()+key;
|
||||
}
|
||||
|
||||
public abstract Long getData(K key);
|
||||
}
|
135
muyu-common/muyu-common-cache/src/main/java/com/muyu/cache/abs/HashCacheAbs.java
vendored
100644
135
muyu-common/muyu-common-cache/src/main/java/com/muyu/cache/abs/HashCacheAbs.java
vendored
100644
|
@ -0,0 +1,135 @@
|
|||
package com.muyu.cache.abs;
|
||||
|
||||
import com.muyu.cache.HashCache;
|
||||
import com.muyu.common.redis.service.RedisService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* HashCacheAbs
|
||||
*
|
||||
* @author DeKangLiu
|
||||
* on 2024/4/1
|
||||
*/
|
||||
|
||||
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) {
|
||||
Map<String, HV> cacheMap = redisService.getCacheMap(encode(key));
|
||||
if (cacheMap==null||cacheMap.isEmpty()){
|
||||
Map<HK, HV> dataMap = getData(key);
|
||||
if (dataMap!=null&&!dataMap.isEmpty()){
|
||||
cacheMap=encodeMap(dataMap);
|
||||
}else {
|
||||
cacheMap=encodeMap(defaultValue());
|
||||
}
|
||||
redisService.setCacheMap(encode(key),cacheMap);
|
||||
}
|
||||
return decodeMap(cacheMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HV get(K key, HK hashKey) {
|
||||
HV hashValue = redisService.getCacheMapValue(encode(key), encodeHashKey(hashKey));
|
||||
if (hashKey==null){
|
||||
HV dataValue = getData(key, hashKey);
|
||||
hashValue=dataValue!=null?dataValue:defaultHashValue();
|
||||
put(key,hashKey,hashValue);
|
||||
}
|
||||
return hashValue;
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HV> getToList(K key) {
|
||||
Map<HK, HV> hkhvMap = get(key);
|
||||
return hkhvMap.values().stream().toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(K key, Map<HK, HV> map) {
|
||||
redisService.setCacheMap(encode(key),encodeMap(map));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(K key, HK hashKey, HV hashValue) {
|
||||
redisService.setCacheMapValue(encode(key),encodeHashKey(hashKey),hashValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(K key) {
|
||||
redisService.deleteObject(encode(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(K key, HK hashKey) {
|
||||
redisService.deleteCacheMapValue(encode(key),encodeHashKey(hashKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* 原始数据转编码数据
|
||||
* @param dataMap 原始数据
|
||||
* @return 编码数据
|
||||
*/
|
||||
private Map<String,HV> encodeMap(Map<HK,HV> dataMap){
|
||||
HashMap<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){
|
||||
HashMap<HK, HV> dataMap = new HashMap<>();
|
||||
encodeDataMap.forEach((hashKey,hashValue)->dataMap.put(decodeHashKey(hashKey),hashValue));
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
public abstract Map<HK ,HV> getData(K key);
|
||||
|
||||
public abstract HV getData(K key,HK hashKey);
|
||||
|
||||
public abstract Map<HK,HV> defaultValue();
|
||||
|
||||
public abstract HV defaultHashValue();
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.muyu.cache.docoration;
|
||||
|
||||
/**
|
||||
* DecorationKey
|
||||
*
|
||||
* @author DeKangLiu
|
||||
* on 2024/4/1
|
||||
*/
|
||||
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);
|
||||
}
|
|
@ -58,7 +58,7 @@ public class IpUtils {
|
|||
ip = request.getRemoteAddr();
|
||||
}
|
||||
|
||||
return "0:0:0:0:0:0:0:1".equals(ip) ? "115.159.211.196" : getMultistageReverseProxyIp(ip);
|
||||
return "0:0:0:0:0:0:0:1".equals(ip) ? "115.159.81.159" : getMultistageReverseProxyIp(ip);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,7 +70,7 @@ public class IpUtils {
|
|||
*/
|
||||
public static boolean internalIp (String ip) {
|
||||
byte[] addr = textToNumericFormatV4(ip);
|
||||
return internalIp(addr) || "115.159.211.196".equals(ip);
|
||||
return internalIp(addr) || "115.159.81.159".equals(ip);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -197,7 +197,7 @@ public class IpUtils {
|
|||
return InetAddress.getLocalHost().getHostAddress();
|
||||
} catch (UnknownHostException e) {
|
||||
}
|
||||
return "115.159.211.196";
|
||||
return "115.159.81.159";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -255,4 +255,24 @@ public class RedisService {
|
|||
public Collection<String> keys (final String pattern) {
|
||||
return redisTemplate.keys(pattern);
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加序列值
|
||||
* @param key key
|
||||
* @param number 值
|
||||
* @return 操作后的值
|
||||
*/
|
||||
public Long increment(final String key, Long number) {
|
||||
return redisTemplate.opsForValue().increment(key,number);
|
||||
}
|
||||
|
||||
/**
|
||||
* 减少序列值
|
||||
* @param key key
|
||||
* @param number 值
|
||||
* @return 操作后的值
|
||||
*/
|
||||
public Long decrement(final String key, Long number) {
|
||||
return redisTemplate.opsForValue().decrement(key,number);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,11 +14,11 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 115.159.211.196:8848
|
||||
server-addr: 115.159.81.159:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 115.159.211.196:8848
|
||||
namespace: b8ace5a6-28a3-4126-b109-9b6623c58dc0
|
||||
server-addr: 115.159.81.159:8848
|
||||
namespace: f394dee0-fead-4010-8359-2955bacca31f
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
@ -29,12 +29,12 @@ spring:
|
|||
eager: true
|
||||
transport:
|
||||
# 控制台地址
|
||||
dashboard: 115.159.211.196:8718
|
||||
dashboard: 115.159.81.159:8718
|
||||
# nacos配置持久化
|
||||
datasource:
|
||||
ds1:
|
||||
nacos:
|
||||
server-addr: 115.159.211.196:8848
|
||||
server-addr: 115.159.81.159:8848
|
||||
dataId: sentinel-muyu-gateway
|
||||
groupId: DEFAULT_GROUP
|
||||
data-type: json
|
||||
|
|
|
@ -14,11 +14,11 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 115.159.211.196:8848
|
||||
server-addr: 115.159.81.159:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 115.159.211.196:8848
|
||||
namespace: b8ace5a6-28a3-4126-b109-9b6623c58dc0
|
||||
server-addr: 115.159.81.159:8848
|
||||
namespace: f394dee0-fead-4010-8359-2955bacca31f
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -14,11 +14,11 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 115.159.211.196:8848
|
||||
server-addr: 115.159.81.159:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 115.159.211.196:8848
|
||||
namespace: b8ace5a6-28a3-4126-b109-9b6623c58dc0
|
||||
server-addr: 115.159.81.159:8848
|
||||
namespace: f394dee0-fead-4010-8359-2955bacca31f
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -14,11 +14,11 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 115.159.211.196:8848
|
||||
server-addr: 115.159.81.159:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 115.159.211.196:8848
|
||||
namespace: b8ace5a6-28a3-4126-b109-9b6623c58dc0
|
||||
server-addr: 115.159.81.159:8848
|
||||
namespace: f394dee0-fead-4010-8359-2955bacca31f
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.product.cache;
|
|||
|
||||
import com.muyu.cache.abs.CacheAbs;
|
||||
import com.muyu.common.core.text.Convert;
|
||||
import com.muyu.product.cache.datasource.ProjectInfoData;
|
||||
import com.muyu.product.domain.ProjectInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
package com.muyu.product.cache;
|
||||
|
||||
import com.muyu.cache.abs.HashCacheAbs;
|
||||
import com.muyu.common.core.text.Convert;
|
||||
import com.muyu.product.cache.datasource.ProjectSkuData;
|
||||
import com.muyu.product.domain.ProjectSkuInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* ProjectSkuCache
|
||||
*
|
||||
* @author DeKangLiu
|
||||
* on 2024/4/1
|
||||
*/
|
||||
@Component
|
||||
public class ProjectSkuCache extends HashCacheAbs<Long,String, ProjectSkuInfo>{
|
||||
|
||||
@Autowired
|
||||
private ProjectSkuData projectSkuData;
|
||||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "project:sku:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long decode(String redisKey) {
|
||||
return Convert.toLong(redisKey.replace(keyPre(),""));
|
||||
}
|
||||
@Override
|
||||
public String decodeHashKey(String redisHashKey) {
|
||||
return redisHashKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ProjectSkuInfo> getData(Long key) {
|
||||
return projectSkuData.getData(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProjectSkuInfo getData(Long key, String hashKey) {
|
||||
return projectSkuData.getData(key,hashKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ProjectSkuInfo> defaultValue() {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProjectSkuInfo defaultHashValue() {
|
||||
return new ProjectSkuInfo();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.muyu.product.cache;
|
||||
|
||||
/**
|
||||
* ProjectSkuStockCache
|
||||
*
|
||||
* @author DeKangLiu
|
||||
* on 2024/4/1
|
||||
*/
|
||||
public class ProjectSkuStockCache {
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.product.cache;
|
||||
package com.muyu.product.cache.datasource;
|
||||
|
||||
import com.muyu.product.domain.ProjectInfo;
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.muyu.product.cache.datasource;
|
||||
|
||||
import com.muyu.product.domain.ProjectSkuInfo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* ProjectSkuData
|
||||
*
|
||||
* @author DeKangLiu
|
||||
* on 2024/4/1
|
||||
*/
|
||||
public interface ProjectSkuData {
|
||||
|
||||
public Map<String, ProjectSkuInfo> getData(Long projectId);
|
||||
|
||||
public ProjectSkuInfo getData(Long projectId,String projectSku);
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.muyu.product.cache.datasource;
|
||||
|
||||
|
||||
import com.muyu.product.cache.key.SkuStockKey;
|
||||
|
||||
/**
|
||||
* ProjectSkuStockData
|
||||
*
|
||||
* @author DeKangLiu
|
||||
* on 2024/4/2
|
||||
*/
|
||||
public interface ProjectSkuStockData {
|
||||
public Long getData(SkuStockKey key);
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.product.cache.key;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* SkuStockKey
|
||||
*
|
||||
* @author DeKangLiu
|
||||
* on 2024/4/2
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SkuStockKey {
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* sku
|
||||
*/
|
||||
private String sku;
|
||||
}
|
|
@ -58,4 +58,8 @@ private List<TemplateAttributeModel> attributeInfoList;
|
|||
* 属性组集合
|
||||
*/
|
||||
private List<TemplateAttributeGroupModel> attributeGroupList;
|
||||
/**
|
||||
* 商品规格
|
||||
*/
|
||||
private List<RuleAttrAddModel> ruleAttrModelList;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.muyu.product.cache;
|
||||
package com.muyu.product.cache.impl;
|
||||
|
||||
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;
|
||||
|
@ -12,7 +13,7 @@ import org.springframework.stereotype.Service;
|
|||
* on 2024/3/27
|
||||
*/
|
||||
@Service
|
||||
public class ProjectInfoDataImpl implements ProjectInfoData{
|
||||
public class ProjectInfoDataImpl implements ProjectInfoData {
|
||||
@Autowired
|
||||
private ProjectInfoService projectInfoService;
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.muyu.product.cache.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.muyu.product.cache.datasource.ProjectSkuData;
|
||||
import com.muyu.product.domain.ProjectSkuInfo;
|
||||
import com.muyu.product.service.ProjectSkuInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* ProjectSkuDataImpl
|
||||
*
|
||||
* @author DeKangLiu
|
||||
* on 2024/4/1
|
||||
*/
|
||||
@Service
|
||||
public class ProjectSkuDataImpl implements ProjectSkuData{
|
||||
@Autowired
|
||||
private ProjectSkuInfoService projectSkuInfoService;
|
||||
@Override
|
||||
public Map<String, ProjectSkuInfo> getData(Long projectId) {
|
||||
LambdaQueryWrapper<ProjectSkuInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ProjectSkuInfo::getProjectId,projectId);
|
||||
List<ProjectSkuInfo> projectSkuInfoList = projectSkuInfoService.list(queryWrapper);
|
||||
|
||||
return projectSkuInfoList.stream().collect(Collectors.toMap(ProjectSkuInfo::getSku,projectSkuInfo -> projectSkuInfo));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProjectSkuInfo getData(Long projectId, String projectSku) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.muyu.product.cache.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.muyu.product.cache.datasource.ProjectSkuStockData;
|
||||
import com.muyu.product.cache.key.SkuStockKey;
|
||||
import com.muyu.product.domain.ProjectSkuInfo;
|
||||
import com.muyu.product.service.ProjectSkuInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* sku库存实体类 ProjectSkuStockDataImpl
|
||||
*
|
||||
* @author DeKangLiu
|
||||
* on 2024/4/2
|
||||
*/
|
||||
@Service
|
||||
public class ProjectSkuStockDataImpl implements ProjectSkuStockData{
|
||||
@Autowired
|
||||
private ProjectSkuInfoService projectSkuInfoService;
|
||||
|
||||
@Override
|
||||
public Long getData(SkuStockKey key) {
|
||||
LambdaQueryWrapper<ProjectSkuInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ProjectSkuInfo::getProjectId,key.getProjectId());
|
||||
queryWrapper.eq(ProjectSkuInfo::getSku,key.getSku());
|
||||
ProjectSkuInfo projectSkuInfo = projectSkuInfoService.getOne(queryWrapper);
|
||||
return projectSkuInfo.getStock();
|
||||
}
|
||||
}
|
|
@ -116,7 +116,6 @@ public class CategoryInfoController extends BaseController {
|
|||
categoryInfoService.util(id,categoryInfoEditReq);
|
||||
return toAjax(categoryInfoService.updateById(CategoryInfo.editBuild(id,categoryInfoEditReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除品类信息
|
||||
*/
|
||||
|
@ -126,10 +125,9 @@ public class CategoryInfoController extends BaseController {
|
|||
@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) {
|
||||
categoryInfoService.removeBatchById(ids);
|
||||
return toAjax(categoryInfoService.removeBatchByIds(ids));
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 通过品类ID获取父级以上的属性、属性组、品牌集合
|
||||
* @param categoryId 品类ID
|
||||
|
|
|
@ -53,7 +53,8 @@ public class ProjectInfoController extends BaseController {
|
|||
private AsProductAttributeInfoService asProductAttributeInfoService;
|
||||
@Autowired
|
||||
private ProjectSkuInfoService projectSkuInfoService;
|
||||
|
||||
@Autowired
|
||||
private ProjectInfoCache projectInfoCache;
|
||||
/**
|
||||
* 查询商品信息列表
|
||||
*/
|
||||
|
@ -96,42 +97,42 @@ public class ProjectInfoController extends BaseController {
|
|||
@GetMapping(value = "/cache/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||
public Result<ProjectInfo> getCacheInfo(@PathVariable("id") Long id) {
|
||||
return Result.success(projectInfoService.getById(id));
|
||||
}
|
||||
@Autowired
|
||||
private ProjectInfoCache projectInfoCache;
|
||||
@ApiOperation("获取商品信息详细信息")
|
||||
@RequiresPermissions("product:info:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||
public Result<ProjectInfo> getInfo(@PathVariable("id") Long id) {
|
||||
return Result.success(projectInfoCache.get(id));
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 获取商品信息详细信息
|
||||
// */
|
||||
// @Autowired
|
||||
// private ProjectInfoCache projectInfoCache;
|
||||
// @ApiOperation("获取商品信息详细信息")
|
||||
// @RequiresPermissions("product:info:query")
|
||||
// @GetMapping(value = "/{id}")
|
||||
// @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||
// public Result<ProjectAddModel> getInfo(@PathVariable("id") Long id) {
|
||||
//
|
||||
// LambdaQueryWrapper<AsProductAttributeInfo> asProductAttributeInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// asProductAttributeInfoLambdaQueryWrapper.eq(AsProductAttributeInfo::getProductId, id);
|
||||
// List<AsProductAttributeInfo> list = asProductAttributeInfoService.list(asProductAttributeInfoLambdaQueryWrapper);
|
||||
//
|
||||
// ProjectInfo projectInfo = projectInfoService.getById(id);
|
||||
// LambdaQueryWrapper<ProjectSkuInfo> projectSkuInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// projectSkuInfoLambdaQueryWrapper.eq(ProjectSkuInfo::getProjectId,id);
|
||||
// List<ProjectSkuInfo> projectSkuInfos = projectSkuInfoService.list(projectSkuInfoLambdaQueryWrapper);
|
||||
// ProjectAddModel projectAddModel = ProjectAddModel.queryBuild(projectInfo,
|
||||
// list, projectSkuInfos
|
||||
// );
|
||||
// projectAddModel.setId(id);
|
||||
// return Result.success(projectAddModel);
|
||||
// public Result<ProjectInfo> getInfo(@PathVariable("id") Long id) {
|
||||
// return Result.success(projectInfoCache.get(id));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取商品信息详细信息
|
||||
*/
|
||||
@ApiOperation("获取商品信息详细信息")
|
||||
@RequiresPermissions("product:info:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||
public Result<ProjectAddModel> getInfo(@PathVariable("id") Long id) {
|
||||
|
||||
LambdaQueryWrapper<AsProductAttributeInfo> asProductAttributeInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
asProductAttributeInfoLambdaQueryWrapper.eq(AsProductAttributeInfo::getProductId, id);
|
||||
List<AsProductAttributeInfo> list = asProductAttributeInfoService.list(asProductAttributeInfoLambdaQueryWrapper);
|
||||
|
||||
ProjectInfo projectInfo = projectInfoService.getById(id);
|
||||
LambdaQueryWrapper<ProjectSkuInfo> projectSkuInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
projectSkuInfoLambdaQueryWrapper.eq(ProjectSkuInfo::getProjectId,id);
|
||||
List<ProjectSkuInfo> projectSkuInfos = projectSkuInfoService.list(projectSkuInfoLambdaQueryWrapper);
|
||||
ProjectAddModel projectAddModel = ProjectAddModel.queryBuild(projectInfo,
|
||||
list, projectSkuInfos
|
||||
);
|
||||
projectAddModel.setId(id);
|
||||
return Result.success(projectAddModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品信息
|
||||
*/
|
||||
|
|
|
@ -69,7 +69,6 @@ public interface CategoryInfoService extends IService<CategoryInfo> {
|
|||
*/
|
||||
CategoryCommonElementResp getTemplateAttributeByCateGoryId (Long cateGoryId);
|
||||
|
||||
Boolean removeBatchById(List<Long> ids);
|
||||
|
||||
void util(Long id, CategoryInfoEditReq categoryInfoEditReq);
|
||||
|
||||
|
|
|
@ -352,7 +352,6 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
|
|||
if (asCategoryAttributeList != null && !asCategoryAttributeList.isEmpty()){
|
||||
List<Long> templateAttributeIdList = asCategoryAttributeList.stream()
|
||||
.map(AsCategoryAttribute::getAttributeId)
|
||||
.filter(templateAttributeId -> !attributeIdSet.contains(templateAttributeId))
|
||||
.toList();
|
||||
templateAttributeModelList = attributeInfoService.listByIds(templateAttributeIdList).stream()
|
||||
.map(AttributeInfo::buildTemplateModel)
|
||||
|
@ -378,33 +377,7 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
|
|||
.build();
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private AsCategoryAttributeGroupMapper asCategoryAttributeGroupMapper;
|
||||
@Autowired
|
||||
private AsCategoryAttributeMapper asCategoryAttributeMapper;
|
||||
@Autowired
|
||||
private AsCategoryBrandMapper asCategoryBrandMapper;
|
||||
/**
|
||||
* 删除中间表
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean removeBatchById(List<Long> ids) {
|
||||
//删除品类属性组中间表
|
||||
LambdaQueryWrapper<AsCategoryAttributeGroup> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(AsCategoryAttributeGroup::getAttributeGroupId, ids);
|
||||
asCategoryAttributeGroupMapper.delete(lambdaQueryWrapper);
|
||||
//删除品类属性中间表
|
||||
LambdaQueryWrapper<AsCategoryAttribute> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(AsCategoryAttribute::getAttributeId, ids);
|
||||
asCategoryAttributeMapper.delete(queryWrapper);
|
||||
//删除品类品牌中间
|
||||
LambdaQueryWrapper<AsCategoryBrand> asCategoryBrandLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
asCategoryBrandLambdaQueryWrapper.in(AsCategoryBrand::getBrandId, ids);
|
||||
asCategoryBrandMapper.delete(asCategoryBrandLambdaQueryWrapper);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void util(Long id, CategoryInfoEditReq categoryInfoEditReq) {
|
||||
|
@ -434,4 +407,3 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -213,36 +213,39 @@ private AsBrandProjectService asBrandProjectService;
|
|||
|
||||
@Override
|
||||
public ProjectDetailResp getDetailInfo(Long id) {
|
||||
//商品信息获取
|
||||
// 商品信息获取
|
||||
ProjectInfo projectInfo = this.getById(id);
|
||||
//品牌信息
|
||||
BrandInfo brandInfo =this.brandInfoService.getById(projectInfo.getBrandId());
|
||||
//品类集合
|
||||
// 品牌信息
|
||||
BrandInfo brandInfo = this.brandInfoService.getById(projectInfo.getBrandId());
|
||||
// 品类集合
|
||||
List<CategoryInfo> categoryInfoList = categoryInfoService.listByIds(new ArrayList<>() {{
|
||||
add(projectInfo.getMianType());
|
||||
add(projectInfo.getParentType());
|
||||
add(projectInfo.getType());
|
||||
}});
|
||||
//商品sku集合
|
||||
// 商品Sku集合
|
||||
List<ProjectSkuInfo> projectSkuInfoList = this.projectSkuInfoService.list(new LambdaQueryWrapper<>() {{
|
||||
eq(ProjectSkuInfo::getProjectId, id);
|
||||
}});
|
||||
//商品和属性集合
|
||||
List<AsProductAttributeInfo> productAttributeInfoList = this.asProductAttributeInfoService.list(new LambdaQueryWrapper<AsProductAttributeInfo>() {{
|
||||
|
||||
// 商品和属性集合
|
||||
List<AsProductAttributeInfo> productAttributeInfoList = this.asProductAttributeInfoService.list(new LambdaQueryWrapper<>() {{
|
||||
eq(AsProductAttributeInfo::getProductId, id);
|
||||
}});
|
||||
//商品规格
|
||||
List<RuleAttrAddModel> ruleAttrModelList = this.ruleAttrInfoService.list(new LambdaQueryWrapper<RuleAttrInfo>() {{
|
||||
// 商品规格
|
||||
List<RuleAttrAddModel> ruleAttrModelList = ruleAttrInfoService.list(new LambdaQueryWrapper<>() {{
|
||||
eq(RuleAttrInfo::getRuleId, projectInfo.getRuleId());
|
||||
}}).stream()
|
||||
.map(RuleAttrAddModel::infoBuild).toList();
|
||||
|
||||
|
||||
CategoryCommonElementResp templateAttribute = this.categoryInfoService.getTemplateAttributeByCateGoryId(projectInfo.getType());
|
||||
List<TemplateAttributeGroupModel> templateAttributeGroupList = templateAttribute.getTemplateAttributeGroupList();
|
||||
ArrayList<TemplateAttributeModel> templateAttributeList = new ArrayList<>() {{
|
||||
List<TemplateAttributeModel> templateAttributeList = new ArrayList<>(){{
|
||||
addAll(templateAttribute.getTemplateAttributeList());
|
||||
}};
|
||||
//属性组和商品属性的id
|
||||
ArrayList<Long> notInAttributeIdList = new ArrayList<>();
|
||||
// 属性组和商品属性的ID
|
||||
List<Long> notInAttributeIdList = new ArrayList<>();
|
||||
List<Long> attributeGroupIdList = templateAttributeGroupList.stream()
|
||||
.flatMap(templateAttributeGroupModel -> templateAttributeGroupModel.getAttributeList().stream())
|
||||
.map(TemplateAttributeModel::getId)
|
||||
|
@ -251,12 +254,12 @@ private AsBrandProjectService asBrandProjectService;
|
|||
.map(TemplateAttributeModel::getId)
|
||||
.toList();
|
||||
if (!attributeGroupIdList.isEmpty()){
|
||||
notInAttributeIdList.addAll(attributeGroupIdList);
|
||||
notInAttributeIdList.addAll( attributeGroupIdList );
|
||||
}
|
||||
if (!attributeIdList.isEmpty()){
|
||||
notInAttributeIdList.addAll(attributeIdList);
|
||||
notInAttributeIdList.addAll( attributeIdList );
|
||||
}
|
||||
|
||||
// 添加上,商品的自有属性
|
||||
List<AsProductAttributeInfo> productAttributeList = this.asProductAttributeInfoService.list(
|
||||
new LambdaQueryWrapper<>() {{
|
||||
eq(AsProductAttributeInfo::getProductId, projectInfo.getId());
|
||||
|
@ -265,17 +268,19 @@ private AsBrandProjectService asBrandProjectService;
|
|||
);
|
||||
|
||||
List<TemplateAttributeModel> projectAttributeList = new ArrayList<>();
|
||||
if (!projectAttributeList.isEmpty()){
|
||||
if (!productAttributeList.isEmpty()){
|
||||
List<Long> attrIdList = productAttributeList.stream()
|
||||
.map(AsProductAttributeInfo::getAttributeId)
|
||||
.toList();
|
||||
projectAttributeList = attributeInfoService.list(new LambdaQueryWrapper<>(){{
|
||||
projectAttributeList = attributeInfoService.list(
|
||||
new LambdaQueryWrapper<>() {{
|
||||
in(AttributeInfo::getId, attrIdList);
|
||||
}}).stream()
|
||||
}}
|
||||
).stream()
|
||||
.map(TemplateAttributeModel::attributeInfoBuild)
|
||||
.toList();
|
||||
}
|
||||
//把自由属性添加到商品属性的集合当中,进行合并
|
||||
// 把自有属性添加到商品属性的集合当中,进行合并
|
||||
if (!projectAttributeList.isEmpty()){
|
||||
templateAttributeList.addAll(projectAttributeList);
|
||||
}
|
||||
|
@ -285,7 +290,7 @@ private AsBrandProjectService asBrandProjectService;
|
|||
.categoryInfoList(categoryInfoList)
|
||||
.projectSkuInfoList(projectSkuInfoList)
|
||||
.productAttributeInfoList(productAttributeInfoList)
|
||||
.ruleAttrAddModelList(ruleAttrModelList)
|
||||
.ruleAttrModelList(ruleAttrModelList)
|
||||
.attributeInfoList(templateAttributeList)
|
||||
.attributeGroupList(templateAttributeGroupList)
|
||||
.build();
|
||||
|
|
|
@ -14,11 +14,11 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 115.159.211.196:8848
|
||||
server-addr: 115.159.81.159:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 115.159.211.196:8848
|
||||
namespace: b8ace5a6-28a3-4126-b109-9b6623c58dc0
|
||||
server-addr: 115.159.81.159:8848
|
||||
namespace: f394dee0-fead-4010-8359-2955bacca31f
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -10,12 +10,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="groupId" column="group_id" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updataBy" column="updata_by" />
|
||||
<result property="updataTime" column="updata_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAttributeInfoVo">
|
||||
select id, name, group_id, create_by, create_time, updata_by, updata_time, remark from attribute_info
|
||||
select id, name, group_id, create_by, create_time, update_time, update_time, remark from attribute_info
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<?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 muyu
|
||||
* @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;
|
||||
|
||||
/** 购物车id */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "购物车id", value = "购物车id")
|
||||
private Long id;
|
||||
|
||||
/** 商品ID */
|
||||
@Excel(name = "商品ID")
|
||||
@ApiModelProperty(name = "商品ID", value = "商品ID")
|
||||
private Long projectId;
|
||||
|
||||
/** SKU */
|
||||
@Excel(name = "SKU")
|
||||
@ApiModelProperty(name = "SKU", value = "SKU")
|
||||
private String projectSku;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户ID")
|
||||
@ApiModelProperty(name = "用户ID", value = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/** 数量 */
|
||||
@Excel(name = "数量")
|
||||
@ApiModelProperty(name = "数量", value = "数量")
|
||||
private Long num;
|
||||
|
||||
/** 是否选中 */
|
||||
@Excel(name = "是否选中")
|
||||
@ApiModelProperty(name = "是否选中", value = "是否选中")
|
||||
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 muyu
|
||||
* @date 2024-03-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "CartInfoEditReq", description = "购物车")
|
||||
public class CartInfoEditReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 商品ID */
|
||||
@ApiModelProperty(name = "商品ID", value = "商品ID")
|
||||
private Long projectId;
|
||||
|
||||
/** SKU */
|
||||
@ApiModelProperty(name = "SKU", value = "SKU")
|
||||
private String projectSku;
|
||||
|
||||
/** 用户ID */
|
||||
@ApiModelProperty(name = "用户ID", value = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/** 数量 */
|
||||
@ApiModelProperty(name = "数量", value = "数量")
|
||||
private Long num;
|
||||
|
||||
/** 是否选中 */
|
||||
@ApiModelProperty(name = "是否选中", value = "是否选中")
|
||||
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 muyu
|
||||
* @date 2024-03-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "CartInfoQueryReq", description = "购物车")
|
||||
public class CartInfoQueryReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 商品ID */
|
||||
@ApiModelProperty(name = "商品ID", value = "商品ID")
|
||||
private Long projectId;
|
||||
|
||||
/** SKU */
|
||||
@ApiModelProperty(name = "SKU", value = "SKU")
|
||||
private String projectSku;
|
||||
|
||||
/** 用户ID */
|
||||
@ApiModelProperty(name = "用户ID", value = "用户ID")
|
||||
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 muyu
|
||||
* @date 2024-03-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "CartInfoSaveReq", description = "购物车")
|
||||
public class CartInfoSaveReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 购物车id */
|
||||
|
||||
@ApiModelProperty(name = "购物车id", value = "购物车id")
|
||||
private Long id;
|
||||
|
||||
/** 商品ID */
|
||||
|
||||
@ApiModelProperty(name = "商品ID", value = "商品ID")
|
||||
private Long projectId;
|
||||
|
||||
/** SKU */
|
||||
|
||||
@ApiModelProperty(name = "SKU", value = "SKU")
|
||||
private String projectSku;
|
||||
|
||||
/** 用户ID */
|
||||
|
||||
@ApiModelProperty(name = "用户ID", value = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/** 数量 */
|
||||
|
||||
@ApiModelProperty(name = "数量", value = "数量")
|
||||
private Long num;
|
||||
|
||||
/** 是否选中 */
|
||||
|
||||
@ApiModelProperty(name = "是否选中", value = "是否选中")
|
||||
private String isSelected;
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<?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,114 @@
|
|||
<?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>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</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>
|
||||
<!-- 购物车模块 公共依赖-->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-shop-cart-common</artifactId>
|
||||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
<!-- 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>
|
||||
|
||||
</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 muyu
|
||||
* @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 muyu
|
||||
* @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 muyu
|
||||
* @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 muyu
|
||||
* @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,29 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9506
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: muyu-shop-cart
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 115.159.81.159:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 115.159.81.159:8848
|
||||
namespace: f394dee0-fead-4010-8359-2955bacca31f
|
||||
# 配置文件格式
|
||||
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>
|
|
@ -14,11 +14,11 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 115.159.211.196:8848
|
||||
server-addr: 115.159.81.159:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 115.159.211.196:8848
|
||||
namespace: b8ace5a6-28a3-4126-b109-9b6623c58dc0
|
||||
server-addr: 115.159.81.159:8848
|
||||
namespace: f394dee0-fead-4010-8359-2955bacca31f
|
||||
# 配置文件格式
|
||||
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>
|
||||
|
|
|
@ -14,11 +14,11 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 115.159.211.196:8848
|
||||
server-addr: 115.159.81.159:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 115.159.211.196:8848
|
||||
namespace: b8ace5a6-28a3-4126-b109-9b6623c58dc0
|
||||
server-addr: 115.159.81.159:8848
|
||||
namespace: f394dee0-fead-4010-8359-2955bacca31f
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
24
pom.xml
24
pom.xml
|
@ -212,6 +212,23 @@
|
|||
<artifactId>muyu-common-system</artifactId>
|
||||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-product-cache</artifactId>
|
||||
<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>
|
||||
|
||||
<!-- 商品模块 common 依赖 -->
|
||||
<dependency>
|
||||
|
@ -227,12 +244,6 @@
|
|||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 商品模块 缓存 依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-product-cache</artifactId>
|
||||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
@ -252,6 +263,7 @@
|
|||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Source Server : 本地5.7
|
||||
Source Server Type : MySQL
|
||||
Source Server Version : 50737
|
||||
Source Host : 115.159.211.196:3306
|
||||
Source Host : 115.159.81.159:3306
|
||||
Source Schema : product
|
||||
|
||||
Target Server Type : MySQL
|
||||
|
@ -243,9 +243,9 @@ CREATE TABLE `brand_info` (
|
|||
-- ----------------------------
|
||||
-- Records of brand_info
|
||||
-- ----------------------------
|
||||
INSERT INTO `brand_info` VALUES (1, '小米', 'http://115.159.211.196:9300/statics/2024/02/27/1709021128851_20240227160548A001.png', 'Y', '小米', '小米', 'admin', '2024-02-27 16:10:12', 'admin', '2024-02-27 16:16:27');
|
||||
INSERT INTO `brand_info` VALUES (2, '华为', 'http://115.159.211.196:9300/statics/2024/03/05/仓鼠_20240305092606A001.png', 'Y', NULL, NULL, 'admin', '2024-03-05 09:26:09', NULL, NULL);
|
||||
INSERT INTO `brand_info` VALUES (3, '苹果', 'http://115.159.211.196:9300/statics/2024/03/05/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240305092615A002.png', 'Y', NULL, NULL, 'admin', '2024-03-05 09:26:18', NULL, NULL);
|
||||
INSERT INTO `brand_info` VALUES (1, '小米', 'http://115.159.81.159:9300/statics/2024/02/27/1709021128851_20240227160548A001.png', 'Y', '小米', '小米', 'admin', '2024-02-27 16:10:12', 'admin', '2024-02-27 16:16:27');
|
||||
INSERT INTO `brand_info` VALUES (2, '华为', 'http://115.159.81.159:9300/statics/2024/03/05/仓鼠_20240305092606A001.png', 'Y', NULL, NULL, 'admin', '2024-03-05 09:26:09', NULL, NULL);
|
||||
INSERT INTO `brand_info` VALUES (3, '苹果', 'http://115.159.81.159:9300/statics/2024/03/05/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240305092615A002.png', 'Y', NULL, NULL, 'admin', '2024-03-05 09:26:18', NULL, NULL);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for category_info
|
||||
|
@ -269,17 +269,17 @@ CREATE TABLE `category_info` (
|
|||
-- ----------------------------
|
||||
-- Records of category_info
|
||||
-- ----------------------------
|
||||
INSERT INTO `category_info` VALUES (1, '节点1', 'http://115.159.211.196:9300/statics/2024/02/28/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240228170131A002.png', 0, 'Y', '介绍', NULL, 'admin', '2024-02-28 17:09:11', NULL, NULL);
|
||||
INSERT INTO `category_info` VALUES (2, '节点1-1', 'http://115.159.211.196:9300/statics/2024/02/28/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240228170926A003.png', 1, 'Y', '测试', NULL, 'admin', '2024-02-28 17:09:31', NULL, NULL);
|
||||
INSERT INTO `category_info` VALUES (3, '节点1-1-1', 'http://115.159.211.196:9300/statics/2024/02/28/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240228170944A004.png', 2, 'Y', '测试', NULL, 'admin', '2024-02-28 17:09:48', NULL, NULL);
|
||||
INSERT INTO `category_info` VALUES (4, '节点2', 'http://115.159.211.196:9300/statics/2024/02/28/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240228170956A005.png', 0, 'Y', '', NULL, 'admin', '2024-02-28 17:09:58', NULL, NULL);
|
||||
INSERT INTO `category_info` VALUES (5, '节点2-1', 'http://115.159.211.196:9300/statics/2024/02/28/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240228171012A006.png', 4, 'Y', '测试', NULL, 'admin', '2024-02-28 17:10:14', NULL, NULL);
|
||||
INSERT INTO `category_info` VALUES (6, '节点2-1-1', 'http://115.159.211.196:9300/statics/2024/02/28/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240228171031A007.png', 5, 'Y', '', NULL, 'admin', '2024-02-28 17:10:34', NULL, NULL);
|
||||
INSERT INTO `category_info` VALUES (7, '节点1-1-2', 'http://115.159.211.196:9300/statics/2024/02/28/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240228171047A008.png', 2, 'Y', '测试', NULL, 'admin', '2024-02-28 17:10:50', NULL, NULL);
|
||||
INSERT INTO `category_info` VALUES (13, '测试-1', 'http://115.159.211.196:9300/statics/2024/03/01/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240301114154A001.png', 0, 'Y', NULL, NULL, 'admin', '2024-03-01 11:42:03', NULL, NULL);
|
||||
INSERT INTO `category_info` VALUES (14, '测试1-1', 'http://115.159.211.196:9300/statics/2024/03/01/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240301114209A002.png', 13, 'Y', NULL, NULL, 'admin', '2024-03-01 11:42:22', NULL, NULL);
|
||||
INSERT INTO `category_info` VALUES (15, '测试1-2', 'http://115.159.211.196:9300/statics/2024/03/01/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240301114446A003.png', 13, 'Y', NULL, NULL, 'admin', '2024-03-01 11:44:56', NULL, NULL);
|
||||
INSERT INTO `category_info` VALUES (16, '测试1-1-1', 'http://115.159.211.196:9300/statics/2024/03/06/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240306162814A001.png', 14, 'Y', NULL, NULL, 'admin', '2024-03-06 16:28:27', NULL, NULL);
|
||||
INSERT INTO `category_info` VALUES (1, '节点1', 'http://115.159.81.159:9300/statics/2024/02/28/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240228170131A002.png', 0, 'Y', '介绍', NULL, 'admin', '2024-02-28 17:09:11', NULL, NULL);
|
||||
INSERT INTO `category_info` VALUES (2, '节点1-1', 'http://115.159.81.159:9300/statics/2024/02/28/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240228170926A003.png', 1, 'Y', '测试', NULL, 'admin', '2024-02-28 17:09:31', NULL, NULL);
|
||||
INSERT INTO `category_info` VALUES (3, '节点1-1-1', 'http://115.159.81.159:9300/statics/2024/02/28/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240228170944A004.png', 2, 'Y', '测试', NULL, 'admin', '2024-02-28 17:09:48', NULL, NULL);
|
||||
INSERT INTO `category_info` VALUES (4, '节点2', 'http://115.159.81.159:9300/statics/2024/02/28/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240228170956A005.png', 0, 'Y', '', NULL, 'admin', '2024-02-28 17:09:58', NULL, NULL);
|
||||
INSERT INTO `category_info` VALUES (5, '节点2-1', 'http://115.159.81.159:9300/statics/2024/02/28/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240228171012A006.png', 4, 'Y', '测试', NULL, 'admin', '2024-02-28 17:10:14', NULL, NULL);
|
||||
INSERT INTO `category_info` VALUES (6, '节点2-1-1', 'http://115.159.81.159:9300/statics/2024/02/28/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240228171031A007.png', 5, 'Y', '', NULL, 'admin', '2024-02-28 17:10:34', NULL, NULL);
|
||||
INSERT INTO `category_info` VALUES (7, '节点1-1-2', 'http://115.159.81.159:9300/statics/2024/02/28/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240228171047A008.png', 2, 'Y', '测试', NULL, 'admin', '2024-02-28 17:10:50', NULL, NULL);
|
||||
INSERT INTO `category_info` VALUES (13, '测试-1', 'http://115.159.81.159:9300/statics/2024/03/01/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240301114154A001.png', 0, 'Y', NULL, NULL, 'admin', '2024-03-01 11:42:03', NULL, NULL);
|
||||
INSERT INTO `category_info` VALUES (14, '测试1-1', 'http://115.159.81.159:9300/statics/2024/03/01/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240301114209A002.png', 13, 'Y', NULL, NULL, 'admin', '2024-03-01 11:42:22', NULL, NULL);
|
||||
INSERT INTO `category_info` VALUES (15, '测试1-2', 'http://115.159.81.159:9300/statics/2024/03/01/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240301114446A003.png', 13, 'Y', NULL, NULL, 'admin', '2024-03-01 11:44:56', NULL, NULL);
|
||||
INSERT INTO `category_info` VALUES (16, '测试1-1-1', 'http://115.159.81.159:9300/statics/2024/03/06/7GHOYz1SWffN43a77d257b422464c35bc1da44fc6742_20240306162814A001.png', 14, 'Y', NULL, NULL, 'admin', '2024-03-06 16:28:27', NULL, NULL);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for comment_info
|
||||
|
|
|
@ -67,8 +67,8 @@ create table sys_user (
|
|||
-- ----------------------------
|
||||
-- 初始化-用户信息表数据
|
||||
-- ----------------------------
|
||||
insert into sys_user values(1, 103, 'admin', '若依', '00', 'ry@163.com', '15888888888', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '115.159.211.196', sysdate(), 'admin', sysdate(), '', null, '管理员');
|
||||
insert into sys_user values(2, 105, 'ry', '若依', '00', 'ry@qq.com', '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '115.159.211.196', sysdate(), 'admin', sysdate(), '', null, '测试员');
|
||||
insert into sys_user values(1, 103, 'admin', '若依', '00', 'ry@163.com', '15888888888', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '115.159.81.159', sysdate(), 'admin', sysdate(), '', null, '管理员');
|
||||
insert into sys_user values(2, 105, 'ry', '若依', '00', 'ry@qq.com', '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '115.159.81.159', sysdate(), 'admin', sysdate(), '', null, '测试员');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
|
|
|
@ -40,7 +40,7 @@ insert into config_info(id, data_id, group_id, content, md5, gmt_create, gmt_mod
|
|||
(5,'muyu-system-dev.yml','DEFAULT_GROUP','# spring配置\nspring:\n redis:\n host: localhost\n port: 6379\n password:\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n # 主库数据源\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://localhost:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: root\n password: root\n # 从库数据源\n # slave:\n # username: \n # password: \n # url: \n # driver-class-name: \n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.muyu.system\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# swagger配置\nswagger:\n title: 系统模块接口文档\n license: Powered By muyu\n licenseUrl: https://muyu.vip','48e0ed4a040c402bdc2444213a82c910','2020-11-20 00:00:00','2022-09-29 02:49:09','nacos','0:0:0:0:0:0:0:1','','','系统模块','null','null','yaml','',''),
|
||||
(6,'muyu-gen-dev.yml','DEFAULT_GROUP','# spring配置\nspring:\n redis:\n host: localhost\n port: 6379\n password:\n datasource:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://localhost:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: root\n password: root\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.muyu.gen.domain\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# swagger配置\nswagger:\n title: 代码生成接口文档\n license: Powered By muyu\n licenseUrl: https://muyu.vip\n\n# 代码生成\ngen:\n # 作者\n author: muyu\n # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool\n packageName: com.muyu.system\n # 自动去除表前缀,默认是false\n autoRemovePre: false\n # 表前缀(生成类名不会包含表前缀,多个用逗号分隔)\n tablePrefix: sys_\n','eb592420b3fceae1402881887b8a6a0d','2020-11-20 00:00:00','2022-09-29 02:49:42','nacos','0:0:0:0:0:0:0:1','','','代码生成','null','null','yaml','',''),
|
||||
(7,'muyu-job-dev.yml','DEFAULT_GROUP','# spring配置\nspring:\n redis:\n host: localhost\n port: 6379\n password: \n datasource:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://localhost:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: root\n password: root\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.muyu.job.domain\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# swagger配置\nswagger:\n title: 定时任务接口文档\n license: Powered By muyu\n licenseUrl: https://muyu.vip\n','edcf0e3fe13fea07b4ec08b1088f30b3','2020-11-20 00:00:00','2022-09-29 02:50:50','nacos','0:0:0:0:0:0:0:1','','','定时任务','null','null','yaml','',''),
|
||||
(8,'muyu-file-dev.yml','DEFAULT_GROUP','# 本地文件上传 \r\nfile:\r\n domain: http://115.159.211.196:9300\r\n path: D:/muyu/uploadPath\r\n prefix: /statics\r\n\r\n# FastDFS配置\r\nfdfs:\r\n domain: http://8.129.231.12\r\n soTimeout: 3000\r\n connectTimeout: 2000\r\n trackerList: 8.129.231.12:22122\r\n\r\n# Minio配置\r\nminio:\r\n url: http://8.129.231.12:9000\r\n accessKey: minioadmin\r\n secretKey: minioadmin\r\n bucketName: test','5382b93f3d8059d6068c0501fdd41195','2020-11-20 00:00:00','2020-12-21 21:01:59',NULL,'0:0:0:0:0:0:0:1','','','文件服务','null','null','yaml',NULL,''),
|
||||
(8,'muyu-file-dev.yml','DEFAULT_GROUP','# 本地文件上传 \r\nfile:\r\n domain: http://115.159.81.159:9300\r\n path: D:/muyu/uploadPath\r\n prefix: /statics\r\n\r\n# FastDFS配置\r\nfdfs:\r\n domain: http://8.129.231.12\r\n soTimeout: 3000\r\n connectTimeout: 2000\r\n trackerList: 8.129.231.12:22122\r\n\r\n# Minio配置\r\nminio:\r\n url: http://8.129.231.12:9000\r\n accessKey: minioadmin\r\n secretKey: minioadmin\r\n bucketName: test','5382b93f3d8059d6068c0501fdd41195','2020-11-20 00:00:00','2020-12-21 21:01:59',NULL,'0:0:0:0:0:0:0:1','','','文件服务','null','null','yaml',NULL,''),
|
||||
(9,'sentinel-muyu-gateway','DEFAULT_GROUP','[\r\n {\r\n \"resource\": \"muyu-auth\",\r\n \"count\": 500,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"muyu-system\",\r\n \"count\": 1000,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"muyu-gen\",\r\n \"count\": 200,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"muyu-job\",\r\n \"count\": 300,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n }\r\n]','9f3a3069261598f74220bc47958ec252','2020-11-20 00:00:00','2020-11-20 00:00:00',NULL,'0:0:0:0:0:0:0:1','','','限流策略','null','null','json',NULL,'');
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue