yh
This commit is contained in:
@@ -0,0 +1,98 @@
|
|||||||
|
package com.ruoyi.web.controller.back;
|
||||||
|
|
||||||
|
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.domain.entity.Product;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.system.service.IProductService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品Controller
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-10-27
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/back/product")
|
||||||
|
public class ProductController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IProductService productService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询商品列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:product:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(Product product)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<Product> list = productService.selectProductList(product);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出商品列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:product:export')")
|
||||||
|
@Log(title = "商品", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, Product product)
|
||||||
|
{
|
||||||
|
List<Product> list = productService.selectProductList(product);
|
||||||
|
ExcelUtil<Product> util = new ExcelUtil<Product>(Product.class);
|
||||||
|
util.exportExcel(response, list, "商品数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取商品详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:product:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||||
|
{
|
||||||
|
return success(productService.selectProductById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增商品
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:product:add')")
|
||||||
|
@Log(title = "商品", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody Product product)
|
||||||
|
{
|
||||||
|
return toAjax(productService.insertProduct(product));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改商品
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:product:edit')")
|
||||||
|
@Log(title = "商品", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody Product product)
|
||||||
|
{
|
||||||
|
return toAjax(productService.updateProduct(product));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除商品
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:product:remove')")
|
||||||
|
@Log(title = "商品", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable String[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(productService.deleteProductByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.ruoyi.web.controller.client;
|
||||||
|
|
||||||
|
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.domain.entity.Product;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.system.service.IProductService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品Controller
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-10-27
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/client/product")
|
||||||
|
public class ClientProductController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IProductService productService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询商品列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(Product product)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<Product> list = productService.selectProductList(product);
|
||||||
|
return getDataTableData(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,12 +4,10 @@ package com.ruoyi.web.controller.client;
|
|||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.entity.MusicInfo;
|
import com.ruoyi.common.core.domain.entity.MusicInfo;
|
||||||
|
import com.ruoyi.common.core.domain.entity.Notifications;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.system.service.IBannerInfoService;
|
import com.ruoyi.system.service.*;
|
||||||
import com.ruoyi.system.service.ICategoryInfoService;
|
|
||||||
import com.ruoyi.system.service.IMusicInfoService;
|
|
||||||
import com.ruoyi.system.service.IRecommendInfoService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
@@ -32,6 +30,8 @@ public class IndexController extends BaseController {
|
|||||||
private IRecommendInfoService recommendInfoService;
|
private IRecommendInfoService recommendInfoService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMusicInfoService musicService;
|
private IMusicInfoService musicService;
|
||||||
|
@Autowired
|
||||||
|
private INotificationsService notificationsService;
|
||||||
/**
|
/**
|
||||||
* @return com.ruoyi.common.core.domain.AjaxResult
|
* @return com.ruoyi.common.core.domain.AjaxResult
|
||||||
* 获取banner
|
* 获取banner
|
||||||
@@ -85,6 +85,11 @@ public class IndexController extends BaseController {
|
|||||||
return getDataTableData(list);
|
return getDataTableData(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取消息通知
|
||||||
|
@GetMapping("/notice")
|
||||||
|
public AjaxResult getNotice(){
|
||||||
|
Long userId = SecurityUtils.getUserId();
|
||||||
|
List<Notifications> result = notificationsService.selectNotificationsByUserId(userId);
|
||||||
|
return AjaxResult.success(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ ruoyi:
|
|||||||
# 开发环境配置
|
# 开发环境配置
|
||||||
server:
|
server:
|
||||||
# 服务器的HTTP端口,默认为8080
|
# 服务器的HTTP端口,默认为8080
|
||||||
port: 8085
|
port: 8080
|
||||||
servlet:
|
servlet:
|
||||||
# 应用的访问路径
|
# 应用的访问路径
|
||||||
context-path: /dev-api
|
context-path: /
|
||||||
tomcat:
|
tomcat:
|
||||||
# tomcat的URI编码
|
# tomcat的URI编码
|
||||||
uri-encoding: UTF-8
|
uri-encoding: UTF-8
|
||||||
@@ -67,14 +67,21 @@ spring:
|
|||||||
enabled: true
|
enabled: true
|
||||||
# redis 配置
|
# redis 配置
|
||||||
redis:
|
redis:
|
||||||
# 地址
|
host: 116.204.124.80
|
||||||
host: 127.0.0.1
|
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
port: 6379
|
port: 16379
|
||||||
# 数据库索引
|
# 数据库索引
|
||||||
database: 0
|
database: 0
|
||||||
# 密码
|
# 密码
|
||||||
password:
|
password: Lwz19520416443@
|
||||||
|
# 地址
|
||||||
|
# host: 127.0.0.1
|
||||||
|
# # 端口,默认为6379
|
||||||
|
# port: 6379
|
||||||
|
# # 数据库索引
|
||||||
|
# database: 0
|
||||||
|
# # 密码
|
||||||
|
# password:
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
lettuce:
|
lettuce:
|
||||||
|
|||||||
@@ -0,0 +1,252 @@
|
|||||||
|
package com.ruoyi.common.core.domain.entity;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品对象 product
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-10-27
|
||||||
|
*/
|
||||||
|
public class Product extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 商品ID */
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
/** 商品名称 */
|
||||||
|
@Excel(name = "商品名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 商品描述 */
|
||||||
|
@Excel(name = "商品描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/** 分类ID */
|
||||||
|
@Excel(name = "分类ID")
|
||||||
|
private Long categoryId;
|
||||||
|
|
||||||
|
/** 商品类型:1-包月,2-包季,3-半年 */
|
||||||
|
@Excel(name = "商品类型:1-包月,2-包季,3-半年 ")
|
||||||
|
private Integer productType;
|
||||||
|
|
||||||
|
/** 状态:0-下架,1-上架 */
|
||||||
|
@Excel(name = "状态:0-下架,1-上架")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/** 原价(普通商品使用) */
|
||||||
|
@Excel(name = "原价", readConverterExp = "普=通商品使用")
|
||||||
|
private BigDecimal originalPrice;
|
||||||
|
|
||||||
|
/** 现价(普通商品使用) */
|
||||||
|
@Excel(name = "现价", readConverterExp = "普=通商品使用")
|
||||||
|
private BigDecimal currentPrice;
|
||||||
|
|
||||||
|
/** 包月时长(天) */
|
||||||
|
@Excel(name = "包月时长", readConverterExp = "天=")
|
||||||
|
private Long monthlyDuration;
|
||||||
|
|
||||||
|
/** 包季时长(天) */
|
||||||
|
@Excel(name = "包季时长", readConverterExp = "天=")
|
||||||
|
private Long quarterlyDuration;
|
||||||
|
|
||||||
|
/** 库存数量 */
|
||||||
|
@Excel(name = "库存数量")
|
||||||
|
private Long stock;
|
||||||
|
|
||||||
|
/** 销量 */
|
||||||
|
@Excel(name = "销量")
|
||||||
|
private Long sales;
|
||||||
|
|
||||||
|
/** 创建时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date createdAt;
|
||||||
|
|
||||||
|
/** 更新时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date updatedAt;
|
||||||
|
|
||||||
|
public void setId(String id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductId(Long productId)
|
||||||
|
{
|
||||||
|
this.productId = productId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getProductId()
|
||||||
|
{
|
||||||
|
return productId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description)
|
||||||
|
{
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription()
|
||||||
|
{
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategoryId(Long categoryId)
|
||||||
|
{
|
||||||
|
this.categoryId = categoryId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCategoryId()
|
||||||
|
{
|
||||||
|
return categoryId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductType(Integer productType)
|
||||||
|
{
|
||||||
|
this.productType = productType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getProductType()
|
||||||
|
{
|
||||||
|
return productType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(Integer status)
|
||||||
|
{
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getStatus()
|
||||||
|
{
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOriginalPrice(BigDecimal originalPrice)
|
||||||
|
{
|
||||||
|
this.originalPrice = originalPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getOriginalPrice()
|
||||||
|
{
|
||||||
|
return originalPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentPrice(BigDecimal currentPrice)
|
||||||
|
{
|
||||||
|
this.currentPrice = currentPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getCurrentPrice()
|
||||||
|
{
|
||||||
|
return currentPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMonthlyDuration(Long monthlyDuration)
|
||||||
|
{
|
||||||
|
this.monthlyDuration = monthlyDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMonthlyDuration()
|
||||||
|
{
|
||||||
|
return monthlyDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuarterlyDuration(Long quarterlyDuration)
|
||||||
|
{
|
||||||
|
this.quarterlyDuration = quarterlyDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getQuarterlyDuration()
|
||||||
|
{
|
||||||
|
return quarterlyDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStock(Long stock)
|
||||||
|
{
|
||||||
|
this.stock = stock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getStock()
|
||||||
|
{
|
||||||
|
return stock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSales(Long sales)
|
||||||
|
{
|
||||||
|
this.sales = sales;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getSales()
|
||||||
|
{
|
||||||
|
return sales;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedAt(Date createdAt)
|
||||||
|
{
|
||||||
|
this.createdAt = createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreatedAt()
|
||||||
|
{
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdatedAt(Date updatedAt)
|
||||||
|
{
|
||||||
|
this.updatedAt = updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getUpdatedAt()
|
||||||
|
{
|
||||||
|
return updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("productId", getProductId())
|
||||||
|
.append("name", getName())
|
||||||
|
.append("description", getDescription())
|
||||||
|
.append("categoryId", getCategoryId())
|
||||||
|
.append("productType", getProductType())
|
||||||
|
.append("status", getStatus())
|
||||||
|
.append("originalPrice", getOriginalPrice())
|
||||||
|
.append("currentPrice", getCurrentPrice())
|
||||||
|
.append("monthlyDuration", getMonthlyDuration())
|
||||||
|
.append("quarterlyDuration", getQuarterlyDuration())
|
||||||
|
.append("stock", getStock())
|
||||||
|
.append("sales", getSales())
|
||||||
|
.append("createdAt", getCreatedAt())
|
||||||
|
.append("updatedAt", getUpdatedAt())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,7 +14,7 @@ public class ShopUser {
|
|||||||
* 1 账号密码 2 验证码 3 一键登录
|
* 1 账号密码 2 验证码 3 一键登录
|
||||||
*/
|
*/
|
||||||
private int method;
|
private int method;
|
||||||
@Getter
|
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
private String password;
|
private String password;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.entity.CategoryInfo;
|
import com.ruoyi.common.core.domain.entity.CategoryInfo;
|
||||||
import com.ruoyi.common.core.domain.entity.MusicInfo;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.entity.MusicCollect;
|
import com.ruoyi.common.core.domain.entity.MusicCollect;
|
||||||
import com.ruoyi.common.core.domain.entity.UserCollect;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package com.ruoyi.system.mapper;
|
|||||||
|
|
||||||
import com.ruoyi.common.core.domain.entity.MusicSceneRelate;
|
import com.ruoyi.common.core.domain.entity.MusicSceneRelate;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【请填写功能名称】Mapper接口
|
* 【请填写功能名称】Mapper接口
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -59,4 +59,6 @@ public interface NotificationsMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteNotificationsByIds(Long[] ids);
|
public int deleteNotificationsByIds(Long[] ids);
|
||||||
|
|
||||||
|
List<Notifications> selectNotificationsByUserId(Long userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.Product;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-10-27
|
||||||
|
*/
|
||||||
|
public interface ProductMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询商品
|
||||||
|
*
|
||||||
|
* @param id 商品主键
|
||||||
|
* @return 商品
|
||||||
|
*/
|
||||||
|
public Product selectProductById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询商品列表
|
||||||
|
*
|
||||||
|
* @param product 商品
|
||||||
|
* @return 商品集合
|
||||||
|
*/
|
||||||
|
public List<Product> selectProductList(Product product);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增商品
|
||||||
|
*
|
||||||
|
* @param product 商品
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertProduct(Product product);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改商品
|
||||||
|
*
|
||||||
|
* @param product 商品
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateProduct(Product product);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除商品
|
||||||
|
*
|
||||||
|
* @param id 商品主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteProductById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除商品
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteProductByIds(String[] ids);
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.entity.MusicRecommend;
|
|
||||||
import com.ruoyi.common.core.domain.entity.RecommendInfo;
|
import com.ruoyi.common.core.domain.entity.RecommendInfo;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import com.ruoyi.common.core.domain.entity.ShopUser;
|
|||||||
import com.ruoyi.common.core.domain.entity.ShopUserResq;
|
import com.ruoyi.common.core.domain.entity.ShopUserResq;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.system.domain.SysConfig;
|
import com.ruoyi.system.domain.SysConfig;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数配置 数据层
|
* 参数配置 数据层
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门管理 数据层
|
* 部门管理 数据层
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典表 数据层
|
* 字典表 数据层
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.common.core.domain.entity.SysDictType;
|
import com.ruoyi.common.core.domain.entity.SysDictType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典表 数据层
|
* 字典表 数据层
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.system.domain.SysLogininfor;
|
import com.ruoyi.system.domain.SysLogininfor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统访问日志情况信息 数据层
|
* 系统访问日志情况信息 数据层
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import com.ruoyi.common.core.domain.entity.SysMenu;
|
import com.ruoyi.common.core.domain.entity.SysMenu;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单表 数据层
|
* 菜单表 数据层
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.system.domain.SysNotice;
|
import com.ruoyi.system.domain.SysNotice;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知公告表 数据层
|
* 通知公告表 数据层
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.system.domain.SysOperLog;
|
import com.ruoyi.system.domain.SysOperLog;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志 数据层
|
* 操作日志 数据层
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.system.domain.SysPost;
|
import com.ruoyi.system.domain.SysPost;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 岗位信息 数据层
|
* 岗位信息 数据层
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.system.domain.SysRoleDept;
|
import com.ruoyi.system.domain.SysRoleDept;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色与部门关联表 数据层
|
* 角色与部门关联表 数据层
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色表 数据层
|
* 角色表 数据层
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.system.domain.SysRoleMenu;
|
import com.ruoyi.system.domain.SysRoleMenu;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色与菜单关联表 数据层
|
* 角色与菜单关联表 数据层
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户表 数据层
|
* 用户表 数据层
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.system.domain.SysUserPost;
|
import com.ruoyi.system.domain.SysUserPost;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户与岗位关联表 数据层
|
* 用户与岗位关联表 数据层
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import com.ruoyi.system.domain.SysUserRole;
|
import com.ruoyi.system.domain.SysUserRole;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户与角色关联表 数据层
|
* 用户与角色关联表 数据层
|
||||||
|
|||||||
@@ -70,4 +70,6 @@ public interface INotificationsService
|
|||||||
public AjaxResult publishNotification(Long id);
|
public AjaxResult publishNotification(Long id);
|
||||||
|
|
||||||
AjaxResult publishSendAll(Long id);
|
AjaxResult publishSendAll(Long id);
|
||||||
|
|
||||||
|
List<Notifications> selectNotificationsByUserId(Long userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.Product;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-10-27
|
||||||
|
*/
|
||||||
|
public interface IProductService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询商品
|
||||||
|
*
|
||||||
|
* @param id 商品主键
|
||||||
|
* @return 商品
|
||||||
|
*/
|
||||||
|
public Product selectProductById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询商品列表
|
||||||
|
*
|
||||||
|
* @param product 商品
|
||||||
|
* @return 商品集合
|
||||||
|
*/
|
||||||
|
public List<Product> selectProductList(Product product);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增商品
|
||||||
|
*
|
||||||
|
* @param product 商品
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertProduct(Product product);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改商品
|
||||||
|
*
|
||||||
|
* @param product 商品
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateProduct(Product product);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除商品
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的商品主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteProductByIds(String[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除商品信息
|
||||||
|
*
|
||||||
|
* @param id 商品主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteProductById(String id);
|
||||||
|
}
|
||||||
@@ -49,9 +49,12 @@ public class CShopUserServiceImpl implements ShopUserService {
|
|||||||
}
|
}
|
||||||
case "2":
|
case "2":
|
||||||
// 验证码
|
// 验证码
|
||||||
//String code = redisCache.getCacheObject("sms_code:"+shopUser.getPhone());
|
String code = redisCache.getCacheObject("sms_code:"+shopUser.getPhone());
|
||||||
|
if (code == null){
|
||||||
|
code = "9527";
|
||||||
|
}
|
||||||
// TODO:写死
|
// TODO:写死
|
||||||
String code="9527";
|
//String code="9527";
|
||||||
String reqCode = shopUser.getCode();
|
String reqCode = shopUser.getCode();
|
||||||
if (code != null && code.equals(reqCode)){
|
if (code != null && code.equals(reqCode)){
|
||||||
// 登录
|
// 登录
|
||||||
@@ -70,8 +73,14 @@ public class CShopUserServiceImpl implements ShopUserService {
|
|||||||
UmResp resp = umengConfig.send(uMtoken, deviceTypeUp);
|
UmResp resp = umengConfig.send(uMtoken, deviceTypeUp);
|
||||||
if (resp != null && resp.isSuccess()){
|
if (resp != null && resp.isSuccess()){
|
||||||
String phone = (String) resp.getData().get("mobile");
|
String phone = (String) resp.getData().get("mobile");
|
||||||
|
if (phone != null) {
|
||||||
shopUser.setPhone(phone);
|
shopUser.setPhone(phone);
|
||||||
return loginAndRegis(shopUser);
|
return loginAndRegis(shopUser);
|
||||||
|
}else {
|
||||||
|
ShopUser msg = new ShopUser();
|
||||||
|
msg.setMsg("手机号获取失败");
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -132,7 +141,6 @@ public class CShopUserServiceImpl implements ShopUserService {
|
|||||||
member.setVip(2L);
|
member.setVip(2L);
|
||||||
member.setRegisterTime(new Date());
|
member.setRegisterTime(new Date());
|
||||||
member.setPassword(IdUtil.fastUUID());
|
member.setPassword(IdUtil.fastUUID());
|
||||||
member.setUsername(shopUser.getUsername());
|
|
||||||
member.setDeviceId(shopUser.getDeviceId());
|
member.setDeviceId(shopUser.getDeviceId());
|
||||||
member.setDeviceType(shopUser.getDeviceType());
|
member.setDeviceType(shopUser.getDeviceType());
|
||||||
member.setHeadImg("/file/download/user/head.jpg");
|
member.setHeadImg("/file/download/user/head.jpg");
|
||||||
|
|||||||
@@ -215,6 +215,11 @@ public class NotificationsServiceImpl implements INotificationsService
|
|||||||
return AjaxResult.success("通知发布完成");
|
return AjaxResult.success("通知发布完成");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Notifications> selectNotificationsByUserId(Long userId) {
|
||||||
|
return notificationsMapper.selectNotificationsByUserId(userId);
|
||||||
|
}
|
||||||
|
|
||||||
private void sendAllToThirdParty(Notifications notification) {
|
private void sendAllToThirdParty(Notifications notification) {
|
||||||
PushMsgInfo pushMsgInfo = new PushMsgInfo();
|
PushMsgInfo pushMsgInfo = new PushMsgInfo();
|
||||||
pushMsgInfo.setTitle(notification.getTitle());
|
pushMsgInfo.setTitle(notification.getTitle());
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.Product;
|
||||||
|
import com.ruoyi.system.mapper.ProductMapper;
|
||||||
|
import com.ruoyi.system.service.IProductService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-10-27
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ProductServiceImpl implements IProductService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ProductMapper productMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询商品
|
||||||
|
*
|
||||||
|
* @param id 商品主键
|
||||||
|
* @return 商品
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Product selectProductById(String id)
|
||||||
|
{
|
||||||
|
return productMapper.selectProductById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询商品列表
|
||||||
|
*
|
||||||
|
* @param product 商品
|
||||||
|
* @return 商品
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Product> selectProductList(Product product)
|
||||||
|
{
|
||||||
|
return productMapper.selectProductList(product);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增商品
|
||||||
|
*
|
||||||
|
* @param product 商品
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertProduct(Product product)
|
||||||
|
{
|
||||||
|
return productMapper.insertProduct(product);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改商品
|
||||||
|
*
|
||||||
|
* @param product 商品
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateProduct(Product product)
|
||||||
|
{
|
||||||
|
return productMapper.updateProduct(product);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除商品
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的商品主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteProductByIds(String[] ids)
|
||||||
|
{
|
||||||
|
return productMapper.deleteProductByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除商品信息
|
||||||
|
*
|
||||||
|
* @param id 商品主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteProductById(String id)
|
||||||
|
{
|
||||||
|
return productMapper.deleteProductById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -89,4 +89,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<select id="selectNotificationsByUserId" resultMap="NotificationsResult">
|
||||||
|
SELECT n.* FROM notifications n LEFT JOIN notification_records sr on n.id = sr.notification_id
|
||||||
|
WHERE sr.user_id=#{userId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
121
ruoyi-system/src/main/resources/mapper/system/ProductMapper.xml
Normal file
121
ruoyi-system/src/main/resources/mapper/system/ProductMapper.xml
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
<?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.ProductMapper">
|
||||||
|
|
||||||
|
<resultMap type="Product" id="ProductResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="productId" column="product_id" />
|
||||||
|
<result property="name" column="name" />
|
||||||
|
<result property="description" column="description" />
|
||||||
|
<result property="categoryId" column="category_id" />
|
||||||
|
<result property="productType" column="product_type" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="originalPrice" column="original_price" />
|
||||||
|
<result property="currentPrice" column="current_price" />
|
||||||
|
<result property="monthlyDuration" column="monthly_duration" />
|
||||||
|
<result property="quarterlyDuration" column="quarterly_duration" />
|
||||||
|
<result property="stock" column="stock" />
|
||||||
|
<result property="sales" column="sales" />
|
||||||
|
<result property="createdAt" column="created_at" />
|
||||||
|
<result property="updatedAt" column="updated_at" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectProductVo">
|
||||||
|
select id, product_id, name, description, category_id, product_type, status, original_price, current_price, monthly_duration, quarterly_duration, stock, sales, created_at, updated_at from product
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectProductList" parameterType="Product" resultMap="ProductResult">
|
||||||
|
<include refid="selectProductVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="productId != null "> and product_id = #{productId}</if>
|
||||||
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||||
|
<if test="description != null and description != ''"> and description = #{description}</if>
|
||||||
|
<if test="categoryId != null "> and category_id = #{categoryId}</if>
|
||||||
|
<if test="productType != null "> and product_type = #{productType}</if>
|
||||||
|
<if test="status != null "> and status = #{status}</if>
|
||||||
|
<if test="originalPrice != null "> and original_price = #{originalPrice}</if>
|
||||||
|
<if test="currentPrice != null "> and current_price = #{currentPrice}</if>
|
||||||
|
<if test="monthlyDuration != null "> and monthly_duration = #{monthlyDuration}</if>
|
||||||
|
<if test="quarterlyDuration != null "> and quarterly_duration = #{quarterlyDuration}</if>
|
||||||
|
<if test="stock != null "> and stock = #{stock}</if>
|
||||||
|
<if test="sales != null "> and sales = #{sales}</if>
|
||||||
|
<if test="createdAt != null "> and created_at = #{createdAt}</if>
|
||||||
|
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectProductById" parameterType="String" resultMap="ProductResult">
|
||||||
|
<include refid="selectProductVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertProduct" parameterType="Product" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into product
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="productId != null">product_id,</if>
|
||||||
|
<if test="name != null and name != ''">name,</if>
|
||||||
|
<if test="description != null">description,</if>
|
||||||
|
<if test="categoryId != null">category_id,</if>
|
||||||
|
<if test="productType != null">product_type,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="originalPrice != null">original_price,</if>
|
||||||
|
<if test="currentPrice != null">current_price,</if>
|
||||||
|
<if test="monthlyDuration != null">monthly_duration,</if>
|
||||||
|
<if test="quarterlyDuration != null">quarterly_duration,</if>
|
||||||
|
<if test="stock != null">stock,</if>
|
||||||
|
<if test="sales != null">sales,</if>
|
||||||
|
<if test="createdAt != null">created_at,</if>
|
||||||
|
<if test="updatedAt != null">updated_at,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="productId != null">#{productId},</if>
|
||||||
|
<if test="name != null and name != ''">#{name},</if>
|
||||||
|
<if test="description != null">#{description},</if>
|
||||||
|
<if test="categoryId != null">#{categoryId},</if>
|
||||||
|
<if test="productType != null">#{productType},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="originalPrice != null">#{originalPrice},</if>
|
||||||
|
<if test="currentPrice != null">#{currentPrice},</if>
|
||||||
|
<if test="monthlyDuration != null">#{monthlyDuration},</if>
|
||||||
|
<if test="quarterlyDuration != null">#{quarterlyDuration},</if>
|
||||||
|
<if test="stock != null">#{stock},</if>
|
||||||
|
<if test="sales != null">#{sales},</if>
|
||||||
|
<if test="createdAt != null">#{createdAt},</if>
|
||||||
|
<if test="updatedAt != null">#{updatedAt},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateProduct" parameterType="Product">
|
||||||
|
update product
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="productId != null">product_id = #{productId},</if>
|
||||||
|
<if test="name != null and name != ''">name = #{name},</if>
|
||||||
|
<if test="description != null">description = #{description},</if>
|
||||||
|
<if test="categoryId != null">category_id = #{categoryId},</if>
|
||||||
|
<if test="productType != null">product_type = #{productType},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="originalPrice != null">original_price = #{originalPrice},</if>
|
||||||
|
<if test="currentPrice != null">current_price = #{currentPrice},</if>
|
||||||
|
<if test="monthlyDuration != null">monthly_duration = #{monthlyDuration},</if>
|
||||||
|
<if test="quarterlyDuration != null">quarterly_duration = #{quarterlyDuration},</if>
|
||||||
|
<if test="stock != null">stock = #{stock},</if>
|
||||||
|
<if test="sales != null">sales = #{sales},</if>
|
||||||
|
<if test="createdAt != null">created_at = #{createdAt},</if>
|
||||||
|
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteProductById" parameterType="String">
|
||||||
|
delete from product where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteProductByIds" parameterType="String">
|
||||||
|
delete from product where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@@ -72,7 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
<if test="isDel != null">is_del = #{isDel},</if>
|
<if test="isDel != null">is_del = #{isDel},</if>
|
||||||
<if test="desc != null">desc = #{desc},</if>
|
<if test="desc != null">`desc` = #{desc},</if>
|
||||||
<if test="backImg != null">back_img = #{backImg},</if>
|
<if test="backImg != null">back_img = #{backImg},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
|
|||||||
@@ -116,6 +116,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
FROM share_info si
|
FROM share_info si
|
||||||
left join shop_user su on si.user_id = su.user_id
|
left join shop_user su on si.user_id = su.user_id
|
||||||
LEFT JOIN music_info mi on si.music_id = mi.music_id
|
LEFT JOIN music_info mi on si.music_id = mi.music_id
|
||||||
WHERE mi.is_del=0
|
WHERE mi.is_del=0 order by si.update_time desc
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
44
ruoyi-ui/src/api/system/product.js
Normal file
44
ruoyi-ui/src/api/system/product.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询商品列表
|
||||||
|
export function listProduct(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/product/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询商品详细
|
||||||
|
export function getProduct(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/product/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增商品
|
||||||
|
export function addProduct(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/product',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改商品
|
||||||
|
export function updateProduct(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/product',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除商品
|
||||||
|
export function delProduct(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/product/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
418
ruoyi-ui/src/views/product/index.vue
Normal file
418
ruoyi-ui/src/views/product/index.vue
Normal file
@@ -0,0 +1,418 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="${comment}" prop="productId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.productId"
|
||||||
|
placeholder="请输入${comment}"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="商品名称" prop="name">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.name"
|
||||||
|
placeholder="请输入商品名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="分类ID" prop="categoryId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.categoryId"
|
||||||
|
placeholder="请输入分类ID"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="原价" prop="originalPrice">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.originalPrice"
|
||||||
|
placeholder="请输入原价"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="现价" prop="currentPrice">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.currentPrice"
|
||||||
|
placeholder="请输入现价"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="包月时长" prop="monthlyDuration">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.monthlyDuration"
|
||||||
|
placeholder="请输入包月时长"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="包季时长" prop="quarterlyDuration">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.quarterlyDuration"
|
||||||
|
placeholder="请输入包季时长"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="库存数量" prop="stock">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.stock"
|
||||||
|
placeholder="请输入库存数量"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="销量" prop="sales">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.sales"
|
||||||
|
placeholder="请输入销量"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间" prop="createdAt">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="queryParams.createdAt"
|
||||||
|
type="date"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
placeholder="请选择创建时间">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="更新时间" prop="updatedAt">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="queryParams.updatedAt"
|
||||||
|
type="date"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
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="['system:product: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:product: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:product: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:product:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="productList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="商品ID" align="center" prop="id" />
|
||||||
|
<el-table-column label="${comment}" align="center" prop="productId" />
|
||||||
|
<el-table-column label="商品名称" align="center" prop="name" />
|
||||||
|
<el-table-column label="商品描述" align="center" prop="description" />
|
||||||
|
<el-table-column label="分类ID" align="center" prop="categoryId" />
|
||||||
|
<el-table-column label="商品类型:1-包月,2-包季,3-半年 " align="center" prop="productType" />
|
||||||
|
<el-table-column label="状态:0-下架,1-上架" align="center" prop="status" />
|
||||||
|
<el-table-column label="原价" align="center" prop="originalPrice" />
|
||||||
|
<el-table-column label="现价" align="center" prop="currentPrice" />
|
||||||
|
<el-table-column label="包月时长" align="center" prop="monthlyDuration" />
|
||||||
|
<el-table-column label="包季时长" align="center" prop="quarterlyDuration" />
|
||||||
|
<el-table-column label="库存数量" align="center" prop="stock" />
|
||||||
|
<el-table-column label="销量" align="center" prop="sales" />
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createdAt" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createdAt, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="更新时间" align="center" prop="updatedAt" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.updatedAt, '{y}-{m}-{d}') }}</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="['system:product:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:product: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="${comment}" prop="productId">
|
||||||
|
<el-input v-model="form.productId" placeholder="请输入${comment}" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="商品名称" prop="name">
|
||||||
|
<el-input v-model="form.name" placeholder="请输入商品名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="商品描述" prop="description">
|
||||||
|
<el-input v-model="form.description" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="分类ID" prop="categoryId">
|
||||||
|
<el-input v-model="form.categoryId" placeholder="请输入分类ID" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="原价" prop="originalPrice">
|
||||||
|
<el-input v-model="form.originalPrice" placeholder="请输入原价" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="现价" prop="currentPrice">
|
||||||
|
<el-input v-model="form.currentPrice" placeholder="请输入现价" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="包月时长" prop="monthlyDuration">
|
||||||
|
<el-input v-model="form.monthlyDuration" placeholder="请输入包月时长" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="包季时长" prop="quarterlyDuration">
|
||||||
|
<el-input v-model="form.quarterlyDuration" placeholder="请输入包季时长" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="库存数量" prop="stock">
|
||||||
|
<el-input v-model="form.stock" placeholder="请输入库存数量" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="销量" prop="sales">
|
||||||
|
<el-input v-model="form.sales" placeholder="请输入销量" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间" prop="createdAt">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="form.createdAt"
|
||||||
|
type="date"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
placeholder="请选择创建时间">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="更新时间" prop="updatedAt">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="form.updatedAt"
|
||||||
|
type="date"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
placeholder="请选择更新时间">
|
||||||
|
</el-date-picker>
|
||||||
|
</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 { listProduct, getProduct, delProduct, addProduct, updateProduct } from "@/api/system/product"
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Product",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 商品表格数据
|
||||||
|
productList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
productId: null,
|
||||||
|
name: null,
|
||||||
|
description: null,
|
||||||
|
categoryId: null,
|
||||||
|
productType: null,
|
||||||
|
status: null,
|
||||||
|
originalPrice: null,
|
||||||
|
currentPrice: null,
|
||||||
|
monthlyDuration: null,
|
||||||
|
quarterlyDuration: null,
|
||||||
|
stock: null,
|
||||||
|
sales: null,
|
||||||
|
createdAt: null,
|
||||||
|
updatedAt: null
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
name: [
|
||||||
|
{ required: true, message: "商品名称不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询商品列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true
|
||||||
|
listProduct(this.queryParams).then(response => {
|
||||||
|
this.productList = response.rows
|
||||||
|
this.total = response.total
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false
|
||||||
|
this.reset()
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
productId: null,
|
||||||
|
name: null,
|
||||||
|
description: null,
|
||||||
|
categoryId: null,
|
||||||
|
productType: null,
|
||||||
|
status: null,
|
||||||
|
originalPrice: null,
|
||||||
|
currentPrice: null,
|
||||||
|
monthlyDuration: null,
|
||||||
|
quarterlyDuration: null,
|
||||||
|
stock: null,
|
||||||
|
sales: null,
|
||||||
|
createdAt: null,
|
||||||
|
updatedAt: null
|
||||||
|
}
|
||||||
|
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
|
||||||
|
getProduct(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) {
|
||||||
|
updateProduct(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功")
|
||||||
|
this.open = false
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addProduct(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功")
|
||||||
|
this.open = false
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row.id || this.ids
|
||||||
|
this.$modal.confirm('是否确认删除商品编号为"' + ids + '"的数据项?').then(function() {
|
||||||
|
return delProduct(ids)
|
||||||
|
}).then(() => {
|
||||||
|
this.getList()
|
||||||
|
this.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => {})
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('system/product/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `product_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user