lxw
2022-08-03 0816268c9fc2dd7ed659906851b3346858d4c1e9
批量增加散装件和子件替换关系
2个文件已修改
24 ■■■■ 已修改文件
src/main/java/com/whyc/controller/ComponentProductController.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/ComponentProductService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/ComponentProductController.java
@@ -1,14 +1,14 @@
package com.whyc.controller;
import com.whyc.dto.Response;
import com.whyc.pojo.ComponentProduct;
import com.whyc.service.ComponentProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Api(tags = "散装件管理")
@RestController
@@ -19,8 +19,8 @@
    @ApiOperation(value = "增加散装件和产品之间替换关系")
    @GetMapping("addCompentConnectBom")
    public Response addCompentConnectBom(@RequestParam int componentId,@RequestParam String parentModel,@RequestParam String subName){
        return  service.addCompentConnectBom(componentId,parentModel,subName);
    @PostMapping("addCompentConnectBom")
    public Response addCompentConnectBom(@RequestBody List<ComponentProduct> list){
        return  service.addCompentConnectBom(list);
    }
}
src/main/java/com/whyc/service/ComponentProductService.java
@@ -6,17 +6,15 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ComponentProductService {
    @Autowired(required = false)
    private ComponentProductMapper mapper;
    //增加散装件和产品之间替换关系
    public Response addCompentConnectBom(int componentId, String parentModel, String subName) {
        ComponentProduct comProduct=new ComponentProduct();
        comProduct.setComponentId(componentId);
        comProduct.setParentModel(parentModel);
        comProduct.setSubName(subName);
        int bl=mapper.insert(comProduct);
    public Response addCompentConnectBom(List<ComponentProduct> list) {
        int bl=mapper.insertBatchSomeColumn(list);
        return new Response().setII(1,true,bl,bl>0?"添加关联成功":"添加关联失败");
    }
}