From 143d78b78256c6d4a89e3854d10a48f4a328a7ba Mon Sep 17 00:00:00 2001 From: Claude Lee Date: Thu, 26 Sep 2024 09:43:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=94=9F=E4=BA=A7=E5=9F=BA?= =?UTF-8?q?=E5=9C=B0controller=E5=92=8C=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dhc/DhcProductionBaseLineController.java | 104 ++++++++++++++++++ .../dhc/domain/DhcProductionBaseLine.java | 50 +++++++++ .../mapper/DhcProductionBaseLineMapper.java | 61 ++++++++++ .../IDhcProductionBaseLineService.java | 61 ++++++++++ .../DhcProductionBaseLineServiceImpl.java | 93 ++++++++++++++++ .../dhc/DhcProductionBaseLineMapper.xml | 57 ++++++++++ 6 files changed, 426 insertions(+) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/dhc/DhcProductionBaseLineController.java create mode 100644 ruoyi-plan/src/main/java/com/ruoyi/dhc/domain/DhcProductionBaseLine.java create mode 100644 ruoyi-plan/src/main/java/com/ruoyi/dhc/mapper/DhcProductionBaseLineMapper.java create mode 100644 ruoyi-plan/src/main/java/com/ruoyi/dhc/service/IDhcProductionBaseLineService.java create mode 100644 ruoyi-plan/src/main/java/com/ruoyi/dhc/service/impl/DhcProductionBaseLineServiceImpl.java create mode 100644 ruoyi-plan/src/main/resources/mapper/dhc/DhcProductionBaseLineMapper.xml diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/dhc/DhcProductionBaseLineController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/dhc/DhcProductionBaseLineController.java new file mode 100644 index 0000000..2861cad --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/dhc/DhcProductionBaseLineController.java @@ -0,0 +1,104 @@ +package com.ruoyi.web.controller.dhc; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.dhc.domain.DhcProductionBaseLine; +import com.ruoyi.dhc.service.IDhcProductionBaseLineService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 生产基地与产品线关系Controller + * + * @author ruoyi + * @date 2024-09-26 + */ +@RestController +@RequestMapping("/dhc/line") +public class DhcProductionBaseLineController extends BaseController +{ + @Autowired + private IDhcProductionBaseLineService dhcProductionBaseLineService; + + /** + * 查询生产基地与产品线关系列表 + */ + @PreAuthorize("@ss.hasPermi('dhc:line:list')") + @GetMapping("/list") + public TableDataInfo list(DhcProductionBaseLine dhcProductionBaseLine) + { + startPage(); + List list = dhcProductionBaseLineService.selectDhcProductionBaseLineList(dhcProductionBaseLine); + return getDataTable(list); + } + + /** + * 导出生产基地与产品线关系列表 + */ + @PreAuthorize("@ss.hasPermi('dhc:line:export')") + @Log(title = "生产基地与产品线关系", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DhcProductionBaseLine dhcProductionBaseLine) + { + List list = dhcProductionBaseLineService.selectDhcProductionBaseLineList(dhcProductionBaseLine); + ExcelUtil util = new ExcelUtil(DhcProductionBaseLine.class); + util.exportExcel(response, list, "生产基地与产品线关系数据"); + } + + /** + * 获取生产基地与产品线关系详细信息 + */ + @PreAuthorize("@ss.hasPermi('dhc:line:query')") + @GetMapping(value = "/{productLineCode}") + public AjaxResult getInfo(@PathVariable("productLineCode") String productLineCode) + { + return success(dhcProductionBaseLineService.selectDhcProductionBaseLineByProductLineCode(productLineCode)); + } + + /** + * 新增生产基地与产品线关系 + */ + @PreAuthorize("@ss.hasPermi('dhc:line:add')") + @Log(title = "生产基地与产品线关系", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DhcProductionBaseLine dhcProductionBaseLine) + { + return toAjax(dhcProductionBaseLineService.insertDhcProductionBaseLine(dhcProductionBaseLine)); + } + + /** + * 修改生产基地与产品线关系 + */ + @PreAuthorize("@ss.hasPermi('dhc:line:edit')") + @Log(title = "生产基地与产品线关系", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DhcProductionBaseLine dhcProductionBaseLine) + { + return toAjax(dhcProductionBaseLineService.updateDhcProductionBaseLine(dhcProductionBaseLine)); + } + + /** + * 删除生产基地与产品线关系 + */ + @PreAuthorize("@ss.hasPermi('dhc:line:remove')") + @Log(title = "生产基地与产品线关系", businessType = BusinessType.DELETE) + @DeleteMapping("/{productLineCodes}") + public AjaxResult remove(@PathVariable String[] productLineCodes) + { + return toAjax(dhcProductionBaseLineService.deleteDhcProductionBaseLineByProductLineCodes(productLineCodes)); + } +} diff --git a/ruoyi-plan/src/main/java/com/ruoyi/dhc/domain/DhcProductionBaseLine.java b/ruoyi-plan/src/main/java/com/ruoyi/dhc/domain/DhcProductionBaseLine.java new file mode 100644 index 0000000..80f4392 --- /dev/null +++ b/ruoyi-plan/src/main/java/com/ruoyi/dhc/domain/DhcProductionBaseLine.java @@ -0,0 +1,50 @@ +package com.ruoyi.dhc.domain; + +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; + +/** + * 生产基地与产品线关系对象 dhc_production_base_line + * + * @author ruoyi + * @date 2024-09-26 + */ +public class DhcProductionBaseLine extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 产品线编码 */ + private String productLineCode; + + /** 生成基地编码 */ + private String productionBaseCode; + + public void setProductLineCode(String productLineCode) + { + this.productLineCode = productLineCode; + } + + public String getProductLineCode() + { + return productLineCode; + } + public void setProductionBaseCode(String productionBaseCode) + { + this.productionBaseCode = productionBaseCode; + } + + public String getProductionBaseCode() + { + return productionBaseCode; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("productLineCode", getProductLineCode()) + .append("productionBaseCode", getProductionBaseCode()) + .toString(); + } +} diff --git a/ruoyi-plan/src/main/java/com/ruoyi/dhc/mapper/DhcProductionBaseLineMapper.java b/ruoyi-plan/src/main/java/com/ruoyi/dhc/mapper/DhcProductionBaseLineMapper.java new file mode 100644 index 0000000..aa83b51 --- /dev/null +++ b/ruoyi-plan/src/main/java/com/ruoyi/dhc/mapper/DhcProductionBaseLineMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.dhc.mapper; + +import java.util.List; +import com.ruoyi.dhc.domain.DhcProductionBaseLine; + +/** + * 生产基地与产品线关系Mapper接口 + * + * @author ruoyi + * @date 2024-09-26 + */ +public interface DhcProductionBaseLineMapper +{ + /** + * 查询生产基地与产品线关系 + * + * @param productLineCode 生产基地与产品线关系主键 + * @return 生产基地与产品线关系 + */ + public DhcProductionBaseLine selectDhcProductionBaseLineByProductLineCode(String productLineCode); + + /** + * 查询生产基地与产品线关系列表 + * + * @param dhcProductionBaseLine 生产基地与产品线关系 + * @return 生产基地与产品线关系集合 + */ + public List selectDhcProductionBaseLineList(DhcProductionBaseLine dhcProductionBaseLine); + + /** + * 新增生产基地与产品线关系 + * + * @param dhcProductionBaseLine 生产基地与产品线关系 + * @return 结果 + */ + public int insertDhcProductionBaseLine(DhcProductionBaseLine dhcProductionBaseLine); + + /** + * 修改生产基地与产品线关系 + * + * @param dhcProductionBaseLine 生产基地与产品线关系 + * @return 结果 + */ + public int updateDhcProductionBaseLine(DhcProductionBaseLine dhcProductionBaseLine); + + /** + * 删除生产基地与产品线关系 + * + * @param productLineCode 生产基地与产品线关系主键 + * @return 结果 + */ + public int deleteDhcProductionBaseLineByProductLineCode(String productLineCode); + + /** + * 批量删除生产基地与产品线关系 + * + * @param productLineCodes 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDhcProductionBaseLineByProductLineCodes(String[] productLineCodes); +} diff --git a/ruoyi-plan/src/main/java/com/ruoyi/dhc/service/IDhcProductionBaseLineService.java b/ruoyi-plan/src/main/java/com/ruoyi/dhc/service/IDhcProductionBaseLineService.java new file mode 100644 index 0000000..ad758ea --- /dev/null +++ b/ruoyi-plan/src/main/java/com/ruoyi/dhc/service/IDhcProductionBaseLineService.java @@ -0,0 +1,61 @@ +package com.ruoyi.dhc.service; + +import java.util.List; +import com.ruoyi.dhc.domain.DhcProductionBaseLine; + +/** + * 生产基地与产品线关系Service接口 + * + * @author ruoyi + * @date 2024-09-26 + */ +public interface IDhcProductionBaseLineService +{ + /** + * 查询生产基地与产品线关系 + * + * @param productLineCode 生产基地与产品线关系主键 + * @return 生产基地与产品线关系 + */ + public DhcProductionBaseLine selectDhcProductionBaseLineByProductLineCode(String productLineCode); + + /** + * 查询生产基地与产品线关系列表 + * + * @param dhcProductionBaseLine 生产基地与产品线关系 + * @return 生产基地与产品线关系集合 + */ + public List selectDhcProductionBaseLineList(DhcProductionBaseLine dhcProductionBaseLine); + + /** + * 新增生产基地与产品线关系 + * + * @param dhcProductionBaseLine 生产基地与产品线关系 + * @return 结果 + */ + public int insertDhcProductionBaseLine(DhcProductionBaseLine dhcProductionBaseLine); + + /** + * 修改生产基地与产品线关系 + * + * @param dhcProductionBaseLine 生产基地与产品线关系 + * @return 结果 + */ + public int updateDhcProductionBaseLine(DhcProductionBaseLine dhcProductionBaseLine); + + /** + * 批量删除生产基地与产品线关系 + * + * @param productLineCodes 需要删除的生产基地与产品线关系主键集合 + * @return 结果 + */ + public int deleteDhcProductionBaseLineByProductLineCodes(String[] productLineCodes); + + /** + * 删除生产基地与产品线关系信息 + * + * @param productLineCode 生产基地与产品线关系主键 + * @return 结果 + */ + public int deleteDhcProductionBaseLineByProductLineCode(String productLineCode); +} diff --git a/ruoyi-plan/src/main/java/com/ruoyi/dhc/service/impl/DhcProductionBaseLineServiceImpl.java b/ruoyi-plan/src/main/java/com/ruoyi/dhc/service/impl/DhcProductionBaseLineServiceImpl.java new file mode 100644 index 0000000..5867185 --- /dev/null +++ b/ruoyi-plan/src/main/java/com/ruoyi/dhc/service/impl/DhcProductionBaseLineServiceImpl.java @@ -0,0 +1,93 @@ +package com.ruoyi.dhc.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.dhc.mapper.DhcProductionBaseLineMapper; +import com.ruoyi.dhc.domain.DhcProductionBaseLine; +import com.ruoyi.dhc.service.IDhcProductionBaseLineService; + +/** + * 生产基地与产品线关系Service业务层处理 + * + * @author ruoyi + * @date 2024-09-26 + */ +@Service +public class DhcProductionBaseLineServiceImpl implements IDhcProductionBaseLineService +{ + @Autowired + private DhcProductionBaseLineMapper dhcProductionBaseLineMapper; + + /** + * 查询生产基地与产品线关系 + * + * @param productLineCode 生产基地与产品线关系主键 + * @return 生产基地与产品线关系 + */ + @Override + public DhcProductionBaseLine selectDhcProductionBaseLineByProductLineCode(String productLineCode) + { + return dhcProductionBaseLineMapper.selectDhcProductionBaseLineByProductLineCode(productLineCode); + } + + /** + * 查询生产基地与产品线关系列表 + * + * @param dhcProductionBaseLine 生产基地与产品线关系 + * @return 生产基地与产品线关系 + */ + @Override + public List selectDhcProductionBaseLineList(DhcProductionBaseLine dhcProductionBaseLine) + { + return dhcProductionBaseLineMapper.selectDhcProductionBaseLineList(dhcProductionBaseLine); + } + + /** + * 新增生产基地与产品线关系 + * + * @param dhcProductionBaseLine 生产基地与产品线关系 + * @return 结果 + */ + @Override + public int insertDhcProductionBaseLine(DhcProductionBaseLine dhcProductionBaseLine) + { + return dhcProductionBaseLineMapper.insertDhcProductionBaseLine(dhcProductionBaseLine); + } + + /** + * 修改生产基地与产品线关系 + * + * @param dhcProductionBaseLine 生产基地与产品线关系 + * @return 结果 + */ + @Override + public int updateDhcProductionBaseLine(DhcProductionBaseLine dhcProductionBaseLine) + { + return dhcProductionBaseLineMapper.updateDhcProductionBaseLine(dhcProductionBaseLine); + } + + /** + * 批量删除生产基地与产品线关系 + * + * @param productLineCodes 需要删除的生产基地与产品线关系主键 + * @return 结果 + */ + @Override + public int deleteDhcProductionBaseLineByProductLineCodes(String[] productLineCodes) + { + return dhcProductionBaseLineMapper.deleteDhcProductionBaseLineByProductLineCodes(productLineCodes); + } + + /** + * 删除生产基地与产品线关系信息 + * + * @param productLineCode 生产基地与产品线关系主键 + * @return 结果 + */ + @Override + public int deleteDhcProductionBaseLineByProductLineCode(String productLineCode) + { + return dhcProductionBaseLineMapper.deleteDhcProductionBaseLineByProductLineCode(productLineCode); + } +} diff --git a/ruoyi-plan/src/main/resources/mapper/dhc/DhcProductionBaseLineMapper.xml b/ruoyi-plan/src/main/resources/mapper/dhc/DhcProductionBaseLineMapper.xml new file mode 100644 index 0000000..b65b32c --- /dev/null +++ b/ruoyi-plan/src/main/resources/mapper/dhc/DhcProductionBaseLineMapper.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + select product_line_code, production_base_code from dhc_production_base_line + + + + + + + + insert into dhc_production_base_line + + product_line_code, + production_base_code, + + + #{productLineCode}, + #{productionBaseCode}, + + + + + update dhc_production_base_line + + production_base_code = #{productionBaseCode}, + + where product_line_code = #{productLineCode} + + + + delete from dhc_production_base_line where product_line_code = #{productLineCode} + + + + delete from dhc_production_base_line where product_line_code in + + #{productLineCode} + + + \ No newline at end of file