mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-19 09:55:16 +08:00
update first
This commit is contained in:
parent
b6301a5381
commit
5c30c2d712
3
pom.xml
3
pom.xml
@ -200,6 +200,9 @@
|
||||
<module>ruoyi-generator</module>
|
||||
<module>ruoyi-common</module>
|
||||
<module>ruoyi-demo</module>
|
||||
<module>ruoyi-coupons</module>
|
||||
<module>ruoyi-product</module>
|
||||
<module>ruoyi-activity</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
||||
19
ruoyi-activity/pom.xml
Normal file
19
ruoyi-activity/pom.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ruoyi-vue-plus</artifactId>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<version>2.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ruoyi-activity</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
@ -48,6 +48,12 @@
|
||||
<artifactId>ruoyi-generator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 产品模块-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-product</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- demo模块 -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
|
||||
@ -0,0 +1,111 @@
|
||||
package com.ruoyi.web.controller.product;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.product.bo.ProBannerAddBo;
|
||||
import com.ruoyi.product.bo.ProBannerEditBo;
|
||||
import com.ruoyi.product.bo.ProBannerQueryBo;
|
||||
import com.ruoyi.product.service.IProBannerService;
|
||||
import com.ruoyi.product.vo.ProBannerVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* banner管理Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-06-30
|
||||
*/
|
||||
@Api(value = "banner管理控制器", tags = {"banner管理管理"})
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/product/proBanner")
|
||||
public class ProBannerController extends BaseController {
|
||||
|
||||
private final IProBannerService iProBannerService;
|
||||
|
||||
/**
|
||||
* 查询banner管理列表
|
||||
*/
|
||||
@ApiOperation("查询banner管理列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:banner:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<ProBannerVo> list(@Validated ProBannerQueryBo bo) {
|
||||
return iProBannerService.queryPageList(bo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出banner管理列表
|
||||
*/
|
||||
@ApiOperation("导出banner管理列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:banner:export')")
|
||||
@Log(title = "banner管理", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult<ProBannerVo> export(@Validated ProBannerQueryBo bo) {
|
||||
List<ProBannerVo> list = iProBannerService.queryList(bo);
|
||||
ExcelUtil<ProBannerVo> util = new ExcelUtil<ProBannerVo>(ProBannerVo.class);
|
||||
return util.exportExcel(list, "banner管理");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取banner管理详细信息
|
||||
*/
|
||||
@ApiOperation("获取banner管理详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('system:banner:query')")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult<ProBannerVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(iProBannerService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增banner管理
|
||||
*/
|
||||
@ApiOperation("新增banner管理")
|
||||
@PreAuthorize("@ss.hasPermi('system:banner:add')")
|
||||
@Log(title = "banner管理", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit
|
||||
@PostMapping()
|
||||
public AjaxResult<Void> add(@Validated @RequestBody ProBannerAddBo bo) {
|
||||
return toAjax(iProBannerService.insertByAddBo(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改banner管理
|
||||
*/
|
||||
@ApiOperation("修改banner管理")
|
||||
@PreAuthorize("@ss.hasPermi('system:banner:edit')")
|
||||
@Log(title = "banner管理", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping()
|
||||
public AjaxResult<Void> edit(@Validated @RequestBody ProBannerEditBo bo) {
|
||||
return toAjax(iProBannerService.updateByEditBo(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除banner管理
|
||||
*/
|
||||
@ApiOperation("删除banner管理")
|
||||
@PreAuthorize("@ss.hasPermi('system:banner:remove')")
|
||||
@Log(title = "banner管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(iProBannerService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,114 @@
|
||||
package com.ruoyi.web.controller.product;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.product.bo.ProCategoryAddBo;
|
||||
import com.ruoyi.product.bo.ProCategoryEditBo;
|
||||
import com.ruoyi.product.bo.ProCategoryQueryBo;
|
||||
import com.ruoyi.product.service.IProCategoryService;
|
||||
import com.ruoyi.product.vo.ProCategoryVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品服务类别Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-03-14
|
||||
*/
|
||||
@Api(value = "商品服务类别控制器", tags = {"商品服务类别管理"})
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/product/proCategory")
|
||||
public class ProCategoryController extends BaseController {
|
||||
|
||||
private final IProCategoryService iProCategoryService;
|
||||
|
||||
/**
|
||||
* 查询商品服务类别列表
|
||||
*/
|
||||
@ApiOperation("查询商品服务类别列表")
|
||||
@PreAuthorize("@ss.hasPermi('product:proCategory:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<ProCategoryVo> list(@Validated ProCategoryQueryBo bo) {
|
||||
return iProCategoryService.queryPageList(bo);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('product:proCategory:list')")
|
||||
@GetMapping("/listCategoriesWithoutPage")
|
||||
public List<ProCategoryVo> listCategoriesWithoutPage(ProCategoryQueryBo proCategory) {
|
||||
return iProCategoryService.queryList(proCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出商品服务类别列表
|
||||
*/
|
||||
@ApiOperation("导出商品服务类别列表")
|
||||
@PreAuthorize("@ss.hasPermi('product:proCategory:export')")
|
||||
@Log(title = "商品服务类别", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult<ProCategoryVo> export(@Validated ProCategoryQueryBo bo) {
|
||||
List<ProCategoryVo> list = iProCategoryService.queryList(bo);
|
||||
ExcelUtil<ProCategoryVo> util = new ExcelUtil<>(ProCategoryVo.class);
|
||||
return util.exportExcel(list, "商品服务类别");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品服务类别详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('product:proCategory:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(iProCategoryService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品服务类别
|
||||
*/
|
||||
@ApiOperation("新增商品服务类别")
|
||||
@PreAuthorize("@ss.hasPermi('product:proCategory:add')")
|
||||
@Log(title = "商品服务类别", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit
|
||||
@PostMapping()
|
||||
public AjaxResult<Void> add(@Validated @RequestBody ProCategoryAddBo bo) {
|
||||
return toAjax(iProCategoryService.insertByAddBo(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品服务类别
|
||||
*/
|
||||
@ApiOperation("修改商品服务类别")
|
||||
@PreAuthorize("@ss.hasPermi('product:proCategory:edit')")
|
||||
@Log(title = "商品服务类别", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping()
|
||||
public AjaxResult<Void> edit(@Validated @RequestBody ProCategoryEditBo bo) {
|
||||
return toAjax(iProCategoryService.updateByEditBo(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品服务类别
|
||||
*/
|
||||
@ApiOperation("删除商品服务类别")
|
||||
@PreAuthorize("@ss.hasPermi('product:proCategory:remove')")
|
||||
@Log(title = "商品服务类别", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(iProCategoryService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,111 @@
|
||||
package com.ruoyi.web.controller.product;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.product.bo.ProItemAddBo;
|
||||
import com.ruoyi.product.bo.ProItemEditBo;
|
||||
import com.ruoyi.product.bo.ProItemQueryBo;
|
||||
import com.ruoyi.product.service.IProItemService;
|
||||
import com.ruoyi.product.vo.ProItemVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品详情Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-07-01
|
||||
*/
|
||||
@Api(value = "商品详情控制器", tags = {"商品详情管理"})
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/product/proItem")
|
||||
public class ProItemController extends BaseController {
|
||||
|
||||
private final IProItemService iProItemService;
|
||||
|
||||
/**
|
||||
* 查询商品详情列表
|
||||
*/
|
||||
@ApiOperation("查询商品详情列表")
|
||||
@PreAuthorize("@ss.hasPermi('product:proItem:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<ProItemVo> list(@Validated ProItemQueryBo bo) {
|
||||
return iProItemService.queryPageList(bo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出商品详情列表
|
||||
*/
|
||||
@ApiOperation("导出商品详情列表")
|
||||
@PreAuthorize("@ss.hasPermi('product:proItem:export')")
|
||||
@Log(title = "商品详情", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult<ProItemVo> export(@Validated ProItemQueryBo bo) {
|
||||
List<ProItemVo> list = iProItemService.queryList(bo);
|
||||
ExcelUtil<ProItemVo> util = new ExcelUtil<>(ProItemVo.class);
|
||||
return util.exportExcel(list, "商品详情");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品详情详细信息
|
||||
*/
|
||||
@ApiOperation("获取商品详情详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('product:proItem:query')")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult<ProItemVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(iProItemService.getProItemById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品详情
|
||||
*/
|
||||
@ApiOperation("新增商品详情")
|
||||
@PreAuthorize("@ss.hasPermi('product:proItem:add')")
|
||||
@Log(title = "商品详情", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit
|
||||
@PostMapping()
|
||||
public AjaxResult<Void> add(@Validated @RequestBody ProItemAddBo bo) {
|
||||
return toAjax(iProItemService.insertByAddBo(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品详情
|
||||
*/
|
||||
@ApiOperation("修改商品详情")
|
||||
@PreAuthorize("@ss.hasPermi('product:proItem:edit')")
|
||||
@Log(title = "商品详情", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping()
|
||||
public AjaxResult<Void> edit(@Validated @RequestBody ProItemEditBo bo) {
|
||||
return toAjax(iProItemService.updateByEditBo(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品详情
|
||||
*/
|
||||
@ApiOperation("删除商品详情")
|
||||
@PreAuthorize("@ss.hasPermi('product:proItem:remove')")
|
||||
@Log(title = "商品详情", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(iProItemService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,121 @@
|
||||
/*
|
||||
package com.ruoyi.web.controller.product;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.product.bo.ProItemSpecificationAddBo;
|
||||
import com.ruoyi.product.bo.ProItemSpecificationEditBo;
|
||||
import com.ruoyi.product.bo.ProItemSpecificationQueryBo;
|
||||
import com.ruoyi.product.service.IProItemSpecificationService;
|
||||
import com.ruoyi.product.vo.ProItemSpecificationVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
*/
|
||||
/**
|
||||
* 商品规格Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-04-06
|
||||
*//*
|
||||
|
||||
@Api(value = "商品规格控制器", tags = {"商品规格管理"})
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/product/proItemSpecification")
|
||||
public class ProItemSpecificationController extends BaseController {
|
||||
|
||||
private final IProItemSpecificationService iProItemSpecificationService;
|
||||
|
||||
*/
|
||||
/**
|
||||
* 查询商品规格列表
|
||||
*//*
|
||||
|
||||
@ApiOperation("查询商品规格列表")
|
||||
@PreAuthorize("@ss.hasPermi('product:proItemSpecification:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<ProItemSpecificationVo> list(ProItemSpecificationQueryBo bo) {
|
||||
startPage();
|
||||
List<ProItemSpecificationVo> list = iProItemSpecificationService.queryList(bo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* 导出商品规格列表
|
||||
*//*
|
||||
|
||||
@ApiOperation("导出商品规格列表")
|
||||
@PreAuthorize("@ss.hasPermi('product:proItemSpecification:export')")
|
||||
@Log(title = "商品规格", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult<ProItemSpecificationVo> export(ProItemSpecificationQueryBo bo) {
|
||||
List<ProItemSpecificationVo> list = iProItemSpecificationService.queryList(bo);
|
||||
ExcelUtil<ProItemSpecificationVo> util = new ExcelUtil<>(ProItemSpecificationVo.class);
|
||||
return util.exportExcel(list, "proItemSpecification");
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* 获取商品规格详细信息
|
||||
*//*
|
||||
|
||||
@ApiOperation("获取商品规格详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('product:proItemSpecification:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult<ProItemSpecificationVo> getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(iProItemSpecificationService.queryById(id));
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* 新增商品规格
|
||||
*//*
|
||||
|
||||
@ApiOperation("新增商品规格")
|
||||
@PreAuthorize("@ss.hasPermi('product:proItemSpecification:add')")
|
||||
@Log(title = "商品规格", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult<Void> add(@RequestBody ProItemSpecificationAddBo bo) {
|
||||
return toAjax(iProItemSpecificationService.insertByAddBo(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* 修改商品规格
|
||||
*//*
|
||||
|
||||
@ApiOperation("修改商品规格")
|
||||
@PreAuthorize("@ss.hasPermi('product:proItemSpecification:edit')")
|
||||
@Log(title = "商品规格", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult<Void> edit(@RequestBody ProItemSpecificationEditBo bo) {
|
||||
return toAjax(iProItemSpecificationService.updateByEditBo(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* 删除商品规格
|
||||
*//*
|
||||
|
||||
@ApiOperation("删除商品规格")
|
||||
@PreAuthorize("@ss.hasPermi('product:proItemSpecification:remove')")
|
||||
@Log(title = "商品规格", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult<Void> remove(@PathVariable Long ids) {
|
||||
return toAjax(iProItemSpecificationService.deleteWithValidByIds(Collections.singletonList(ids), true) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
*/
|
||||
@ -12,9 +12,9 @@ spring:
|
||||
# 主库数据源
|
||||
master:
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true
|
||||
url: jdbc:mysql://${MYSQL_HOST:tb-mysql}:3306/meijai?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true
|
||||
username: root
|
||||
password: root
|
||||
password: ${MYSQL_PWD}
|
||||
# 从库数据源
|
||||
slave:
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
@ -66,13 +66,13 @@ spring:
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: localhost
|
||||
host: ${REDIS_HOST:tb-redis}
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
database: 3
|
||||
# 密码
|
||||
password:
|
||||
password: ${MYSQL_PWD}
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
# 是否开启ssl
|
||||
|
||||
@ -136,4 +136,9 @@ public class Constants
|
||||
* 资源映射路径 前缀
|
||||
*/
|
||||
public static final String REDIS_LOCK_KEY = "redis_lock:";
|
||||
|
||||
/**
|
||||
* 日期相关常量
|
||||
*/
|
||||
public static final String FULL_DATE_TIME = "yyyy-MM-dd HH:mm:ss";
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ -18,29 +18,42 @@ import java.util.Map;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class BaseEntity implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
public class BaseEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 搜索值 */
|
||||
private String searchValue;
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
private String searchValue;
|
||||
|
||||
/** 创建者 */
|
||||
private String createBy;
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/** 创建时间 */
|
||||
private Date createTime;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/** 更新者 */
|
||||
private String updateBy;
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/** 更新时间 */
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/** 请求参数 */
|
||||
private Map<String, Object> params = new HashMap<>();
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
private Map<String, Object> params = new HashMap<>();
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
package com.ruoyi.common.utils;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
@UtilityClass
|
||||
public class IdUtils {
|
||||
|
||||
public Long nextId() {
|
||||
return IdUtil.getSnowflake(1, 1).nextId();
|
||||
}
|
||||
}
|
||||
19
ruoyi-coupons/pom.xml
Normal file
19
ruoyi-coupons/pom.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ruoyi-vue-plus</artifactId>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<version>2.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ruoyi-coupons</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
33
ruoyi-product/pom.xml
Normal file
33
ruoyi-product/pom.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ruoyi-vue-plus</artifactId>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<version>2.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ruoyi-product</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
<description>
|
||||
产品详情模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -0,0 +1,53 @@
|
||||
package com.ruoyi.product.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* banner管理添加对象 pro_banner
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-06-30
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("banner管理添加对象")
|
||||
public class ProBannerAddBo {
|
||||
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ApiModelProperty("主键id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* banner标题
|
||||
*/
|
||||
@ApiModelProperty("banner标题")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* url跳转(也可能是path)
|
||||
*/
|
||||
@ApiModelProperty("url跳转(也可能是path)")
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 图片url
|
||||
*/
|
||||
@ApiModelProperty("图片url")
|
||||
private String picUrl;
|
||||
|
||||
/**
|
||||
* 是否跳转
|
||||
*/
|
||||
@ApiModelProperty("是否跳转")
|
||||
private Integer redirectFlag;
|
||||
|
||||
/**
|
||||
* banner类型,1应用内跳转,3外部跳转
|
||||
*/
|
||||
@ApiModelProperty("banner类型,1应用内跳转,3外部跳转")
|
||||
private Integer bannerType;
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package com.ruoyi.product.bo;
|
||||
|
||||
/**
|
||||
* @BelongsProject: RuoYi-Vue-Plus
|
||||
* @BelongsPackage: com.ruoyi.product.bo
|
||||
* @Author: yefei
|
||||
* @CreateTime: 2021-06-30 16:41
|
||||
* @Description: 编辑
|
||||
*/
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* banner管理编辑对象 pro_banner
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-06-30
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("banner管理编辑对象")
|
||||
public class ProBannerEditBo {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@ApiModelProperty("主键id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* banner标题
|
||||
*/
|
||||
@ApiModelProperty("banner标题")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* url跳转(也可能是path)
|
||||
*/
|
||||
@ApiModelProperty("url跳转(也可能是path)")
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 图片url
|
||||
*/
|
||||
@ApiModelProperty("图片url")
|
||||
private String picUrl;
|
||||
|
||||
/**
|
||||
* 是否跳转
|
||||
*/
|
||||
@ApiModelProperty("是否跳转")
|
||||
private Integer redirectFlag;
|
||||
|
||||
/**
|
||||
* banner类型,1应用内跳转,3外部跳转
|
||||
*/
|
||||
@ApiModelProperty("banner类型,1应用内跳转,3外部跳转")
|
||||
private Integer bannerType;
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.ruoyi.product.bo;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @BelongsProject: RuoYi-Vue-Plus
|
||||
* @BelongsPackage: com.ruoyi.product.bo
|
||||
* @Author: yefei
|
||||
* @CreateTime: 2021-06-30 16:37
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("banner管理分页查询对象")
|
||||
public class ProBannerQueryBo extends BaseEntity {
|
||||
/**
|
||||
* 分页大小
|
||||
*/
|
||||
@ApiModelProperty("分页大小")
|
||||
private Integer pageSize;
|
||||
/**
|
||||
* 当前页数
|
||||
*/
|
||||
@ApiModelProperty("当前页数")
|
||||
private Integer pageNum;
|
||||
/**
|
||||
* 排序列
|
||||
*/
|
||||
@ApiModelProperty("排序列")
|
||||
private String orderByColumn;
|
||||
/**
|
||||
* 排序的方向desc或者asc
|
||||
*/
|
||||
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
|
||||
private String isAsc;
|
||||
|
||||
|
||||
/**
|
||||
* banner标题
|
||||
*/
|
||||
@ApiModelProperty("banner标题")
|
||||
private String title;
|
||||
/**
|
||||
* url跳转(也可能是path)
|
||||
*/
|
||||
@ApiModelProperty("url跳转(也可能是path)")
|
||||
private String url;
|
||||
/**
|
||||
* 图片url
|
||||
*/
|
||||
@ApiModelProperty("图片url")
|
||||
private String picUrl;
|
||||
/**
|
||||
* 是否跳转
|
||||
*/
|
||||
@ApiModelProperty("是否跳转")
|
||||
private Integer redirectFlag;
|
||||
/**
|
||||
* banner类型,1应用内跳转,3外部跳转
|
||||
*/
|
||||
@ApiModelProperty("banner类型,1应用内跳转,3外部跳转")
|
||||
private Integer bannerType;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.ruoyi.product.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 商品服务类别添加对象 pro_category
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-07-01
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("商品服务类别添加对象")
|
||||
public class ProCategoryAddBo {
|
||||
|
||||
|
||||
/**
|
||||
* 类别名字
|
||||
*/
|
||||
@ApiModelProperty("类别名字")
|
||||
private String categoryName;
|
||||
|
||||
/**
|
||||
* icon图片
|
||||
*/
|
||||
@ApiModelProperty("icon图片")
|
||||
private String iconUrl;
|
||||
|
||||
/**
|
||||
* 备注信息
|
||||
*/
|
||||
@ApiModelProperty("备注信息")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@ApiModelProperty("创建者")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
@ApiModelProperty("更新者")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updateTime;
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
package com.ruoyi.product.bo;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 商品服务类别编辑对象 pro_category
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-07-01
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("商品服务类别编辑对象")
|
||||
public class ProCategoryEditBo {
|
||||
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ApiModelProperty("主键id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 类别名字
|
||||
*/
|
||||
@ApiModelProperty("类别名字")
|
||||
private String categoryName;
|
||||
|
||||
/**
|
||||
* icon图片
|
||||
*/
|
||||
@ApiModelProperty("icon图片")
|
||||
private String iconUrl;
|
||||
|
||||
/**
|
||||
* 备注信息
|
||||
*/
|
||||
@ApiModelProperty("备注信息")
|
||||
private String remark;
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package com.ruoyi.product.bo;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 商品服务类别分页查询对象 pro_category
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-07-01
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("商品服务类别分页查询对象")
|
||||
public class ProCategoryQueryBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 分页大小
|
||||
*/
|
||||
@ApiModelProperty("分页大小")
|
||||
private Integer pageSize;
|
||||
/**
|
||||
* 当前页数
|
||||
*/
|
||||
@ApiModelProperty("当前页数")
|
||||
private Integer pageNum;
|
||||
/**
|
||||
* 排序列
|
||||
*/
|
||||
@ApiModelProperty("排序列")
|
||||
private String orderByColumn;
|
||||
/**
|
||||
* 排序的方向desc或者asc
|
||||
*/
|
||||
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
|
||||
private String isAsc;
|
||||
|
||||
|
||||
/**
|
||||
* 类别名字
|
||||
*/
|
||||
@ApiModelProperty("类别名字")
|
||||
private String categoryName;
|
||||
/**
|
||||
* icon图片
|
||||
*/
|
||||
@ApiModelProperty("icon图片")
|
||||
private String iconUrl;
|
||||
|
||||
}
|
||||
@ -0,0 +1,94 @@
|
||||
package com.ruoyi.product.bo;
|
||||
|
||||
import com.ruoyi.product.dto.ProItemPictureDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品详情添加对象 pro_item
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-07-01
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("商品详情添加对象")
|
||||
public class ProItemAddBo {
|
||||
|
||||
|
||||
/**
|
||||
* 产品名字
|
||||
*/
|
||||
@ApiModelProperty("产品名字")
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
* 价钱
|
||||
*/
|
||||
@ApiModelProperty("价钱")
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@ApiModelProperty("描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 库存(限量库存)
|
||||
*/
|
||||
@ApiModelProperty("库存(限量库存)")
|
||||
private Integer sku;
|
||||
|
||||
/**
|
||||
* 封面图片
|
||||
*/
|
||||
@ApiModelProperty("封面图片")
|
||||
private String coverImage;
|
||||
|
||||
/**
|
||||
* 是否发布
|
||||
*/
|
||||
@ApiModelProperty("是否发布")
|
||||
private Integer publishFlag;
|
||||
|
||||
/**
|
||||
* 发布时间
|
||||
*/
|
||||
@ApiModelProperty("发布时间")
|
||||
private Date publishTime;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@ApiModelProperty("创建者")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
@ApiModelProperty("更新者")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty("图片列表")
|
||||
private List<ProItemPictureDTO> proItemPictures;
|
||||
|
||||
@ApiModelProperty("分类id集合")
|
||||
private List<String> proItemCategoryIds;
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.ruoyi.product.bo;
|
||||
|
||||
import com.ruoyi.product.domain.ProItem;
|
||||
import com.ruoyi.product.dto.ProItemPictureDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品详情编辑对象 pro_item
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-07-01
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("商品详情编辑对象")
|
||||
public class ProItemEditBo extends ProItem {
|
||||
|
||||
|
||||
@ApiModelProperty("图片列表")
|
||||
private List<ProItemPictureDTO> proItemPictures;
|
||||
|
||||
@ApiModelProperty("分类id集合")
|
||||
private List<String> proItemCategoryIds;
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package com.ruoyi.product.bo;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 商品详情分页查询对象 pro_item
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-04-07
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("商品详情分页查询对象")
|
||||
public class ProItemQueryBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 分页大小
|
||||
*/
|
||||
@ApiModelProperty("分页大小")
|
||||
private Integer pageSize;
|
||||
/**
|
||||
* 当前页数
|
||||
*/
|
||||
@ApiModelProperty("当前页数")
|
||||
private Integer pageNum;
|
||||
/**
|
||||
* 排序列
|
||||
*/
|
||||
@ApiModelProperty("排序列")
|
||||
private String orderByColumn;
|
||||
/**
|
||||
* 排序的方向desc或者asc
|
||||
*/
|
||||
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
|
||||
private String isAsc;
|
||||
|
||||
|
||||
/**
|
||||
* 产品名字
|
||||
*/
|
||||
@ApiModelProperty("产品名字")
|
||||
private String proName;
|
||||
/**
|
||||
* 库存(限量库存)
|
||||
*/
|
||||
@ApiModelProperty("库存(限量库存)")
|
||||
private Integer sku;
|
||||
/**
|
||||
* 封面图片
|
||||
*/
|
||||
@ApiModelProperty("封面图片")
|
||||
private String coverImage;
|
||||
/**
|
||||
* 是否发布
|
||||
*/
|
||||
@ApiModelProperty("是否发布")
|
||||
private Integer publishFlag;
|
||||
|
||||
@ApiModelProperty("是否分页,0不分页,1分页,默认分页")
|
||||
private Integer bePage = 1;
|
||||
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.ruoyi.product.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 商品关系(预约记录、优惠券)添加对象 pro_item_relation
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-04-09
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("商品关系(预约记录、优惠券)添加对象")
|
||||
public class ProItemRelationAddBo {
|
||||
|
||||
/** 业务id,可以是预约记录id,也可以是优惠券id */
|
||||
@ApiModelProperty("业务id,可以是预约记录id,也可以是优惠券id")
|
||||
private Long businessId;
|
||||
/** 1表示优惠券类型关联关系,3表示预约类型关联关系 */
|
||||
@ApiModelProperty("1表示优惠券类型关联关系,3表示预约类型关联关系")
|
||||
private String type;
|
||||
/** 商品id */
|
||||
@ApiModelProperty("商品id")
|
||||
private Long proItemId;
|
||||
/** 创建时间 */
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
/** 创建人 */
|
||||
@ApiModelProperty("创建人")
|
||||
private String createBy;
|
||||
/** 更新时间 */
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updateTime;
|
||||
/** 更新人 */
|
||||
@ApiModelProperty("更新人")
|
||||
private String updateBy;
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package com.ruoyi.product.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 商品关系(预约记录、优惠券)编辑对象 pro_item_relation
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-04-09
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("商品关系(预约记录、优惠券)编辑对象")
|
||||
public class ProItemRelationEditBo {
|
||||
|
||||
|
||||
/** 业务id,可以是预约记录id,也可以是优惠券id */
|
||||
@ApiModelProperty("业务id,可以是预约记录id,也可以是优惠券id")
|
||||
private Long businessId;
|
||||
|
||||
/** 1表示优惠券类型关联关系,3表示预约类型关联关系 */
|
||||
@ApiModelProperty("1表示优惠券类型关联关系,3表示预约类型关联关系")
|
||||
private String type;
|
||||
|
||||
/** 商品id */
|
||||
@ApiModelProperty("商品id")
|
||||
private Long proItemId;
|
||||
|
||||
/** 更新时间 */
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/** 更新人 */
|
||||
@ApiModelProperty("更新人")
|
||||
private String updateBy;
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.ruoyi.product.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 商品关系(预约记录、优惠券)分页查询对象 pro_item_relation
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-04-09
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("商品关系(预约记录、优惠券)分页查询对象")
|
||||
public class ProItemRelationQueryBo extends BaseEntity {
|
||||
|
||||
/** 分页大小 */
|
||||
@ApiModelProperty("分页大小")
|
||||
private Integer pageSize;
|
||||
/** 当前页数 */
|
||||
@ApiModelProperty("当前页数")
|
||||
private Integer pageNum;
|
||||
/** 排序列 */
|
||||
@ApiModelProperty("排序列")
|
||||
private String orderByColumn;
|
||||
/** 排序的方向desc或者asc */
|
||||
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
|
||||
private String isAsc;
|
||||
|
||||
|
||||
/** 业务id,可以是预约记录id,也可以是优惠券id */
|
||||
@ApiModelProperty("业务id,可以是预约记录id,也可以是优惠券id")
|
||||
private Long businessId;
|
||||
/** 1表示优惠券类型关联关系,3表示预约类型关联关系 */
|
||||
@ApiModelProperty("1表示优惠券类型关联关系,3表示预约类型关联关系")
|
||||
private String type;
|
||||
/** 商品id */
|
||||
@ApiModelProperty("商品id")
|
||||
private Long proItemId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
package com.ruoyi.product.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 商品规格添加对象 pro_item_specification
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-04-06
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("商品规格添加对象")
|
||||
public class ProItemSpecificationAddBo {
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
@ApiModelProperty("商品id")
|
||||
private Long itemId;
|
||||
/**
|
||||
* 规格名字
|
||||
*/
|
||||
@ApiModelProperty("规格名字")
|
||||
private String specificationTitle;
|
||||
/**
|
||||
* 图片url地址
|
||||
*/
|
||||
@ApiModelProperty("图片url地址")
|
||||
private String urlPath;
|
||||
/**
|
||||
* 规格库存
|
||||
*/
|
||||
@ApiModelProperty("规格库存")
|
||||
private Integer specificationSku;
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
@ApiModelProperty("价格")
|
||||
private BigDecimal price;
|
||||
/**
|
||||
* 别名
|
||||
*/
|
||||
@ApiModelProperty("别名")
|
||||
private String aliasName;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@ApiModelProperty("描述")
|
||||
private String description;
|
||||
/**
|
||||
* 是否上架,0未上架,1上架,默认是0
|
||||
*/
|
||||
@ApiModelProperty("是否上架,0未上架,1上架,默认是0")
|
||||
private String publishFlag;
|
||||
/**
|
||||
* 上架时间
|
||||
*/
|
||||
@ApiModelProperty("上架时间")
|
||||
private LocalDateTime publishTime;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@ApiModelProperty("创建人id")
|
||||
private String createBy;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty("更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
@ApiModelProperty("更新人id")
|
||||
private String updateBy;
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
package com.ruoyi.product.bo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.ruoyi.common.constant.Constants.FULL_DATE_TIME;
|
||||
|
||||
/**
|
||||
* 商品规格编辑对象 pro_item_specification
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-04-06
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("商品规格编辑对象")
|
||||
public class ProItemSpecificationEditBo {
|
||||
|
||||
@ApiModelProperty("商品规格id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@ApiModelProperty("商品id")
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 规格名字
|
||||
*/
|
||||
@ApiModelProperty("规格名字")
|
||||
private String specificationTitle;
|
||||
|
||||
/**
|
||||
* 图片url地址
|
||||
*/
|
||||
@ApiModelProperty("图片url地址")
|
||||
private String urlPath;
|
||||
|
||||
/**
|
||||
* 规格库存
|
||||
*/
|
||||
@ApiModelProperty("规格库存")
|
||||
private Integer specificationSku;
|
||||
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
@ApiModelProperty("价格")
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 别名
|
||||
*/
|
||||
@ApiModelProperty("别名")
|
||||
private String aliasName;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@ApiModelProperty("描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 是否上架,0未上架,1上架,默认是0
|
||||
*/
|
||||
@ApiModelProperty("是否上架,0未上架,1上架,默认是0")
|
||||
private String publishFlag;
|
||||
|
||||
/**
|
||||
* 上架时间
|
||||
*/
|
||||
@JsonFormat(pattern = FULL_DATE_TIME)
|
||||
@ApiModelProperty("上架时间")
|
||||
private LocalDateTime publishTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty("更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
@ApiModelProperty("更新人id")
|
||||
private String updateBy;
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package com.ruoyi.product.bo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 商品规格分页查询对象 pro_item_specification
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-04-06
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("商品规格分页查询对象")
|
||||
public class ProItemSpecificationQueryBo {
|
||||
|
||||
/**
|
||||
* 分页大小
|
||||
*/
|
||||
@ApiModelProperty("分页大小")
|
||||
private Integer pageSize;
|
||||
/**
|
||||
* 当前页数
|
||||
*/
|
||||
@ApiModelProperty("当前页数")
|
||||
private Integer pageNum;
|
||||
/**
|
||||
* 排序列
|
||||
*/
|
||||
@ApiModelProperty("排序列")
|
||||
private String orderByColumn;
|
||||
/**
|
||||
* 排序的方向desc或者asc
|
||||
*/
|
||||
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
|
||||
private String isAsc;
|
||||
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
@ApiModelProperty("商品id")
|
||||
private Long itemId;
|
||||
|
||||
@ApiModelProperty("规格标题")
|
||||
private String specificationTitle;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> params = new HashMap<>();
|
||||
}
|
||||
@ -0,0 +1,83 @@
|
||||
package com.ruoyi.product.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* banner管理对象 pro_banner
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-03-14
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("pro_banner")
|
||||
public class ProBanner implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* banner标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* url跳转(也可能是path)
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 图片url
|
||||
*/
|
||||
private String picUrl;
|
||||
|
||||
/**
|
||||
* 是否跳转
|
||||
*/
|
||||
private Integer redirectFlag;
|
||||
|
||||
/**
|
||||
* banner类型,1应用内跳转,3外部跳转
|
||||
*/
|
||||
private Integer bannerType;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updateTime;
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
package com.ruoyi.product.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 商品服务类别对象 pro_category
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-03-14
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("pro_category")
|
||||
public class ProCategory implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@TableId(value = "id", type = IdType.INPUT)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 类别名字
|
||||
*/
|
||||
@Excel(name = "类别名字")
|
||||
private String categoryName;
|
||||
|
||||
/**
|
||||
* icon图片
|
||||
*/
|
||||
@Excel(name = "icon图片")
|
||||
private String iconUrl;
|
||||
|
||||
/**
|
||||
* 备注信息
|
||||
*/
|
||||
@Excel(name = "备注信息")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> params = new HashMap<>();
|
||||
}
|
||||
@ -0,0 +1,121 @@
|
||||
package com.ruoyi.product.domain;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.product.dto.ProItemPictureDTO;
|
||||
import com.ruoyi.product.vo.ProItemVo;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 商品详情对象 pro_item
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-03-13
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("pro_item")
|
||||
public class ProItem implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@TableId(value = "id", type = IdType.INPUT)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 产品名字
|
||||
*/
|
||||
@Excel(name = "产品名字")
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
* 价钱
|
||||
*/
|
||||
@Excel(name = "价钱")
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 库存(限量库存)
|
||||
*/
|
||||
@Excel(name = "库存(限量库存)")
|
||||
private Integer sku;
|
||||
|
||||
/**
|
||||
* 封面图片
|
||||
*/
|
||||
@Excel(name = "封面图片")
|
||||
private String coverImage;
|
||||
|
||||
/**
|
||||
* 是否发布
|
||||
*/
|
||||
@Excel(name = "是否发布")
|
||||
private Integer publishFlag;
|
||||
|
||||
/**
|
||||
* 发布时间
|
||||
*/
|
||||
@Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date publishTime;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> params = new HashMap<>();
|
||||
|
||||
|
||||
public ProItemVo toVo(List<ProItemPictureDTO> pictures, List<String> categoryIds) {
|
||||
ProItemVo vo = new ProItemVo();
|
||||
BeanUtil.copyProperties(this, vo);
|
||||
vo.setProItemPictures(pictures);
|
||||
vo.setProItemCategoryIds(categoryIds);
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
package com.ruoyi.product.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* proItemCategory对象 pro_item_category
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-03-24
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("pro_item_category")
|
||||
public class ProItemCategory implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.INPUT)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 分类id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package com.ruoyi.product.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* proItemPicture对象 pro_item_picture
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-03-20
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("pro_item_picture")
|
||||
public class ProItemPicture implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
|
||||
/** 主键id */
|
||||
@TableId(value = "id", type = IdType.INPUT)
|
||||
private Long id;
|
||||
|
||||
/** 商品id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long itemId;
|
||||
|
||||
/** 图片地址 */
|
||||
private String picUrl;
|
||||
|
||||
/** 类型,1是商品banner图, 3是评论图片 */
|
||||
private Integer picType;
|
||||
|
||||
/** paixu */
|
||||
private Integer picSort;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Date createTime;
|
||||
|
||||
/** 创建人id */
|
||||
private String createBy;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Date updateTime;
|
||||
|
||||
/** 更新人id */
|
||||
private String updateBy;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> params = new HashMap<>();
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
package com.ruoyi.product.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
|
||||
/**
|
||||
* 商品关系(预约记录、优惠券)对象 pro_item_relation
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-04-09
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("pro_item_relation")
|
||||
public class ProItemRelation implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
|
||||
/** 主键id */
|
||||
@TableId(value = "id", type = IdType.INPUT)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 业务id,可以是预约记录id,也可以是优惠券id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long businessId;
|
||||
|
||||
/** 1表示优惠券类型关联关系,3表示预约类型关联关系 */
|
||||
private String type;
|
||||
|
||||
/** 商品id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long proItemId;
|
||||
|
||||
/** 创建时间 */
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/** 创建人 */
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String createBy;
|
||||
|
||||
/** 更新时间 */
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/** 更新人 */
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private String updateBy;
|
||||
|
||||
public String getStringForProItemId() {
|
||||
return this.proItemId.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,106 @@
|
||||
package com.ruoyi.product.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 商品规格对象 pro_item_specification
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-04-06
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("pro_item_specification")
|
||||
public class ProItemSpecification implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.INPUT)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 规格名字
|
||||
*/
|
||||
private String specificationTitle;
|
||||
|
||||
/**
|
||||
* 图片url地址
|
||||
*/
|
||||
private String urlPath;
|
||||
|
||||
/**
|
||||
* 规格库存
|
||||
*/
|
||||
private Integer specificationSku;
|
||||
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 别名
|
||||
*/
|
||||
private String aliasName;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 是否上架,0未上架,1上架,默认是0
|
||||
*/
|
||||
private String publishFlag;
|
||||
|
||||
/**
|
||||
* 上架时间
|
||||
*/
|
||||
private LocalDateTime publishTime;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private String updateBy;
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.ruoyi.product.dto;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class ProItemPictureDTO {
|
||||
|
||||
private String key;
|
||||
private String value;
|
||||
// 返回出参的时候将值设置成url
|
||||
private String url;
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.ruoyi.product.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PictureTypeEnum {
|
||||
|
||||
SWIPER(1, "轮播图"),
|
||||
COMMENT(3, "评论");
|
||||
private Integer value;
|
||||
|
||||
private String description;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.ruoyi.product.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PublishFlagEnum {
|
||||
|
||||
YES("1", "已发布"),
|
||||
NO("0", "未发布");
|
||||
|
||||
private String value;
|
||||
|
||||
private String description;
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.product.mapper;
|
||||
|
||||
import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
|
||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||
import com.ruoyi.product.domain.ProBanner;
|
||||
import org.apache.ibatis.annotations.CacheNamespace;
|
||||
|
||||
/**
|
||||
* banner管理Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-06-30
|
||||
*/
|
||||
// 如使需切换数据源 请勿使用缓存 会造成数据不一致现象
|
||||
@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class)
|
||||
public interface ProBannerMapper extends BaseMapperPlus<ProBanner> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.product.mapper;
|
||||
|
||||
import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
|
||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||
import com.ruoyi.product.domain.ProCategory;
|
||||
import org.apache.ibatis.annotations.CacheNamespace;
|
||||
|
||||
/**
|
||||
* 商品服务类别Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-07-01
|
||||
*/
|
||||
// 如使需切换数据源 请勿使用缓存 会造成数据不一致现象
|
||||
@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class)
|
||||
public interface ProCategoryMapper extends BaseMapperPlus<ProCategory> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.ruoyi.product.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.product.domain.ProItemCategory;
|
||||
|
||||
/**
|
||||
* proItemCategoryMapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-03-24
|
||||
*/
|
||||
public interface ProItemCategoryMapper extends BaseMapper<ProItemCategory> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.product.mapper;
|
||||
|
||||
import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
|
||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||
import com.ruoyi.product.domain.ProItem;
|
||||
import org.apache.ibatis.annotations.CacheNamespace;
|
||||
|
||||
/**
|
||||
* 商品详情Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-07-01
|
||||
*/
|
||||
// 如使需切换数据源 请勿使用缓存 会造成数据不一致现象
|
||||
@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class)
|
||||
public interface ProItemMapper extends BaseMapperPlus<ProItem> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.ruoyi.product.mapper;
|
||||
|
||||
import com.ruoyi.product.domain.ProItemPicture;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* proItemPictureMapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-03-20
|
||||
*/
|
||||
public interface ProItemPictureMapper extends BaseMapper<ProItemPicture> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.product.mapper;
|
||||
|
||||
import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
|
||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||
import com.ruoyi.product.domain.ProItemRelation;
|
||||
import org.apache.ibatis.annotations.CacheNamespace;
|
||||
|
||||
/**
|
||||
* 商品关系(预约记录、优惠券)Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-04-09
|
||||
*/
|
||||
@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class)
|
||||
public interface ProItemRelationMapper extends BaseMapperPlus<ProItemRelation> {
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.product.mapper;
|
||||
|
||||
import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
|
||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||
import com.ruoyi.product.domain.ProItemSpecification;
|
||||
import org.apache.ibatis.annotations.CacheNamespace;
|
||||
|
||||
/**
|
||||
* 商品规格Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-06-30
|
||||
*/
|
||||
// 如使需切换数据源 请勿使用缓存 会造成数据不一致现象
|
||||
@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class)
|
||||
public interface ProItemSpecificationMapper extends BaseMapperPlus<ProItemSpecification> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
package com.ruoyi.product.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.product.bo.ProBannerAddBo;
|
||||
import com.ruoyi.product.bo.ProBannerEditBo;
|
||||
import com.ruoyi.product.bo.ProBannerQueryBo;
|
||||
import com.ruoyi.product.bo.ProItemRelationQueryBo;
|
||||
import com.ruoyi.product.domain.ProBanner;
|
||||
import com.ruoyi.product.vo.ProBannerVo;
|
||||
import com.ruoyi.product.vo.ProItemRelationVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* banner管理Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-03-14
|
||||
*/
|
||||
public interface IProBannerService extends IServicePlus<ProBanner> {
|
||||
/**
|
||||
* 查询单个
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ProBannerVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
TableDataInfo<ProBannerVo> queryPageList(ProBannerQueryBo bo);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
List<ProBannerVo> queryList(ProBannerQueryBo bo);
|
||||
|
||||
/**
|
||||
* 根据新增业务对象插入banner管理
|
||||
*
|
||||
* @param bo banner管理新增业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean insertByAddBo(ProBannerAddBo bo);
|
||||
|
||||
/**
|
||||
* 根据编辑业务对象修改banner管理
|
||||
*
|
||||
* @param bo banner管理编辑业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean updateByEditBo(ProBannerEditBo bo);
|
||||
|
||||
/**
|
||||
* 校验并删除数据
|
||||
*
|
||||
* @param ids 主键集合
|
||||
* @param isValid 是否校验,true-删除前校验,false-不校验
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.ruoyi.product.service;
|
||||
|
||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.product.bo.ProCategoryAddBo;
|
||||
import com.ruoyi.product.bo.ProCategoryEditBo;
|
||||
import com.ruoyi.product.bo.ProCategoryQueryBo;
|
||||
import com.ruoyi.product.domain.ProCategory;
|
||||
import com.ruoyi.product.vo.ProCategoryVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品服务类别Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-07-01
|
||||
*/
|
||||
public interface IProCategoryService extends IServicePlus<ProCategory> {
|
||||
/**
|
||||
* 查询单个
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ProCategoryVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
TableDataInfo<ProCategoryVo> queryPageList(ProCategoryQueryBo bo);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
List<ProCategoryVo> queryList(ProCategoryQueryBo bo);
|
||||
|
||||
/**
|
||||
* 根据新增业务对象插入商品服务类别
|
||||
*
|
||||
* @param bo 商品服务类别新增业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean insertByAddBo(ProCategoryAddBo bo);
|
||||
|
||||
/**
|
||||
* 根据编辑业务对象修改商品服务类别
|
||||
*
|
||||
* @param bo 商品服务类别编辑业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean updateByEditBo(ProCategoryEditBo bo);
|
||||
|
||||
/**
|
||||
* 校验并删除数据
|
||||
*
|
||||
* @param ids 主键集合
|
||||
* @param isValid 是否校验,true-删除前校验,false-不校验
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.ruoyi.product.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.product.domain.ProItemCategory;
|
||||
|
||||
/**
|
||||
* proItemCategoryService接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-03-24
|
||||
*/
|
||||
public interface IProItemCategoryService extends IService<ProItemCategory> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.ruoyi.product.service;
|
||||
|
||||
import com.ruoyi.product.domain.ProItemPicture;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* proItemPictureService接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-03-20
|
||||
*/
|
||||
public interface IProItemPictureService extends IService<ProItemPicture> {
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
List<ProItemPicture> queryList(ProItemPicture proItemPicture);
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package com.ruoyi.product.service;
|
||||
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.product.domain.ProItemRelation;
|
||||
import com.ruoyi.product.vo.ProItemRelationVo;
|
||||
import com.ruoyi.product.bo.ProItemRelationQueryBo;
|
||||
import com.ruoyi.product.bo.ProItemRelationAddBo;
|
||||
import com.ruoyi.product.bo.ProItemRelationEditBo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品关系(预约记录、优惠券)Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-04-09
|
||||
*/
|
||||
public interface IProItemRelationService extends IService<ProItemRelation> {
|
||||
/**
|
||||
* 查询单个
|
||||
* @return
|
||||
*/
|
||||
ProItemRelationVo queryById(Long id);
|
||||
|
||||
TableDataInfo<ProItemRelationVo> queryPageList(ProItemRelationQueryBo bo);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
List<ProItemRelationVo> queryList(ProItemRelationQueryBo bo);
|
||||
|
||||
/**
|
||||
* 根据新增业务对象插入商品关系(预约记录、优惠券)
|
||||
* @param bo 商品关系(预约记录、优惠券)新增业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean insertByAddBo(ProItemRelationAddBo bo);
|
||||
|
||||
/**
|
||||
* 根据编辑业务对象修改商品关系(预约记录、优惠券)
|
||||
* @param bo 商品关系(预约记录、优惠券)编辑业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean updateByEditBo(ProItemRelationEditBo bo);
|
||||
|
||||
/**
|
||||
* 校验并删除数据
|
||||
* @param ids 主键集合
|
||||
* @param isValid 是否校验,true-删除前校验,false-不校验
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package com.ruoyi.product.service;
|
||||
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.product.bo.ProItemAddBo;
|
||||
import com.ruoyi.product.bo.ProItemEditBo;
|
||||
import com.ruoyi.product.bo.ProItemQueryBo;
|
||||
import com.ruoyi.product.domain.ProItem;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.product.vo.ProItemVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品详情Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-03-13
|
||||
*/
|
||||
public interface IProItemService extends IService<ProItem> {
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
TableDataInfo<ProItemVo> queryPageList(ProItemQueryBo bo);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
List<ProItemVo> queryList(ProItemQueryBo bo);
|
||||
|
||||
/**
|
||||
* 新增商品
|
||||
* @param bo
|
||||
* @return
|
||||
*/
|
||||
boolean insertByAddBo(ProItemAddBo bo);
|
||||
|
||||
/**
|
||||
* 根据id更新商品详情
|
||||
* @param bo
|
||||
* @return
|
||||
*/
|
||||
boolean updateByEditBo(ProItemEditBo bo);
|
||||
|
||||
/**
|
||||
* 根据id获取详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ProItemVo getProItemById(Long id);
|
||||
|
||||
/**
|
||||
* 校验并删除数据
|
||||
* @param ids 主键集合
|
||||
* @param isValid 是否校验,true-删除前校验,false-不校验
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package com.ruoyi.product.service;
|
||||
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.product.domain.ProItemSpecification;
|
||||
import com.ruoyi.product.vo.ProItemSpecificationVo;
|
||||
import com.ruoyi.product.bo.ProItemSpecificationQueryBo;
|
||||
import com.ruoyi.product.bo.ProItemSpecificationAddBo;
|
||||
import com.ruoyi.product.bo.ProItemSpecificationEditBo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品规格Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-04-06
|
||||
*/
|
||||
public interface IProItemSpecificationService extends IService<ProItemSpecification> {
|
||||
/**
|
||||
* 查询单个
|
||||
* @return
|
||||
*/
|
||||
ProItemSpecificationVo queryById(Long id);
|
||||
|
||||
TableDataInfo<ProItemSpecificationVo> queryPageList(ProItemSpecificationQueryBo bo);
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
List<ProItemSpecificationVo> queryList(ProItemSpecificationQueryBo bo);
|
||||
|
||||
/**
|
||||
* 根据新增业务对象插入商品规格
|
||||
* @param bo 商品规格新增业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean insertByAddBo(ProItemSpecificationAddBo bo);
|
||||
|
||||
/**
|
||||
* 根据编辑业务对象修改商品规格
|
||||
* @param bo 商品规格编辑业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean updateByEditBo(ProItemSpecificationEditBo bo);
|
||||
|
||||
/**
|
||||
* 校验并删除数据
|
||||
* @param ids 主键集合
|
||||
* @param isValid 是否校验,true-删除前校验,false-不校验
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
package com.ruoyi.product.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||
import com.ruoyi.common.core.page.PagePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.IdUtils;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.product.bo.ProBannerAddBo;
|
||||
import com.ruoyi.product.bo.ProBannerEditBo;
|
||||
import com.ruoyi.product.bo.ProBannerQueryBo;
|
||||
import com.ruoyi.product.bo.ProItemRelationQueryBo;
|
||||
import com.ruoyi.product.domain.ProBanner;
|
||||
import com.ruoyi.product.mapper.ProBannerMapper;
|
||||
import com.ruoyi.product.service.IProBannerService;
|
||||
import com.ruoyi.product.vo.ProBannerVo;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* banner管理Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-03-14
|
||||
*/
|
||||
@Service
|
||||
public class ProBannerServiceImpl extends ServicePlusImpl<ProBannerMapper, ProBanner> implements IProBannerService {
|
||||
|
||||
|
||||
@Override
|
||||
public ProBannerVo queryById(Long id){
|
||||
return getVoById(id, ProBannerVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<ProBannerVo> queryPageList(ProBannerQueryBo bo) {
|
||||
PagePlus<ProBanner, ProBannerVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo), ProBannerVo.class);
|
||||
return PageUtils.buildDataInfo(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProBannerVo> queryList(ProBannerQueryBo bo) {
|
||||
return listVo(buildQueryWrapper(bo), ProBannerVo.class);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<ProBanner> buildQueryWrapper(ProBannerQueryBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<ProBanner> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StrUtil.isNotBlank(bo.getTitle()), ProBanner::getTitle, bo.getTitle());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getUrl()), ProBanner::getUrl, bo.getUrl());
|
||||
lqw.eq(bo.getRedirectFlag() != null, ProBanner::getRedirectFlag, bo.getRedirectFlag());
|
||||
lqw.eq(bo.getBannerType() != null, ProBanner::getBannerType, bo.getBannerType());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean insertByAddBo(ProBannerAddBo bo) {
|
||||
ProBanner add = BeanUtil.toBean(bo, ProBanner.class);
|
||||
add.setId(IdUtils.nextId());
|
||||
validEntityBeforeSave(add);
|
||||
return save(add);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateByEditBo(ProBannerEditBo bo) {
|
||||
ProBanner update = BeanUtil.toBean(bo, ProBanner.class);
|
||||
validEntityBeforeSave(update);
|
||||
return updateById(update);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*
|
||||
* @param entity 实体类数据
|
||||
*/
|
||||
private void validEntityBeforeSave(ProBanner entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return removeByIds(ids);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
package com.ruoyi.product.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||
import com.ruoyi.common.core.page.PagePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.IdUtils;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.product.bo.ProCategoryAddBo;
|
||||
import com.ruoyi.product.bo.ProCategoryEditBo;
|
||||
import com.ruoyi.product.bo.ProCategoryQueryBo;
|
||||
import com.ruoyi.product.domain.ProCategory;
|
||||
import com.ruoyi.product.mapper.ProCategoryMapper;
|
||||
import com.ruoyi.product.service.IProCategoryService;
|
||||
import com.ruoyi.product.vo.ProCategoryVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 商品服务类别Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-03-14
|
||||
*/
|
||||
@Service
|
||||
public class ProCategoryServiceImpl extends ServicePlusImpl<ProCategoryMapper, ProCategory> implements IProCategoryService {
|
||||
|
||||
@Override
|
||||
public ProCategoryVo queryById(Long id) {
|
||||
return getVoById(id, ProCategoryVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<ProCategoryVo> queryPageList(ProCategoryQueryBo bo) {
|
||||
PagePlus<ProCategory, ProCategoryVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo), ProCategoryVo.class);
|
||||
return PageUtils.buildDataInfo(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProCategoryVo> queryList(ProCategoryQueryBo bo) {
|
||||
return listVo(buildQueryWrapper(bo), ProCategoryVo.class);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<ProCategory> buildQueryWrapper(ProCategoryQueryBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<ProCategory> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StrUtil.isNotBlank(bo.getCategoryName()), ProCategory::getCategoryName, bo.getCategoryName());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getIconUrl()), ProCategory::getIconUrl, bo.getIconUrl());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean insertByAddBo(ProCategoryAddBo bo) {
|
||||
ProCategory add = BeanUtil.toBean(bo, ProCategory.class);
|
||||
add.setId(IdUtils.nextId());
|
||||
validEntityBeforeSave(add);
|
||||
return save(add);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateByEditBo(ProCategoryEditBo bo) {
|
||||
ProCategory update = BeanUtil.toBean(bo, ProCategory.class);
|
||||
validEntityBeforeSave(update);
|
||||
return updateById(update);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*
|
||||
* @param entity 实体类数据
|
||||
*/
|
||||
private void validEntityBeforeSave(ProCategory entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return removeByIds(ids);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.ruoyi.product.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.product.domain.ProItemCategory;
|
||||
import com.ruoyi.product.mapper.ProItemCategoryMapper;
|
||||
import com.ruoyi.product.service.IProItemCategoryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* proItemCategoryService业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-03-24
|
||||
*/
|
||||
@Service
|
||||
public class ProItemCategoryServiceImpl extends ServiceImpl<ProItemCategoryMapper, ProItemCategory> implements IProItemCategoryService {
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.ruoyi.product.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.product.domain.ProItemPicture;
|
||||
import com.ruoyi.product.mapper.ProItemPictureMapper;
|
||||
import com.ruoyi.product.service.IProItemPictureService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* proItemPictureService业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-03-20
|
||||
*/
|
||||
@Service
|
||||
public class ProItemPictureServiceImpl extends ServiceImpl<ProItemPictureMapper, ProItemPicture> implements IProItemPictureService {
|
||||
|
||||
@Override
|
||||
public List<ProItemPicture> queryList(ProItemPicture proItemPicture) {
|
||||
LambdaQueryWrapper<ProItemPicture> lqw = Wrappers.lambdaQuery();
|
||||
return this.list(lqw);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
package com.ruoyi.product.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||
import com.ruoyi.common.core.page.PagePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.product.bo.ProItemRelationAddBo;
|
||||
import com.ruoyi.product.bo.ProItemRelationEditBo;
|
||||
import com.ruoyi.product.bo.ProItemRelationQueryBo;
|
||||
import com.ruoyi.product.domain.ProItemRelation;
|
||||
import com.ruoyi.product.mapper.ProItemRelationMapper;
|
||||
import com.ruoyi.product.service.IProItemRelationService;
|
||||
import com.ruoyi.product.vo.ProItemRelationVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 商品关系(预约记录、优惠券)Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-04-09
|
||||
*/
|
||||
@Service
|
||||
public class ProItemRelationServiceImpl extends ServicePlusImpl<ProItemRelationMapper, ProItemRelation> implements IProItemRelationService {
|
||||
|
||||
@Override
|
||||
public ProItemRelationVo queryById(Long id) {
|
||||
ProItemRelation db = this.baseMapper.selectById(id);
|
||||
return BeanUtil.toBean(db, ProItemRelationVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<ProItemRelationVo> queryPageList(ProItemRelationQueryBo bo) {
|
||||
PagePlus<ProItemRelation, ProItemRelationVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo), ProItemRelationVo.class);
|
||||
return PageUtils.buildDataInfo(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProItemRelationVo> queryList(ProItemRelationQueryBo bo) {
|
||||
return listVo(buildQueryWrapper(bo), ProItemRelationVo.class);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<ProItemRelation> buildQueryWrapper(ProItemRelationQueryBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<ProItemRelation> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getBusinessId() != null, ProItemRelation::getBusinessId, bo.getBusinessId());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getType()), ProItemRelation::getType, bo.getType());
|
||||
lqw.eq(bo.getProItemId() != null, ProItemRelation::getProItemId, bo.getProItemId());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean insertByAddBo(ProItemRelationAddBo bo) {
|
||||
ProItemRelation add = BeanUtil.toBean(bo, ProItemRelation.class);
|
||||
validEntityBeforeSave(add);
|
||||
return this.save(add);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateByEditBo(ProItemRelationEditBo bo) {
|
||||
ProItemRelation update = BeanUtil.toBean(bo, ProItemRelation.class);
|
||||
validEntityBeforeSave(update);
|
||||
return this.updateById(update);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*
|
||||
* @param entity 实体类数据
|
||||
*/
|
||||
private void validEntityBeforeSave(ProItemRelation entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return this.removeByIds(ids);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,160 @@
|
||||
package com.ruoyi.product.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||
import com.ruoyi.common.core.page.PagePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.exception.BaseException;
|
||||
import com.ruoyi.common.utils.IdUtils;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.product.bo.ProItemAddBo;
|
||||
import com.ruoyi.product.bo.ProItemEditBo;
|
||||
import com.ruoyi.product.bo.ProItemQueryBo;
|
||||
import com.ruoyi.product.domain.ProItem;
|
||||
import com.ruoyi.product.domain.ProItemCategory;
|
||||
import com.ruoyi.product.domain.ProItemPicture;
|
||||
import com.ruoyi.product.dto.ProItemPictureDTO;
|
||||
import com.ruoyi.product.enums.PictureTypeEnum;
|
||||
import com.ruoyi.product.enums.PublishFlagEnum;
|
||||
import com.ruoyi.product.mapper.ProItemMapper;
|
||||
import com.ruoyi.product.service.IProItemCategoryService;
|
||||
import com.ruoyi.product.service.IProItemPictureService;
|
||||
import com.ruoyi.product.service.IProItemService;
|
||||
import com.ruoyi.product.vo.ProItemVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 商品详情Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-03-13
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ProItemServiceImpl extends ServicePlusImpl<ProItemMapper, ProItem> implements IProItemService {
|
||||
|
||||
|
||||
private final ProItemMapper proItemMapper;
|
||||
private final IProItemPictureService proItemPictureService;
|
||||
private final IProItemCategoryService proItemCategoryService;
|
||||
|
||||
public boolean insertByAddBo(ProItemAddBo bo) {
|
||||
if (Objects.equals(bo.getPublishFlag(), PublishFlagEnum.YES.getValue())) {
|
||||
bo.setPublishTime(new Date());
|
||||
}
|
||||
ProItem proItem = new ProItem();
|
||||
BeanUtil.copyProperties(bo, proItem);
|
||||
proItem.setId(IdUtils.nextId());
|
||||
proItemMapper.insert(proItem);
|
||||
if (CollUtil.isNotEmpty(bo.getProItemPictures())) {
|
||||
List<ProItemPicture> pictures = getProItemPictures(bo.getProItemPictures(), proItem.getId());
|
||||
proItemPictureService.saveBatch(pictures);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(bo.getProItemCategoryIds())) {
|
||||
List<ProItemCategory> proItemCategories = getProItemCategories(bo.getProItemCategoryIds(), proItem.getId());
|
||||
proItemCategoryService.saveBatch(proItemCategories);
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
private List<ProItemCategory> getProItemCategories(List<String> categoryIds, Long id) {
|
||||
return categoryIds.stream().map(item -> {
|
||||
ProItemCategory category = new ProItemCategory();
|
||||
category.setId(IdUtils.nextId());
|
||||
category.setCategoryId(Long.parseLong(item));
|
||||
category.setItemId(id);
|
||||
return category;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<ProItemPicture> getProItemPictures(List<ProItemPictureDTO> pictureDTOS, Long id) {
|
||||
List<ProItemPicture> res = new ArrayList<>();
|
||||
for (ProItemPictureDTO proItemPicture : pictureDTOS) {
|
||||
ProItemPicture itemPicture = new ProItemPicture();
|
||||
itemPicture.setId(IdUtils.nextId());
|
||||
itemPicture.setItemId(id);
|
||||
itemPicture.setPicUrl(proItemPicture.getValue());
|
||||
itemPicture.setPicType(PictureTypeEnum.SWIPER.getValue());
|
||||
itemPicture.setPicSort(pictureDTOS.indexOf(proItemPicture));
|
||||
res.add(itemPicture);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean updateByEditBo(ProItemEditBo bo) {
|
||||
ProItem exist = baseMapper.selectById(bo.getId());
|
||||
Optional.ofNullable(exist).orElseThrow(() -> new BaseException("商品信息不存在!"));
|
||||
// 开始更新图片信息
|
||||
proItemPictureService.remove(Wrappers.<ProItemPicture>lambdaUpdate().eq(ProItemPicture::getItemId, exist.getId()));
|
||||
if (CollUtil.isNotEmpty(bo.getProItemPictures())) {
|
||||
List<ProItemPicture> pictures = getProItemPictures(bo.getProItemPictures(), bo.getId());
|
||||
proItemPictureService.saveBatch(pictures);
|
||||
}
|
||||
proItemCategoryService.remove(Wrappers.<ProItemCategory>lambdaUpdate().eq(ProItemCategory::getItemId, exist.getId()));
|
||||
if (CollUtil.isNotEmpty(bo.getProItemCategoryIds())) {
|
||||
List<ProItemCategory> proItemCategories = getProItemCategories(bo.getProItemCategoryIds(), bo.getId());
|
||||
proItemCategoryService.saveBatch(proItemCategories);
|
||||
}
|
||||
// 当库中未发布,参数中带着已发布,此时需要更新发布时间
|
||||
if ((Objects.equals(PublishFlagEnum.NO.getValue(), exist.getPublishFlag()) || Objects.isNull(exist.getPublishFlag()))
|
||||
&& Objects.equals(PublishFlagEnum.YES.getValue(), bo.getPublishFlag())) {
|
||||
bo.setPublishTime(new Date());
|
||||
}
|
||||
baseMapper.updateById(bo);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProItemVo getProItemById(Long id) {
|
||||
ProItem proItem = baseMapper.selectById(id);
|
||||
List<ProItemPicture> pictures = proItemPictureService.list(
|
||||
Wrappers.<ProItemPicture>lambdaQuery().eq(ProItemPicture::getItemId, id));
|
||||
List<ProItemCategory> categories = proItemCategoryService.list(
|
||||
Wrappers.<ProItemCategory>lambdaQuery().eq(ProItemCategory::getItemId, id));
|
||||
List<ProItemPictureDTO> pic = pictures.stream()
|
||||
.map(item -> ProItemPictureDTO.builder().url(item.getPicUrl()).value(item.getPicUrl()).build())
|
||||
.collect(Collectors.toList());
|
||||
List<String> categoryIds = categories.stream().map(item -> item.getCategoryId().toString()).collect(Collectors.toList());
|
||||
return proItem.toVo(pic, categoryIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return removeByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<ProItemVo> queryPageList(ProItemQueryBo proItemQueryBo) {
|
||||
PagePlus<ProItem, ProItemVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(proItemQueryBo), ProItemVo.class);
|
||||
return PageUtils.buildDataInfo(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProItemVo> queryList(ProItemQueryBo bo) {
|
||||
return listVo(buildQueryWrapper(bo), ProItemVo.class);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<ProItem> buildQueryWrapper(ProItemQueryBo bo) {
|
||||
// Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<ProItem> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StrUtil.isNotBlank(bo.getProName()), ProItem::getProName, bo.getProName());
|
||||
lqw.eq(bo.getSku() != null, ProItem::getSku, bo.getSku());
|
||||
lqw.eq(bo.getPublishFlag() != null, ProItem::getPublishFlag, bo.getPublishFlag());
|
||||
// lqw.eq(bo.getPublishTime() != null, ProItem::getPublishTime, bo.getPublishTime());
|
||||
return lqw;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,98 @@
|
||||
package com.ruoyi.product.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||
import com.ruoyi.common.core.page.PagePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.exception.BaseException;
|
||||
import com.ruoyi.common.utils.IdUtils;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.product.bo.ProItemSpecificationAddBo;
|
||||
import com.ruoyi.product.bo.ProItemSpecificationEditBo;
|
||||
import com.ruoyi.product.bo.ProItemSpecificationQueryBo;
|
||||
import com.ruoyi.product.domain.ProItemSpecification;
|
||||
import com.ruoyi.product.enums.PublishFlagEnum;
|
||||
import com.ruoyi.product.mapper.ProItemSpecificationMapper;
|
||||
import com.ruoyi.product.service.IProItemSpecificationService;
|
||||
import com.ruoyi.product.vo.ProItemSpecificationVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 商品规格Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-04-06
|
||||
*/
|
||||
@Service
|
||||
public class ProItemSpecificationServiceImpl extends ServicePlusImpl<ProItemSpecificationMapper, ProItemSpecification> implements IProItemSpecificationService {
|
||||
|
||||
@Override
|
||||
public ProItemSpecificationVo queryById(Long id) {
|
||||
return getVoById(id, ProItemSpecificationVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<ProItemSpecificationVo> queryPageList(ProItemSpecificationQueryBo bo) {
|
||||
PagePlus<ProItemSpecification, ProItemSpecificationVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo), ProItemSpecificationVo.class);
|
||||
return PageUtils.buildDataInfo(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProItemSpecificationVo> queryList(ProItemSpecificationQueryBo bo) {
|
||||
return listVo(buildQueryWrapper(bo), ProItemSpecificationVo.class);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<ProItemSpecification> buildQueryWrapper(ProItemSpecificationQueryBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<ProItemSpecification> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getItemId() != null, ProItemSpecification::getItemId, bo.getItemId());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean insertByAddBo(ProItemSpecificationAddBo bo) {
|
||||
ProItemSpecification add = BeanUtil.toBean(bo, ProItemSpecification.class);
|
||||
validEntityBeforeSave(add, Boolean.TRUE);
|
||||
add.setId(IdUtils.nextId());
|
||||
return this.save(add);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateByEditBo(ProItemSpecificationEditBo bo) {
|
||||
ProItemSpecification update = BeanUtil.toBean(bo, ProItemSpecification.class);
|
||||
validEntityBeforeSave(update, Boolean.FALSE);
|
||||
return this.updateById(update);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*
|
||||
* @param entity 实体类数据
|
||||
*/
|
||||
private void validEntityBeforeSave(ProItemSpecification entity, boolean beAdd) {
|
||||
if (beAdd && Objects.equals(PublishFlagEnum.YES.getValue(), entity.getPublishFlag())) {
|
||||
entity.setPublishTime(LocalDateTime.now());
|
||||
}
|
||||
if (!beAdd) {
|
||||
ProItemSpecification exist = baseMapper.selectById(entity.getId());
|
||||
Optional.ofNullable(exist).orElseThrow(() -> new BaseException("该规格不存在,请刷新重试!"));
|
||||
if (Objects.equals(PublishFlagEnum.YES.getValue(), entity.getPublishFlag())
|
||||
&& (Objects.isNull(exist.getPublishFlag()) || Objects.equals(PublishFlagEnum.NO.getValue(), exist.getPublishFlag()))) {
|
||||
entity.setPublishTime(LocalDateTime.now());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return this.removeByIds(ids);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package com.ruoyi.product.vo;
|
||||
|
||||
/**
|
||||
* @BelongsProject: RuoYi-Vue-Plus
|
||||
* @BelongsPackage: com.ruoyi.product.vo
|
||||
* @Author: yefei
|
||||
* @CreateTime: 2021-06-30 16:37
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* banner管理视图对象 pro_banner
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-06-30
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("banner管理视图对象")
|
||||
public class ProBannerVo {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@ApiModelProperty("主键id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* banner标题
|
||||
*/
|
||||
@Excel(name = "banner标题")
|
||||
@ApiModelProperty("banner标题")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* url跳转(也可能是path)
|
||||
*/
|
||||
@Excel(name = "url跳转(也可能是path)")
|
||||
@ApiModelProperty("url跳转(也可能是path)")
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 图片url
|
||||
*/
|
||||
@Excel(name = "图片url")
|
||||
@ApiModelProperty("图片url")
|
||||
private String picUrl;
|
||||
|
||||
/**
|
||||
* 是否跳转
|
||||
*/
|
||||
@Excel(name = "是否跳转")
|
||||
@ApiModelProperty("是否跳转")
|
||||
private Integer redirectFlag;
|
||||
|
||||
/**
|
||||
* banner类型,1应用内跳转,3外部跳转
|
||||
*/
|
||||
@Excel(name = "banner类型,1应用内跳转,3外部跳转")
|
||||
@ApiModelProperty("banner类型,1应用内跳转,3外部跳转")
|
||||
private Integer bannerType;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
package com.ruoyi.product.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @BelongsProject: RuoYi-Vue-Plus
|
||||
* @BelongsPackage: com.ruoyi.product.vo
|
||||
* @Author: yefei
|
||||
* @CreateTime: 2021-07-01 12:00
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("商品服务类别视图对象")
|
||||
public class ProCategoryVo {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ApiModelProperty("主键id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 类别名字
|
||||
*/
|
||||
@Excel(name = "类别名字")
|
||||
@ApiModelProperty("类别名字")
|
||||
private String categoryName;
|
||||
|
||||
/**
|
||||
* icon图片
|
||||
*/
|
||||
@Excel(name = "icon图片")
|
||||
@ApiModelProperty("icon图片")
|
||||
private String iconUrl;
|
||||
|
||||
/**
|
||||
* 备注信息
|
||||
*/
|
||||
@Excel(name = "备注信息")
|
||||
@ApiModelProperty("备注信息")
|
||||
private String remark;
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updateTime;
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package com.ruoyi.product.vo;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 商品关系(预约记录、优惠券)视图对象 mall_package
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-04-09
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("商品关系(预约记录、优惠券)视图对象")
|
||||
public class ProItemRelationVo {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键id */
|
||||
@ApiModelProperty("主键id")
|
||||
private Long id;
|
||||
|
||||
/** 业务id,可以是预约记录id,也可以是优惠券id */
|
||||
@Excel(name = "业务id,可以是预约记录id,也可以是优惠券id")
|
||||
@ApiModelProperty("业务id,可以是预约记录id,也可以是优惠券id")
|
||||
private Long businessId;
|
||||
/** 1表示优惠券类型关联关系,3表示预约类型关联关系 */
|
||||
@Excel(name = "1表示优惠券类型关联关系,3表示预约类型关联关系")
|
||||
@ApiModelProperty("1表示优惠券类型关联关系,3表示预约类型关联关系")
|
||||
private String type;
|
||||
/** 商品id */
|
||||
@Excel(name = "商品id")
|
||||
@ApiModelProperty("商品id")
|
||||
private Long proItemId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
package com.ruoyi.product.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* 商品规格视图对象 mall_package
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-04-06
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("商品规格视图对象")
|
||||
public class ProItemSpecificationVo {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ApiModelProperty("主键id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
@Excel(name = "商品id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@ApiModelProperty("商品id")
|
||||
private Long itemId;
|
||||
/**
|
||||
* 规格名字
|
||||
*/
|
||||
@Excel(name = "规格名字")
|
||||
@ApiModelProperty("规格名字")
|
||||
private String specificationTitle;
|
||||
/**
|
||||
* 图片url地址
|
||||
*/
|
||||
@Excel(name = "图片url地址")
|
||||
@ApiModelProperty("图片url地址")
|
||||
private String urlPath;
|
||||
/**
|
||||
* 规格库存
|
||||
*/
|
||||
@Excel(name = "规格库存")
|
||||
@ApiModelProperty("规格库存")
|
||||
private Integer specificationSku;
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
@Excel(name = "价格")
|
||||
@ApiModelProperty("价格")
|
||||
private BigDecimal price;
|
||||
/**
|
||||
* 别名
|
||||
*/
|
||||
@Excel(name = "别名")
|
||||
@ApiModelProperty("别名")
|
||||
private String aliasName;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Excel(name = "描述")
|
||||
@ApiModelProperty("描述")
|
||||
private String description;
|
||||
/**
|
||||
* 是否上架,0未上架,1上架,默认是0
|
||||
*/
|
||||
@Excel(name = "是否上架,0未上架,1上架,默认是0")
|
||||
@ApiModelProperty("是否上架,0未上架,1上架,默认是0")
|
||||
private String publishFlag;
|
||||
/**
|
||||
* 上架时间
|
||||
*/
|
||||
@Excel(name = "上架时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("上架时间")
|
||||
private LocalDateTime publishTime;
|
||||
|
||||
}
|
||||
104
ruoyi-product/src/main/java/com/ruoyi/product/vo/ProItemVo.java
Normal file
104
ruoyi-product/src/main/java/com/ruoyi/product/vo/ProItemVo.java
Normal file
@ -0,0 +1,104 @@
|
||||
package com.ruoyi.product.vo;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.product.dto.ProItemPictureDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品详情视图对象 pro_item
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-07-01
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("商品详情视图对象")
|
||||
public class ProItemVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ApiModelProperty("主键id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 产品名字
|
||||
*/
|
||||
@Excel(name = "产品名字")
|
||||
@ApiModelProperty("产品名字")
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
* 价钱
|
||||
*/
|
||||
@Excel(name = "价钱")
|
||||
@ApiModelProperty("价钱")
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Excel(name = "描述")
|
||||
@ApiModelProperty("描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 库存(限量库存)
|
||||
*/
|
||||
@Excel(name = "库存(限量库存)")
|
||||
@ApiModelProperty("库存(限量库存)")
|
||||
private Integer sku;
|
||||
|
||||
/**
|
||||
* 封面图片
|
||||
*/
|
||||
@Excel(name = "封面图片")
|
||||
@ApiModelProperty("封面图片")
|
||||
private String coverImage;
|
||||
|
||||
/**
|
||||
* 是否发布
|
||||
*/
|
||||
@Excel(name = "是否发布")
|
||||
@ApiModelProperty("是否发布")
|
||||
private Integer publishFlag;
|
||||
|
||||
/**
|
||||
* 发布时间
|
||||
*/
|
||||
@Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty("发布时间")
|
||||
private Date publishTime;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@Excel(name = "创建者")
|
||||
@ApiModelProperty("创建者")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty("图片列表")
|
||||
private List<ProItemPictureDTO> proItemPictures;
|
||||
|
||||
@ApiModelProperty("分类id集合")
|
||||
private List<String> proItemCategoryIds;
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.ProBannerMapper">
|
||||
|
||||
<resultMap type="ProBanner" id="ProBannerResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="title" column="title"/>
|
||||
<result property="url" column="url"/>
|
||||
<result property="picUrl" column="pic_url"/>
|
||||
<result property="redirectFlag" column="redirect_flag"/>
|
||||
<result property="bannerType" column="banner_type"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.product.mapper.ProItemMapper">
|
||||
|
||||
<resultMap type="ProItem" id="ProItemResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="proName" column="pro_name"/>
|
||||
<result property="price" column="price"/>
|
||||
<result property="description" column="description"/>
|
||||
<result property="sku" column="sku"/>
|
||||
<result property="coverImage" column="cover_image"/>
|
||||
<result property="publishFlag" column="publish_flag"/>
|
||||
<result property="publishTime" column="publish_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.product.mapper.ProItemPictureMapper">
|
||||
|
||||
<resultMap type="ProItemPicture" id="ProItemPictureResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="itemId" column="item_id"/>
|
||||
<result property="picUrl" column="pic_url"/>
|
||||
<result property="picType" column="pic_type"/>
|
||||
<result property="picSort" column="pic_sort"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.product.mapper.ProItemRelationMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.product.domain.ProItemRelation" id="ProItemRelationResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="businessId" column="business_id"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="proItemId" column="pro_item_id"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.product.mapper.ProItemSpecificationMapper">
|
||||
|
||||
<resultMap type="ProItemSpecification" id="ProItemSpecificationResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="itemId" column="item_id"/>
|
||||
<result property="specificationTitle" column="specification_title"/>
|
||||
<result property="urlPath" column="url_path"/>
|
||||
<result property="specificationSku" column="specification_sku"/>
|
||||
<result property="price" column="price"/>
|
||||
<result property="aliasName" column="alias_name"/>
|
||||
<result property="description" column="description"/>
|
||||
<result property="publishFlag" column="publish_flag"/>
|
||||
<result property="publishTime" column="publish_time"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -77,6 +77,7 @@
|
||||
"sass-loader": "10.1.0",
|
||||
"script-ext-html-webpack-plugin": "2.1.5",
|
||||
"svg-sprite-loader": "5.1.1",
|
||||
"vue-quill-editor": "^3.0.6",
|
||||
"vue-template-compiler": "2.6.12"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
53
ruoyi-ui/src/api/product/proBanner.js
Normal file
53
ruoyi-ui/src/api/product/proBanner.js
Normal file
@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询banner管理列表
|
||||
export function listBanner(query) {
|
||||
return request({
|
||||
url: '/product/proBanner/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询banner管理详细
|
||||
export function getBanner(id) {
|
||||
return request({
|
||||
url: '/product/proBanner/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增banner管理
|
||||
export function addBanner(data) {
|
||||
return request({
|
||||
url: '/product/proBanner',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改banner管理
|
||||
export function updateBanner(data) {
|
||||
return request({
|
||||
url: '/product/proBanner',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除banner管理
|
||||
export function delBanner(id) {
|
||||
return request({
|
||||
url: '/product/proBanner' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出banner管理
|
||||
export function exportBanner(query) {
|
||||
return request({
|
||||
url: '/product/proBanner/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
61
ruoyi-ui/src/api/product/proCategory.js
Normal file
61
ruoyi-ui/src/api/product/proCategory.js
Normal file
@ -0,0 +1,61 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询商品服务类别列表
|
||||
export function listProCategory(query) {
|
||||
return request({
|
||||
url: '/product/proCategory/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询商品服务类别详细
|
||||
export function getProCategory(id) {
|
||||
return request({
|
||||
url: '/product/proCategory/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增商品服务类别
|
||||
export function addProCategory(data) {
|
||||
return request({
|
||||
url: '/product/proCategory',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改商品服务类别
|
||||
export function updateProCategory(data) {
|
||||
return request({
|
||||
url: '/product/proCategory',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除商品服务类别
|
||||
export function delProCategory(id) {
|
||||
return request({
|
||||
url: '/product/proCategory/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出商品服务类别
|
||||
export function exportProCategory(query) {
|
||||
return request({
|
||||
url: '/product/proCategory/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function listCategoriesWithoutPage(query) {
|
||||
return request({
|
||||
url: '/product/proCategory/listCategoriesWithoutPage',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
62
ruoyi-ui/src/api/product/proItem.js
Normal file
62
ruoyi-ui/src/api/product/proItem.js
Normal file
@ -0,0 +1,62 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询商品详情列表
|
||||
export function listProItem(query) {
|
||||
return request({
|
||||
url: '/product/proItem/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询商品详情详细
|
||||
export function getProItem(id) {
|
||||
return request({
|
||||
url: '/product/proItem/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增商品详情
|
||||
export function addProItem(data) {
|
||||
return request({
|
||||
url: '/product/proItem',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改商品详情
|
||||
export function updateProItem(data) {
|
||||
return request({
|
||||
url: '/product/proItem',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除商品详情
|
||||
export function delProItem(id) {
|
||||
return request({
|
||||
url: '/product/proItem/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出商品详情
|
||||
export function exportProItem(query) {
|
||||
return request({
|
||||
url: '/product/proItem/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 上传图片通用方法
|
||||
export function uploadFile(data) {
|
||||
return request({
|
||||
url: '/common/upload',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
53
ruoyi-ui/src/api/product/proItemSpecification.js
Normal file
53
ruoyi-ui/src/api/product/proItemSpecification.js
Normal file
@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询商品规格列表
|
||||
export function listProItemSpecification(query) {
|
||||
return request({
|
||||
url: '/product/proItemSpecification/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询商品规格详细
|
||||
export function getProItemSpecification(id) {
|
||||
return request({
|
||||
url: '/product/proItemSpecification/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增商品规格
|
||||
export function addProItemSpecification(data) {
|
||||
return request({
|
||||
url: '/product/proItemSpecification',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改商品规格
|
||||
export function updateProItemSpecification(data) {
|
||||
return request({
|
||||
url: '/product/proItemSpecification',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除商品规格
|
||||
export function delProItemSpecification(id) {
|
||||
return request({
|
||||
url: '/product/proItemSpecification/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出商品规格
|
||||
export function exportProItemSpecification(query) {
|
||||
return request({
|
||||
url: '/product/proItemSpecification/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
203
ruoyi-ui/src/components/Editor/EditorDC.vue
Normal file
203
ruoyi-ui/src/components/Editor/EditorDC.vue
Normal file
@ -0,0 +1,203 @@
|
||||
<template>
|
||||
<div>
|
||||
<quill-editor v-model="editorValue" :options="editorOption"></quill-editor>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getToken} from "@/utils/auth";
|
||||
import "quill/dist/quill.core.css";
|
||||
import "quill/dist/quill.snow.css";
|
||||
import "quill/dist/quill.bubble.css";
|
||||
import {Quill, quillEditor} from "vue-quill-editor";
|
||||
import {container, ImageExtend, QuillWatch} from "@/components/EditorDc/index";
|
||||
|
||||
Quill.register("modules/ImageExtend", ImageExtend);
|
||||
export default {
|
||||
name: "EditorDC",
|
||||
props: {
|
||||
value: {
|
||||
type: [String, Number],
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
components: {quillEditor},
|
||||
data() {
|
||||
return {
|
||||
editorValue: "",
|
||||
// 富文本框参数设置
|
||||
editorOption: {
|
||||
placeholder: "请输入内容",
|
||||
modules: {
|
||||
ImageExtend: {
|
||||
// 可选参数 是否显示上传进度和提示语
|
||||
loading: true,
|
||||
// 图片参数名
|
||||
name: "file",
|
||||
// 可选参数 图片大小,单位为M,1M = 1024kb
|
||||
size: 2,
|
||||
// 服务器地址, 如果action为空,则采用base64插入图片
|
||||
action: process.env.VUE_APP_BASE_API + "/common/upload",
|
||||
// 可选 可上传的图片格式
|
||||
// Optional, uploadable image format
|
||||
accept: "image/jpg, image/png, image/gif, image/jpeg, image/bmp, image/x-icon",
|
||||
// response 为一个函数用来获取服务器返回的具体图片地址
|
||||
// 例如服务器返回 {code: 200; data:{ url: 'baidu.com'}}
|
||||
response: (res) => {
|
||||
return res.data.url;
|
||||
},
|
||||
// 可选参数 设置请求头部
|
||||
headers: (xhr) => {
|
||||
xhr.setRequestHeader("Authorization", 'Bearer ' + getToken());
|
||||
},
|
||||
// 图片超过大小的回调
|
||||
sizeError: () => {
|
||||
alert("图片大小超过 2 M");
|
||||
},
|
||||
// 可选参数 自定义开始上传触发事件
|
||||
start: () => {
|
||||
},
|
||||
// 可选参数 自定义上传结束触发的事件,无论成功或者失败
|
||||
end: () => {
|
||||
},
|
||||
// 可选参数 上传失败触发的事件
|
||||
error: () => {
|
||||
},
|
||||
// 可选参数 上传成功触发的事件
|
||||
success: () => {
|
||||
},
|
||||
// 可选参数 选择图片触发,也可用来设置头部,但比headers多了一个参数,可设置formData
|
||||
change: (xhr, formData) => {
|
||||
},
|
||||
},
|
||||
toolbar: {
|
||||
// container为工具栏,此次引入了全部工具栏,也可自行配置
|
||||
container: container,
|
||||
handlers: {
|
||||
image: function () {
|
||||
// 劫持原来的图片点击按钮事件
|
||||
QuillWatch.emit(this.quill.id);
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
handler(val) {
|
||||
this.editorValue = val;
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
editorValue(val) {
|
||||
this.$emit("input", val);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onEditorChange({editor, html, text}) {
|
||||
this.editorValue = html;
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.editor, .ql-toolbar {
|
||||
white-space: pre-wrap !important;
|
||||
line-height: normal !important;
|
||||
}
|
||||
|
||||
.quill-img {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ql-editor {
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
.ql-snow .ql-tooltip[data-mode="link"]::before {
|
||||
content: "请输入链接地址:";
|
||||
}
|
||||
|
||||
.ql-snow .ql-tooltip.ql-editing a.ql-action::after {
|
||||
border-right: 0px;
|
||||
content: "保存";
|
||||
padding-right: 0px;
|
||||
}
|
||||
|
||||
.ql-snow .ql-tooltip[data-mode="video"]::before {
|
||||
content: "请输入视频地址:";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-size .ql-picker-label::before,
|
||||
.ql-snow .ql-picker.ql-size .ql-picker-item::before {
|
||||
content: "14px";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="small"]::before,
|
||||
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="small"]::before {
|
||||
content: "10px";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="large"]::before,
|
||||
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="large"]::before {
|
||||
content: "18px";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="huge"]::before,
|
||||
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="huge"]::before {
|
||||
content: "32px";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-label::before,
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-item::before {
|
||||
content: "文本";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="1"]::before,
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]::before {
|
||||
content: "标题1";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]::before,
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before {
|
||||
content: "标题2";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]::before,
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before {
|
||||
content: "标题3";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="4"]::before,
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="4"]::before {
|
||||
content: "标题4";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="5"]::before,
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="5"]::before {
|
||||
content: "标题5";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="6"]::before,
|
||||
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="6"]::before {
|
||||
content: "标题6";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-font .ql-picker-label::before,
|
||||
.ql-snow .ql-picker.ql-font .ql-picker-item::before {
|
||||
content: "标准字体";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="serif"]::before,
|
||||
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="serif"]::before {
|
||||
content: "衬线字体";
|
||||
}
|
||||
|
||||
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="monospace"]::before,
|
||||
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="monospace"]::before {
|
||||
content: "等宽字体";
|
||||
}
|
||||
</style>
|
||||
321
ruoyi-ui/src/components/EditorDc/index.js
Normal file
321
ruoyi-ui/src/components/EditorDc/index.js
Normal file
@ -0,0 +1,321 @@
|
||||
/**
|
||||
*@description 观察者模式 全局监听富文本编辑器
|
||||
*/
|
||||
export const QuillWatch = {
|
||||
watcher: {}, // 登记编辑器信息
|
||||
active: null, // 当前触发的编辑器
|
||||
on: function(imageExtendId, ImageExtend) {
|
||||
// 登记注册使用了ImageEXtend的编辑器
|
||||
if (!this.watcher[imageExtendId]) {
|
||||
this.watcher[imageExtendId] = ImageExtend;
|
||||
}
|
||||
},
|
||||
emit: function(activeId, type = 1) {
|
||||
// 事件发射触发
|
||||
this.active = this.watcher[activeId];
|
||||
if (type === 1) {
|
||||
imgHandler();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 图片功能拓展: 增加上传 拖动 复制
|
||||
*/
|
||||
export class ImageExtend {
|
||||
/**
|
||||
* @param quill {Quill}富文本实例
|
||||
* @param config {Object} options
|
||||
* config keys: action, headers, editForm start end error size response
|
||||
*/
|
||||
constructor(quill, config = {}) {
|
||||
this.id = Math.random();
|
||||
this.quill = quill;
|
||||
this.quill.id = this.id;
|
||||
this.config = config;
|
||||
this.file = ""; // 要上传的图片
|
||||
this.imgURL = ""; // 图片地址
|
||||
quill.root.addEventListener("paste", this.pasteHandle.bind(this), false);
|
||||
quill.root.addEventListener("drop", this.dropHandle.bind(this), false);
|
||||
quill.root.addEventListener(
|
||||
"dropover",
|
||||
function(e) {
|
||||
e.preventDefault();
|
||||
},
|
||||
false
|
||||
);
|
||||
this.cursorIndex = 0;
|
||||
QuillWatch.on(this.id, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 检验图片大小是否超出限制
|
||||
*/
|
||||
checkPicSize() {
|
||||
let self = this;
|
||||
if (self.config.size && self.file.size >= self.config.size * 1024 * 1024) {
|
||||
if (self.config.sizeError) {
|
||||
self.config.sizeError();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 粘贴
|
||||
* @param e
|
||||
*/
|
||||
pasteHandle(e) {
|
||||
e.preventDefault();
|
||||
QuillWatch.emit(this.quill.id, 0);
|
||||
let clipboardData = e.clipboardData;
|
||||
let i = 0;
|
||||
let items, item, types;
|
||||
|
||||
if (clipboardData) {
|
||||
items = clipboardData.items;
|
||||
|
||||
if (!items) {
|
||||
return;
|
||||
}
|
||||
item = items[0];
|
||||
types = clipboardData.types || [];
|
||||
|
||||
for (; i < types.length; i++) {
|
||||
if (types[i] === "Files") {
|
||||
item = items[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (item && item.kind === "file" && item.type.match(/^image\//i)) {
|
||||
this.file = item.getAsFile();
|
||||
let self = this;
|
||||
// 如果图片限制大小
|
||||
if (!this.checkPicSize()) {
|
||||
return;
|
||||
}
|
||||
if (this.config.action) {
|
||||
this.uploadImg();
|
||||
} else {
|
||||
this.toBase64();
|
||||
}
|
||||
}
|
||||
if (item && item.kind === "string" && ["text/plain", "text/html"].indexOf(item.types)) {
|
||||
//将粘贴的文本内容插入到编辑器中
|
||||
item.getAsString(function(s) {
|
||||
const self = QuillWatch.active;
|
||||
let length = self.quill.getSelection(true).index;
|
||||
self.cursorIndex = length;
|
||||
self.quill.insertText(QuillWatch.active.cursorIndex, s.replace(/\s{2,}/g, "\n"));
|
||||
self.quill.update();
|
||||
setTimeout(() => self.quill.setSelection(self.cursorIndex + s.length, 0), 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 拖拽
|
||||
* @param e
|
||||
*/
|
||||
dropHandle(e) {
|
||||
QuillWatch.emit(this.quill.id, 0);
|
||||
const self = this;
|
||||
e.preventDefault();
|
||||
// 如果图片限制大小
|
||||
if (!self.checkPicSize()) {
|
||||
return;
|
||||
}
|
||||
self.file = e.dataTransfer.files[0]; // 获取到第一个上传的文件对象
|
||||
if (this.config.action) {
|
||||
self.uploadImg();
|
||||
} else {
|
||||
self.toBase64();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 将图片转为base4
|
||||
*/
|
||||
toBase64() {
|
||||
const self = this;
|
||||
const reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
// 返回base64
|
||||
self.imgURL = e.target.result;
|
||||
self.insertImg();
|
||||
};
|
||||
reader.readAsDataURL(self.file);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 上传图片到服务器
|
||||
*/
|
||||
uploadImg() {
|
||||
const self = this;
|
||||
let quillLoading = self.quillLoading;
|
||||
let config = self.config;
|
||||
// 构造表单
|
||||
let formData = new FormData();
|
||||
formData.append(config.name, self.file);
|
||||
// 自定义修改表单
|
||||
if (config.editForm) {
|
||||
config.editForm(formData);
|
||||
}
|
||||
// 创建ajax请求
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("post", config.action, true);
|
||||
// 如果有设置请求头
|
||||
if (config.headers) {
|
||||
config.headers(xhr);
|
||||
}
|
||||
if (config.change) {
|
||||
config.change(xhr, formData);
|
||||
}
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === 4) {
|
||||
if (xhr.status === 200) {
|
||||
//success
|
||||
let res = JSON.parse(xhr.responseText);
|
||||
self.imgURL = config.response(res);
|
||||
QuillWatch.active.uploadSuccess();
|
||||
self.insertImg();
|
||||
if (self.config.success) {
|
||||
self.config.success();
|
||||
}
|
||||
} else {
|
||||
//error
|
||||
if (self.config.error) {
|
||||
self.config.error();
|
||||
}
|
||||
QuillWatch.active.uploadError();
|
||||
}
|
||||
}
|
||||
};
|
||||
// 开始上传数据
|
||||
xhr.upload.onloadstart = function(e) {
|
||||
QuillWatch.active.uploading();
|
||||
// let length = (self.quill.getSelection() || {}).index || self.quill.getLength()
|
||||
// self.quill.insertText(length, '[uploading...]', { 'color': 'red'}, true)
|
||||
if (config.start) {
|
||||
config.start();
|
||||
}
|
||||
};
|
||||
// 上传过程
|
||||
xhr.upload.onprogress = function(e) {
|
||||
let complete = (((e.loaded / e.total) * 100) | 0) + "%";
|
||||
QuillWatch.active.progress(complete);
|
||||
};
|
||||
// 当发生网络异常的时候会触发,如果上传数据的过程还未结束
|
||||
xhr.upload.onerror = function(e) {
|
||||
QuillWatch.active.uploadError();
|
||||
if (config.error) {
|
||||
config.error();
|
||||
}
|
||||
};
|
||||
// 上传数据完成(成功或者失败)时会触发
|
||||
xhr.upload.onloadend = function(e) {
|
||||
if (config.end) {
|
||||
config.end();
|
||||
}
|
||||
};
|
||||
xhr.send(formData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 往富文本编辑器插入图片
|
||||
*/
|
||||
insertImg() {
|
||||
const self = QuillWatch.active;
|
||||
self.quill.insertEmbed(QuillWatch.active.cursorIndex, "image", self.imgURL);
|
||||
self.quill.update();
|
||||
self.quill.setSelection(self.cursorIndex + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 显示上传的进度
|
||||
*/
|
||||
progress(pro) {
|
||||
pro = "[" + "uploading" + pro + "]";
|
||||
QuillWatch.active.quill.root.innerHTML = QuillWatch.active.quill.root.innerHTML.replace(
|
||||
/\[uploading.*?\]/,
|
||||
pro
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始上传
|
||||
*/
|
||||
uploading() {
|
||||
let length = QuillWatch.active.quill.getSelection(true).index;
|
||||
QuillWatch.active.cursorIndex = length;
|
||||
QuillWatch.active.quill.insertText(QuillWatch.active.cursorIndex, "[uploading...]", { color: "red" }, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传失败
|
||||
*/
|
||||
uploadError() {
|
||||
QuillWatch.active.quill.root.innerHTML = QuillWatch.active.quill.root.innerHTML.replace(
|
||||
/\[uploading.*?\]/,
|
||||
"[upload error]"
|
||||
);
|
||||
}
|
||||
|
||||
uploadSuccess() {
|
||||
QuillWatch.active.quill.root.innerHTML = QuillWatch.active.quill.root.innerHTML.replace(/\[uploading.*?\]/, "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 点击图片上传
|
||||
*/
|
||||
export function imgHandler() {
|
||||
let fileInput = document.querySelector(".quill-image-input");
|
||||
if (fileInput === null) {
|
||||
fileInput = document.createElement("input");
|
||||
fileInput.setAttribute("type", "file");
|
||||
fileInput.classList.add("quill-image-input");
|
||||
fileInput.style.display = "none";
|
||||
// 监听选择文件
|
||||
fileInput.addEventListener("change", function() {
|
||||
let self = QuillWatch.active;
|
||||
self.file = fileInput.files[0];
|
||||
fileInput.value = "";
|
||||
// 可设置上传图片的格式
|
||||
fileInput.setAttribute("accept", self.config.accept);
|
||||
// 如果图片限制大小
|
||||
if (!self.checkPicSize()) {
|
||||
return;
|
||||
}
|
||||
if (self.config.action) {
|
||||
self.uploadImg();
|
||||
} else {
|
||||
self.toBase64();
|
||||
}
|
||||
});
|
||||
document.body.appendChild(fileInput);
|
||||
}
|
||||
fileInput.click();
|
||||
}
|
||||
|
||||
/**
|
||||
*@description 全部工具栏
|
||||
*/
|
||||
export const container = [
|
||||
["bold", "italic", "underline", "strike"],
|
||||
["blockquote", "code-block"],
|
||||
[{ header: 1 }, { header: 2 }],
|
||||
[{ list: "ordered" }, { list: "bullet" }],
|
||||
[{ script: "sub" }, { script: "super" }],
|
||||
[{ indent: "-1" }, { indent: "+1" }],
|
||||
[{ direction: "rtl" }],
|
||||
[{ size: ["small", false, "large", "huge"] }],
|
||||
[{ header: [1, 2, 3, 4, 5, 6, false] }],
|
||||
[{ color: [] }, { background: [] }],
|
||||
[{ font: [] }],
|
||||
[{ align: [] }],
|
||||
["clean"],
|
||||
["link", "image", "video"],
|
||||
];
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div :class="mode=='pop'?'mask':''" v-show="showBox">
|
||||
<div :class="mode=='pop'?'mask_verify':''" v-show="showBox">
|
||||
<div :class="mode=='pop'?'verifybox':''" :style="{'max-width':parseInt(imgSize.width)+30+'px'}">
|
||||
<div class="verifybox-top" v-if="mode=='pop'">
|
||||
请完成安全验证
|
||||
@ -230,7 +230,7 @@
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
.mask{
|
||||
.mask_verify{
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left:0;
|
||||
|
||||
349
ruoyi-ui/src/views/product/proBanner/index.vue
Normal file
349
ruoyi-ui/src/views/product/proBanner/index.vue
Normal file
@ -0,0 +1,349 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="标题" prop="title">
|
||||
<el-input
|
||||
v-model="queryParams.title"
|
||||
placeholder="标题"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否跳转" prop="redirectFlag">
|
||||
<el-select v-model="queryParams.redirectFlag" placeholder="请选择是否跳转" clearable size="small">
|
||||
<el-option
|
||||
v-for="dict in statusOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="bannerType">
|
||||
<el-select v-model="queryParams.bannerType" placeholder="请选择banner类型,1应用内跳转,3外部跳转" clearable size="small">
|
||||
<el-option
|
||||
v-for="dict in typeOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['system:banner:add']"
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['system:banner:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['system:banner:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['system:banner:export']"
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="bannerList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="主键id" align="center" prop="id" v-if="false"/>
|
||||
<el-table-column label="标题" align="center" prop="title"/>
|
||||
<el-table-column label="跳转路径" align="center" prop="url"/>
|
||||
<el-table-column label="banner图片" align="center" prop="picUrl">
|
||||
<template scope="scope"><img :src="scope.row.picUrl" width="40" height="40" class="banner_pic"/></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否跳转" align="center" prop="redirectFlag">
|
||||
<template scope="scope">{{ scope.row.redirectFlag === 0 ? '不可以跳转' : '可以跳转' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="banner类型" align="center" prop="bannerType">
|
||||
<template scope="scope">{{ scope.row.bannerType === 1 ? '应用内跳转' : '外部跳转' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:banner:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:banner:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改banner管理对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="标题:" prop="title">
|
||||
<el-input v-model="form.title" placeholder="请输入banner标题"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="url:" prop="url">
|
||||
<el-input v-model="form.url" placeholder="请输入url跳转(也可能是path)"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="图片:">
|
||||
<imageUpload v-model="form.picUrl"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否跳转:">
|
||||
<el-radio-group v-model="form.redirectFlag">
|
||||
<el-radio :label="1">是</el-radio>
|
||||
<el-radio :label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
<!-- <el-switch v-model="form.redirectFlag"></el-switch>-->
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="bannerType">
|
||||
<el-select v-model="form.bannerType" placeholder="请选择banner类型,1应用内跳转,3外部跳转">
|
||||
<el-option label="应用内跳转" :value="1"></el-option>
|
||||
<el-option label="外部跳转" :value="3"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {listBanner, getBanner, delBanner, addBanner, updateBanner, exportBanner} from '@/api/product/proBanner'
|
||||
import ImageUpload from '@/components/ImageUpload'
|
||||
|
||||
export default {
|
||||
name: 'Banner',
|
||||
components: {
|
||||
ImageUpload
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// banner管理表格数据
|
||||
bannerList: [],
|
||||
// 弹出层标题
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 状态数据字典
|
||||
statusOptions: [],
|
||||
typeOptions: [],
|
||||
// 创建时间时间范围
|
||||
daterangeCreateTime: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
title: undefined,
|
||||
url: undefined,
|
||||
redirectFlag: undefined,
|
||||
bannerType: undefined
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.getDicts("banner_redirect").then(response => {
|
||||
this.statusOptions = response.data;
|
||||
});
|
||||
this.getDicts("banner_redirect_type").then(response => {
|
||||
this.typeOptions = response.data;
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
/** 查询banner管理列表 */
|
||||
getList() {
|
||||
this.loading = true
|
||||
this.queryParams.params = {}
|
||||
if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
|
||||
this.queryParams.params['beginCreateTime'] = this.daterangeCreateTime[0]
|
||||
this.queryParams.params['endCreateTime'] = this.daterangeCreateTime[1]
|
||||
}
|
||||
listBanner(this.queryParams).then(response => {
|
||||
this.bannerList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
title: undefined,
|
||||
url: undefined,
|
||||
redirectFlag: 0,
|
||||
bannerType: undefined,
|
||||
createBy: undefined,
|
||||
createTime: undefined,
|
||||
updateBy: undefined,
|
||||
updateTime: undefined
|
||||
}
|
||||
this.resetForm('form')
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.daterangeCreateTime = []
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset()
|
||||
this.open = true
|
||||
this.title = '添加banner管理'
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset()
|
||||
const id = row.id || this.ids
|
||||
getBanner(id).then(response => {
|
||||
this.form = response.data
|
||||
this.open = true
|
||||
this.title = '修改banner管理'
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs['form'].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateBanner(this.form).then(response => {
|
||||
this.msgSuccess('修改成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
addBanner(this.form).then(response => {
|
||||
this.msgSuccess('新增成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids
|
||||
this.$confirm('是否确认删除banner管理编号为"' + ids + '"的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return delBanner(ids)
|
||||
}).then(() => {
|
||||
this.getList()
|
||||
this.msgSuccess('删除成功')
|
||||
})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams
|
||||
this.$confirm('是否确认导出所有banner管理数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return exportBanner(queryParams)
|
||||
}).then(response => {
|
||||
this.download(response.msg)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped="scoped">
|
||||
.banner_pic {
|
||||
width: 80px;
|
||||
height: 60px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
</style>
|
||||
291
ruoyi-ui/src/views/product/proCategory/index.vue
Normal file
291
ruoyi-ui/src/views/product/proCategory/index.vue
Normal file
@ -0,0 +1,291 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"
|
||||
@submit.native.prevent>
|
||||
<el-form-item label="类别名字" prop="categoryName">
|
||||
<el-input
|
||||
v-model="queryParams.categoryName"
|
||||
placeholder="请输入类别名字"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['product:proCategory:add']"
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['product:proCategory:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['product:proCategory:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['product:proCategory:export']"
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="proCategoryList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="主键id" align="center" prop="id" v-if="false"/>
|
||||
<el-table-column label="类别名字" align="center" prop="categoryName"/>
|
||||
<el-table-column label="icon图片" align="center" prop="iconUrl">
|
||||
<template scope="scope"><img :src="scope.row.iconUrl" width="40" height="40" class="banner_pic"/></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注信息" align="center" prop="remark"/>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['product:proCategory:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['product:proCategory:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改商品服务类别对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="类别名字" prop="categoryName">
|
||||
<el-input v-model="form.categoryName" placeholder="请输入类别名字"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="icon图片">
|
||||
<imageUpload v-model="form.iconUrl"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注信息" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listProCategory,
|
||||
getProCategory,
|
||||
delProCategory,
|
||||
addProCategory,
|
||||
updateProCategory,
|
||||
exportProCategory
|
||||
} from '@/api/product/proCategory'
|
||||
import ImageUpload from '@/components/ImageUpload'
|
||||
|
||||
export default {
|
||||
name: 'ProCategory',
|
||||
components: {
|
||||
ImageUpload
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 商品服务类别表格数据
|
||||
proCategoryList: [],
|
||||
// 弹出层标题
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
categoryName: undefined,
|
||||
iconUrl: undefined
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
/** 查询商品服务类别列表 */
|
||||
getList() {
|
||||
this.loading = true
|
||||
listProCategory(this.queryParams).then(response => {
|
||||
this.proCategoryList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
categoryName: undefined,
|
||||
iconUrl: undefined,
|
||||
remark: undefined,
|
||||
createBy: undefined,
|
||||
createTime: undefined,
|
||||
updateBy: undefined,
|
||||
updateTime: undefined
|
||||
}
|
||||
this.resetForm('form')
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset()
|
||||
this.open = true
|
||||
this.title = '添加商品服务类别'
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset()
|
||||
const id = row.id || this.ids
|
||||
getProCategory(id).then(response => {
|
||||
this.form = response.data
|
||||
this.open = true
|
||||
this.title = '修改商品服务类别'
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs['form'].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateProCategory(this.form).then(response => {
|
||||
this.msgSuccess('修改成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
addProCategory(this.form).then(response => {
|
||||
this.msgSuccess('新增成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids
|
||||
this.$confirm('是否确认删除商品服务类别编号为"' + ids + '"的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return delProCategory(ids)
|
||||
}).then(() => {
|
||||
this.getList()
|
||||
this.msgSuccess('删除成功')
|
||||
})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams
|
||||
this.$confirm('是否确认导出所有商品服务类别数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return exportProCategory(queryParams)
|
||||
}).then(response => {
|
||||
this.download(response.msg)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
516
ruoyi-ui/src/views/product/proItem/index.vue
Normal file
516
ruoyi-ui/src/views/product/proItem/index.vue
Normal file
@ -0,0 +1,516 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="产品名字" prop="proName">
|
||||
<el-input
|
||||
v-model="queryParams.proName"
|
||||
placeholder="请输入产品名字"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="库存" prop="sku">
|
||||
<el-input
|
||||
v-model="queryParams.sku"
|
||||
placeholder="请输入库存(限量库存)"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否发布" prop="publishFlag">
|
||||
<el-select v-model="queryParams.publishFlag">
|
||||
<el-option label="已发布" value="1"/>
|
||||
<el-option label="未发布" value="0"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="发布时间" prop="publishTime">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['product:proItem:add']"
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['product:proItem:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['product:proItem:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['product:proItem:export']"
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="proItemList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="主键id" align="center" prop="id" v-if="false"/>
|
||||
<el-table-column label="产品名字" align="center" prop="proName"/>
|
||||
<el-table-column label="价钱" align="center" prop="price"/>
|
||||
<el-table-column label="库存" align="center" prop="sku"/>
|
||||
<el-table-column label="封面图片" align="center" prop="coverImage">
|
||||
<template scope="scope"><img :src="scope.row.coverImage" width="40" height="40" class="banner_pic"/></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否发布" align="center" prop="publishFlag">
|
||||
<template scope="scope">{{ scope.row.publishFlag === 0 ? '未发布' : '已发布' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="发布时间" align="center" prop="publishTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.publishTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['product:proItem:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="editSpecification(scope.row)"
|
||||
v-hasPermi="['product:proItem:edit']"
|
||||
>编辑规格
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['product:proItem:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改商品详情对话框 -->
|
||||
<el-drawer :title="title" :visible.sync="open" size="70%" append-to-body>
|
||||
<div class="drawerClass">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="产品名字" prop="proName">
|
||||
<el-input v-model="form.proName" placeholder="请输入产品名字"/>
|
||||
</el-form-item>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="价钱" prop="price">
|
||||
<el-input-number v-model="form.price" :step="0.1" :precision="2" :min="0" placeholder="请输入价钱"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="限量库存" prop="sku">
|
||||
<el-input-number v-model="form.sku" :min="0" placeholder="请输入库存(限量库存)" style="width: 100%"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="类别标签">
|
||||
<el-select v-model="form.proItemCategoryIds" style="width: 100%" multiple placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in categories"
|
||||
:key="item.id"
|
||||
:label="item.categoryName"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="描述">
|
||||
<EditorDc v-model="form.description" :min-height="200"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="封面图片">
|
||||
<imageUpload v-model="form.coverImage"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="轮播图">
|
||||
<el-upload
|
||||
action="#"
|
||||
list-type="picture-card"
|
||||
:on-preview="handlePictureCardPreview"
|
||||
:on-remove="handleRemove"
|
||||
:http-request="uploadSwiper"
|
||||
:before-upload="beforeSwiperUpload"
|
||||
:file-list="picList"
|
||||
>
|
||||
<i class="el-icon-plus"></i>
|
||||
</el-upload>
|
||||
<el-dialog :visible.sync="dialogVisible" title="预览" width="800" append-to-body>
|
||||
<img :src="dialogImageUrl" style="display: block; max-width: 100%; margin: 0 auto;">
|
||||
</el-dialog>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否发布">
|
||||
<el-radio-group v-model="form.publishFlag">
|
||||
<el-radio :label="1">是</el-radio>
|
||||
<el-radio :label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-drawer>
|
||||
|
||||
<el-drawer title="编辑规格" :visible.sync="specificationOpen" v-if="specificationOpen" size="70%" append-to-body>
|
||||
<div class="drawerClass">
|
||||
<ProItemSpecification :pro-item-id="itemId"/>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
addProItem,
|
||||
delProItem,
|
||||
exportProItem,
|
||||
getProItem,
|
||||
listProItem,
|
||||
updateProItem,
|
||||
uploadFile
|
||||
} from '@/api/product/proItem'
|
||||
import {listCategoriesWithoutPage} from '@/api/product/proCategory'
|
||||
import ImageUpload from '@/components/ImageUpload'
|
||||
import EditorDc from '@/components/Editor/EditorDC'
|
||||
import ProItemSpecification from '../proItemSpecification/index'
|
||||
|
||||
export default {
|
||||
name: 'ProItem',
|
||||
components: {
|
||||
ImageUpload,
|
||||
EditorDc,
|
||||
ProItemSpecification
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dateRange: "",
|
||||
// swiper相关
|
||||
dialogImageUrl: '',
|
||||
dialogVisible: false,
|
||||
picList: [],
|
||||
categories: [],
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 商品详情表格数据
|
||||
proItemList: [],
|
||||
// 弹出层标题
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
specificationOpen: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
proName: undefined,
|
||||
sku: undefined,
|
||||
coverImage: undefined,
|
||||
publishFlag: undefined,
|
||||
publishStartTime: undefined,
|
||||
publishEndTime: undefined
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
itemId: '',
|
||||
specificationForm: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
proName: [
|
||||
{required: true, message: '产品名字不能为空', trigger: 'blur'}
|
||||
],
|
||||
price: [
|
||||
{required: true, message: '起步价不能为空', trigger: 'blur'}
|
||||
],
|
||||
description: [
|
||||
{required: true, message: '描述不能为空', trigger: 'blur'}
|
||||
],
|
||||
coverImage: [
|
||||
{required: true, message: '封面图片不能为空', trigger: 'blur'}
|
||||
],
|
||||
publishFlag: [
|
||||
{required: true, message: '是否发布不能为空', trigger: 'blur'}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.getCategories()
|
||||
},
|
||||
methods: {
|
||||
/** 查询商品分类**/
|
||||
getCategories() {
|
||||
listCategoriesWithoutPage().then(resp => {
|
||||
this.categories = resp
|
||||
})
|
||||
},
|
||||
/** 查询商品详情列表 */
|
||||
getList() {
|
||||
this.loading = true
|
||||
listProItem(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||
this.proItemList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
proName: undefined,
|
||||
price: undefined,
|
||||
description: undefined,
|
||||
sku: undefined,
|
||||
coverImage: undefined,
|
||||
proItemPictures: undefined,
|
||||
proItemCategoryIds: undefined,
|
||||
publishFlag: undefined,
|
||||
publishTime: undefined,
|
||||
createBy: undefined,
|
||||
createTime: undefined,
|
||||
updateBy: undefined,
|
||||
updateTime: undefined
|
||||
}
|
||||
this.picList = []
|
||||
this.resetForm('form')
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm('queryForm')
|
||||
this.dateRange = ''
|
||||
this.handleQuery()
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset()
|
||||
this.open = true
|
||||
this.title = '添加商品详情'
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset()
|
||||
const id = row.id || this.ids
|
||||
getProItem(id).then(response => {
|
||||
this.form = response.data
|
||||
this.open = true
|
||||
this.title = '修改商品详情'
|
||||
this.picList = response.data.proItemPictures
|
||||
})
|
||||
},
|
||||
|
||||
editSpecification(row) {
|
||||
this.itemId = row.id
|
||||
this.specificationOpen = true
|
||||
// const itemId = row.id || this.ids
|
||||
// listProItemSpecification({ itemId: itemId }).then(response => {
|
||||
// this.specificationForm = response.rows
|
||||
// this.specificationOpen = true
|
||||
// })
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.form.proItemPictures = this.picList
|
||||
this.$refs['form'].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateProItem(this.form).then(response => {
|
||||
this.msgSuccess('修改成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
addProItem(this.form).then(response => {
|
||||
this.msgSuccess('新增成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids
|
||||
this.$confirm('是否确认删除商品详情编号为"' + ids + '"的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return delProItem(ids)
|
||||
}).then(() => {
|
||||
this.getList()
|
||||
this.msgSuccess('删除成功')
|
||||
})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams
|
||||
this.$confirm('是否确认导出所有商品详情数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return exportProItem(queryParams)
|
||||
}).then(response => {
|
||||
this.download(response.msg)
|
||||
})
|
||||
},
|
||||
|
||||
// swiper相关图片列表上传
|
||||
uploadSwiper(item) {
|
||||
const formData = new FormData()
|
||||
formData.append('file', item.file)
|
||||
const uid = item.file.uid
|
||||
uploadFile(formData).then(res => {
|
||||
this.picList.push({key: uid, value: res.data.url, url: res.data.url})
|
||||
this.emptyUpload()
|
||||
}).catch((e) => {
|
||||
console.log(e)
|
||||
this.$message.error('上传失败,请重新上传')
|
||||
this.emptyUpload()
|
||||
})
|
||||
},
|
||||
beforeSwiperUpload(file) {
|
||||
const isJPG = file.type === 'image/jpeg'
|
||||
const isPng = file.type === 'image/png'
|
||||
const isLt2M = file.size / 1024 / 1024 < 2
|
||||
|
||||
if (!isJPG && !isPng) {
|
||||
this.$message.error('上传图片只能是 JPG或png 格式!')
|
||||
}
|
||||
if (!isLt2M) {
|
||||
this.$message.error('上传图片大小不能超过 2MB!')
|
||||
}
|
||||
return (isJPG || isPng) && isLt2M
|
||||
},
|
||||
handleRemove(file) {
|
||||
for (const i in this.picList) {
|
||||
if (this.picList[i].url === file.url) {
|
||||
this.picList.splice(i, 1)
|
||||
}
|
||||
}
|
||||
},
|
||||
handlePictureCardPreview(file) {
|
||||
this.dialogImageUrl = file.url
|
||||
this.dialogVisible = true
|
||||
},
|
||||
/**
|
||||
* 清空上传组件
|
||||
*/
|
||||
emptyUpload() {
|
||||
const mainImg = this.$refs.upload
|
||||
if (mainImg) {
|
||||
if (mainImg.length) {
|
||||
mainImg.forEach(item => {
|
||||
item.clearFiles()
|
||||
})
|
||||
} else {
|
||||
this.$refs.upload.clearFiles()
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style>
|
||||
/* /deep/ */
|
||||
.el-upload-list__item.is-ready {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.drawerClass {
|
||||
padding: 0px 20px 30px 30px;
|
||||
}
|
||||
|
||||
</style>
|
||||
342
ruoyi-ui/src/views/product/proItemSpecification/index.vue
Normal file
342
ruoyi-ui/src/views/product/proItemSpecification/index.vue
Normal file
@ -0,0 +1,342 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="规格标题" prop="specificationTitle">
|
||||
<el-input
|
||||
v-model="queryParams.specificationTitle"
|
||||
placeholder="请输入商品规格标题"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['product:proItemSpecification:add']"
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['product:proItemSpecification:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['product:proItemSpecification:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['product:proItemSpecification:export']"
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="proItemSpecificationList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="规格名字" align="center" prop="specificationTitle"/>
|
||||
<el-table-column label="封面图片" align="center" prop="urlPath">
|
||||
<template scope="scope"><img :src="scope.row.urlPath" width="40" height="40" class="banner_pic"/></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格库存" align="center" prop="specificationSku"/>
|
||||
<el-table-column label="价格" align="center" prop="price"/>
|
||||
<el-table-column label="别名" align="center" prop="aliasName"/>
|
||||
<el-table-column label="描述" align="center" prop="description"/>
|
||||
<el-table-column label="是否上架" align="center" prop="publishFlag">
|
||||
<template scope="scope">{{ scope.row.publishFlag === '0' ? '未上架' : '已上架' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="上次上架时间" align="center" prop="publishTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.publishTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['product:proItemSpecification:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['product:proItemSpecification:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改商品规格对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="规格名字" prop="specificationTitle">
|
||||
<el-input v-model="form.specificationTitle" placeholder="请输入规格名字"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="封面图片" prop="urlPath">
|
||||
<imageUpload v-model="form.urlPath"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="规格库存" prop="specificationSku">
|
||||
<el-input-number v-model="form.specificationSku" :min="0" placeholder="请输入规格库存"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="价格" prop="price">
|
||||
<el-input-number v-model="form.price" :step="0.1" :precision="2" :min="0" placeholder="请输入价格"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="别名" prop="aliasName">
|
||||
<el-input v-model="form.aliasName" placeholder="请输入别名"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="form.description" type="textarea" maxlength="100"
|
||||
show-word-limit placeholder="请输入描述"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否上架" prop="publishFlag">
|
||||
<el-switch v-model="form.publishFlag"
|
||||
active-color="#13ce66"
|
||||
active-value="1"
|
||||
inactive-value="0"
|
||||
></el-switch>
|
||||
<!-- <el-input v-model="form.publishFlag" placeholder="请输入是否上架,0未上架,1上架,默认是0"/>-->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listProItemSpecification,
|
||||
getProItemSpecification,
|
||||
delProItemSpecification,
|
||||
addProItemSpecification,
|
||||
updateProItemSpecification,
|
||||
exportProItemSpecification
|
||||
} from '@/api/product/proItemSpecification'
|
||||
import ImageUpload from '@/components/ImageUpload'
|
||||
|
||||
export default {
|
||||
name: 'ProItemSpecification',
|
||||
components: {
|
||||
ImageUpload
|
||||
},
|
||||
props: {
|
||||
proItemId: '',
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 商品规格表格数据
|
||||
proItemSpecificationList: [],
|
||||
// 弹出层标题
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
itemId: undefined,
|
||||
specificationTitle: undefined
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
specificationTitle: [
|
||||
{ required: true, message: '规格名字不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
/** 查询商品规格列表 */
|
||||
getList() {
|
||||
this.loading = true
|
||||
this.queryParams.itemId = this.proItemId
|
||||
listProItemSpecification(this.queryParams).then(response => {
|
||||
this.proItemSpecificationList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false
|
||||
this.proItemSpecificationList = [];
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
itemId: undefined,
|
||||
specificationTitle: undefined,
|
||||
urlPath: undefined,
|
||||
specificationSku: undefined,
|
||||
price: undefined,
|
||||
aliasName: undefined,
|
||||
description: undefined,
|
||||
publishFlag: undefined,
|
||||
publishTime: undefined,
|
||||
createTime: undefined,
|
||||
createBy: undefined,
|
||||
updateTime: undefined,
|
||||
updateBy: undefined
|
||||
}
|
||||
this.resetForm('form')
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset()
|
||||
this.open = true
|
||||
this.title = '添加商品规格'
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset()
|
||||
const id = row.id || this.ids
|
||||
getProItemSpecification(id).then(response => {
|
||||
this.form = response.data
|
||||
this.open = true
|
||||
this.title = '修改商品规格'
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.form.itemId = this.proItemId
|
||||
this.$refs['form'].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateProItemSpecification(this.form).then(response => {
|
||||
this.msgSuccess('修改成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
addProItemSpecification(this.form).then(response => {
|
||||
this.msgSuccess('新增成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids
|
||||
this.$confirm('是否确认删除商品规格编号为"' + ids + '"的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function() {
|
||||
return delProItemSpecification(ids)
|
||||
}).then(() => {
|
||||
this.getList()
|
||||
this.msgSuccess('删除成功')
|
||||
})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams
|
||||
this.$confirm('是否确认导出所有商品规格数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function() {
|
||||
return exportProItemSpecification(queryParams)
|
||||
}).then(response => {
|
||||
this.download(response.msg)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="css">
|
||||
.banner_pic {
|
||||
border-radius: 5px;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user