+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 708b841..df6b8c1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -121,6 +121,13 @@
okhttp
4.9.3
+
+
+
+ cn.hutool
+ hutool-all
+ 5.8.25
+
diff --git a/service/pom.xml b/service/pom.xml
index 1013f23..c36e6ba 100644
--- a/service/pom.xml
+++ b/service/pom.xml
@@ -16,6 +16,7 @@
service-acl
service-sys
service-product
+ service-search
diff --git a/service/service-acl/src/main/resources/application.yml b/service/service-acl/src/main/resources/application.yml
index 4b98984..5c9022d 100644
--- a/service/service-acl/src/main/resources/application.yml
+++ b/service/service-acl/src/main/resources/application.yml
@@ -11,7 +11,7 @@ spring:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://${bunny.datasource.host}:${bunny.datasource.port}/${bunny.datasource.sqlData}?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true
username: ${bunny.datasource.username}
- password: "${bunny.datasource.password}"
+ password: ${bunny.datasource.password}
cloud:
sentinel:
diff --git a/service/service-product/Dockerfile b/service/service-product/Dockerfile
new file mode 100644
index 0000000..ef109ac
--- /dev/null
+++ b/service/service-product/Dockerfile
@@ -0,0 +1,21 @@
+FROM openjdk:17
+MAINTAINER bunny
+
+#系统编码
+ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
+
+# 设置时区,构建镜像时执行的命令
+RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
+RUN echo "Asia/Shanghai" > /etc/timezone
+
+# 设定工作目录
+WORKDIR /home/bunny
+
+# 复制jar包
+COPY target/*.jar /home/bunny/app.jar
+
+#启动容器时的进程
+ENTRYPOINT ["java","-jar","/home/bunny/app.jar"]
+
+#暴露 8080 端口
+EXPOSE 8080
\ No newline at end of file
diff --git a/service/service-product/pom.xml b/service/service-product/pom.xml
index 921dc11..5683617 100644
--- a/service/service-product/pom.xml
+++ b/service/service-product/pom.xml
@@ -18,6 +18,9 @@
-
+
+ cn.hutool
+ hutool-all
+
diff --git a/service/service-product/src/main/java/com/atguigu/ssyx/product/controller/SkuInfoController.java b/service/service-product/src/main/java/com/atguigu/ssyx/product/controller/SkuInfoController.java
index cd6dbc0..1f69e01 100644
--- a/service/service-product/src/main/java/com/atguigu/ssyx/product/controller/SkuInfoController.java
+++ b/service/service-product/src/main/java/com/atguigu/ssyx/product/controller/SkuInfoController.java
@@ -1,9 +1,20 @@
package com.atguigu.ssyx.product.controller;
-import org.springframework.web.bind.annotation.RequestMapping;
+import com.atguigu.ssyx.common.result.Result;
+import com.atguigu.ssyx.model.product.SkuInfo;
+import com.atguigu.ssyx.product.service.SkuInfoService;
+import com.atguigu.ssyx.vo.product.SkuInfoQueryVo;
+import com.atguigu.ssyx.vo.product.SkuInfoVo;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
-import org.springframework.web.bind.annotation.RestController;
+import java.util.List;
/**
*
@@ -13,9 +24,84 @@ import org.springframework.web.bind.annotation.RestController;
* @author bunny
* @since 2024-04-03
*/
+@Api(value = "SkuInfo管理", tags = "商品Sku管理")
@RestController
-@RequestMapping("/product/sku-info")
+@RequestMapping(value = "/admin/product/skuInfo")
public class SkuInfoController {
+ @Autowired
+ private SkuInfoService skuInfoService;
+ @ApiOperation(value = "获取sku分页列表")
+ @GetMapping("{page}/{limit}")
+ public Result> index(
+ @ApiParam(name = "page", value = "当前页码", required = true)
+ @PathVariable Long page,
+
+ @ApiParam(name = "limit", value = "每页记录数", required = true)
+ @PathVariable Long limit,
+
+ @ApiParam(name = "skuInfoQueryVo", value = "查询对象", required = false)
+ SkuInfoQueryVo skuInfoQueryVo) {
+ Page pageParam = new Page<>(page, limit);
+ IPage pageModel = skuInfoService.selectPage(pageParam, skuInfoQueryVo);
+ return Result.success(pageModel);
+ }
+
+ @ApiOperation(value = "商品添加方法")
+ @PostMapping("save")
+ public Result save(@RequestBody SkuInfoVo skuInfoVo) {
+ skuInfoService.saveSkuInfo(skuInfoVo);
+ return Result.success();
+ }
+
+ @ApiOperation(value = "获取商品SKU信息")
+ @GetMapping("get/{id}")
+ public Result get(@PathVariable Long id) {
+ SkuInfoVo skuInfoVo = skuInfoService.getSkuInfoVo(id);
+ return Result.success(skuInfoVo);
+ }
+
+ @ApiOperation(value = "修改商品sku信息")
+ @PutMapping("update")
+ public Result updateById(@RequestBody SkuInfoVo skuInfoVo) {
+ skuInfoService.updateSkuInfo(skuInfoVo);
+ return Result.success();
+ }
+
+ @ApiOperation(value = "商品SKU删除")
+ @DeleteMapping("remove/{id}")
+ public Result remove(@PathVariable Long id) {
+ skuInfoService.removeById(id);
+ return Result.success();
+ }
+
+ @ApiOperation(value = "根据id列表删除")
+ @DeleteMapping("batchRemove")
+ public Result batchRemove(@RequestBody List ids) {
+ skuInfoService.removeByIds(ids);
+ return Result.success();
+ }
+
+ @ApiOperation(value = "商品审核")
+ @GetMapping("check/{skuId}/{status}")
+ public Result check(@PathVariable Long skuId, @PathVariable Integer status) {
+ skuInfoService.check(skuId, status);
+ return Result.success();
+ }
+
+ @ApiOperation(value = "商品上架")
+ @GetMapping("publish/{skuId}/{status}")
+ public Result publish(@PathVariable("skuId") Long skuId,
+ @PathVariable("status") Integer status) {
+ skuInfoService.publish(skuId, status);
+ return Result.success();
+ }
+
+ @ApiOperation(value = "新人专享")
+ @GetMapping("isNewPerson/{skuId}/{status}")
+ public Result isNewPerson(@PathVariable Long skuId, @PathVariable Integer status) {
+ skuInfoService.isNewPerson(skuId, status);
+ return Result.success();
+ }
}
diff --git a/service/service-product/src/main/java/com/atguigu/ssyx/product/service/SkuAttrValueService.java b/service/service-product/src/main/java/com/atguigu/ssyx/product/service/SkuAttrValueService.java
index 120f6b1..bf55e8e 100644
--- a/service/service-product/src/main/java/com/atguigu/ssyx/product/service/SkuAttrValueService.java
+++ b/service/service-product/src/main/java/com/atguigu/ssyx/product/service/SkuAttrValueService.java
@@ -3,6 +3,8 @@ package com.atguigu.ssyx.product.service;
import com.atguigu.ssyx.model.product.SkuAttrValue;
import com.baomidou.mybatisplus.extension.service.IService;
+import java.util.List;
+
/**
*
* spu属性值 服务类
@@ -13,4 +15,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface SkuAttrValueService extends IService {
+ /**
+ * 根据id查询商品属性信息列表
+ *
+ * @param id 商品id
+ * @return 图片列表
+ */
+ List getAttrValueListBySkuId(Long id);
}
diff --git a/service/service-product/src/main/java/com/atguigu/ssyx/product/service/SkuImageService.java b/service/service-product/src/main/java/com/atguigu/ssyx/product/service/SkuImageService.java
index 26c3e76..5ce3529 100644
--- a/service/service-product/src/main/java/com/atguigu/ssyx/product/service/SkuImageService.java
+++ b/service/service-product/src/main/java/com/atguigu/ssyx/product/service/SkuImageService.java
@@ -3,6 +3,8 @@ package com.atguigu.ssyx.product.service;
import com.atguigu.ssyx.model.product.SkuImage;
import com.baomidou.mybatisplus.extension.service.IService;
+import java.util.List;
+
/**
*
* 商品图片 服务类
@@ -13,4 +15,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface SkuImageService extends IService {
+ /**
+ * 根据id查询商品图片列表
+ *
+ * @param id 商品id
+ * @return 商品图片列表
+ */
+ List getImageListBySkuId(Long id);
}
diff --git a/service/service-product/src/main/java/com/atguigu/ssyx/product/service/SkuInfoService.java b/service/service-product/src/main/java/com/atguigu/ssyx/product/service/SkuInfoService.java
index d9b08c9..a76aa13 100644
--- a/service/service-product/src/main/java/com/atguigu/ssyx/product/service/SkuInfoService.java
+++ b/service/service-product/src/main/java/com/atguigu/ssyx/product/service/SkuInfoService.java
@@ -1,6 +1,10 @@
package com.atguigu.ssyx.product.service;
import com.atguigu.ssyx.model.product.SkuInfo;
+import com.atguigu.ssyx.vo.product.SkuInfoQueryVo;
+import com.atguigu.ssyx.vo.product.SkuInfoVo;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
/**
@@ -13,4 +17,58 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface SkuInfoService extends IService {
+ /**
+ * 获取sku分页列表
+ *
+ * @param pageParam 分页查询条件
+ * @param skuInfoQueryVo 商品查询条件
+ * @return 分页结果
+ */
+ IPage selectPage(Page pageParam, SkuInfoQueryVo skuInfoQueryVo);
+
+ /**
+ * 商品添加方法
+ *
+ * @param skuInfoVo 商品信息
+ */
+ void saveSkuInfo(SkuInfoVo skuInfoVo);
+
+ /**
+ * 获取商品SKU信息
+ *
+ * @param id 商品id
+ * @return 商品信息
+ */
+ SkuInfoVo getSkuInfoVo(Long id);
+
+ /**
+ * 修改商品sku信息
+ *
+ * @param skuInfoVo 商品信息
+ */
+ void updateSkuInfo(SkuInfoVo skuInfoVo);
+
+ /**
+ * 商品审核
+ *
+ * @param skuId 商品ID
+ * @param status 商品状态
+ */
+ void check(Long skuId, Integer status);
+
+ /**
+ * 商品上架
+ *
+ * @param skuId 商品ID
+ * @param status 商品状态
+ */
+ void publish(Long skuId, Integer status);
+
+ /**
+ * 新人专享
+ *
+ * @param skuId 商品ID
+ * @param status 商品状态
+ */
+ void isNewPerson(Long skuId, Integer status);
}
diff --git a/service/service-product/src/main/java/com/atguigu/ssyx/product/service/SkuPosterService.java b/service/service-product/src/main/java/com/atguigu/ssyx/product/service/SkuPosterService.java
index abf22d1..52be52b 100644
--- a/service/service-product/src/main/java/com/atguigu/ssyx/product/service/SkuPosterService.java
+++ b/service/service-product/src/main/java/com/atguigu/ssyx/product/service/SkuPosterService.java
@@ -3,6 +3,8 @@ package com.atguigu.ssyx.product.service;
import com.atguigu.ssyx.model.product.SkuPoster;
import com.baomidou.mybatisplus.extension.service.IService;
+import java.util.List;
+
/**
*
* 商品海报表 服务类
@@ -13,4 +15,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface SkuPosterService extends IService {
+ /**
+ * 根据id查询商品海报列表
+ *
+ * @param id 商品id
+ * @return 图片列表
+ */
+ List getPosterListBySkuId(Long id);
}
diff --git a/service/service-product/src/main/java/com/atguigu/ssyx/product/service/impl/SkuAttrValueServiceImpl.java b/service/service-product/src/main/java/com/atguigu/ssyx/product/service/impl/SkuAttrValueServiceImpl.java
index 4f84a47..e65d7c0 100644
--- a/service/service-product/src/main/java/com/atguigu/ssyx/product/service/impl/SkuAttrValueServiceImpl.java
+++ b/service/service-product/src/main/java/com/atguigu/ssyx/product/service/impl/SkuAttrValueServiceImpl.java
@@ -3,9 +3,12 @@ package com.atguigu.ssyx.product.service.impl;
import com.atguigu.ssyx.model.product.SkuAttrValue;
import com.atguigu.ssyx.product.mapper.SkuAttrValueMapper;
import com.atguigu.ssyx.product.service.SkuAttrValueService;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
+import java.util.List;
+
/**
*
* spu属性值 服务实现类
@@ -17,4 +20,14 @@ import org.springframework.stereotype.Service;
@Service
public class SkuAttrValueServiceImpl extends ServiceImpl implements SkuAttrValueService {
+ /**
+ * 根据id查询商品属性信息列表
+ *
+ * @param id 商品id
+ * @return 图片列表
+ */
+ @Override
+ public List getAttrValueListBySkuId(Long id) {
+ return baseMapper.selectList(Wrappers.lambdaQuery().eq(SkuAttrValue::getSkuId, id));
+ }
}
diff --git a/service/service-product/src/main/java/com/atguigu/ssyx/product/service/impl/SkuImageServiceImpl.java b/service/service-product/src/main/java/com/atguigu/ssyx/product/service/impl/SkuImageServiceImpl.java
index c16cc9a..b6a363a 100644
--- a/service/service-product/src/main/java/com/atguigu/ssyx/product/service/impl/SkuImageServiceImpl.java
+++ b/service/service-product/src/main/java/com/atguigu/ssyx/product/service/impl/SkuImageServiceImpl.java
@@ -3,9 +3,12 @@ package com.atguigu.ssyx.product.service.impl;
import com.atguigu.ssyx.model.product.SkuImage;
import com.atguigu.ssyx.product.mapper.SkuImageMapper;
import com.atguigu.ssyx.product.service.SkuImageService;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
+import java.util.List;
+
/**
*
* 商品图片 服务实现类
@@ -16,5 +19,14 @@ import org.springframework.stereotype.Service;
*/
@Service
public class SkuImageServiceImpl extends ServiceImpl implements SkuImageService {
-
+ /**
+ * 根据id查询商品图片列表
+ *
+ * @param id 商品id
+ * @return 商品图片列表
+ */
+ @Override
+ public List getImageListBySkuId(Long id) {
+ return baseMapper.selectList(Wrappers.lambdaQuery().eq(SkuImage::getSkuId, id));
+ }
}
diff --git a/service/service-product/src/main/java/com/atguigu/ssyx/product/service/impl/SkuInfoServiceImpl.java b/service/service-product/src/main/java/com/atguigu/ssyx/product/service/impl/SkuInfoServiceImpl.java
index a6cb98b..f740277 100644
--- a/service/service-product/src/main/java/com/atguigu/ssyx/product/service/impl/SkuInfoServiceImpl.java
+++ b/service/service-product/src/main/java/com/atguigu/ssyx/product/service/impl/SkuInfoServiceImpl.java
@@ -1,10 +1,29 @@
package com.atguigu.ssyx.product.service.impl;
+import com.atguigu.ssyx.model.product.SkuAttrValue;
+import com.atguigu.ssyx.model.product.SkuImage;
import com.atguigu.ssyx.model.product.SkuInfo;
+import com.atguigu.ssyx.model.product.SkuPoster;
import com.atguigu.ssyx.product.mapper.SkuInfoMapper;
+import com.atguigu.ssyx.product.service.SkuAttrValueService;
+import com.atguigu.ssyx.product.service.SkuImageService;
import com.atguigu.ssyx.product.service.SkuInfoService;
+import com.atguigu.ssyx.product.service.SkuPosterService;
+import com.atguigu.ssyx.vo.product.SkuInfoQueryVo;
+import com.atguigu.ssyx.vo.product.SkuInfoVo;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import io.jsonwebtoken.lang.Collections;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
+import java.util.List;
/**
*
@@ -16,5 +35,185 @@ import org.springframework.stereotype.Service;
*/
@Service
public class SkuInfoServiceImpl extends ServiceImpl implements SkuInfoService {
+ @Autowired
+ private SkuAttrValueService skuAttrValueService;
+ @Autowired
+ private SkuImageService skuImageService;
+ @Autowired
+ private SkuPosterService skuPosterService;
+
+ /**
+ * 获取sku分页列表
+ *
+ * @param pageParam 分页查询条件
+ * @param vo 商品查询条件
+ * @return 分页结果
+ */
+ @Override
+ public IPage selectPage(Page pageParam, SkuInfoQueryVo vo) {
+ String keyword = vo.getKeyword();
+ String skuType = vo.getSkuType();
+ Long categoryId = vo.getCategoryId();
+
+ // 封装查询条件
+ LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>();
+ wrapper.like(!StringUtils.isEmpty(keyword), SkuInfo::getSkuName, keyword);
+ wrapper.eq(!StringUtils.isEmpty(skuType), SkuInfo::getSkuType, skuType);
+ wrapper.eq(categoryId != null, SkuInfo::getCategoryId, categoryId);
+
+ // 返回结果
+ return page(pageParam, wrapper);
+ }
+
+ /**
+ * 商品添加方法
+ *
+ * @param skuInfoVo 商品信息
+ */
+ @Override
+ public void saveSkuInfo(SkuInfoVo skuInfoVo) {
+ // 添加sku基本信息
+ SkuInfo skuInfo = new SkuInfo();
+ BeanUtils.copyProperties(skuInfoVo, skuInfo);
+ baseMapper.insert(skuInfo);
+ // 保存sku海报
+ List skuPosterList = skuInfoVo.getSkuPosterList();
+ if (!Collections.isEmpty(skuPosterList)) {
+ skuPosterList.forEach(skuPoster -> skuPoster.setSkuId(skuInfo.getId()));
+ skuPosterService.saveBatch(skuPosterList);
+ }
+ // 保存sku图片
+ List skuImagesList = skuInfoVo.getSkuImagesList();
+ if (!Collections.isEmpty(skuImagesList)) {
+ skuImagesList.forEach(skuImage -> skuImage.setSkuId(skuImage.getId()));
+ skuImageService.saveBatch(skuImagesList);
+ }
+ // 保存sku属性
+ List skuAttrValueList = skuInfoVo.getSkuAttrValueList();
+ if (!Collections.isEmpty(skuImagesList)) {
+ skuAttrValueList.forEach(skuAttrValue -> skuAttrValue.setSkuId(skuInfo.getId()));
+ skuAttrValueService.saveBatch(skuAttrValueList);
+ }
+ }
+
+ /**
+ * 获取商品SKU信息
+ *
+ * @param id 商品id
+ * @return 商品信息
+ */
+ @Override
+ public SkuInfoVo getSkuInfoVo(Long id) {
+ SkuInfoVo skuInfoVo = new SkuInfoVo();
+
+ // 根据id查询sku基本信息
+ SkuInfo skuInfo = baseMapper.selectById(id);
+
+ // 根据id查询商品图片列表
+ List skuImageList = skuImageService.getImageListBySkuId(id);
+
+ // 根据id查询商品海报列表
+ List skuPosterList = skuPosterService.getPosterListBySkuId(id);
+
+ // 根据id查询商品属性信息列表
+ List skuAttrValueList = skuAttrValueService.getAttrValueListBySkuId(id);
+
+ BeanUtils.copyProperties(skuInfo, skuInfoVo);
+ skuInfoVo.setSkuAttrValueList(skuAttrValueList);
+ skuInfoVo.setSkuImagesList(skuImageList);
+ skuInfoVo.setSkuPosterList(skuPosterList);
+
+ // 封装数据返回
+ return skuInfoVo;
+ }
+
+ /**
+ * 修改商品sku信息
+ *
+ * @param skuInfoVo 商品信息
+ */
+ @Override
+ public void updateSkuInfo(SkuInfoVo skuInfoVo) {
+ // 修改sku基本信息
+ SkuInfo skuInfo = new SkuInfo();
+ BeanUtils.copyProperties(skuInfo, skuInfo);
+ baseMapper.updateById(skuInfo);
+
+ // 海报信息
+ Long skuId = skuInfoVo.getId();
+ // 创建查询条件,并删除之前的海报内容
+ LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>();
+ wrapper.eq(SkuPoster::getSkuId, skuId);
+ skuPosterService.remove(wrapper);
+
+ // 设置海报图片skuId值,并完成添加
+ List skuPosterList = skuInfoVo.getSkuPosterList();
+ if (!CollectionUtils.isEmpty(skuPosterList)) {
+ skuPosterList.forEach(skuPoster -> skuPoster.setSkuId(skuId));
+ skuPosterService.saveBatch(skuPosterList);
+ }
+
+ // 商品图片
+ skuImageService.remove(Wrappers.lambdaQuery().eq(SkuImage::getSkuId, skuId));
+ List skuImagesList = skuInfoVo.getSkuImagesList();
+ if (!Collections.isEmpty(skuImagesList)) {
+ skuImagesList.forEach(skuImage -> skuImage.setSkuId(skuId));
+ skuImageService.saveBatch(skuImagesList);
+ }
+
+ // 商品属性
+ skuAttrValueService.remove(Wrappers.lambdaQuery().eq(SkuAttrValue::getSkuId, skuId));
+ List skuAttrValueList = skuInfoVo.getSkuAttrValueList();
+ if (!Collections.isEmpty(skuAttrValueList)) {
+ skuAttrValueList.forEach(skuAttrValue -> skuAttrValue.setSkuId(skuId));
+ skuAttrValueService.saveBatch(skuAttrValueList);
+ }
+ }
+
+ /**
+ * 商品审核
+ *
+ * @param skuId 商品ID
+ * @param status 商品状态
+ */
+ @Override
+ public void check(Long skuId, Integer status) {
+ SkuInfo skuInfo = new SkuInfo();
+ skuInfo.setId(skuId);
+ skuInfo.setCheckStatus(status);
+ updateById(skuInfo);
+ }
+
+ /**
+ * 商品上架
+ *
+ * @param skuId 商品ID
+ * @param status 商品状态
+ */
+ @Override
+ public void publish(Long skuId, Integer status) {
+ SkuInfo skuInfo = new SkuInfo();
+ skuInfo.setId(skuId);
+ if (status == 1) {
+ skuInfo.setPublishStatus(status);
+ } else {
+ skuInfo.setPublishStatus(0);
+ }
+ baseMapper.updateById(skuInfo);
+ }
+
+ /**
+ * 新人专享
+ *
+ * @param skuId 商品ID
+ * @param status 商品状态
+ */
+ @Override
+ public void isNewPerson(Long skuId, Integer status) {
+ SkuInfo skuInfo = new SkuInfo();
+ skuInfo.setId(skuId);
+ skuInfo.setIsNewPerson(status);
+ baseMapper.updateById(skuInfo);
+ }
}
diff --git a/service/service-product/src/main/java/com/atguigu/ssyx/product/service/impl/SkuPosterServiceImpl.java b/service/service-product/src/main/java/com/atguigu/ssyx/product/service/impl/SkuPosterServiceImpl.java
index 35edf9b..c7bba8c 100644
--- a/service/service-product/src/main/java/com/atguigu/ssyx/product/service/impl/SkuPosterServiceImpl.java
+++ b/service/service-product/src/main/java/com/atguigu/ssyx/product/service/impl/SkuPosterServiceImpl.java
@@ -3,9 +3,12 @@ package com.atguigu.ssyx.product.service.impl;
import com.atguigu.ssyx.model.product.SkuPoster;
import com.atguigu.ssyx.product.mapper.SkuPosterMapper;
import com.atguigu.ssyx.product.service.SkuPosterService;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
+import java.util.List;
+
/**
*
* 商品海报表 服务实现类
@@ -16,5 +19,14 @@ import org.springframework.stereotype.Service;
*/
@Service
public class SkuPosterServiceImpl extends ServiceImpl implements SkuPosterService {
-
+ /**
+ * 根据id查询商品海报列表
+ *
+ * @param id 商品id
+ * @return 图片列表
+ */
+ @Override
+ public List getPosterListBySkuId(Long id) {
+ return baseMapper.selectList(Wrappers.lambdaQuery().eq(SkuPoster::getSkuId, id));
+ }
}
diff --git a/service/service-product/src/main/resources/application.yml b/service/service-product/src/main/resources/application.yml
index 1d69fb6..8d33931 100644
--- a/service/service-product/src/main/resources/application.yml
+++ b/service/service-product/src/main/resources/application.yml
@@ -11,7 +11,7 @@ spring:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://${bunny.datasource.host}:${bunny.datasource.port}/${bunny.datasource.sqlData}?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true
username: ${bunny.datasource.username}
- password: "${bunny.datasource.password}"
+ password: ${bunny.datasource.password}
cloud:
sentinel:
diff --git a/service/service-search/Dockerfile b/service/service-search/Dockerfile
new file mode 100644
index 0000000..ef109ac
--- /dev/null
+++ b/service/service-search/Dockerfile
@@ -0,0 +1,21 @@
+FROM openjdk:17
+MAINTAINER bunny
+
+#系统编码
+ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
+
+# 设置时区,构建镜像时执行的命令
+RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
+RUN echo "Asia/Shanghai" > /etc/timezone
+
+# 设定工作目录
+WORKDIR /home/bunny
+
+# 复制jar包
+COPY target/*.jar /home/bunny/app.jar
+
+#启动容器时的进程
+ENTRYPOINT ["java","-jar","/home/bunny/app.jar"]
+
+#暴露 8080 端口
+EXPOSE 8080
\ No newline at end of file
diff --git a/service/service-search/pom.xml b/service/service-search/pom.xml
new file mode 100644
index 0000000..7d73f9f
--- /dev/null
+++ b/service/service-search/pom.xml
@@ -0,0 +1,32 @@
+
+ 4.0.0
+
+ com.atguigu
+ service
+ 1.0-SNAPSHOT
+
+
+ service-search
+ jar
+
+ service-search
+ https://maven.apache.org
+
+
+ UTF-8
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-elasticsearch
+
+
+
+
+
+
+
+
+
diff --git a/service/service-search/src/main/resources/application-dev.yml b/service/service-search/src/main/resources/application-dev.yml
new file mode 100644
index 0000000..642acdd
--- /dev/null
+++ b/service/service-search/src/main/resources/application-dev.yml
@@ -0,0 +1,27 @@
+server:
+ port: 8203
+
+bunny:
+ datasource:
+ host: 106.15.251.123
+ port: 3305
+ sqlData: shequ-product
+ username: root
+ password: "02120212"
+
+ nacos:
+ server-addr: z-bunny.cn:8848
+ discovery:
+ namespace: ssyx
+
+ redis:
+ host: 47.120.65.66
+ port: 6379
+ database: 2
+ password: "02120212"
+
+ minio:
+ endpointUrl: "http://129.211.31.58:9000"
+ bucket-name: ssyx
+ accessKey: bunny
+ secretKey: "02120212"
\ No newline at end of file
diff --git a/service/service-search/src/main/resources/application.yml b/service/service-search/src/main/resources/application.yml
new file mode 100644
index 0000000..8d33931
--- /dev/null
+++ b/service/service-search/src/main/resources/application.yml
@@ -0,0 +1,62 @@
+server:
+ port: 8203
+spring:
+ application:
+ name: service-product
+ profiles:
+ active: dev
+
+ datasource:
+ type: com.zaxxer.hikari.HikariDataSource
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ url: jdbc:mysql://${bunny.datasource.host}:${bunny.datasource.port}/${bunny.datasource.sqlData}?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true
+ username: ${bunny.datasource.username}
+ password: ${bunny.datasource.password}
+
+ cloud:
+ sentinel:
+ log:
+ dir: logs/${spring.application.name}/sentinel
+ nacos:
+ discovery:
+ namespace: ${bunny.nacos.discovery.namespace}
+ server-addr: ${bunny.nacos.server-addr}
+
+ jackson:
+ date-format: yyyy-MM-dd HH:mm:ss
+ time-zone: GMT+8
+
+
+mybatis-plus:
+ type-aliases-package: com.atguigu.model # 配置每个包前缀
+ mapper-locations: classpath:mapper/*.xml
+ configuration:
+ map-underscore-to-camel-case: true
+ auto-mapping-behavior: full
+ log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 查看日志
+ global-config:
+ db-config:
+ # 设置表名前缀,不用在每个tableName添加前缀
+ # table-prefix: t_
+ # 全局配置主键值方式
+ id-type: assign_id
+ logic-not-delete-value: 0 # 未删除默认为0
+ logic-delete-value: 1 # 删除
+ logic-delete-field: deleted # 全局配置逻辑删除
+
+logging:
+ level:
+ com.atguigu.ssyx.acl.mapper: debug
+ com.atguigu.ssyx.acl.controller: info
+ com.atguigu.ssyx.acl.service: info
+ pattern:
+ dateformat: HH:mm:ss:SSS
+ file:
+ path: "logs/${spring.application.name}"
+
+bunny:
+ minio:
+ endpointUrl: ${bunny.minio.endpointUrl}
+ accessKey: ${bunny.minio.accessKey}
+ secretKey: ${bunny.minio.secretKey}
+ bucket-name: ${bunny.minio.bucket-name}
\ No newline at end of file
diff --git a/service/service-search/src/main/resources/banner.txt b/service/service-search/src/main/resources/banner.txt
new file mode 100644
index 0000000..cc77fc2
--- /dev/null
+++ b/service/service-search/src/main/resources/banner.txt
@@ -0,0 +1,16 @@
+-----------------▄██-█▄---------
+-----------------███▄██▄--------
+-----------------███████--------
+-----------------▀███████-------
+-------------------██████▄▄-----
+-------------------█████████▄---
+-------------------██████▄████--
+-------▄███████████████████████-
+-----▄███████████████████████▀--
+---▄██████████████████████------
+---███████████████████████------
+---███████████████████████------
+-▄▄██████████████████████▀------
+-█████████████████▀█████--------
+-▀██████████████▀▀-▀█████▄------
+-------▀▀▀▀▀▀▀▀▀------▀▀▀▀------
\ No newline at end of file
diff --git a/service/service-search/src/main/resources/favicon.ico b/service/service-search/src/main/resources/favicon.ico
new file mode 100644
index 0000000..1ba397c
Binary files /dev/null and b/service/service-search/src/main/resources/favicon.ico differ
diff --git a/service/service-sys/src/main/resources/application.yml b/service/service-sys/src/main/resources/application.yml
index 35787e2..ae79b49 100644
--- a/service/service-sys/src/main/resources/application.yml
+++ b/service/service-sys/src/main/resources/application.yml
@@ -12,7 +12,7 @@ spring:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://${bunny.datasource.host}:${bunny.datasource.port}/${bunny.datasource.sqlData}?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true
username: ${bunny.datasource.username}
- password: "${bunny.datasource.password}"
+ password: ${bunny.datasource.password}
cloud:
sentinel: