Browse Source

添加生产基地controller和初始化方法

master
Claude Lee 2 months ago
parent
commit
143d78b782
  1. 104
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/dhc/DhcProductionBaseLineController.java
  2. 50
      ruoyi-plan/src/main/java/com/ruoyi/dhc/domain/DhcProductionBaseLine.java
  3. 61
      ruoyi-plan/src/main/java/com/ruoyi/dhc/mapper/DhcProductionBaseLineMapper.java
  4. 61
      ruoyi-plan/src/main/java/com/ruoyi/dhc/service/IDhcProductionBaseLineService.java
  5. 93
      ruoyi-plan/src/main/java/com/ruoyi/dhc/service/impl/DhcProductionBaseLineServiceImpl.java
  6. 57
      ruoyi-plan/src/main/resources/mapper/dhc/DhcProductionBaseLineMapper.xml

104
ruoyi-admin/src/main/java/com/ruoyi/web/controller/dhc/DhcProductionBaseLineController.java

@ -0,0 +1,104 @@ @@ -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<DhcProductionBaseLine> 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<DhcProductionBaseLine> list = dhcProductionBaseLineService.selectDhcProductionBaseLineList(dhcProductionBaseLine);
ExcelUtil<DhcProductionBaseLine> util = new ExcelUtil<DhcProductionBaseLine>(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));
}
}

50
ruoyi-plan/src/main/java/com/ruoyi/dhc/domain/DhcProductionBaseLine.java

@ -0,0 +1,50 @@ @@ -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();
}
}

61
ruoyi-plan/src/main/java/com/ruoyi/dhc/mapper/DhcProductionBaseLineMapper.java

@ -0,0 +1,61 @@ @@ -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<DhcProductionBaseLine> 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);
}

61
ruoyi-plan/src/main/java/com/ruoyi/dhc/service/IDhcProductionBaseLineService.java

@ -0,0 +1,61 @@ @@ -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<DhcProductionBaseLine> 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);
}

93
ruoyi-plan/src/main/java/com/ruoyi/dhc/service/impl/DhcProductionBaseLineServiceImpl.java

@ -0,0 +1,93 @@ @@ -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<DhcProductionBaseLine> 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);
}
}

57
ruoyi-plan/src/main/resources/mapper/dhc/DhcProductionBaseLineMapper.xml

@ -0,0 +1,57 @@ @@ -0,0 +1,57 @@
<?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.ruoyi.dhc.mapper.DhcProductionBaseLineMapper">
<resultMap type="DhcProductionBaseLine" id="DhcProductionBaseLineResult">
<result property="productLineCode" column="product_line_code" />
<result property="productionBaseCode" column="production_base_code" />
</resultMap>
<sql id="selectDhcProductionBaseLineVo">
select product_line_code, production_base_code from dhc_production_base_line
</sql>
<select id="selectDhcProductionBaseLineList" parameterType="DhcProductionBaseLine" resultMap="DhcProductionBaseLineResult">
<include refid="selectDhcProductionBaseLineVo"/>
<where>
</where>
</select>
<select id="selectDhcProductionBaseLineByProductLineCode" parameterType="String" resultMap="DhcProductionBaseLineResult">
<include refid="selectDhcProductionBaseLineVo"/>
where product_line_code = #{productLineCode}
</select>
<insert id="insertDhcProductionBaseLine" parameterType="DhcProductionBaseLine">
insert into dhc_production_base_line
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="productLineCode != null">product_line_code,</if>
<if test="productionBaseCode != null">production_base_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="productLineCode != null">#{productLineCode},</if>
<if test="productionBaseCode != null">#{productionBaseCode},</if>
</trim>
</insert>
<update id="updateDhcProductionBaseLine" parameterType="DhcProductionBaseLine">
update dhc_production_base_line
<trim prefix="SET" suffixOverrides=",">
<if test="productionBaseCode != null">production_base_code = #{productionBaseCode},</if>
</trim>
where product_line_code = #{productLineCode}
</update>
<delete id="deleteDhcProductionBaseLineByProductLineCode" parameterType="String">
delete from dhc_production_base_line where product_line_code = #{productLineCode}
</delete>
<delete id="deleteDhcProductionBaseLineByProductLineCodes" parameterType="String">
delete from dhc_production_base_line where product_line_code in
<foreach item="productLineCode" collection="array" open="(" separator="," close=")">
#{productLineCode}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save