diff --git a/sql/mall.sql b/sql/mall.sql index 7b3d8ce5b..9493c3bcf 100644 --- a/sql/mall.sql +++ b/sql/mall.sql @@ -253,3 +253,35 @@ create table product_sku collate utf8mb4_general_ci; +---Market-Banner管理SQL +drop table if exists market_banner; +CREATE TABLE `market_banner` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Banner编号', + `title` varchar(64) NOT NULL DEFAULT '' COMMENT 'Banner标题', + `pic_url` varchar(255) NOT NULL COMMENT '图片URL', + `status` tinyint(4) NOT NULL DEFAULT '-1' COMMENT '活动状态', + `url` varchar(255) NOT NULL COMMENT '跳转地址', + `creator` varchar(64) DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + `tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '租户编号', + `sort` tinyint(4) DEFAULT NULL COMMENT '排序', + `memo` varchar(255) DEFAULT NULL COMMENT '描述', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='Banner管理'; +-- 菜单 SQL +INSERT INTO `system_menu`(`id`,`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`) +VALUES (2002, 'Banner管理', '', 2, 1, 2000, 'brand', '', 'mall/market/banner/index', 0); +-- 按钮父菜单ID +SELECT @parentId := LAST_INSERT_ID(); +-- 按钮 SQL +INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`) +VALUES ('Banner查询', 'market:banner:query', 3, 1, @parentId, '', '', '', 0); +INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`) +VALUES ('Banner创建', 'market:banner:create', 3, 2, @parentId, '', '', '', 0); +INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`) +VALUES ('Banner更新', 'market:banner:update', 3, 3, @parentId, '', '', '', 0); +INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`) +VALUES ('Banner删除', 'market:banner:delete', 3, 4, @parentId, '', '', '', 0); diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/enums/CommonStatusEnum.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/enums/CommonStatusEnum.java index 68e0ead10..cd1b9dc5e 100644 --- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/enums/CommonStatusEnum.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/enums/CommonStatusEnum.java @@ -1,8 +1,11 @@ package cn.iocoder.yudao.framework.common.enums; +import cn.iocoder.yudao.framework.common.core.IntArrayValuable; import lombok.AllArgsConstructor; import lombok.Getter; +import java.util.Arrays; + /** * 通用状态枚举 * @@ -10,11 +13,14 @@ import lombok.Getter; */ @Getter @AllArgsConstructor -public enum CommonStatusEnum { +public enum CommonStatusEnum implements IntArrayValuable { ENABLE(0, "开启"), DISABLE(1, "关闭"); + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CommonStatusEnum::getStatus).toArray(); + + /** * 状态值 */ @@ -24,4 +30,9 @@ public enum CommonStatusEnum { */ private final String name; + @Override + public int[] array() { + return ARRAYS; + } + } diff --git a/yudao-module-mall/yudao-module-market-api/src/main/java/cn/iocoder/yudao/module/market/enums/ErrorCodeConstants.java b/yudao-module-mall/yudao-module-market-api/src/main/java/cn/iocoder/yudao/module/market/enums/ErrorCodeConstants.java index 101e84325..d63b52465 100644 --- a/yudao-module-mall/yudao-module-market-api/src/main/java/cn/iocoder/yudao/module/market/enums/ErrorCodeConstants.java +++ b/yudao-module-mall/yudao-module-market-api/src/main/java/cn/iocoder/yudao/module/market/enums/ErrorCodeConstants.java @@ -12,4 +12,7 @@ public interface ErrorCodeConstants { // ========== 促销活动相关 1003001000============ ErrorCode ACTIVITY_NOT_EXISTS = new ErrorCode(1003001000, "促销活动不存在"); + + // ========== banner相关 1003002000============ + ErrorCode BANNER_NOT_EXISTS = new ErrorCode(1003002000, "Banner不存在"); } diff --git a/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/activity/vo/ActivityCreateReqVO.java b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/activity/vo/ActivityCreateReqVO.java index c031a361a..0ca112709 100644 --- a/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/activity/vo/ActivityCreateReqVO.java +++ b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/activity/vo/ActivityCreateReqVO.java @@ -5,6 +5,9 @@ import java.util.*; import io.swagger.annotations.*; import javax.validation.constraints.*; +/** + * @author xia + */ @ApiModel("管理后台 - 促销活动创建 Request VO") @Data @EqualsAndHashCode(callSuper = true) diff --git a/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/banner/BannerController.java b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/banner/BannerController.java new file mode 100644 index 000000000..932ead7de --- /dev/null +++ b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/banner/BannerController.java @@ -0,0 +1,71 @@ +package cn.iocoder.yudao.module.market.controller.admin.banner; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.market.controller.admin.banner.vo.*; +import cn.iocoder.yudao.module.market.convert.banner.BannerConvert; +import cn.iocoder.yudao.module.market.dal.dataobject.banner.BannerDO; +import cn.iocoder.yudao.module.market.service.banner.BannerService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +@Api(tags = "管理后台 - Banner 管理") +@RestController +@RequestMapping("/market/banner") +@Validated +public class BannerController { + + @Resource + private BannerService bannerService; + + @PostMapping("/create") + @ApiOperation("创建 Banner") + @PreAuthorize("@ss.hasPermission('market:banner:create')") + public CommonResult createBanner(@Valid @RequestBody BannerCreateReqVO createReqVO) { + return success(bannerService.createBanner(createReqVO)); + } + + @PutMapping("/update") + @ApiOperation("更新 Banner") + @PreAuthorize("@ss.hasPermission('market:banner:update')") + public CommonResult updateBanner(@Valid @RequestBody BannerUpdateReqVO updateReqVO) { + bannerService.updateBanner(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @ApiOperation("删除 Banner") + @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class) + @PreAuthorize("@ss.hasPermission('market:banner:delete')") + public CommonResult deleteBanner(@RequestParam("id") Long id) { + bannerService.deleteBanner(id); + return success(true); + } + + @GetMapping("/get") + @ApiOperation("获得 Banner") + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) + @PreAuthorize("@ss.hasPermission('market:banner:query')") + public CommonResult getBanner(@RequestParam("id") Long id) { + BannerDO banner = bannerService.getBanner(id); + return success(BannerConvert.INSTANCE.convert(banner)); + } + + @GetMapping("/page") + @ApiOperation("获得 Banner 分页") + @PreAuthorize("@ss.hasPermission('market:banner:query')") + public CommonResult> getBannerPage(@Valid BannerPageReqVO pageVO) { + PageResult pageResult = bannerService.getBannerPage(pageVO); + return success(BannerConvert.INSTANCE.convertPage(pageResult)); + } + +} diff --git a/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/banner/vo/BannerBaseVO.java b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/banner/vo/BannerBaseVO.java new file mode 100644 index 000000000..f5f37dbbc --- /dev/null +++ b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/banner/vo/BannerBaseVO.java @@ -0,0 +1,42 @@ +package cn.iocoder.yudao.module.market.controller.admin.banner.vo; + +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; +import cn.iocoder.yudao.framework.common.validation.InEnum; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * Banner Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + * @author xia + */ +@Data +public class BannerBaseVO { + + @ApiModelProperty(value = "标题", required = true) + @NotNull(message = "标题不能为空") + private String title; + + @ApiModelProperty(value = "跳转链接", required = true) + @NotNull(message = "跳转链接不能为空") + private String url; + + @ApiModelProperty(value = "图片地址", required = true) + @NotNull(message = "图片地址不能为空") + private String picUrl; + + @ApiModelProperty(value = "排序", required = true) + @NotNull(message = "排序不能为空") + private Integer sort; + + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空") + @InEnum(CommonStatusEnum.class) + private Integer status; + + @ApiModelProperty(value = "备注") + private String memo; + +} diff --git a/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/banner/vo/BannerCreateReqVO.java b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/banner/vo/BannerCreateReqVO.java new file mode 100644 index 000000000..0bb0c1bcf --- /dev/null +++ b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/banner/vo/BannerCreateReqVO.java @@ -0,0 +1,22 @@ +package cn.iocoder.yudao.module.market.controller.admin.banner.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import java.util.Date; + +/** + * @author xia + */ +@ApiModel("管理后台 - Banner 创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class BannerCreateReqVO extends BannerBaseVO { + + + +} diff --git a/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/banner/vo/BannerPageReqVO.java b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/banner/vo/BannerPageReqVO.java new file mode 100644 index 000000000..79a9c40c7 --- /dev/null +++ b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/banner/vo/BannerPageReqVO.java @@ -0,0 +1,42 @@ +package cn.iocoder.yudao.module.market.controller.admin.banner.vo; + +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.validation.InEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +/** + * @author xia + */ +@ApiModel("管理后台 - Banner 分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class BannerPageReqVO extends PageParam { + + @ApiModelProperty(value = "标题") + private String title; + + + @ApiModelProperty(value = "状态") + @InEnum(CommonStatusEnum.class) + private Integer status; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "开始创建时间") + private Date beginCreateTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "结束创建时间") + private Date endCreateTime; + +} diff --git a/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/banner/vo/BannerRespVO.java b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/banner/vo/BannerRespVO.java new file mode 100644 index 000000000..f4045b991 --- /dev/null +++ b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/banner/vo/BannerRespVO.java @@ -0,0 +1,26 @@ +package cn.iocoder.yudao.module.market.controller.admin.banner.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import javax.validation.constraints.NotNull; +import java.util.Date; + +/** + * @author xia + */ +@ApiModel("管理后台 - Banner Response VO") +@Data +@ToString(callSuper = true) +public class BannerRespVO extends BannerBaseVO { + + @ApiModelProperty(value = "banner编号", required = true) + @NotNull(message = "banner编号不能为空") + private Long id; + + @ApiModelProperty(value = "创建时间", required = true) + private Date createTime; + +} diff --git a/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/banner/vo/BannerUpdateReqVO.java b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/banner/vo/BannerUpdateReqVO.java new file mode 100644 index 000000000..1f2d7ce80 --- /dev/null +++ b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/banner/vo/BannerUpdateReqVO.java @@ -0,0 +1,24 @@ +package cn.iocoder.yudao.module.market.controller.admin.banner.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import javax.validation.constraints.NotNull; + +/** + * @author xia + */ +@ApiModel("管理后台 - Banner更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class BannerUpdateReqVO extends BannerBaseVO { + + @ApiModelProperty(value = "banner 编号", required = true) + @NotNull(message = "banner 编号不能为空") + private Long id; + +} diff --git a/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/app/banner/AppBannerController.java b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/app/banner/AppBannerController.java new file mode 100644 index 000000000..3d9d58eb8 --- /dev/null +++ b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/app/banner/AppBannerController.java @@ -0,0 +1,43 @@ +package cn.iocoder.yudao.module.market.controller.app.banner; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.market.controller.admin.banner.vo.BannerRespVO; +import cn.iocoder.yudao.module.market.convert.banner.BannerConvert; +import cn.iocoder.yudao.module.market.dal.dataobject.banner.BannerDO; +import cn.iocoder.yudao.module.market.service.banner.BannerService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +/** + * @author: XIA + */ +@RestController +@RequestMapping("/market/banner") +@Api(tags = "用户APP- 首页Banner") +@Validated +public class AppBannerController { + + // TODO @xia:使用 @Resource 哈 + @Autowired + private BannerService bannerService; + + // TODO @xia:新建一个 AppBannerRespVO,只返回必要的字段。status 要过滤下。然后 sort 下结果 + @GetMapping("/list") + @ApiOperation("获得banner列表") + @PreAuthorize("@ss.hasPermission('market:banner:query')") + public CommonResult> getBannerList() { + List list = bannerService.getBannerList(); + return success(BannerConvert.INSTANCE.convertList(list)); + } + +} diff --git a/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/convert/banner/BannerConvert.java b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/convert/banner/BannerConvert.java new file mode 100644 index 000000000..0e5d66e14 --- /dev/null +++ b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/convert/banner/BannerConvert.java @@ -0,0 +1,36 @@ +package cn.iocoder.yudao.module.market.convert.banner; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.market.controller.admin.banner.vo.BannerCreateReqVO; +import cn.iocoder.yudao.module.market.controller.admin.banner.vo.BannerRespVO; +import cn.iocoder.yudao.module.market.controller.admin.banner.vo.BannerUpdateReqVO; +import cn.iocoder.yudao.module.market.controller.admin.banner.vo.BannerUpdateStatusReqVO; +import cn.iocoder.yudao.module.market.dal.dataobject.banner.BannerDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * Banner Convert + * + * @author xia + */ +@Mapper +public interface BannerConvert { + + BannerConvert INSTANCE = Mappers.getMapper(BannerConvert.class); + + + List convertList(List list); + + PageResult convertPage(PageResult pageResult); + + BannerRespVO convert(BannerDO banner); + + BannerDO convert(BannerCreateReqVO createReqVO); + + BannerDO convert(BannerUpdateReqVO updateReqVO); + + BannerDO convert(BannerUpdateStatusReqVO updateStatusReqVO); +} diff --git a/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/dal/dataobject/banner/BannerDO.java b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/dal/dataobject/banner/BannerDO.java new file mode 100644 index 000000000..1f48f7144 --- /dev/null +++ b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/dal/dataobject/banner/BannerDO.java @@ -0,0 +1,53 @@ +package cn.iocoder.yudao.module.market.dal.dataobject.banner; + +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +/** + * banner DO + * + * @author xia + */ +@TableName("market_banner") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BannerDO extends BaseDO { + + /** + * 编号 + */ + private Long id; + /** + * 标题 + */ + private String title; + /** + * 跳转链接 + */ + private String url; + /** + * 图片链接 + */ + private String picUrl; + /** + * 排序 + */ + private Integer sort; + + /** + * 状态 {@link cn.iocoder.yudao.framework.common.enums.CommonStatusEnum} + */ + private Integer status; + /** + * 备注 + */ + private String memo; + + // TODO 芋艿 点击次数。&& 其他数据相关 + +} diff --git a/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/dal/mysql/banner/BannerMapper.java b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/dal/mysql/banner/BannerMapper.java new file mode 100644 index 000000000..05c8cd3c9 --- /dev/null +++ b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/dal/mysql/banner/BannerMapper.java @@ -0,0 +1,27 @@ +package cn.iocoder.yudao.module.market.dal.mysql.banner; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.module.market.controller.admin.banner.vo.BannerPageReqVO; +import cn.iocoder.yudao.module.market.dal.dataobject.banner.BannerDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * Banner Mapper + * + * @author xia + */ +@Mapper +public interface BannerMapper extends BaseMapperX { + + default PageResult selectPage(BannerPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(BannerDO::getTitle, reqVO.getTitle()) + .eqIfPresent(BannerDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(BannerDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .betweenIfPresent(BannerDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .orderByDesc(BannerDO::getSort)); + } + +} diff --git a/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/service/banner/BannerService.java b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/service/banner/BannerService.java new file mode 100644 index 000000000..67debdc3d --- /dev/null +++ b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/service/banner/BannerService.java @@ -0,0 +1,63 @@ +package cn.iocoder.yudao.module.market.service.banner; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.market.controller.admin.banner.vo.BannerCreateReqVO; +import cn.iocoder.yudao.module.market.controller.admin.banner.vo.BannerPageReqVO; +import cn.iocoder.yudao.module.market.controller.admin.banner.vo.BannerUpdateReqVO; +import cn.iocoder.yudao.module.market.dal.dataobject.banner.BannerDO; + +import javax.validation.Valid; +import java.util.List; + +/** + * 首页 Banner Service 接口 + * + * @author xia + */ +public interface BannerService { + + /** + * 创建 Banner + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createBanner(@Valid BannerCreateReqVO createReqVO); + + /** + * 更新 Banner + * + * @param updateReqVO 更新信息 + */ + void updateBanner(@Valid BannerUpdateReqVO updateReqVO); + + /** + * 删除 Banner + * + * @param id 编号 + */ + void deleteBanner(Long id); + + /** + * 获得 Banner + * + * @param id 编号 + * @return Banner + */ + BannerDO getBanner(Long id); + + /** + * 获得所有 Banner列表 + * @return Banner列表 + */ + List getBannerList(); + + /** + * 获得 Banner 分页 + * + * @param pageReqVO 分页查询 + * @return Banner分页 + */ + PageResult getBannerPage(BannerPageReqVO pageReqVO); + +} diff --git a/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/service/banner/BannerServiceImpl.java b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/service/banner/BannerServiceImpl.java new file mode 100644 index 000000000..04784ff66 --- /dev/null +++ b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/service/banner/BannerServiceImpl.java @@ -0,0 +1,78 @@ +package cn.iocoder.yudao.module.market.service.banner; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.market.controller.admin.banner.vo.BannerCreateReqVO; +import cn.iocoder.yudao.module.market.controller.admin.banner.vo.BannerPageReqVO; +import cn.iocoder.yudao.module.market.controller.admin.banner.vo.BannerUpdateReqVO; +import cn.iocoder.yudao.module.market.convert.banner.BannerConvert; +import cn.iocoder.yudao.module.market.dal.dataobject.banner.BannerDO; +import cn.iocoder.yudao.module.market.dal.mysql.banner.BannerMapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.market.enums.ErrorCodeConstants.BANNER_NOT_EXISTS; + +/** + * 首页banner 实现类 + * + * @author xia + */ +@Service +@Validated +public class BannerServiceImpl implements BannerService { + + @Resource + private BannerMapper bannerMapper; + + @Override + public Long createBanner(BannerCreateReqVO createReqVO) { + // 插入 + BannerDO banner = BannerConvert.INSTANCE.convert(createReqVO); + bannerMapper.insert(banner); + // 返回 + return banner.getId(); + } + + @Override + public void updateBanner(BannerUpdateReqVO updateReqVO) { + // 校验存在 + this.validateBannerExists(updateReqVO.getId()); + // 更新 + BannerDO updateObj = BannerConvert.INSTANCE.convert(updateReqVO); + bannerMapper.updateById(updateObj); + } + + @Override + public void deleteBanner(Long id) { + // 校验存在 + this.validateBannerExists(id); + // 删除 + bannerMapper.deleteById(id); + } + + private void validateBannerExists(Long id) { + if (bannerMapper.selectById(id) == null) { + throw exception(BANNER_NOT_EXISTS); + } + } + + @Override + public BannerDO getBanner(Long id) { + return bannerMapper.selectById(id); + } + + @Override + public List getBannerList() { + return bannerMapper.selectList(); + } + + @Override + public PageResult getBannerPage(BannerPageReqVO pageReqVO) { + return bannerMapper.selectPage(pageReqVO); + } + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/SkuController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/ProductSkuController.java similarity index 60% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/SkuController.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/ProductSkuController.java index 49f5159ef..878318f78 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/SkuController.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/ProductSkuController.java @@ -22,31 +22,31 @@ import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.sku.SkuDO; -import cn.iocoder.yudao.module.product.convert.sku.SkuConvert; -import cn.iocoder.yudao.module.product.service.sku.SkuService; +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; +import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; +import cn.iocoder.yudao.module.product.service.sku.ProductSkuService; @Api(tags = "管理后台 - 商品sku") @RestController @RequestMapping("/product/sku") @Validated -public class SkuController { +public class ProductSkuController { @Resource - private SkuService skuService; + private ProductSkuService ProductSkuService; @PostMapping("/create") @ApiOperation("创建商品sku") @PreAuthorize("@ss.hasPermission('product:sku:create')") - public CommonResult createSku(@Valid @RequestBody SkuCreateReqVO createReqVO) { - return success(skuService.createSku(createReqVO)); + public CommonResult createSku(@Valid @RequestBody ProductSkuCreateReqVO createReqVO) { + return success(ProductSkuService.createSku(createReqVO)); } @PutMapping("/update") @ApiOperation("更新商品sku") @PreAuthorize("@ss.hasPermission('product:sku:update')") - public CommonResult updateSku(@Valid @RequestBody SkuUpdateReqVO updateReqVO) { - skuService.updateSku(updateReqVO); + public CommonResult updateSku(@Valid @RequestBody ProductSkuUpdateReqVO updateReqVO) { + ProductSkuService.updateSku(updateReqVO); return success(true); } @@ -55,7 +55,7 @@ public class SkuController { @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Integer.class) @PreAuthorize("@ss.hasPermission('product:sku:delete')") public CommonResult deleteSku(@RequestParam("id") Integer id) { - skuService.deleteSku(id); + ProductSkuService.deleteSku(id); return success(true); } @@ -63,38 +63,38 @@ public class SkuController { @ApiOperation("获得商品sku") @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Integer.class) @PreAuthorize("@ss.hasPermission('product:sku:query')") - public CommonResult getSku(@RequestParam("id") Integer id) { - SkuDO sku = skuService.getSku(id); - return success(SkuConvert.INSTANCE.convert(sku)); + public CommonResult getSku(@RequestParam("id") Integer id) { + ProductSkuDO sku = ProductSkuService.getSku(id); + return success(ProductSkuConvert.INSTANCE.convert(sku)); } @GetMapping("/list") @ApiOperation("获得商品sku列表") @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) @PreAuthorize("@ss.hasPermission('product:sku:query')") - public CommonResult> getSkuList(@RequestParam("ids") Collection ids) { - List list = skuService.getSkuList(ids); - return success(SkuConvert.INSTANCE.convertList(list)); + public CommonResult> getSkuList(@RequestParam("ids") Collection ids) { + List list = ProductSkuService.getSkuList(ids); + return success(ProductSkuConvert.INSTANCE.convertList(list)); } @GetMapping("/page") @ApiOperation("获得商品sku分页") @PreAuthorize("@ss.hasPermission('product:sku:query')") - public CommonResult> getSkuPage(@Valid SkuPageReqVO pageVO) { - PageResult pageResult = skuService.getSkuPage(pageVO); - return success(SkuConvert.INSTANCE.convertPage(pageResult)); + public CommonResult> getSkuPage(@Valid ProductSkuPageReqVO pageVO) { + PageResult pageResult = ProductSkuService.getSkuPage(pageVO); + return success(ProductSkuConvert.INSTANCE.convertPage(pageResult)); } @GetMapping("/export-excel") @ApiOperation("导出商品sku Excel") @PreAuthorize("@ss.hasPermission('product:sku:export')") @OperateLog(type = EXPORT) - public void exportSkuExcel(@Valid SkuExportReqVO exportReqVO, + public void exportSkuExcel(@Valid ProductSkuExportReqVO exportReqVO, HttpServletResponse response) throws IOException { - List list = skuService.getSkuList(exportReqVO); + List list = ProductSkuService.getSkuList(exportReqVO); // 导出 Excel - List datas = SkuConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "商品sku.xls", "数据", SkuExcelVO.class, datas); + List datas = ProductSkuConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "商品sku.xls", "数据", ProductSkuExcelVO.class, datas); } } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuBaseVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuBaseVO.java similarity index 89% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuBaseVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuBaseVO.java index b91be42c9..9f351e9b7 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuBaseVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuBaseVO.java @@ -10,7 +10,7 @@ import javax.validation.constraints.*; * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 */ @Data -public class SkuBaseVO { +public class ProductSkuBaseVO { @ApiModelProperty(value = "spu编号", required = true) @NotNull(message = "spu编号不能为空") @@ -18,7 +18,7 @@ public class SkuBaseVO { @ApiModelProperty(value = "规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]", required = true) @NotNull(message = "规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]不能为空") - private String properties; + private List properties; @ApiModelProperty(value = "销售价格,单位:分", required = true) @NotNull(message = "销售价格,单位:分不能为空") @@ -43,4 +43,10 @@ public class SkuBaseVO { @ApiModelProperty(value = "状态: 0-正常 1-禁用") private Integer status; + @Data + public static class Property { + private Integer propertyId; + private Integer valueId; + } + } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuCreateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuCreateReqVO.java similarity index 83% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuCreateReqVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuCreateReqVO.java index 0de3632a3..e01c272a4 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuCreateReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuCreateReqVO.java @@ -9,6 +9,6 @@ import javax.validation.constraints.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class SkuCreateReqVO extends SkuBaseVO { +public class ProductSkuCreateReqVO extends ProductSkuBaseVO { } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExcelVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuExcelVO.java similarity index 83% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExcelVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuExcelVO.java index 60382739f..0f31b4f23 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExcelVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuExcelVO.java @@ -12,7 +12,7 @@ import com.alibaba.excel.annotation.ExcelProperty; * @author 芋道源码 */ @Data -public class SkuExcelVO { +public class ProductSkuExcelVO { @ExcelProperty("主键") private Integer id; @@ -21,7 +21,7 @@ public class SkuExcelVO { private Long spuId; @ExcelProperty("规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]") - private String properties; + private List properties; @ExcelProperty("销售价格,单位:分") private Integer price; @@ -44,4 +44,9 @@ public class SkuExcelVO { @ExcelProperty("创建时间") private Date createTime; + @Data + public static class Property { + private Integer propertyId; + private Integer valueId; + } } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExportReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuExportReqVO.java similarity index 97% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExportReqVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuExportReqVO.java index d934bc64e..76847a28f 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuExportReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuExportReqVO.java @@ -10,7 +10,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @ApiModel(value = "管理后台 - 商品sku Excel 导出 Request VO", description = "参数和 SkuPageReqVO 是一致的") @Data -public class SkuExportReqVO { +public class ProductSkuExportReqVO { @ApiModelProperty(value = "spu编号") private Long spuId; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuPageReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuPageReqVO.java similarity index 96% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuPageReqVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuPageReqVO.java index 5536240aa..fcf8b95fc 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuPageReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuPageReqVO.java @@ -12,7 +12,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class SkuPageReqVO extends PageParam { +public class ProductSkuPageReqVO extends PageParam { @ApiModelProperty(value = "spu编号") private Long spuId; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuRespVO.java similarity index 88% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuRespVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuRespVO.java index 220e6bad6..cf5e83fb7 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuRespVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuRespVO.java @@ -8,7 +8,7 @@ import io.swagger.annotations.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class SkuRespVO extends SkuBaseVO { +public class ProductSkuRespVO extends ProductSkuBaseVO { @ApiModelProperty(value = "主键", required = true) private Integer id; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuUpdateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuUpdateReqVO.java similarity index 87% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuUpdateReqVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuUpdateReqVO.java index cdf4e8557..ec79a09e9 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/SkuUpdateReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuUpdateReqVO.java @@ -9,7 +9,7 @@ import javax.validation.constraints.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class SkuUpdateReqVO extends SkuBaseVO { +public class ProductSkuUpdateReqVO extends ProductSkuBaseVO { @ApiModelProperty(value = "主键", required = true) @NotNull(message = "主键不能为空") diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/SpuController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java similarity index 77% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/SpuController.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java index 700d04fa4..742ffd83e 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/SpuController.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java @@ -22,23 +22,23 @@ import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.spu.SpuDO; -import cn.iocoder.yudao.module.product.convert.spu.SpuConvert; -import cn.iocoder.yudao.module.product.service.spu.SpuService; +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; +import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; +import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; @Api(tags = "管理后台 - 商品spu") @RestController @RequestMapping("/product/spu") @Validated -public class SpuController { +public class ProductSpuController { @Resource - private SpuService spuService; + private ProductSpuService spuService; @PostMapping("/create") @ApiOperation("创建商品spu") @PreAuthorize("@ss.hasPermission('product:spu:create')") - public CommonResult createSpu(@Valid @RequestBody SpuCreateReqVO createReqVO) { + public CommonResult createSpu(@Valid @RequestBody ProductSpuCreateReqVO createReqVO) { return success(spuService.createSpu(createReqVO)); } @@ -64,8 +64,8 @@ public class SpuController { @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Integer.class) @PreAuthorize("@ss.hasPermission('product:spu:query')") public CommonResult getSpu(@RequestParam("id") Integer id) { - SpuDO spu = spuService.getSpu(id); - return success(SpuConvert.INSTANCE.convert(spu)); + ProductSpuDO spu = spuService.getSpu(id); + return success(ProductSpuConvert.INSTANCE.convert(spu)); } @GetMapping("/list") @@ -73,16 +73,16 @@ public class SpuController { @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) @PreAuthorize("@ss.hasPermission('product:spu:query')") public CommonResult> getSpuList(@RequestParam("ids") Collection ids) { - List list = spuService.getSpuList(ids); - return success(SpuConvert.INSTANCE.convertList(list)); + List list = spuService.getSpuList(ids); + return success(ProductSpuConvert.INSTANCE.convertList(list)); } @GetMapping("/page") @ApiOperation("获得商品spu分页") @PreAuthorize("@ss.hasPermission('product:spu:query')") public CommonResult> getSpuPage(@Valid SpuPageReqVO pageVO) { - PageResult pageResult = spuService.getSpuPage(pageVO); - return success(SpuConvert.INSTANCE.convertPage(pageResult)); + PageResult pageResult = spuService.getSpuPage(pageVO); + return success(ProductSpuConvert.INSTANCE.convertPage(pageResult)); } @GetMapping("/export-excel") @@ -91,9 +91,9 @@ public class SpuController { @OperateLog(type = EXPORT) public void exportSpuExcel(@Valid SpuExportReqVO exportReqVO, HttpServletResponse response) throws IOException { - List list = spuService.getSpuList(exportReqVO); + List list = spuService.getSpuList(exportReqVO); // 导出 Excel - List datas = SpuConvert.INSTANCE.convertList02(list); + List datas = ProductSpuConvert.INSTANCE.convertList02(list); ExcelUtils.write(response, "商品spu.xls", "数据", SpuExcelVO.class, datas); } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuBaseVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuBaseVO.java similarity index 95% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuBaseVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuBaseVO.java index 442fd34ba..65a5f2a0e 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuBaseVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuBaseVO.java @@ -10,7 +10,7 @@ import javax.validation.constraints.*; * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 */ @Data -public class SpuBaseVO { +public class ProductSpuBaseVO { @ApiModelProperty(value = "商品名称") private String name; @@ -29,7 +29,7 @@ public class SpuBaseVO { @ApiModelProperty(value = "商品主图地址,* 数组,以逗号分隔,最多上传15张", required = true) @NotNull(message = "商品主图地址,* 数组,以逗号分隔,最多上传15张不能为空") - private String picUrls; + private List picUrls; @ApiModelProperty(value = "排序字段", required = true) @NotNull(message = "排序字段不能为空") diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuCreateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuCreateReqVO.java similarity index 83% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuCreateReqVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuCreateReqVO.java index 53cbea5b8..fb24fbdcf 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuCreateReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuCreateReqVO.java @@ -9,6 +9,6 @@ import javax.validation.constraints.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class SpuCreateReqVO extends SpuBaseVO { +public class ProductSpuCreateReqVO extends ProductSpuBaseVO { } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExcelVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExcelVO.java index 3a8816111..9e90acd3d 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExcelVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExcelVO.java @@ -30,7 +30,7 @@ public class SpuExcelVO { private Long categoryId; @ExcelProperty("商品主图地址,* 数组,以逗号分隔,最多上传15张") - private String picUrls; + private List picUrls; @ExcelProperty("排序字段") private Integer sort; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExportReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExportReqVO.java index 93e390510..c5658a67e 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExportReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuExportReqVO.java @@ -25,7 +25,7 @@ public class SpuExportReqVO { private Long categoryId; @ApiModelProperty(value = "商品主图地址,* 数组,以逗号分隔,最多上传15张") - private String picUrls; + private List picUrls; @ApiModelProperty(value = "排序字段") private Integer sort; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuRespVO.java index 2b5c90744..826b68a74 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuRespVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuRespVO.java @@ -8,7 +8,7 @@ import io.swagger.annotations.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class SpuRespVO extends SpuBaseVO { +public class SpuRespVO extends ProductSpuBaseVO { @ApiModelProperty(value = "主键", required = true) private Integer id; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuUpdateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuUpdateReqVO.java index c1222a168..6faac6586 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuUpdateReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuUpdateReqVO.java @@ -9,7 +9,7 @@ import javax.validation.constraints.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class SpuUpdateReqVO extends SpuBaseVO { +public class SpuUpdateReqVO extends ProductSpuBaseVO { @ApiModelProperty(value = "主键", required = true) @NotNull(message = "主键不能为空") diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/ProductSkuConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/ProductSkuConvert.java new file mode 100755 index 000000000..3d6e4bd2b --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/ProductSkuConvert.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.product.convert.sku; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; + +/** + * 商品sku Convert + * + * @author 芋道源码 + */ +@Mapper +public interface ProductSkuConvert { + + ProductSkuConvert INSTANCE = Mappers.getMapper(ProductSkuConvert.class); + + ProductSkuDO convert(ProductSkuCreateReqVO bean); + + ProductSkuDO convert(ProductSkuUpdateReqVO bean); + + ProductSkuRespVO convert(ProductSkuDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/SkuConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/SkuConvert.java deleted file mode 100755 index 62684692e..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/SkuConvert.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.yudao.module.product.convert.sku; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; -import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.sku.SkuDO; - -/** - * 商品sku Convert - * - * @author 芋道源码 - */ -@Mapper -public interface SkuConvert { - - SkuConvert INSTANCE = Mappers.getMapper(SkuConvert.class); - - SkuDO convert(SkuCreateReqVO bean); - - SkuDO convert(SkuUpdateReqVO bean); - - SkuRespVO convert(SkuDO bean); - - List convertList(List list); - - PageResult convertPage(PageResult page); - - List convertList02(List list); - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java new file mode 100755 index 000000000..fb01e2dc2 --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.product.convert.spu; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; + +/** + * 商品spu Convert + * + * @author 芋道源码 + */ +@Mapper +public interface ProductSpuConvert { + + ProductSpuConvert INSTANCE = Mappers.getMapper(ProductSpuConvert.class); + + ProductSpuDO convert(ProductSpuCreateReqVO bean); + + ProductSpuDO convert(SpuUpdateReqVO bean); + + SpuRespVO convert(ProductSpuDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/SpuConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/SpuConvert.java deleted file mode 100755 index bd3e05928..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/SpuConvert.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.yudao.module.product.convert.spu; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; -import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.spu.SpuDO; - -/** - * 商品spu Convert - * - * @author 芋道源码 - */ -@Mapper -public interface SpuConvert { - - SpuConvert INSTANCE = Mappers.getMapper(SpuConvert.class); - - SpuDO convert(SpuCreateReqVO bean); - - SpuDO convert(SpuUpdateReqVO bean); - - SpuRespVO convert(SpuDO bean); - - List convertList(List list); - - PageResult convertPage(PageResult page); - - List convertList02(List list); - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/SkuDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/ProductSkuDO.java similarity index 86% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/SkuDO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/ProductSkuDO.java index f07184339..bf5866b77 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/SkuDO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/ProductSkuDO.java @@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.*; +import java.util.List; + /** * 商品sku DO * @@ -19,7 +21,7 @@ import lombok.*; @Builder @NoArgsConstructor @AllArgsConstructor -public class SkuDO extends BaseDO { +public class ProductSkuDO extends BaseDO { /** * 主键 @@ -34,7 +36,7 @@ public class SkuDO extends BaseDO { * 规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }] */ // TODO franky:可以定义一个内部的 Property 类,然后 List - private String properties; + private List properties; /** * 销售价格,单位:分 */ @@ -60,4 +62,11 @@ public class SkuDO extends BaseDO { */ private Integer status; + @Data + public static class Property { + private Integer propertyId; + private Integer valueId; + } + } + diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/SpuDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSpuDO.java similarity index 93% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/SpuDO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSpuDO.java index defd6799a..1486290ce 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/SpuDO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSpuDO.java @@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.*; +import java.util.List; + /** * 商品spu DO * @@ -19,7 +21,7 @@ import lombok.*; @Builder @NoArgsConstructor @AllArgsConstructor -public class SpuDO extends BaseDO { +public class ProductSpuDO extends BaseDO { /** * 主键 @@ -46,7 +48,7 @@ public class SpuDO extends BaseDO { * 商品主图地址,* 数组,以逗号分隔,最多上传15张 */ // TODO franky:List - private String picUrls; + private List picUrls; /** * 排序字段 */ diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java new file mode 100755 index 000000000..23fc2e1bd --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java @@ -0,0 +1,48 @@ +package cn.iocoder.yudao.module.product.dal.mysql.sku; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; + +/** + * 商品sku Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface ProductSkuMapper extends BaseMapperX { + + default PageResult selectPage(ProductSkuPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(ProductSkuDO::getSpuId, reqVO.getSpuId()) + .eqIfPresent(ProductSkuDO::getProperties, reqVO.getProperties()) + .eqIfPresent(ProductSkuDO::getPrice, reqVO.getPrice()) + .eqIfPresent(ProductSkuDO::getOriginalPrice, reqVO.getOriginalPrice()) + .eqIfPresent(ProductSkuDO::getCostPrice, reqVO.getCostPrice()) + .eqIfPresent(ProductSkuDO::getBarCode, reqVO.getBarCode()) + .eqIfPresent(ProductSkuDO::getPicUrl, reqVO.getPicUrl()) + .eqIfPresent(ProductSkuDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(ProductSkuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .orderByDesc(ProductSkuDO::getId)); + } + + default List selectList(ProductSkuExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(ProductSkuDO::getSpuId, reqVO.getSpuId()) + .eqIfPresent(ProductSkuDO::getProperties, reqVO.getProperties()) + .eqIfPresent(ProductSkuDO::getPrice, reqVO.getPrice()) + .eqIfPresent(ProductSkuDO::getOriginalPrice, reqVO.getOriginalPrice()) + .eqIfPresent(ProductSkuDO::getCostPrice, reqVO.getCostPrice()) + .eqIfPresent(ProductSkuDO::getBarCode, reqVO.getBarCode()) + .eqIfPresent(ProductSkuDO::getPicUrl, reqVO.getPicUrl()) + .eqIfPresent(ProductSkuDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(ProductSkuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .orderByDesc(ProductSkuDO::getId)); + } + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/SkuMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/SkuMapper.java deleted file mode 100755 index 15b2468eb..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/SkuMapper.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.iocoder.yudao.module.product.dal.mysql.sku; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.module.product.dal.dataobject.sku.SkuDO; -import org.apache.ibatis.annotations.Mapper; -import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; - -/** - * 商品sku Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface SkuMapper extends BaseMapperX { - - default PageResult selectPage(SkuPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .eqIfPresent(SkuDO::getSpuId, reqVO.getSpuId()) - .eqIfPresent(SkuDO::getProperties, reqVO.getProperties()) - .eqIfPresent(SkuDO::getPrice, reqVO.getPrice()) - .eqIfPresent(SkuDO::getOriginalPrice, reqVO.getOriginalPrice()) - .eqIfPresent(SkuDO::getCostPrice, reqVO.getCostPrice()) - .eqIfPresent(SkuDO::getBarCode, reqVO.getBarCode()) - .eqIfPresent(SkuDO::getPicUrl, reqVO.getPicUrl()) - .eqIfPresent(SkuDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(SkuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .orderByDesc(SkuDO::getId)); - } - - default List selectList(SkuExportReqVO reqVO) { - return selectList(new LambdaQueryWrapperX() - .eqIfPresent(SkuDO::getSpuId, reqVO.getSpuId()) - .eqIfPresent(SkuDO::getProperties, reqVO.getProperties()) - .eqIfPresent(SkuDO::getPrice, reqVO.getPrice()) - .eqIfPresent(SkuDO::getOriginalPrice, reqVO.getOriginalPrice()) - .eqIfPresent(SkuDO::getCostPrice, reqVO.getCostPrice()) - .eqIfPresent(SkuDO::getBarCode, reqVO.getBarCode()) - .eqIfPresent(SkuDO::getPicUrl, reqVO.getPicUrl()) - .eqIfPresent(SkuDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(SkuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .orderByDesc(SkuDO::getId)); - } - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java new file mode 100755 index 000000000..d6349eb2f --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java @@ -0,0 +1,52 @@ +package cn.iocoder.yudao.module.product.dal.mysql.spu; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; + +/** + * 商品spu Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface ProductSpuMapper extends BaseMapperX { + + default PageResult selectPage(SpuPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(ProductSpuDO::getName, reqVO.getName()) + .eqIfPresent(ProductSpuDO::getSellPoint, reqVO.getSellPoint()) + .eqIfPresent(ProductSpuDO::getDescription, reqVO.getDescription()) + .eqIfPresent(ProductSpuDO::getCategoryId, reqVO.getCategoryId()) + .eqIfPresent(ProductSpuDO::getPicUrls, reqVO.getPicUrls()) + .eqIfPresent(ProductSpuDO::getSort, reqVO.getSort()) + .eqIfPresent(ProductSpuDO::getLikeCount, reqVO.getLikeCount()) + .eqIfPresent(ProductSpuDO::getPrice, reqVO.getPrice()) + .eqIfPresent(ProductSpuDO::getQuantity, reqVO.getQuantity()) + .eqIfPresent(ProductSpuDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(ProductSpuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .orderByDesc(ProductSpuDO::getId)); + } + + default List selectList(SpuExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .likeIfPresent(ProductSpuDO::getName, reqVO.getName()) + .eqIfPresent(ProductSpuDO::getSellPoint, reqVO.getSellPoint()) + .eqIfPresent(ProductSpuDO::getDescription, reqVO.getDescription()) + .eqIfPresent(ProductSpuDO::getCategoryId, reqVO.getCategoryId()) + .eqIfPresent(ProductSpuDO::getPicUrls, reqVO.getPicUrls()) + .eqIfPresent(ProductSpuDO::getSort, reqVO.getSort()) + .eqIfPresent(ProductSpuDO::getLikeCount, reqVO.getLikeCount()) + .eqIfPresent(ProductSpuDO::getPrice, reqVO.getPrice()) + .eqIfPresent(ProductSpuDO::getQuantity, reqVO.getQuantity()) + .eqIfPresent(ProductSpuDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(ProductSpuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .orderByDesc(ProductSpuDO::getId)); + } + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/SpuMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/SpuMapper.java deleted file mode 100755 index 932e68f34..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/SpuMapper.java +++ /dev/null @@ -1,52 +0,0 @@ -package cn.iocoder.yudao.module.product.dal.mysql.spu; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.module.product.dal.dataobject.spu.SpuDO; -import org.apache.ibatis.annotations.Mapper; -import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; - -/** - * 商品spu Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface SpuMapper extends BaseMapperX { - - default PageResult selectPage(SpuPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .likeIfPresent(SpuDO::getName, reqVO.getName()) - .eqIfPresent(SpuDO::getSellPoint, reqVO.getSellPoint()) - .eqIfPresent(SpuDO::getDescription, reqVO.getDescription()) - .eqIfPresent(SpuDO::getCategoryId, reqVO.getCategoryId()) - .eqIfPresent(SpuDO::getPicUrls, reqVO.getPicUrls()) - .eqIfPresent(SpuDO::getSort, reqVO.getSort()) - .eqIfPresent(SpuDO::getLikeCount, reqVO.getLikeCount()) - .eqIfPresent(SpuDO::getPrice, reqVO.getPrice()) - .eqIfPresent(SpuDO::getQuantity, reqVO.getQuantity()) - .eqIfPresent(SpuDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(SpuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .orderByDesc(SpuDO::getId)); - } - - default List selectList(SpuExportReqVO reqVO) { - return selectList(new LambdaQueryWrapperX() - .likeIfPresent(SpuDO::getName, reqVO.getName()) - .eqIfPresent(SpuDO::getSellPoint, reqVO.getSellPoint()) - .eqIfPresent(SpuDO::getDescription, reqVO.getDescription()) - .eqIfPresent(SpuDO::getCategoryId, reqVO.getCategoryId()) - .eqIfPresent(SpuDO::getPicUrls, reqVO.getPicUrls()) - .eqIfPresent(SpuDO::getSort, reqVO.getSort()) - .eqIfPresent(SpuDO::getLikeCount, reqVO.getLikeCount()) - .eqIfPresent(SpuDO::getPrice, reqVO.getPrice()) - .eqIfPresent(SpuDO::getQuantity, reqVO.getQuantity()) - .eqIfPresent(SpuDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(SpuDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .orderByDesc(SpuDO::getId)); - } - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/SkuService.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuService.java similarity index 69% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/SkuService.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuService.java index f7bad6947..3cbe595c1 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/SkuService.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuService.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.product.service.sku; import java.util.*; import javax.validation.*; import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.sku.SkuDO; +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; /** @@ -11,7 +11,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; * * @author 芋道源码 */ -public interface SkuService { +public interface ProductSkuService { /** * 创建商品sku @@ -19,14 +19,14 @@ public interface SkuService { * @param createReqVO 创建信息 * @return 编号 */ - Integer createSku(@Valid SkuCreateReqVO createReqVO); + Integer createSku(@Valid ProductSkuCreateReqVO createReqVO); /** * 更新商品sku * * @param updateReqVO 更新信息 */ - void updateSku(@Valid SkuUpdateReqVO updateReqVO); + void updateSku(@Valid ProductSkuUpdateReqVO updateReqVO); /** * 删除商品sku @@ -41,7 +41,7 @@ public interface SkuService { * @param id 编号 * @return 商品sku */ - SkuDO getSku(Integer id); + ProductSkuDO getSku(Integer id); /** * 获得商品sku列表 @@ -49,7 +49,7 @@ public interface SkuService { * @param ids 编号 * @return 商品sku列表 */ - List getSkuList(Collection ids); + List getSkuList(Collection ids); /** * 获得商品sku分页 @@ -57,7 +57,7 @@ public interface SkuService { * @param pageReqVO 分页查询 * @return 商品sku分页 */ - PageResult getSkuPage(SkuPageReqVO pageReqVO); + PageResult getSkuPage(ProductSkuPageReqVO pageReqVO); /** * 获得商品sku列表, 用于 Excel 导出 @@ -65,6 +65,6 @@ public interface SkuService { * @param exportReqVO 查询条件 * @return 商品sku列表 */ - List getSkuList(SkuExportReqVO exportReqVO); + List getSkuList(ProductSkuExportReqVO exportReqVO); } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuServiceImpl.java new file mode 100755 index 000000000..04bc3e369 --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuServiceImpl.java @@ -0,0 +1,82 @@ +package cn.iocoder.yudao.module.product.service.sku; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; + +import java.util.*; +import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; +import cn.iocoder.yudao.module.product.dal.mysql.sku.ProductSkuMapper; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; + +/** + * 商品sku Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class ProductSkuServiceImpl implements ProductSkuService { + + @Resource + private ProductSkuMapper ProductSkuMapper; + + @Override + public Integer createSku(ProductSkuCreateReqVO createReqVO) { + // 插入 + ProductSkuDO sku = ProductSkuConvert.INSTANCE.convert(createReqVO); + ProductSkuMapper.insert(sku); + // 返回 + return sku.getId(); + } + + @Override + public void updateSku(ProductSkuUpdateReqVO updateReqVO) { + // 校验存在 + this.validateSkuExists(updateReqVO.getId()); + // 更新 + ProductSkuDO updateObj = ProductSkuConvert.INSTANCE.convert(updateReqVO); + ProductSkuMapper.updateById(updateObj); + } + + @Override + public void deleteSku(Integer id) { + // 校验存在 + this.validateSkuExists(id); + // 删除 + ProductSkuMapper.deleteById(id); + } + + private void validateSkuExists(Integer id) { + if (ProductSkuMapper.selectById(id) == null) { + throw exception(SKU_NOT_EXISTS); + } + } + + @Override + public ProductSkuDO getSku(Integer id) { + return ProductSkuMapper.selectById(id); + } + + @Override + public List getSkuList(Collection ids) { + return ProductSkuMapper.selectBatchIds(ids); + } + + @Override + public PageResult getSkuPage(ProductSkuPageReqVO pageReqVO) { + return ProductSkuMapper.selectPage(pageReqVO); + } + + @Override + public List getSkuList(ProductSkuExportReqVO exportReqVO) { + return ProductSkuMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImpl.java deleted file mode 100755 index 5984924f1..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -package cn.iocoder.yudao.module.product.service.sku; - -import org.springframework.stereotype.Service; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; - -import java.util.*; -import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.sku.SkuDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import cn.iocoder.yudao.module.product.convert.sku.SkuConvert; -import cn.iocoder.yudao.module.product.dal.mysql.sku.SkuMapper; - -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; - -/** - * 商品sku Service 实现类 - * - * @author 芋道源码 - */ -@Service -@Validated -public class SkuServiceImpl implements SkuService { - - @Resource - private SkuMapper skuMapper; - - @Override - public Integer createSku(SkuCreateReqVO createReqVO) { - // 插入 - SkuDO sku = SkuConvert.INSTANCE.convert(createReqVO); - skuMapper.insert(sku); - // 返回 - return sku.getId(); - } - - @Override - public void updateSku(SkuUpdateReqVO updateReqVO) { - // 校验存在 - this.validateSkuExists(updateReqVO.getId()); - // 更新 - SkuDO updateObj = SkuConvert.INSTANCE.convert(updateReqVO); - skuMapper.updateById(updateObj); - } - - @Override - public void deleteSku(Integer id) { - // 校验存在 - this.validateSkuExists(id); - // 删除 - skuMapper.deleteById(id); - } - - private void validateSkuExists(Integer id) { - if (skuMapper.selectById(id) == null) { - throw exception(SKU_NOT_EXISTS); - } - } - - @Override - public SkuDO getSku(Integer id) { - return skuMapper.selectById(id); - } - - @Override - public List getSkuList(Collection ids) { - return skuMapper.selectBatchIds(ids); - } - - @Override - public PageResult getSkuPage(SkuPageReqVO pageReqVO) { - return skuMapper.selectPage(pageReqVO); - } - - @Override - public List getSkuList(SkuExportReqVO exportReqVO) { - return skuMapper.selectList(exportReqVO); - } - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/SpuService.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuService.java similarity index 73% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/SpuService.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuService.java index e8ae06fe8..f0649ffe0 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/SpuService.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuService.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.product.service.spu; import java.util.*; import javax.validation.*; import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.spu.SpuDO; +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; /** @@ -11,7 +11,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; * * @author 芋道源码 */ -public interface SpuService { +public interface ProductSpuService { /** * 创建商品spu @@ -19,7 +19,7 @@ public interface SpuService { * @param createReqVO 创建信息 * @return 编号 */ - Integer createSpu(@Valid SpuCreateReqVO createReqVO); + Integer createSpu(@Valid ProductSpuCreateReqVO createReqVO); /** * 更新商品spu @@ -41,7 +41,7 @@ public interface SpuService { * @param id 编号 * @return 商品spu */ - SpuDO getSpu(Integer id); + ProductSpuDO getSpu(Integer id); /** * 获得商品spu列表 @@ -49,7 +49,7 @@ public interface SpuService { * @param ids 编号 * @return 商品spu列表 */ - List getSpuList(Collection ids); + List getSpuList(Collection ids); /** * 获得商品spu分页 @@ -57,7 +57,7 @@ public interface SpuService { * @param pageReqVO 分页查询 * @return 商品spu分页 */ - PageResult getSpuPage(SpuPageReqVO pageReqVO); + PageResult getSpuPage(SpuPageReqVO pageReqVO); /** * 获得商品spu列表, 用于 Excel 导出 @@ -65,6 +65,6 @@ public interface SpuService { * @param exportReqVO 查询条件 * @return 商品spu列表 */ - List getSpuList(SpuExportReqVO exportReqVO); + List getSpuList(SpuExportReqVO exportReqVO); } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/SpuServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java similarity index 50% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/SpuServiceImpl.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java index 147c7bcde..a978852a6 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/SpuServiceImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java @@ -6,11 +6,11 @@ import org.springframework.validation.annotation.Validated; import java.util.*; import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.spu.SpuDO; +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.product.convert.spu.SpuConvert; -import cn.iocoder.yudao.module.product.dal.mysql.spu.SpuMapper; +import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; +import cn.iocoder.yudao.module.product.dal.mysql.spu.ProductSpuMapper; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; @@ -22,16 +22,16 @@ import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; */ @Service @Validated -public class SpuServiceImpl implements SpuService { +public class ProductSpuServiceImpl implements ProductSpuService { @Resource - private SpuMapper spuMapper; + private ProductSpuMapper ProductSpuMapper; @Override - public Integer createSpu(SpuCreateReqVO createReqVO) { + public Integer createSpu(ProductSpuCreateReqVO createReqVO) { // 插入 - SpuDO spu = SpuConvert.INSTANCE.convert(createReqVO); - spuMapper.insert(spu); + ProductSpuDO spu = ProductSpuConvert.INSTANCE.convert(createReqVO); + ProductSpuMapper.insert(spu); // 返回 return spu.getId(); } @@ -41,8 +41,8 @@ public class SpuServiceImpl implements SpuService { // 校验存在 this.validateSpuExists(updateReqVO.getId()); // 更新 - SpuDO updateObj = SpuConvert.INSTANCE.convert(updateReqVO); - spuMapper.updateById(updateObj); + ProductSpuDO updateObj = ProductSpuConvert.INSTANCE.convert(updateReqVO); + ProductSpuMapper.updateById(updateObj); } @Override @@ -50,33 +50,33 @@ public class SpuServiceImpl implements SpuService { // 校验存在 this.validateSpuExists(id); // 删除 - spuMapper.deleteById(id); + ProductSpuMapper.deleteById(id); } private void validateSpuExists(Integer id) { - if (spuMapper.selectById(id) == null) { + if (ProductSpuMapper.selectById(id) == null) { throw exception(SPU_NOT_EXISTS); } } @Override - public SpuDO getSpu(Integer id) { - return spuMapper.selectById(id); + public ProductSpuDO getSpu(Integer id) { + return ProductSpuMapper.selectById(id); } @Override - public List getSpuList(Collection ids) { - return spuMapper.selectBatchIds(ids); + public List getSpuList(Collection ids) { + return ProductSpuMapper.selectBatchIds(ids); } @Override - public PageResult getSpuPage(SpuPageReqVO pageReqVO) { - return spuMapper.selectPage(pageReqVO); + public PageResult getSpuPage(SpuPageReqVO pageReqVO) { + return ProductSpuMapper.selectPage(pageReqVO); } @Override - public List getSpuList(SpuExportReqVO exportReqVO) { - return spuMapper.selectList(exportReqVO); + public List getSpuList(SpuExportReqVO exportReqVO) { + return ProductSpuMapper.selectList(exportReqVO); } } diff --git a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImplTest.java b/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImplTest.java index 1b2085bd5..475d51614 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImplTest.java +++ b/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImplTest.java @@ -9,8 +9,8 @@ import javax.annotation.Resource; import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.sku.SkuDO; -import cn.iocoder.yudao.module.product.dal.mysql.sku.SkuMapper; +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; +import cn.iocoder.yudao.module.product.dal.mysql.sku.ProductSkuMapper; import cn.iocoder.yudao.framework.common.pojo.PageResult; import javax.annotation.Resource; @@ -27,71 +27,71 @@ import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.*; /** -* {@link SkuServiceImpl} 的单元测试类 +* {@link ProductSkuServiceImpl} 的单元测试类 * * @author 芋道源码 */ -@Import(SkuServiceImpl.class) +@Import(ProductSkuServiceImpl.class) public class SkuServiceImplTest extends BaseDbUnitTest { @Resource - private SkuServiceImpl skuService; + private ProductSkuServiceImpl ProductSkuService; @Resource - private SkuMapper skuMapper; + private ProductSkuMapper ProductSkuMapper; @Test public void testCreateSku_success() { // 准备参数 - SkuCreateReqVO reqVO = randomPojo(SkuCreateReqVO.class); + ProductSkuCreateReqVO reqVO = randomPojo(ProductSkuCreateReqVO.class); // 调用 - Integer skuId = skuService.createSku(reqVO); + Integer skuId = ProductSkuService.createSku(reqVO); // 断言 assertNotNull(skuId); // 校验记录的属性是否正确 - SkuDO sku = skuMapper.selectById(skuId); + ProductSkuDO sku = ProductSkuMapper.selectById(skuId); assertPojoEquals(reqVO, sku); } @Test public void testUpdateSku_success() { // mock 数据 - SkuDO dbSku = randomPojo(SkuDO.class); - skuMapper.insert(dbSku);// @Sql: 先插入出一条存在的数据 + ProductSkuDO dbSku = randomPojo(ProductSkuDO.class); + ProductSkuMapper.insert(dbSku);// @Sql: 先插入出一条存在的数据 // 准备参数 - SkuUpdateReqVO reqVO = randomPojo(SkuUpdateReqVO.class, o -> { + ProductSkuUpdateReqVO reqVO = randomPojo(ProductSkuUpdateReqVO.class, o -> { o.setId(dbSku.getId()); // 设置更新的 ID }); // 调用 - skuService.updateSku(reqVO); + ProductSkuService.updateSku(reqVO); // 校验是否更新正确 - SkuDO sku = skuMapper.selectById(reqVO.getId()); // 获取最新的 + ProductSkuDO sku = ProductSkuMapper.selectById(reqVO.getId()); // 获取最新的 assertPojoEquals(reqVO, sku); } @Test public void testUpdateSku_notExists() { // 准备参数 - SkuUpdateReqVO reqVO = randomPojo(SkuUpdateReqVO.class); + ProductSkuUpdateReqVO reqVO = randomPojo(ProductSkuUpdateReqVO.class); // 调用, 并断言异常 - assertServiceException(() -> skuService.updateSku(reqVO), SKU_NOT_EXISTS); + assertServiceException(() -> ProductSkuService.updateSku(reqVO), SKU_NOT_EXISTS); } @Test public void testDeleteSku_success() { // mock 数据 - SkuDO dbSku = randomPojo(SkuDO.class); - skuMapper.insert(dbSku);// @Sql: 先插入出一条存在的数据 + ProductSkuDO dbSku = randomPojo(ProductSkuDO.class); + ProductSkuMapper.insert(dbSku);// @Sql: 先插入出一条存在的数据 // 准备参数 Integer id = dbSku.getId(); // 调用 - skuService.deleteSku(id); + ProductSkuService.deleteSku(id); // 校验数据不存在了 - assertNull(skuMapper.selectById(id)); + assertNull(ProductSkuMapper.selectById(id)); } @Test @@ -100,14 +100,14 @@ public class SkuServiceImplTest extends BaseDbUnitTest { Integer id = 1; // 调用, 并断言异常 - assertServiceException(() -> skuService.deleteSku(id), SKU_NOT_EXISTS); + assertServiceException(() -> ProductSkuService.deleteSku(id), SKU_NOT_EXISTS); } @Test @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 public void testGetSkuPage() { // mock 数据 - SkuDO dbSku = randomPojo(SkuDO.class, o -> { // 等会查询到 + ProductSkuDO dbSku = randomPojo(ProductSkuDO.class, o -> { // 等会查询到 o.setSpuId(null); o.setProperties(null); o.setPrice(null); @@ -118,27 +118,27 @@ public class SkuServiceImplTest extends BaseDbUnitTest { o.setStatus(null); o.setCreateTime(null); }); - skuMapper.insert(dbSku); + ProductSkuMapper.insert(dbSku); // 测试 spuId 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setSpuId(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setSpuId(null))); // 测试 properties 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setProperties(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setProperties(null))); // 测试 price 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPrice(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPrice(null))); // 测试 originalPrice 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setOriginalPrice(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setOriginalPrice(null))); // 测试 costPrice 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCostPrice(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCostPrice(null))); // 测试 barCode 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setBarCode(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setBarCode(null))); // 测试 picUrl 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPicUrl(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPicUrl(null))); // 测试 status 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setStatus(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setStatus(null))); // 测试 createTime 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCreateTime(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCreateTime(null))); // 准备参数 - SkuPageReqVO reqVO = new SkuPageReqVO(); + ProductSkuPageReqVO reqVO = new ProductSkuPageReqVO(); reqVO.setSpuId(null); reqVO.setProperties(null); reqVO.setPrice(null); @@ -151,7 +151,7 @@ public class SkuServiceImplTest extends BaseDbUnitTest { reqVO.setEndCreateTime(null); // 调用 - PageResult pageResult = skuService.getSkuPage(reqVO); + PageResult pageResult = ProductSkuService.getSkuPage(reqVO); // 断言 assertEquals(1, pageResult.getTotal()); assertEquals(1, pageResult.getList().size()); @@ -162,7 +162,7 @@ public class SkuServiceImplTest extends BaseDbUnitTest { @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 public void testGetSkuList() { // mock 数据 - SkuDO dbSku = randomPojo(SkuDO.class, o -> { // 等会查询到 + ProductSkuDO dbSku = randomPojo(ProductSkuDO.class, o -> { // 等会查询到 o.setSpuId(null); o.setProperties(null); o.setPrice(null); @@ -173,27 +173,27 @@ public class SkuServiceImplTest extends BaseDbUnitTest { o.setStatus(null); o.setCreateTime(null); }); - skuMapper.insert(dbSku); + ProductSkuMapper.insert(dbSku); // 测试 spuId 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setSpuId(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setSpuId(null))); // 测试 properties 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setProperties(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setProperties(null))); // 测试 price 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPrice(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPrice(null))); // 测试 originalPrice 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setOriginalPrice(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setOriginalPrice(null))); // 测试 costPrice 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCostPrice(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCostPrice(null))); // 测试 barCode 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setBarCode(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setBarCode(null))); // 测试 picUrl 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPicUrl(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPicUrl(null))); // 测试 status 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setStatus(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setStatus(null))); // 测试 createTime 不匹配 - skuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCreateTime(null))); + ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCreateTime(null))); // 准备参数 - SkuExportReqVO reqVO = new SkuExportReqVO(); + ProductSkuExportReqVO reqVO = new ProductSkuExportReqVO(); reqVO.setSpuId(null); reqVO.setProperties(null); reqVO.setPrice(null); @@ -206,7 +206,7 @@ public class SkuServiceImplTest extends BaseDbUnitTest { reqVO.setEndCreateTime(null); // 调用 - List list = skuService.getSkuList(reqVO); + List list = ProductSkuService.getSkuList(reqVO); // 断言 assertEquals(1, list.size()); assertPojoEquals(dbSku, list.get(0)); diff --git a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/SpuServiceImplTest.java b/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java similarity index 64% rename from yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/SpuServiceImplTest.java rename to yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java index c8bd50ad8..afbbdc027 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/SpuServiceImplTest.java +++ b/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java @@ -9,8 +9,8 @@ import javax.annotation.Resource; import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.spu.SpuDO; -import cn.iocoder.yudao.module.product.dal.mysql.spu.SpuMapper; +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; +import cn.iocoder.yudao.module.product.dal.mysql.spu.ProductSpuMapper; import cn.iocoder.yudao.framework.common.pojo.PageResult; import javax.annotation.Resource; @@ -27,38 +27,38 @@ import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.*; /** -* {@link SpuServiceImpl} 的单元测试类 +* {@link ProductSpuServiceImpl} 的单元测试类 * * @author 芋道源码 */ -@Import(SpuServiceImpl.class) -public class SpuServiceImplTest extends BaseDbUnitTest { +@Import(ProductSpuServiceImpl.class) +public class ProductSpuServiceImplTest extends BaseDbUnitTest { @Resource - private SpuServiceImpl spuService; + private ProductSpuServiceImpl spuService; @Resource - private SpuMapper spuMapper; + private ProductSpuMapper ProductSpuMapper; @Test public void testCreateSpu_success() { // 准备参数 - SpuCreateReqVO reqVO = randomPojo(SpuCreateReqVO.class); + ProductSpuCreateReqVO reqVO = randomPojo(ProductSpuCreateReqVO.class); // 调用 Integer spuId = spuService.createSpu(reqVO); // 断言 assertNotNull(spuId); // 校验记录的属性是否正确 - SpuDO spu = spuMapper.selectById(spuId); + ProductSpuDO spu = ProductSpuMapper.selectById(spuId); assertPojoEquals(reqVO, spu); } @Test public void testUpdateSpu_success() { // mock 数据 - SpuDO dbSpu = randomPojo(SpuDO.class); - spuMapper.insert(dbSpu);// @Sql: 先插入出一条存在的数据 + ProductSpuDO dbSpu = randomPojo(ProductSpuDO.class); + ProductSpuMapper.insert(dbSpu);// @Sql: 先插入出一条存在的数据 // 准备参数 SpuUpdateReqVO reqVO = randomPojo(SpuUpdateReqVO.class, o -> { o.setId(dbSpu.getId()); // 设置更新的 ID @@ -67,7 +67,7 @@ public class SpuServiceImplTest extends BaseDbUnitTest { // 调用 spuService.updateSpu(reqVO); // 校验是否更新正确 - SpuDO spu = spuMapper.selectById(reqVO.getId()); // 获取最新的 + ProductSpuDO spu = ProductSpuMapper.selectById(reqVO.getId()); // 获取最新的 assertPojoEquals(reqVO, spu); } @@ -83,15 +83,15 @@ public class SpuServiceImplTest extends BaseDbUnitTest { @Test public void testDeleteSpu_success() { // mock 数据 - SpuDO dbSpu = randomPojo(SpuDO.class); - spuMapper.insert(dbSpu);// @Sql: 先插入出一条存在的数据 + ProductSpuDO dbSpu = randomPojo(ProductSpuDO.class); + ProductSpuMapper.insert(dbSpu);// @Sql: 先插入出一条存在的数据 // 准备参数 Integer id = dbSpu.getId(); // 调用 spuService.deleteSpu(id); // 校验数据不存在了 - assertNull(spuMapper.selectById(id)); + assertNull(ProductSpuMapper.selectById(id)); } @Test @@ -107,7 +107,7 @@ public class SpuServiceImplTest extends BaseDbUnitTest { @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 public void testGetSpuPage() { // mock 数据 - SpuDO dbSpu = randomPojo(SpuDO.class, o -> { // 等会查询到 + ProductSpuDO dbSpu = randomPojo(ProductSpuDO.class, o -> { // 等会查询到 o.setName(null); o.setSellPoint(null); o.setDescription(null); @@ -120,29 +120,29 @@ public class SpuServiceImplTest extends BaseDbUnitTest { o.setStatus(null); o.setCreateTime(null); }); - spuMapper.insert(dbSpu); + ProductSpuMapper.insert(dbSpu); // 测试 name 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setName(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setName(null))); // 测试 sellPoint 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSellPoint(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSellPoint(null))); // 测试 description 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setDescription(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setDescription(null))); // 测试 categoryId 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCategoryId(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCategoryId(null))); // 测试 picUrls 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPicUrls(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPicUrls(null))); // 测试 sort 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSort(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSort(null))); // 测试 likeCount 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setLikeCount(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setLikeCount(null))); // 测试 price 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPrice(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPrice(null))); // 测试 quantity 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setQuantity(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setQuantity(null))); // 测试 status 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setStatus(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setStatus(null))); // 测试 createTime 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCreateTime(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCreateTime(null))); // 准备参数 SpuPageReqVO reqVO = new SpuPageReqVO(); reqVO.setName(null); @@ -159,7 +159,7 @@ public class SpuServiceImplTest extends BaseDbUnitTest { reqVO.setEndCreateTime(null); // 调用 - PageResult pageResult = spuService.getSpuPage(reqVO); + PageResult pageResult = spuService.getSpuPage(reqVO); // 断言 assertEquals(1, pageResult.getTotal()); assertEquals(1, pageResult.getList().size()); @@ -170,7 +170,7 @@ public class SpuServiceImplTest extends BaseDbUnitTest { @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 public void testGetSpuList() { // mock 数据 - SpuDO dbSpu = randomPojo(SpuDO.class, o -> { // 等会查询到 + ProductSpuDO dbSpu = randomPojo(ProductSpuDO.class, o -> { // 等会查询到 o.setName(null); o.setSellPoint(null); o.setDescription(null); @@ -183,29 +183,29 @@ public class SpuServiceImplTest extends BaseDbUnitTest { o.setStatus(null); o.setCreateTime(null); }); - spuMapper.insert(dbSpu); + ProductSpuMapper.insert(dbSpu); // 测试 name 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setName(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setName(null))); // 测试 sellPoint 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSellPoint(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSellPoint(null))); // 测试 description 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setDescription(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setDescription(null))); // 测试 categoryId 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCategoryId(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCategoryId(null))); // 测试 picUrls 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPicUrls(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPicUrls(null))); // 测试 sort 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSort(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setSort(null))); // 测试 likeCount 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setLikeCount(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setLikeCount(null))); // 测试 price 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPrice(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPrice(null))); // 测试 quantity 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setQuantity(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setQuantity(null))); // 测试 status 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setStatus(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setStatus(null))); // 测试 createTime 不匹配 - spuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCreateTime(null))); + ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setCreateTime(null))); // 准备参数 SpuExportReqVO reqVO = new SpuExportReqVO(); reqVO.setName(null); @@ -222,7 +222,7 @@ public class SpuServiceImplTest extends BaseDbUnitTest { reqVO.setEndCreateTime(null); // 调用 - List list = spuService.getSpuList(reqVO); + List list = spuService.getSpuList(reqVO); // 断言 assertEquals(1, list.size()); assertPojoEquals(dbSpu, list.get(0)); diff --git a/yudao-ui-admin/src/api/mall/market/banner.js b/yudao-ui-admin/src/api/mall/market/banner.js new file mode 100644 index 000000000..57c55def9 --- /dev/null +++ b/yudao-ui-admin/src/api/mall/market/banner.js @@ -0,0 +1,54 @@ +import request from '@/utils/request' + +// 创建Banner +export function createBanner(data) { + return request({ + url: '/market/banner/create', + method: 'post', + data: data + }) +} + +// 更新Banner +export function updateBanner(data) { + return request({ + url: '/market/banner/update', + method: 'put', + data: data + }) +} + +// 删除Banner +export function deleteBanner(id) { + return request({ + url: '/market/banner/delete?id=' + id, + method: 'delete' + }) +} + +// 获得Banner +export function getBanner(id) { + return request({ + url: '/market/banner/get?id=' + id, + method: 'get' + }) +} + +// 获得Banner分页 +export function getBannerPage(query) { + return request({ + url: '/market/banner/page', + method: 'get', + params: query + }) +} + +// 导出Banner Excel +export function exportBannerExcel(query) { + return request({ + url: '/market/banner/export-excel', + method: 'get', + params: query, + responseType: 'blob' + }) +} diff --git a/yudao-ui-admin/src/views/mall/market/banner/index.vue b/yudao-ui-admin/src/views/mall/market/banner/index.vue new file mode 100644 index 000000000..448f9124b --- /dev/null +++ b/yudao-ui-admin/src/views/mall/market/banner/index.vue @@ -0,0 +1,265 @@ + + + + + diff --git a/yudao-ui-admin/src/views/mall/product/spu/index.vue b/yudao-ui-admin/src/views/mall/product/spu/index.vue index 90d12cdd4..21c49e0ed 100644 --- a/yudao-ui-admin/src/views/mall/product/spu/index.vue +++ b/yudao-ui-admin/src/views/mall/product/spu/index.vue @@ -12,24 +12,17 @@ - - - - - - - - - - + - - + + + + @@ -65,9 +58,9 @@ - + - +