商品规格修改
parent
265583c5ac
commit
3aadc32624
|
@ -26,7 +26,7 @@ public class FileUploadUtils {
|
|||
/**
|
||||
* 默认大小 50M
|
||||
*/
|
||||
public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
|
||||
public static final long DEFAULT_MAX_SIZE = 1024 * 1024 * 1024;
|
||||
|
||||
/**
|
||||
* 默认的文件名最大长度 100
|
||||
|
|
|
@ -99,4 +99,11 @@ public class RuleAttrInfo extends BaseEntity {
|
|||
.createTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
public static RuleAttrInfo saveBuil(Long id) {
|
||||
return RuleAttrInfo.builder()
|
||||
.ruleId(id)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,8 +53,6 @@ public class RuleInfo extends BaseEntity {
|
|||
@ApiModelProperty(name = "规格状态", value = "规格状态")
|
||||
private String status;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询构造器
|
||||
*/
|
||||
|
|
|
@ -8,6 +8,8 @@ import lombok.experimental.SuperBuilder;
|
|||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品规格对象 rule_info
|
||||
*
|
||||
|
@ -31,4 +33,8 @@ public class RuleInfoEditReq extends BaseEntity {
|
|||
@ApiModelProperty(name = "规格状态", value = "规格状态")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 规格与规格详情
|
||||
*/
|
||||
private List<Long> ruleAddForm;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ import lombok.experimental.SuperBuilder;
|
|||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品规格对象 rule_info
|
||||
*
|
||||
|
|
|
@ -94,6 +94,7 @@ public class RuleAttrInfoController extends BaseController {
|
|||
@PutMapping("/{id}")
|
||||
@ApiOperation("修改规格详情")
|
||||
public Result<String> edit(@PathVariable Long id, @RequestBody RuleAttrInfoEditReq ruleAttrInfoEditReq) {
|
||||
|
||||
return toAjax(ruleAttrInfoService.updateById(RuleAttrInfo.editBuild(id,ruleAttrInfoEditReq)));
|
||||
}
|
||||
|
||||
|
|
|
@ -73,8 +73,9 @@ public class RuleInfoController extends BaseController {
|
|||
@RequiresPermissions("product:rule:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||
public Result<RuleInfo> getInfo(@PathVariable("id") Long id) {
|
||||
return Result.success(ruleInfoService.getById(id));
|
||||
public Result<RuleInfoResp> getInfo(@PathVariable("id") Long id) {
|
||||
|
||||
return Result.success( ruleInfoService.util(id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,6 +97,7 @@ public class RuleInfoController extends BaseController {
|
|||
@PutMapping("/{id}")
|
||||
@ApiOperation("修改商品规格")
|
||||
public Result<String> edit(@PathVariable Long id, @RequestBody RuleInfoEditReq ruleInfoEditReq) {
|
||||
|
||||
return toAjax(ruleInfoService.updateById(RuleInfo.editBuild(id,ruleInfoEditReq)));
|
||||
}
|
||||
|
||||
|
|
|
@ -19,4 +19,5 @@ public interface RuleAttrInfoService extends IService<RuleAttrInfo> {
|
|||
*/
|
||||
public List<RuleAttrInfo> list(RuleAttrInfo ruleAttrInfo);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.muyu.product.domain.RuleInfo;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.product.domain.model.RuleAttrAddModel;
|
||||
import com.muyu.product.domain.model.RuleInfoAddModel;
|
||||
import com.muyu.product.domain.req.RuleInfoEditReq;
|
||||
import com.muyu.product.domain.req.RuleInfoQueryReq;
|
||||
import com.muyu.product.domain.resp.RuleInfoResp;
|
||||
|
||||
|
@ -28,4 +29,7 @@ public interface RuleInfoService extends IService<RuleInfo> {
|
|||
public boolean save(RuleInfoAddModel ruleInfoAddModel);
|
||||
|
||||
TableDataInfo<RuleInfoResp> queryList(RuleInfoQueryReq ruleInfoQueryReq);
|
||||
|
||||
|
||||
RuleInfoResp util(Long id);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,10 @@ package com.muyu.product.service.impl;
|
|||
import java.util.List;
|
||||
|
||||
import com.muyu.common.core.utils.ObjUtils;
|
||||
import com.muyu.product.domain.RuleInfo;
|
||||
import com.muyu.product.service.RuleInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.product.mapper.RuleAttrInfoMapper;
|
||||
import com.muyu.product.domain.RuleAttrInfo;
|
||||
|
@ -50,4 +53,6 @@ public class RuleAttrInfoServiceImpl extends ServiceImpl<RuleAttrInfoMapper, Rul
|
|||
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.muyu.common.security.utils.SecurityUtils;
|
|||
import com.muyu.product.domain.RuleAttrInfo;
|
||||
import com.muyu.product.domain.model.RuleAttrAddModel;
|
||||
import com.muyu.product.domain.model.RuleInfoAddModel;
|
||||
import com.muyu.product.domain.req.RuleInfoEditReq;
|
||||
import com.muyu.product.domain.req.RuleInfoQueryReq;
|
||||
import com.muyu.product.domain.resp.RuleInfoResp;
|
||||
import com.muyu.product.service.RuleAttrInfoService;
|
||||
|
@ -105,6 +106,17 @@ public class RuleInfoServiceImpl extends ServiceImpl<RuleInfoMapper, RuleInfo>
|
|||
.total(isPage ? new PageInfo<>(list).getTotal() : 0)
|
||||
.build();
|
||||
}
|
||||
@Override
|
||||
public RuleInfoResp util(Long id) {
|
||||
|
||||
RuleInfo byId = this.getById(id);
|
||||
List<RuleAttrAddModel> ruleAttrAddModels = ruleAttrInfoService.list(new LambdaQueryWrapper<RuleAttrInfo>().eq(RuleAttrInfo::getRuleId, byId.getId()))
|
||||
.stream().map(ruleAttrInfo ->
|
||||
RuleAttrAddModel.buildModel(ruleAttrInfo, Arrays.stream(ruleAttrInfo.getAttrValue().split(",")).toList())).toList();
|
||||
|
||||
return RuleInfoResp.buildResp(byId,ruleAttrAddModels);
|
||||
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean save(RuleInfoAddModel ruleInfoAddModel) {
|
||||
|
|
Loading…
Reference in New Issue