活动优惠模块
This commit is contained in:
@@ -6,10 +6,9 @@ import com.atguigu.ssyx.product.service.CategoryService;
|
||||
import com.atguigu.ssyx.product.service.SkuInfoService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ClassName: ProductInnnerController
|
||||
@@ -40,4 +39,15 @@ public class ProductInnnerController {
|
||||
return skuInfoService.getById(skuId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量获取sku信息")
|
||||
@PostMapping("inner/findSkuInfoList")
|
||||
public List<SkuInfo> findSkuInfoList(@RequestBody List<Long> skuIdList) {
|
||||
return skuInfoService.findSkuInfoList(skuIdList);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据关键字获取sku列表")
|
||||
@GetMapping("inner/findSkuInfoByKeyword/{keyword}")
|
||||
public List<SkuInfo> findSkuInfoByKeyword(@PathVariable("keyword") String keyword) {
|
||||
return skuInfoService.findSkuInfoByKeyword(keyword);
|
||||
}
|
||||
}
|
||||
|
@@ -83,7 +83,6 @@ public class SkuInfoController {
|
||||
|
||||
@ApiOperation(value = "删除商品sku信息")
|
||||
@DeleteMapping("remove/{id}")
|
||||
//TODO 删除es
|
||||
public Result remove(@PathVariable Long id) {
|
||||
try {
|
||||
skuInfoService.deleteById(id);
|
||||
@@ -95,7 +94,6 @@ public class SkuInfoController {
|
||||
|
||||
@ApiOperation(value = "根据id列表删除商品sku信息")
|
||||
@DeleteMapping("batchRemove")
|
||||
//TODO 删除es
|
||||
public Result batchRemove(@RequestBody List<Long> idList) {
|
||||
try {
|
||||
skuInfoService.deleteByIds(idList);
|
||||
|
@@ -18,21 +18,84 @@ import java.util.List;
|
||||
* @since 2023-09-15
|
||||
*/
|
||||
public interface SkuInfoService extends IService<SkuInfo> {
|
||||
/**
|
||||
* 获取sku分页列表
|
||||
*
|
||||
* @param pageParam
|
||||
* @param skuInfoQueryVo
|
||||
* @return
|
||||
*/
|
||||
IPage<SkuInfo> selectPage(Page<SkuInfo> pageParam, SkuInfoQueryVo skuInfoQueryVo);
|
||||
|
||||
/**
|
||||
* 新增商品sku信息
|
||||
*
|
||||
* @param skuInfoVo
|
||||
*/
|
||||
void saveSkuInfo(SkuInfoVo skuInfoVo);
|
||||
|
||||
/**
|
||||
* 获取商品sku信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SkuInfoVo getSkuInfoVo(Long id);
|
||||
|
||||
void updateSkuInfo(SkuInfoVo skuInfoVo);
|
||||
|
||||
/**
|
||||
* a商品审核
|
||||
*
|
||||
* @param skuId
|
||||
* @param status
|
||||
*/
|
||||
void check(Long skuId, Integer status);
|
||||
|
||||
/**
|
||||
* 商品上/下架
|
||||
*
|
||||
* @param skuId
|
||||
* @param status
|
||||
*/
|
||||
|
||||
void publish(Long skuId, Integer status);
|
||||
|
||||
/**
|
||||
* 新人专享
|
||||
*
|
||||
* @param skuId
|
||||
* @param status
|
||||
*/
|
||||
void isNewPerson(Long skuId, Integer status);
|
||||
|
||||
/**
|
||||
* 根据id列表删除商品sku信息
|
||||
*
|
||||
* @param idList
|
||||
*/
|
||||
void deleteByIds(List<Long> idList);
|
||||
|
||||
/**
|
||||
* 根据id删除商品sku信息
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 批量获取sku信息
|
||||
*
|
||||
* @param skuIdList
|
||||
* @return
|
||||
*/
|
||||
List<SkuInfo> findSkuInfoList(List<Long> skuIdList);
|
||||
|
||||
/**
|
||||
* 根据关键字获取sku列表
|
||||
*
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
List<SkuInfo> findSkuInfoByKeyword(String keyword);
|
||||
}
|
||||
|
@@ -236,6 +236,11 @@ public class SkuInfoServiceImpl extends ServiceImpl<SkuInfoMapper, SkuInfo> impl
|
||||
baseMapper.updateById(skuInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删商品sku信息
|
||||
*
|
||||
* @param idList
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<Long> idList) {
|
||||
baseMapper.deleteBatchIds(idList);
|
||||
@@ -246,6 +251,11 @@ public class SkuInfoServiceImpl extends ServiceImpl<SkuInfoMapper, SkuInfo> impl
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID批量删商品sku信息
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(Long id) {
|
||||
baseMapper.deleteById(id);
|
||||
@@ -254,6 +264,28 @@ public class SkuInfoServiceImpl extends ServiceImpl<SkuInfoMapper, SkuInfo> impl
|
||||
rabbitService.sendMessage(MqConst.EXCHANGE_GOODS_DIRECT, MqConst.ROUTING_GOODS_LOWER, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量获取sku信息
|
||||
*
|
||||
* @param skuIdList
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SkuInfo> findSkuInfoList(List<Long> skuIdList) {
|
||||
return baseMapper.selectBatchIds(skuIdList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据关键字获取sku列表
|
||||
*
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SkuInfo> findSkuInfoByKeyword(String keyword) {
|
||||
return baseMapper.selectList(new LambdaQueryWrapper<SkuInfo>().like(SkuInfo::getSkuName, keyword));
|
||||
}
|
||||
|
||||
private SkuInfoVo getSkuInfoDB(Long skuId) {
|
||||
SkuInfoVo skuInfoVo = new SkuInfoVo();
|
||||
|
||||
|
@@ -4,7 +4,7 @@ server:
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
type-enums-package: com.atguigu.ssyx.enums
|
||||
spring:
|
||||
datasource:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
|
Reference in New Issue
Block a user