src/main/java/com/whyc/controller/ComponentProductController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/mapper/ComponentProductMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/ComponentProductService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/whyc/controller/ComponentProductController.java
New file @@ -0,0 +1,26 @@ package com.whyc.controller; import com.whyc.dto.Response; 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; @Api(tags = "散装件管理") @RestController @RequestMapping("componentProduct") public class ComponentProductController { @Autowired private ComponentProductService service; @ApiOperation(value = "增加散装件和产品之间替换关系") @GetMapping("addCompentConnectBom") public Response addCompentConnectBom(@RequestParam int componentId,@RequestParam String parentModel,@RequestParam String subName){ return service.addCompentConnectBom(componentId,parentModel,subName); } } src/main/java/com/whyc/mapper/ComponentProductMapper.java
New file @@ -0,0 +1,6 @@ package com.whyc.mapper; import com.whyc.pojo.ComponentProduct; public interface ComponentProductMapper extends CustomMapper<ComponentProduct>{ } src/main/java/com/whyc/service/ComponentProductService.java
New file @@ -0,0 +1,22 @@ package com.whyc.service; import com.whyc.dto.Response; import com.whyc.mapper.ComponentProductMapper; import com.whyc.pojo.ComponentProduct; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @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); return new Response().setII(1,true,bl,bl>0?"添加关联成功":"添加关联失败"); } }