diff --git a/src/main/java/com/sczx/car/controller/RuleItemController.java b/src/main/java/com/sczx/car/controller/RuleItemController.java new file mode 100644 index 0000000..017e728 --- /dev/null +++ b/src/main/java/com/sczx/car/controller/RuleItemController.java @@ -0,0 +1,31 @@ +package com.sczx.car.controller; + + +import com.sczx.car.common.Result; +import com.sczx.car.dto.RentBatteyRuleDTO; +import com.sczx.car.service.RentBatteyRuleService; +import com.sczx.car.service.RuleItemService; +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.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@Api(value = "套餐商品接口", tags = "套餐商品接口") +@RestController +@RequestMapping("/ruleitem") +public class RuleItemController { + + @Autowired + private RuleItemService ruleItemService; + + + @ApiOperation(value = "根据租电套餐id查询租电套餐") + @GetMapping("/queryiteminfo") + public Result getItemInfoByIds(@RequestParam(required = true) Long brandId,@RequestParam(required = true) Long carModelId, + @RequestParam(required = true) Long carRuleId,@RequestParam(required = true) Long batteryRuleId){ + return Result.ok(ruleItemService.getRentRuleItemByIds(brandId, carModelId, carRuleId, batteryRuleId)); + } +} diff --git a/src/main/java/com/sczx/car/dto/RuleItemDto.java b/src/main/java/com/sczx/car/dto/RuleItemDto.java new file mode 100644 index 0000000..59502e6 --- /dev/null +++ b/src/main/java/com/sczx/car/dto/RuleItemDto.java @@ -0,0 +1,147 @@ +package com.sczx.car.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + + +@ApiModel(value = "车型租赁规则项对象") +@Data +public class RuleItemDto{ + /** + * 车型ID + */ + @ApiModelProperty("ID") + private Long id; + + /** + * 外部商品ID + */ + @ApiModelProperty("外部商品ID") + private String outItemId; + + /** + * 阿里商品ID + */ + @ApiModelProperty("阿里商品ID") + private String aliItemId; + + /** + * 外部SKU ID + */ + @ApiModelProperty("外部SKU ID") + private String outSkuId; + + /** + * 商品描述 + */ + @ApiModelProperty("商品描述") + private String itemDesc; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * 车型名称 + */ + @ApiModelProperty("车型名称") + private String modelName; + + /** + * 电池类别名称 + */ + @ApiModelProperty("电池类别名称") + private String categoryName; + + /** + * 租赁天数(当类型为"按天数"时使用) + */ + @ApiModelProperty("租赁天数") + private Integer rentalDays; + + /** + * 套餐类型 + */ + @ApiModelProperty("套餐类型") + private String rentType; + + /** + * 套餐名称 + */ + @ApiModelProperty("套餐名称") + private String ruleName; + + @ApiModelProperty("支付宝页面路径") + private String pagePath; + /** + * 车型照片 + */ + @ApiModelProperty("车型照片") + private String image; + + /** + * 车型照片列表1 + */ + @ApiModelProperty("车型照片列表1") + private String imageList1; + + /** + * 车型照片列表2 + */ + @ApiModelProperty("车型照片列表2") + private String imageList2; + + /** + * 车型照片列表3 + */ + @ApiModelProperty("车型照片列表3") + private String imageList3; + + /** + * 是否支持免押(0不支持 1支持) + */ + @ApiModelProperty("是否支持免押(0不支持 1支持)") + private String depositFree; + + /** + * 押金价格(元) + */ + @ApiModelProperty("押金价格(元)") + private BigDecimal depositPrice; + + /** + * 租车价格(元) + */ + @ApiModelProperty("租车价格(元)") + private BigDecimal rentalPrice; + + /** + * 电池套餐ID + */ + @ApiModelProperty("电池套餐ID") + private Long batteryRuleId; + + /** + * 车辆套餐ID + */ + @ApiModelProperty("车辆套餐ID") + private Long carRuleId; + + /** + * 车型ID + */ + @ApiModelProperty("车型ID") + private Long carModelId; + + /** + * 品牌ID + */ + @ApiModelProperty("品牌ID") + private Long brandId; +} diff --git a/src/main/java/com/sczx/car/mapper/RuleItemMapper.java b/src/main/java/com/sczx/car/mapper/RuleItemMapper.java new file mode 100644 index 0000000..15daa52 --- /dev/null +++ b/src/main/java/com/sczx/car/mapper/RuleItemMapper.java @@ -0,0 +1,24 @@ +package com.sczx.car.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.sczx.car.po.RuleItemPo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + + +@Mapper +public interface RuleItemMapper extends BaseMapper { + /** + * 根据品牌ID、车型ID、车辆套餐ID和电池套餐ID查询套餐商品 + * + * @param brandId 品牌ID + * @param carModelId 车型ID + * @param carRuleId 车辆套餐ID + * @param batteryRuleId 电池套餐ID + * @return 套餐商品信息 + */ + RuleItemPo selectByRuleIds(@Param("brandId") Long brandId, + @Param("carModelId") Long carModelId, + @Param("carRuleId") Long carRuleId, + @Param("batteryRuleId") Long batteryRuleId); +} diff --git a/src/main/java/com/sczx/car/po/RuleItemPo.java b/src/main/java/com/sczx/car/po/RuleItemPo.java new file mode 100644 index 0000000..fa5816e --- /dev/null +++ b/src/main/java/com/sczx/car/po/RuleItemPo.java @@ -0,0 +1,92 @@ +package com.sczx.car.po; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.math.BigDecimal; + + +@Getter +@Setter +@TableName("zc_rent_rule_item") +@ApiModel(value = "RuleItemPo对象", description = "套餐商品对象") +public class RuleItemPo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("外部商品ID") + private String outItemId; + + @ApiModelProperty("阿里商品ID") + private String aliItemId; + + @ApiModelProperty("外部SKU ID") + private String outSkuId; + + @ApiModelProperty("商品描述") + private String itemDesc; + + @ApiModelProperty("品牌名称") + private String brandName; + + @ApiModelProperty("车型名称") + private String modelName; + + @ApiModelProperty("电池类别名称") + private String categoryName; + + @ApiModelProperty("租赁天数(当类型为\"按天数\"时使用)") + private Integer rentalDays; + + @ApiModelProperty("套餐类型") + private String rentType; + + @ApiModelProperty("套餐名称") + private String ruleName; + + @ApiModelProperty("支付宝页面路径") + private String pagePath; + + @ApiModelProperty("车型照片") + private String image; + + @ApiModelProperty("车型照片列表1") + private String imageList1; + + @ApiModelProperty("车型照片列表2") + private String imageList2; + + @ApiModelProperty("车型照片列表3") + private String imageList3; + + @ApiModelProperty("是否支持免押(0不支持 1支持)") + private String depositFree; + + @ApiModelProperty("押金价格(元)") + private BigDecimal depositPrice; + + @ApiModelProperty("租车价格(元)") + private BigDecimal rentalPrice; + + @ApiModelProperty("电池套餐ID") + private Long batteryRuleId; + + @ApiModelProperty("车辆套餐ID") + private Long carRuleId; + + @ApiModelProperty("车型ID") + private Long carModelId; + + @ApiModelProperty("品牌ID") + private Long brandId; +} diff --git a/src/main/java/com/sczx/car/service/RuleItemService.java b/src/main/java/com/sczx/car/service/RuleItemService.java new file mode 100644 index 0000000..623d03c --- /dev/null +++ b/src/main/java/com/sczx/car/service/RuleItemService.java @@ -0,0 +1,10 @@ +package com.sczx.car.service; + +import com.sczx.car.dto.RuleItemDto; +import org.springframework.web.bind.annotation.RequestParam; + +public interface RuleItemService { + + RuleItemDto getRentRuleItemByIds(Long brandId,Long carModelId, Long carRuleId, Long batteryRuleId); + +} diff --git a/src/main/java/com/sczx/car/service/impl/RuleItemServiceImpl.java b/src/main/java/com/sczx/car/service/impl/RuleItemServiceImpl.java new file mode 100644 index 0000000..2fbbc50 --- /dev/null +++ b/src/main/java/com/sczx/car/service/impl/RuleItemServiceImpl.java @@ -0,0 +1,35 @@ +package com.sczx.car.service.impl; + + +import com.sczx.car.dto.RuleItemDto; +import com.sczx.car.mapper.RuleItemMapper; +import com.sczx.car.po.RuleItemPo; +import com.sczx.car.service.RuleItemService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Slf4j +@Service +public class RuleItemServiceImpl implements RuleItemService { + + @Autowired + private RuleItemMapper ruleItemMapper; + + @Override + public RuleItemDto getRentRuleItemByIds(Long brandId, Long carModelId, Long carRuleId, Long batteryRuleId) { + log.info("根据套餐商品id查询套餐商品: brandId={}, carModelId={}, carRuleId={}, batteryRuleId={}", + brandId, carModelId, carRuleId, batteryRuleId); + + RuleItemPo ruleItemPo = ruleItemMapper.selectByRuleIds(brandId, carModelId, carRuleId, batteryRuleId); + + if (ruleItemPo == null) { + return null; + } + + RuleItemDto ruleItemDto = new RuleItemDto(); + BeanUtils.copyProperties(ruleItemPo, ruleItemDto); + return ruleItemDto; + } +} diff --git a/src/main/resources/mapper/RuleItemMapper.xml b/src/main/resources/mapper/RuleItemMapper.xml new file mode 100644 index 0000000..74ace80 --- /dev/null +++ b/src/main/resources/mapper/RuleItemMapper.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, out_item_id, ali_item_id, out_sku_id, item_desc, brand_name, model_name, category_name, + rental_days, rent_type, rule_name, page_path, image, image_list1, image_list2, image_list3, + deposit_free, deposit_price, rental_price, battery_rule_id, car_rule_id, car_model_id, brand_id + + + + + +