dev798
parent
db1479a922
commit
a07b6385e9
|
@ -1,9 +1,10 @@
|
||||||
package com.muyu.product.domain.util;
|
package com.muyu.common.core.domain;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.common.core.constant.Constants;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 响应信息主体
|
* 响应信息主体
|
||||||
*
|
*
|
|
@ -1,7 +1,7 @@
|
||||||
package com.muyu.common.system.remote;
|
package com.muyu.common.system.remote;
|
||||||
|
|
||||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.R;
|
||||||
import com.muyu.common.system.domain.SysFile;
|
import com.muyu.common.system.domain.SysFile;
|
||||||
import com.muyu.common.system.remote.factory.RemoteFileFallbackFactory;
|
import com.muyu.common.system.remote.factory.RemoteFileFallbackFactory;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
@ -21,9 +21,8 @@ public interface RemoteFileService {
|
||||||
* 上传文件
|
* 上传文件
|
||||||
*
|
*
|
||||||
* @param file 文件信息
|
* @param file 文件信息
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
public Result<SysFile> upload (@RequestPart(value = "file") MultipartFile file);
|
public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package com.muyu.common.system.remote.factory;
|
package com.muyu.common.system.remote.factory;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.R;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.system.remote.RemoteFileService;
|
|
||||||
import com.muyu.common.system.domain.SysFile;
|
import com.muyu.common.system.domain.SysFile;
|
||||||
|
import com.muyu.common.system.remote.RemoteFileService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
@ -23,8 +24,8 @@ public class RemoteFileFallbackFactory implements FallbackFactory<RemoteFileServ
|
||||||
log.error("文件服务调用失败:{}", throwable.getMessage());
|
log.error("文件服务调用失败:{}", throwable.getMessage());
|
||||||
return new RemoteFileService() {
|
return new RemoteFileService() {
|
||||||
@Override
|
@Override
|
||||||
public Result<SysFile> upload (MultipartFile file) {
|
public R<SysFile> upload (MultipartFile file) {
|
||||||
return Result.error("上传文件失败:" + throwable.getMessage());
|
return R.fail("上传文件失败:" + throwable.getMessage());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,31 +15,31 @@ public class Category extends BaseEntity {
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "id")
|
@ApiModelProperty(value = "id")
|
||||||
private String id;
|
private Integer id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "上级分类的编号:0表示一级分类")
|
@ApiModelProperty(value = "上级分类的编号:0表示一级分类")
|
||||||
private String parent_id;
|
private Integer parentId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "名称")
|
@ApiModelProperty(value = "名称")
|
||||||
private String category_name;
|
private String categoryName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "分类级别:0->1级;1->2级")
|
@ApiModelProperty(value = "分类级别:0->1级;1->2级")
|
||||||
private String level;
|
private Integer level;
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品数量")
|
@ApiModelProperty(value = "商品数量")
|
||||||
private String product_count;
|
private Integer productCount;
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品单位")
|
@ApiModelProperty(value = "商品单位")
|
||||||
private String product_unit;
|
private String productUnit;
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否显示在导航栏:0->不显示;1->显示")
|
@ApiModelProperty(value = "是否显示在导航栏:0->不显示;1->显示")
|
||||||
private String nav_status;
|
private Integer navStatus;
|
||||||
|
|
||||||
@ApiModelProperty(value = "显示状态:0->不显示;1->显示")
|
@ApiModelProperty(value = "显示状态:0->不显示;1->显示")
|
||||||
private String show_status;
|
private Integer showStatus;
|
||||||
|
|
||||||
@ApiModelProperty(value = "排序")
|
@ApiModelProperty(value = "排序")
|
||||||
private String sort;
|
private Integer sort;
|
||||||
|
|
||||||
@ApiModelProperty(value = "图标")
|
@ApiModelProperty(value = "图标")
|
||||||
private String icon;
|
private String icon;
|
||||||
|
|
|
@ -32,6 +32,6 @@ public class QueryProductReq {
|
||||||
private Integer pageNum = 1;
|
private Integer pageNum = 1;
|
||||||
|
|
||||||
@ApiModelProperty(value = "分页参数")
|
@ApiModelProperty(value = "分页参数")
|
||||||
private Integer pageSize = 10;
|
private Integer pageSize = 5;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
package com.muyu.product.controller;
|
package com.muyu.product.controller;
|
||||||
|
|
||||||
import com.muyu.common.core.domain.AjaxResult;
|
import com.muyu.common.core.domain.AjaxResult;
|
||||||
|
import com.muyu.common.core.domain.R;
|
||||||
import com.muyu.product.domain.DTO.Brand;
|
import com.muyu.product.domain.DTO.Brand;
|
||||||
import com.muyu.product.domain.DTO.Services;
|
import com.muyu.product.domain.DTO.Services;
|
||||||
import com.muyu.product.domain.util.R;
|
|
||||||
import com.muyu.product.domain.vo.ProductCategoryVo;
|
import com.muyu.product.domain.vo.ProductCategoryVo;
|
||||||
import com.muyu.product.service.ArgumentService;
|
import com.muyu.product.service.ArgumentService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import lombok.extern.log4j.Log4j2;
|
|
||||||
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.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
|
@ -2,21 +2,29 @@ package com.muyu.product.controller;
|
||||||
|
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.muyu.common.core.domain.AjaxResult;
|
import com.muyu.common.core.domain.AjaxResult;
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.common.core.utils.file.FileTypeUtils;
|
||||||
|
import com.muyu.common.core.utils.file.MimeTypeUtils;
|
||||||
|
import com.muyu.common.system.domain.SysFile;
|
||||||
import com.muyu.common.system.remote.RemoteFileService;
|
import com.muyu.common.system.remote.RemoteFileService;
|
||||||
import com.muyu.product.domain.DTO.Product;
|
import com.muyu.product.domain.DTO.Product;
|
||||||
import com.muyu.product.domain.Resp.ProductResp;
|
import com.muyu.product.domain.Resp.ProductResp;
|
||||||
import com.muyu.product.domain.req.ProductReq;
|
import com.muyu.product.domain.req.ProductReq;
|
||||||
import com.muyu.product.domain.req.QueryProductReq;
|
import com.muyu.product.domain.req.QueryProductReq;
|
||||||
import com.muyu.product.domain.util.R;
|
import com.muyu.common.core.domain.R;
|
||||||
import com.muyu.product.service.ProductService;
|
import com.muyu.product.service.ProductService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import static com.muyu.common.core.domain.AjaxResult.error;
|
||||||
import static com.muyu.common.core.domain.AjaxResult.success;
|
import static com.muyu.common.core.domain.AjaxResult.success;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,6 +42,7 @@ public class ProductController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private RemoteFileService remoteFileService;
|
private RemoteFileService remoteFileService;
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("查询商品信息")
|
@ApiOperation("查询商品信息")
|
||||||
@GetMapping("/queryProduct")
|
@GetMapping("/queryProduct")
|
||||||
public AjaxResult queryProduct(QueryProductReq req){
|
public AjaxResult queryProduct(QueryProductReq req){
|
||||||
|
@ -49,4 +58,27 @@ public class ProductController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("图片上传")
|
||||||
|
@PostMapping("/upload")
|
||||||
|
public AjaxResult avatar(@RequestParam("file") MultipartFile file)
|
||||||
|
{
|
||||||
|
if (!file.isEmpty())
|
||||||
|
{
|
||||||
|
String extension = FileTypeUtils.getExtension(file);
|
||||||
|
if (!StringUtils.equalsAnyIgnoreCase(extension, MimeTypeUtils.IMAGE_EXTENSION))
|
||||||
|
{
|
||||||
|
return error("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtils.IMAGE_EXTENSION) + "格式");
|
||||||
|
}
|
||||||
|
R<SysFile> fileResult = remoteFileService.upload(file);
|
||||||
|
if (StringUtils.isNull(fileResult) || StringUtils.isNull(fileResult.getData()))
|
||||||
|
{
|
||||||
|
return error("文件服务异常,请联系管理员");
|
||||||
|
}
|
||||||
|
String url = fileResult.getData().getUrl();
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("imgUrl", url);
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
return error("上传图片异常,请联系管理员");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package com.muyu.product.mapper;
|
package com.muyu.product.mapper;
|
||||||
|
|
||||||
import com.muyu.product.domain.DTO.Brand;
|
import com.muyu.product.domain.DTO.Brand;
|
||||||
|
import com.muyu.product.domain.DTO.Category;
|
||||||
|
import com.muyu.product.domain.DTO.Services;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -8,6 +11,12 @@ import java.util.List;
|
||||||
* @Author: wangxinyuan
|
* @Author: wangxinyuan
|
||||||
* @Date: 2024/3/29 17:07
|
* @Date: 2024/3/29 17:07
|
||||||
*/
|
*/
|
||||||
|
@Mapper
|
||||||
public interface ArgumentMapper {
|
public interface ArgumentMapper {
|
||||||
List<Brand> queryBrand();
|
List<Brand> queryBrand();
|
||||||
|
|
||||||
|
List<Services> queryService();
|
||||||
|
|
||||||
|
List<Category> queryCategory();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,4 +14,8 @@ import java.util.List;
|
||||||
public interface ProductMapper {
|
public interface ProductMapper {
|
||||||
|
|
||||||
List<ProductResp> queryProduct(QueryProductReq productReq);
|
List<ProductResp> queryProduct(QueryProductReq productReq);
|
||||||
|
|
||||||
|
void insertProduct(Product product);
|
||||||
|
|
||||||
|
void updateMothodId(Integer id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
package com.muyu.product.mapper;
|
package com.muyu.product.mapper;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: wangxinyuan
|
* @Author: wangxinyuan
|
||||||
* @Date: 2024/3/29 17:29
|
* @Date: 2024/3/29 17:29
|
||||||
*/
|
*/
|
||||||
|
@Mapper
|
||||||
public interface ProductSkuMapper {
|
public interface ProductSkuMapper {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,21 @@
|
||||||
package com.muyu.product.mapper;
|
package com.muyu.product.mapper;
|
||||||
|
|
||||||
|
import com.muyu.product.domain.DTO.Ladder;
|
||||||
|
import com.muyu.product.domain.DTO.Member;
|
||||||
|
import com.muyu.product.domain.DTO.Preference;
|
||||||
|
import com.muyu.product.domain.DTO.Price;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: wangxinyuan
|
* @Author: wangxinyuan
|
||||||
* @Date: 2024/3/29 17:07
|
* @Date: 2024/3/29 17:07
|
||||||
*/
|
*/
|
||||||
public interface PromotionMapper {
|
public interface PromotionMapper {
|
||||||
|
|
||||||
|
void insertPreference(Preference preference);
|
||||||
|
|
||||||
|
void insertMember(Member member);
|
||||||
|
|
||||||
|
void insertLadder(Ladder item);
|
||||||
|
|
||||||
|
void insertPrice(Price item);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,15 @@
|
||||||
package com.muyu.product.mapper;
|
package com.muyu.product.mapper;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: wangxinyuan
|
* @Author: wangxinyuan
|
||||||
* @Date: 2024/3/29 17:07
|
* @Date: 2024/3/29 17:07
|
||||||
*/
|
*/
|
||||||
|
@Mapper
|
||||||
public interface ServicesMapper {
|
public interface ServicesMapper {
|
||||||
|
|
||||||
|
int insertProductServicep(Integer productId, List<Integer> serviceIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
package com.muyu.product.service;
|
package com.muyu.product.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: wangxinyuan
|
* @Author: wangxinyuan
|
||||||
* @Date: 2024/3/29 17:05
|
* @Date: 2024/3/29 17:05
|
||||||
*/
|
*/
|
||||||
public interface ServiceService {
|
public interface ServiceService {
|
||||||
|
int insertProductService(Integer id, List<Integer> serviceIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.muyu.product.service.impl;
|
package com.muyu.product.service.impl;
|
||||||
|
|
||||||
import com.muyu.product.domain.DTO.Brand;
|
import com.muyu.product.domain.DTO.Brand;
|
||||||
|
import com.muyu.product.domain.DTO.Category;
|
||||||
import com.muyu.product.domain.DTO.Services;
|
import com.muyu.product.domain.DTO.Services;
|
||||||
import com.muyu.product.domain.vo.ProductCategoryVo;
|
import com.muyu.product.domain.vo.ProductCategoryVo;
|
||||||
import com.muyu.product.mapper.ArgumentMapper;
|
import com.muyu.product.mapper.ArgumentMapper;
|
||||||
|
@ -8,6 +9,8 @@ import com.muyu.product.service.ArgumentService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,11 +29,40 @@ public class ArgumentServiceImpl implements ArgumentService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Services> queryService() {
|
public List<Services> queryService() {
|
||||||
return null;
|
return argumentMapper.queryService();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ProductCategoryVo> queryCategory() {
|
public List<ProductCategoryVo> queryCategory() {
|
||||||
return null;
|
List<Category>categoryList=argumentMapper.queryCategory();
|
||||||
|
List<ProductCategoryVo>productCategoryVos=convertToProductCategoryVoTree(categoryList);
|
||||||
|
return productCategoryVos;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ProductCategoryVo> convertToProductCategoryVoTree(List<Category> categoryList) {
|
||||||
|
ArrayList<ProductCategoryVo> productCategoryVos = new ArrayList<>();
|
||||||
|
HashMap<Integer, ProductCategoryVo> idToProductCategoryVoMap = new HashMap<>();
|
||||||
|
|
||||||
|
for (Category category : categoryList) {
|
||||||
|
ProductCategoryVo productCategoryVo = new ProductCategoryVo();
|
||||||
|
productCategoryVo.setId(category.getId());
|
||||||
|
productCategoryVo.setName(category.getCategoryName());
|
||||||
|
productCategoryVo.setParentId(category.getParentId());
|
||||||
|
productCategoryVo.setChildrenList(new ArrayList<>());
|
||||||
|
idToProductCategoryVoMap.put(category.getId(),productCategoryVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ProductCategoryVo productCategoryVo : idToProductCategoryVoMap.values()) {
|
||||||
|
if(productCategoryVo.getParentId()==0){
|
||||||
|
productCategoryVos.add(productCategoryVo);
|
||||||
|
}else {
|
||||||
|
Integer parentId = productCategoryVo.getParentId();
|
||||||
|
ProductCategoryVo parentProductCategoryVo = idToProductCategoryVoMap.get(parentId);
|
||||||
|
if(parentProductCategoryVo!=null){
|
||||||
|
parentProductCategoryVo.getChildrenList().add(productCategoryVo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return productCategoryVos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,8 @@ package com.muyu.product.service.impl;
|
||||||
|
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.muyu.product.domain.DTO.Product;
|
import com.muyu.product.domain.DTO.*;
|
||||||
|
import com.muyu.product.domain.DTO.Number;
|
||||||
import com.muyu.product.domain.Resp.ProductResp;
|
import com.muyu.product.domain.Resp.ProductResp;
|
||||||
import com.muyu.product.domain.req.ProductReq;
|
import com.muyu.product.domain.req.ProductReq;
|
||||||
import com.muyu.product.domain.req.QueryProductReq;
|
import com.muyu.product.domain.req.QueryProductReq;
|
||||||
|
@ -58,10 +59,61 @@ public class ProductServiceImpl implements ProductService {
|
||||||
|
|
||||||
insertProduct(productReq.getProduct());
|
insertProduct(productReq.getProduct());
|
||||||
|
|
||||||
|
insertProductService(productReq.getProduct().getId(),productReq.getServiceIds());
|
||||||
|
|
||||||
|
|
||||||
|
insertProductPromotion(productReq);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void insertProductPromotion(ProductReq productReq) {
|
||||||
|
Integer methodType = productReq.getProduct().getMethodType();
|
||||||
|
|
||||||
|
//没有优惠
|
||||||
|
if(Number.zero.getValue().equals(String.valueOf(methodType))){
|
||||||
|
updateMethodId(Integer.valueOf(Number.zero.getValue()));
|
||||||
|
}
|
||||||
|
|
||||||
|
//特价优惠
|
||||||
|
if(Number.one.getValue().equals(String.valueOf(methodType))){
|
||||||
|
Preference preference = productReq.getPreference();
|
||||||
|
promotionMapper.insertPreference(preference);
|
||||||
|
updateMethodId(preference.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
//会员优惠
|
||||||
|
if(Number.two.getValue().equals(String.valueOf(methodType))){
|
||||||
|
Member member = productReq.getMember();
|
||||||
|
promotionMapper.insertMember(member);
|
||||||
|
updateMethodId(member.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
//阶梯价格
|
||||||
|
if(Number.three.getValue().equals(String.valueOf(methodType))){
|
||||||
|
List<Ladder> ladder = productReq.getLadder();
|
||||||
|
ladder.forEach(item -> {
|
||||||
|
promotionMapper.insertLadder(item);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//满减价格
|
||||||
|
if(Number.four.getValue().equals(String.valueOf(methodType))){
|
||||||
|
List<Price> price = productReq.getPrice();
|
||||||
|
price.forEach(item -> {
|
||||||
|
promotionMapper.insertPrice(item);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateMethodId(Integer id) {
|
||||||
|
productMapper.updateMothodId(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void insertProductService(Integer id, List<Integer> serviceIds) {
|
||||||
|
serviceService.insertProductService(id,serviceIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void insertProduct(Product product) {
|
private void insertProduct(Product product) {
|
||||||
|
productMapper.insertProduct(product);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,23 @@
|
||||||
package com.muyu.product.service.impl;
|
package com.muyu.product.service.impl;
|
||||||
|
|
||||||
|
import com.muyu.product.mapper.ServicesMapper;
|
||||||
import com.muyu.product.service.ServiceService;
|
import com.muyu.product.service.ServiceService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: wangxinyuan
|
* @Author: wangxinyuan
|
||||||
* @Date: 2024/3/29 17:05
|
* @Date: 2024/3/29 17:05
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ServiceServiceImpl implements ServiceService {
|
public class ServiceServiceImpl implements ServiceService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ServicesMapper servicesMapper;
|
||||||
|
@Override
|
||||||
|
public int insertProductService(Integer productId, List<Integer> serviceIds) {
|
||||||
|
return servicesMapper.insertProductServicep(productId,serviceIds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,5 +9,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select id,brand_name from t_product_brand
|
select id,brand_name from t_product_brand
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="queryService" resultType="com.muyu.product.domain.DTO.Services">
|
||||||
|
select id,service_name from t_product_service
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="queryCategory" resultType="com.muyu.product.domain.DTO.Category">
|
||||||
|
select id,category_name,parent_id from t_product_category
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -12,6 +12,63 @@
|
||||||
product_recommended,details_title,details_information,details_key_word,details_remark,
|
product_recommended,details_title,details_information,details_key_word,details_remark,
|
||||||
method_type,t_product_brand.brand_name,t_product_type.type_name,sale_price
|
method_type,t_product_brand.brand_name,t_product_type.type_name,sale_price
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
<insert id="insertProduct">
|
||||||
|
INSERT INTO `cargo`.`t_Product` (
|
||||||
|
`product_name`,
|
||||||
|
`product_number`,
|
||||||
|
`brand_id`,
|
||||||
|
`type_id`,
|
||||||
|
`product_subheading`,
|
||||||
|
`product_information`,
|
||||||
|
`product_unit`,
|
||||||
|
`product_weight`,
|
||||||
|
`product_sort`,
|
||||||
|
`product_points`,
|
||||||
|
`product_growth`,
|
||||||
|
`product_max_points`,
|
||||||
|
`product_foreknow`,
|
||||||
|
`product_staus`,
|
||||||
|
`product_new`,
|
||||||
|
`product_recommended`,
|
||||||
|
`details_title`,
|
||||||
|
`details_information`,
|
||||||
|
`details_key_word`,
|
||||||
|
`details_remark`,
|
||||||
|
`method_type`,
|
||||||
|
`create_by`,
|
||||||
|
`create_time`
|
||||||
|
) VALUES (
|
||||||
|
#{productName},
|
||||||
|
#{productNumber},
|
||||||
|
#{brandId},
|
||||||
|
#{typeId},
|
||||||
|
#{productSubheading},
|
||||||
|
#{productInformation},
|
||||||
|
#{productUnit},
|
||||||
|
#{productWeight},
|
||||||
|
#{productSort},
|
||||||
|
#{productPoints},
|
||||||
|
#{productGrowth},
|
||||||
|
#{productMaxPoints},
|
||||||
|
#{productForeknow},
|
||||||
|
#{productStatus},
|
||||||
|
#{productNew},
|
||||||
|
#{productRecommended},
|
||||||
|
#{detailsTitle},
|
||||||
|
#{detailsInformation},
|
||||||
|
#{detailsKeyWord},
|
||||||
|
#{detailsRemark},
|
||||||
|
#{methodType},
|
||||||
|
#{createBy},
|
||||||
|
NOW()
|
||||||
|
);
|
||||||
|
</insert>
|
||||||
|
<update id="updateMothodId">
|
||||||
|
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
<select id="queryProduct" resultType="com.muyu.product.domain.Resp.ProductResp">
|
<select id="queryProduct" resultType="com.muyu.product.domain.Resp.ProductResp">
|
||||||
select <include refid="sql"></include> from t_product
|
select <include refid="sql"></include> from t_product
|
||||||
LEFT JOIN t_product_brand ON t_product.brand_id = t_product_brand.id
|
LEFT JOIN t_product_brand ON t_product.brand_id = t_product_brand.id
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?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.muyu.product.mapper.PromotionMapper">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 添加其他操作方法如插入、更新、删除等 -->
|
||||||
|
|
||||||
|
|
||||||
|
<insert id="insertPreference">
|
||||||
|
INSERT INTO `t_product_preference` ( `preference_start_time`, `preference_end_time`, `preference_price`, `create_time`, `create_by`)
|
||||||
|
VALUES (#{preferenceStartTime},#{preferenceEndTime},#{preferencePrice}, now(), #{createBy})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertMember">
|
||||||
|
INSERT INTO `t_product_member` ( `member_gold`, `member_silver`, `member_diamond`, `create_time`, `create_by` )
|
||||||
|
VALUES
|
||||||
|
( #{memberGold},#{memberSilver},#{memberDiamond},now(),#{createBy} )
|
||||||
|
</insert>
|
||||||
|
<insert id="insertLadder">
|
||||||
|
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertPrice">
|
||||||
|
INSERT INTO `t_product_price` ( `price_max`, `price_reduction`, `create_time`, `create_by`)
|
||||||
|
VALUES (#{priceMax},#{priceReduction},now(),#{createBy})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?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.muyu.product.mapper.ServicesMapper">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 添加其他操作方法如插入、更新、删除等 -->
|
||||||
|
|
||||||
|
<insert id="insertProductServicep">
|
||||||
|
insert t_product_service_middle(product_id,service_id)
|
||||||
|
values
|
||||||
|
<foreach collection="serviceIds" item="ids" separator=",">
|
||||||
|
(#{id},#{ids})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.system.controller;
|
package com.muyu.system.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.R;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
import com.muyu.common.core.utils.file.FileTypeUtils;
|
import com.muyu.common.core.utils.file.FileTypeUtils;
|
||||||
|
@ -117,7 +118,7 @@ public class SysProfileController extends BaseController {
|
||||||
if (!StringUtils.equalsAnyIgnoreCase(extension, MimeTypeUtils.IMAGE_EXTENSION)) {
|
if (!StringUtils.equalsAnyIgnoreCase(extension, MimeTypeUtils.IMAGE_EXTENSION)) {
|
||||||
return error("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtils.IMAGE_EXTENSION) + "格式");
|
return error("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtils.IMAGE_EXTENSION) + "格式");
|
||||||
}
|
}
|
||||||
Result<SysFile> fileResult = remoteFileService.upload(file);
|
R<SysFile> fileResult = remoteFileService.upload(file);
|
||||||
if (StringUtils.isNull(fileResult) || StringUtils.isNull(fileResult.getData())) {
|
if (StringUtils.isNull(fileResult) || StringUtils.isNull(fileResult.getData())) {
|
||||||
return error("文件服务异常,请联系管理员");
|
return error("文件服务异常,请联系管理员");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue