feat(新增): 获取分页列表、获取活动规则
This commit is contained in:
parent
5e5b2d4854
commit
eb22d344b3
|
@ -57,5 +57,19 @@
|
|||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
<data-source source="LOCAL" name="shequ-activity@106.15.251.123" uuid="5ca43232-baa4-471e-9ed7-f45169d4cda5">
|
||||
<driver-ref>mysql.8</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<imported>true</imported>
|
||||
<remarks>$PROJECT_DIR$/service/service-activity/src/main/resources/application.yml</remarks>
|
||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://106.15.251.123:3305/shequ-activity?serverTimezone=GMT</jdbc-url>
|
||||
<jdbc-additional-properties>
|
||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
|
@ -1,5 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<writeAnnotations>
|
||||
<writeAnnotation name="com.baomidou.mybatisplus.annotation.EnumValue" />
|
||||
</writeAnnotations>
|
||||
</component>
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.atguigu.ssyx.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
|
@ -8,9 +7,8 @@ public enum ActivityType {
|
|||
FULL_REDUCTION(1, "满减"),
|
||||
FULL_DISCOUNT(2, "满量打折");
|
||||
|
||||
@EnumValue
|
||||
private Integer code ;
|
||||
private String comment ;
|
||||
private final String comment;
|
||||
private final Integer code;
|
||||
|
||||
ActivityType(Integer code, String comment) {
|
||||
this.code = code;
|
||||
|
|
|
@ -6,9 +6,11 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel(description = "SkuInfo")
|
||||
@TableName("sku_info")
|
||||
|
|
|
@ -6,12 +6,22 @@ import com.atguigu.ssyx.model.product.SkuInfo;
|
|||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(value = "service-product", path = "/api/product")
|
||||
public interface ProductFeignClient {
|
||||
// 根据分类id获取分类信息
|
||||
@GetMapping("inner/getCategory/{categoryId}")
|
||||
Result<Category> getCategory(@PathVariable Long categoryId);
|
||||
|
||||
// 根据skuId获取sku信息
|
||||
@GetMapping("inner/getSkuInfo/{skuId}")
|
||||
Result<SkuInfo> getSkuInfo(@PathVariable Long skuId);
|
||||
|
||||
// 根据skuId得到sku信息列表
|
||||
@PostMapping("inner/findSkuInfoList")
|
||||
Result<List<SkuInfo>> findSkuInfoList(@RequestBody List<Long> skuIdList);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.atguigu</groupId>
|
||||
<artifactId>service-product-client</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.atguigu.ssyx.activity;
|
|||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
|
@ -10,6 +12,8 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|||
"com.atguigu.ssyx.common",
|
||||
"com.atguigu.ssyx.activity"})
|
||||
@EnableTransactionManagement
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients(basePackages = {"com.atguigu.ssyx.client"})
|
||||
public class ServiceActivityApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ServiceActivityApplication.class, args);
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package com.atguigu.ssyx.activity.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.ParameterBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.schema.ModelRef;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.Contact;
|
||||
import springfox.documentation.service.Parameter;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
@EnableSwagger2WebMvc
|
||||
public class Knife4jConfig {
|
||||
@Bean
|
||||
public Docket adminApiConfig() {
|
||||
List<Parameter> pars = new ArrayList<>();
|
||||
ParameterBuilder tokenPar = new ParameterBuilder();
|
||||
tokenPar.name("adminId")
|
||||
.description("用户token")
|
||||
.defaultValue("1")
|
||||
.modelRef(new ModelRef("string"))
|
||||
.parameterType("header")
|
||||
.required(false)
|
||||
.build();
|
||||
pars.add(tokenPar.build());
|
||||
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.groupName("活动相关API")
|
||||
.apiInfo(adminApiInfo())
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("com.atguigu.ssyx.activity.controller"))
|
||||
.paths(PathSelectors.regex("/admin/.*"))
|
||||
.build()
|
||||
.globalOperationParameters(pars);
|
||||
}
|
||||
|
||||
private ApiInfo adminApiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title("后台管理系统-API文档")
|
||||
.description("本文档描述了尚上优选后台系统服务接口定义")
|
||||
.version("1.0")
|
||||
.contact(new Contact("atguigu", "http://atguigu.com", "atguigu"))
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -2,23 +2,95 @@ package com.atguigu.ssyx.activity.controller;
|
|||
|
||||
|
||||
import com.atguigu.ssyx.activity.service.ActivityInfoService;
|
||||
import com.atguigu.ssyx.common.result.Result;
|
||||
import com.atguigu.ssyx.model.activity.ActivityInfo;
|
||||
import com.atguigu.ssyx.model.product.SkuInfo;
|
||||
import com.atguigu.ssyx.vo.activity.ActivityRuleVo;
|
||||
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.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 活动表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author bunny
|
||||
* @since 2024-04-04
|
||||
*/
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Api(tags = "活动相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/admin/activity/activityInfo")
|
||||
public class ActivityInfoController {
|
||||
@Autowired
|
||||
private ActivityInfoService activityInfoService;
|
||||
|
||||
@ApiOperation(value = "获取分页列表")
|
||||
@GetMapping("{page}/{limit}")
|
||||
public Result<IPage<ActivityInfo>> index(
|
||||
@ApiParam(name = "page", value = "当前页码", required = true) @PathVariable Long page,
|
||||
@ApiParam(name = "limit", value = "每页记录数", required = true) @PathVariable Long limit
|
||||
) {
|
||||
Page<ActivityInfo> pageParam = new Page<>(page, limit);
|
||||
IPage<ActivityInfo> pageModel = activityInfoService.selectPage(pageParam);
|
||||
return Result.success(pageModel);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取活动")
|
||||
@GetMapping("get/{id}")
|
||||
public Result<ActivityInfo> get(@PathVariable Long id) {
|
||||
ActivityInfo activityInfo = activityInfoService.getById(id);
|
||||
activityInfo.setActivityTypeString(activityInfo.getActivityType().getComment());
|
||||
return Result.success(activityInfo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新建活动")
|
||||
@PostMapping("save")
|
||||
public Result<ActivityInfo> save(@RequestBody ActivityInfo activityInfo) {
|
||||
activityInfo.setCreateTime(new Date());
|
||||
activityInfoService.save(activityInfo);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改活动")
|
||||
@PutMapping("update")
|
||||
public Result<ActivityInfo> updateById(@RequestBody ActivityInfo activityInfo) {
|
||||
activityInfoService.updateById(activityInfo);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除活动")
|
||||
@DeleteMapping("remove/{id}")
|
||||
public Result<ActivityInfo> remove(@PathVariable Long id) {
|
||||
activityInfoService.removeById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据id列表删除活动")
|
||||
@DeleteMapping("batchRemove")
|
||||
public Result<ActivityInfo> batchRemove(@RequestBody List<String> ids) {
|
||||
activityInfoService.removeByIds(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取活动规则")
|
||||
@GetMapping("findActivityRuleList/{id}")
|
||||
public Result<Map<String, Object>> findActivityRuleList(@PathVariable Long id) {
|
||||
return Result.success(activityInfoService.findActivityRuleList(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增活动规则")
|
||||
@PostMapping("saveActivityRule")
|
||||
public Result<ActivityInfo> saveActivityRule(@RequestBody ActivityRuleVo activityRuleVo) {
|
||||
activityInfoService.saveActivityRule(activityRuleVo);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据关键字获取sku列表,活动使用")
|
||||
@GetMapping("findSkuInfoByKeyword/{keyword}")
|
||||
public Result<List<SkuInfo>> findSkuInfoByKeyword(@PathVariable("keyword") String keyword) {
|
||||
return Result.success(activityInfoService.findSkuInfoByKeyword(keyword));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.atguigu.ssyx.activity.mapper;
|
|||
|
||||
import com.atguigu.ssyx.model.activity.ActivityInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -11,6 +12,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
* @author bunny
|
||||
* @since 2024-04-04
|
||||
*/
|
||||
@Mapper
|
||||
public interface ActivityInfoMapper extends BaseMapper<ActivityInfo> {
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package com.atguigu.ssyx.activity.mapper;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.ActivityRule;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ActivityRuleMapper extends BaseMapper<ActivityRule> {
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.atguigu.ssyx.activity.mapper;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.ActivitySku;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ActivitySkuMapper extends BaseMapper<ActivitySku> {
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.atguigu.ssyx.activity.mapper;
|
|||
|
||||
import com.atguigu.ssyx.model.activity.CouponInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -11,6 +12,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
* @author bunny
|
||||
* @since 2024-04-04
|
||||
*/
|
||||
@Mapper
|
||||
public interface CouponInfoMapper extends BaseMapper<CouponInfo> {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,16 +1,45 @@
|
|||
package com.atguigu.ssyx.activity.service;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.ActivityInfo;
|
||||
import com.atguigu.ssyx.model.product.SkuInfo;
|
||||
import com.atguigu.ssyx.vo.activity.ActivityRuleVo;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 活动表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author bunny
|
||||
* @since 2024-04-04
|
||||
*/
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ActivityInfoService extends IService<ActivityInfo> {
|
||||
|
||||
/**
|
||||
* 获取分页列表
|
||||
*
|
||||
* @param pageParam 分页查询条件
|
||||
* @return 分页结果
|
||||
*/
|
||||
IPage<ActivityInfo> selectPage(Page<ActivityInfo> pageParam);
|
||||
|
||||
/**
|
||||
* 获取活动规则
|
||||
*
|
||||
* @param id 当前id
|
||||
* @return 返回集合
|
||||
*/
|
||||
Map<String, Object> findActivityRuleList(Long id);
|
||||
|
||||
/**
|
||||
* 新增活动规则
|
||||
*
|
||||
* @param activityRuleVo 活动规则
|
||||
*/
|
||||
void saveActivityRule(ActivityRuleVo activityRuleVo);
|
||||
|
||||
/**
|
||||
* 根据关键字获取sku列表,活动使用
|
||||
*
|
||||
* @param keyword 关键字
|
||||
* @return 活动列表
|
||||
*/
|
||||
List<SkuInfo> findSkuInfoByKeyword(String keyword);
|
||||
}
|
||||
|
|
|
@ -1,20 +1,92 @@
|
|||
package com.atguigu.ssyx.activity.service.impl;
|
||||
|
||||
import com.atguigu.ssyx.activity.mapper.ActivityInfoMapper;
|
||||
import com.atguigu.ssyx.activity.mapper.ActivityRuleMapper;
|
||||
import com.atguigu.ssyx.activity.mapper.ActivitySkuMapper;
|
||||
import com.atguigu.ssyx.activity.service.ActivityInfoService;
|
||||
import com.atguigu.ssyx.client.product.ProductFeignClient;
|
||||
import com.atguigu.ssyx.model.activity.ActivityInfo;
|
||||
import com.atguigu.ssyx.model.activity.ActivityRule;
|
||||
import com.atguigu.ssyx.model.activity.ActivitySku;
|
||||
import com.atguigu.ssyx.model.product.SkuInfo;
|
||||
import com.atguigu.ssyx.vo.activity.ActivityRuleVo;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 活动表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author bunny
|
||||
* @since 2024-04-04
|
||||
*/
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class ActivityInfoServiceImpl extends ServiceImpl<ActivityInfoMapper, ActivityInfo> implements ActivityInfoService {
|
||||
@Autowired
|
||||
private ProductFeignClient productFeignClient;
|
||||
@Autowired
|
||||
private ActivityRuleMapper activityRuleMapper;
|
||||
@Autowired
|
||||
private ActivitySkuMapper activitySkuMapper;
|
||||
|
||||
/**
|
||||
* 获取分页列表
|
||||
*
|
||||
* @param pageParam 分页查询条件
|
||||
* @return 分页结果
|
||||
*/
|
||||
@Override
|
||||
public IPage<ActivityInfo> selectPage(Page<ActivityInfo> pageParam) {
|
||||
Page<ActivityInfo> page = page(pageParam);
|
||||
List<ActivityInfo> activityInfoList = page.getRecords();
|
||||
activityInfoList.forEach(activityInfo -> {
|
||||
String comment = activityInfo.getActivityType().getComment();
|
||||
activityInfo.setActivityTypeString(comment);
|
||||
});
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取活动规则
|
||||
*
|
||||
* @param id 当前id
|
||||
* @return 返回集合
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> findActivityRuleList(Long id) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
List<ActivityRule> activityInfoList = activityRuleMapper.selectList(Wrappers.<ActivityRule>lambdaQuery().eq(ActivityRule::getActivityId, id));
|
||||
result.put("activityRuleList", activityInfoList);
|
||||
|
||||
List<ActivitySku> activitySkuList = activitySkuMapper.selectList(Wrappers.<ActivitySku>lambdaQuery().eq(ActivitySku::getActivityId, id));
|
||||
List<Long> skuIdList = activitySkuList.stream().map(ActivitySku::getSkuId).collect(Collectors.toList());
|
||||
|
||||
// 通过远程调用根据skuId得到商品信息
|
||||
List<SkuInfo> skuInfoList = productFeignClient.findSkuInfoList(skuIdList).getData();
|
||||
result.put("skuInfoList", skuInfoList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增活动规则
|
||||
*
|
||||
* @param activityRuleVo 活动规则
|
||||
*/
|
||||
@Override
|
||||
public void saveActivityRule(ActivityRuleVo activityRuleVo) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据关键字获取sku列表,活动使用
|
||||
*
|
||||
* @param keyword 关键字
|
||||
* @return 活动列表
|
||||
*/
|
||||
@Override
|
||||
public List<SkuInfo> findSkuInfoByKeyword(String keyword) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<?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.atguigu.ssyx.activity.mapper.ActivityRuleMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,5 @@
|
|||
<?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.atguigu.ssyx.activity.mapper.ActivitySkuMapper">
|
||||
|
||||
</mapper>
|
|
@ -8,10 +8,9 @@ import com.atguigu.ssyx.product.service.SkuInfoService;
|
|||
import io.swagger.annotations.Api;
|
||||
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;
|
||||
|
||||
@Api(value = "远程调用接口", tags = "远程调用接口")
|
||||
@RestController
|
||||
|
@ -35,4 +34,11 @@ public class ProductInnerController {
|
|||
SkuInfo skuInfo = skuInfoService.getById(skuId);
|
||||
return Result.success(skuInfo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据skuId得到sku信息列表")
|
||||
@PostMapping("inner/findSkuInfoList")
|
||||
public Result<List<SkuInfo>> findSkuInfoList(@RequestBody List<Long> skuIdList) {
|
||||
List<SkuInfo> skuInfoList = skuInfoService.findSkuInfoList(skuIdList);
|
||||
return Result.success(skuInfoList);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* sku信息 服务类
|
||||
|
@ -71,4 +73,12 @@ public interface SkuInfoService extends IService<SkuInfo> {
|
|||
* @param status 商品状态
|
||||
*/
|
||||
void isNewPerson(Long skuId, Integer status);
|
||||
|
||||
/**
|
||||
* 根据skuId得到sku信息列表
|
||||
*
|
||||
* @param skuIdList skuId
|
||||
* @return List<SkuInfo>
|
||||
*/
|
||||
List<SkuInfo> findSkuInfoList(List<Long> skuIdList);
|
||||
}
|
||||
|
|
|
@ -223,4 +223,15 @@ public class SkuInfoServiceImpl extends ServiceImpl<SkuInfoMapper, SkuInfo> impl
|
|||
skuInfo.setIsNewPerson(status);
|
||||
baseMapper.updateById(skuInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据skuId得到sku信息列表
|
||||
*
|
||||
* @param skuIdList skuId
|
||||
* @return List<SkuInfo>
|
||||
*/
|
||||
@Override
|
||||
public List<SkuInfo> findSkuInfoList(List<Long> skuIdList) {
|
||||
return baseMapper.selectBatchIds(skuIdList);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue