项目初始化
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
package com.ruoyi.bas.portrel.controller;
|
||||
|
||||
import com.ruoyi.bas.BasProduct.domain.BasProduct;
|
||||
import com.ruoyi.bas.portrel.domain.BasProductPortRel;
|
||||
import com.ruoyi.bas.portrel.service.IBasProductPortRelService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 点位与物料关联Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-29
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/bas/portProductRel")
|
||||
public class BasProductPortRelController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBasProductPortRelService basProductPortRelService;
|
||||
|
||||
/**
|
||||
* 查询点位与物料关联列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bas:portProductRel:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BasProductPortRel basProductPortRel)
|
||||
{
|
||||
startPage();
|
||||
List<BasProduct> list = basProductPortRelService.selectBasProductPortRelList(basProductPortRel);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出点位与物料关联列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bas:portProductRel:export')")
|
||||
@Log(title = "点位与物料关联", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BasProductPortRel basProductPortRel)
|
||||
{
|
||||
List<BasProduct> list = basProductPortRelService.selectBasProductPortRelList(basProductPortRel);
|
||||
ExcelUtil<BasProduct> util = new ExcelUtil<BasProduct>(BasProduct.class);
|
||||
util.exportExcel(response, list, "点位与物料关联数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取点位与物料关联详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bas:portProductRel:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(basProductPortRelService.selectBasProductPortRelById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增点位与物料关联
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bas:portProductRel:add')")
|
||||
@Log(title = "点位与物料关联", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BasProductPortRel basProductPortRel)
|
||||
{
|
||||
return toAjax(basProductPortRelService.insertBasProductPortRel(basProductPortRel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改点位与物料关联
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bas:portProductRel:edit')")
|
||||
@Log(title = "点位与物料关联", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BasProductPortRel basProductPortRel)
|
||||
{
|
||||
return toAjax(basProductPortRelService.updateBasProductPortRel(basProductPortRel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除点位与物料关联
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bas:portProductRel:remove')")
|
||||
@Log(title = "点位与物料关联", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/unbind")
|
||||
public AjaxResult remove(@RequestBody BasProductPortRel basProductPortRel)
|
||||
{
|
||||
return toAjax(basProductPortRelService.deleteRelBatch(basProductPortRel));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.ruoyi.bas.portrel.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 点位与物料关联对象 bas_product_port_rel
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-29
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class BasProductPortRel extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
private Long id;
|
||||
|
||||
/** 物料GUID */
|
||||
@Excel(name = "物料GUID")
|
||||
private String productGuid;
|
||||
|
||||
/** 物料id */
|
||||
@Excel(name = "物料id")
|
||||
private String productId;
|
||||
|
||||
/** 点位id */
|
||||
@Excel(name = "点位id")
|
||||
private String portId;
|
||||
|
||||
/**
|
||||
* 绑定状态
|
||||
*/
|
||||
private String bindStatus;
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
private String productName;
|
||||
|
||||
private List<String> productIds;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.ruoyi.bas.portrel.mapper;
|
||||
|
||||
import com.ruoyi.bas.BasProduct.domain.BasProduct;
|
||||
import com.ruoyi.bas.portrel.domain.BasProductPortRel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 点位与物料关联Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-29
|
||||
*/
|
||||
public interface BasProductPortRelMapper
|
||||
{
|
||||
/**
|
||||
* 查询点位与物料关联
|
||||
*
|
||||
* @param id 点位与物料关联主键
|
||||
* @return 点位与物料关联
|
||||
*/
|
||||
public BasProductPortRel selectBasProductPortRelById(Long id);
|
||||
|
||||
/**
|
||||
* 查询点位与物料关联列表
|
||||
*
|
||||
* @param basProductPortRel 点位与物料关联
|
||||
* @return 点位与物料关联集合
|
||||
*/
|
||||
public List<BasProductPortRel> selectBasProductPortRelList(BasProductPortRel basProductPortRel);
|
||||
|
||||
/**
|
||||
* 新增点位与物料关联
|
||||
*
|
||||
* @param basProductPortRel 点位与物料关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBasProductPortRel(BasProductPortRel basProductPortRel);
|
||||
|
||||
/**
|
||||
* 修改点位与物料关联
|
||||
*
|
||||
* @param basProductPortRel 点位与物料关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBasProductPortRel(BasProductPortRel basProductPortRel);
|
||||
|
||||
/**
|
||||
* 删除点位与物料关联
|
||||
*
|
||||
* @param id 点位与物料关联主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasProductPortRelById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除点位与物料关联
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasProductPortRelByIds(Long[] ids);
|
||||
|
||||
List<BasProduct> selectNotBindProduct(BasProductPortRel basProductPortRel);
|
||||
|
||||
int deleteBasProductPortRel(BasProductPortRel rel);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.ruoyi.bas.portrel.service;
|
||||
|
||||
import com.ruoyi.bas.BasProduct.domain.BasProduct;
|
||||
import com.ruoyi.bas.portrel.domain.BasProductPortRel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 点位与物料关联Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-29
|
||||
*/
|
||||
public interface IBasProductPortRelService
|
||||
{
|
||||
/**
|
||||
* 查询点位与物料关联
|
||||
*
|
||||
* @param id 点位与物料关联主键
|
||||
* @return 点位与物料关联
|
||||
*/
|
||||
public BasProductPortRel selectBasProductPortRelById(Long id);
|
||||
|
||||
/**
|
||||
* 查询点位与物料关联列表
|
||||
*
|
||||
* @param basProductPortRel 点位与物料关联
|
||||
* @return 点位与物料关联集合
|
||||
*/
|
||||
public List<BasProduct> selectBasProductPortRelList(BasProductPortRel basProductPortRel);
|
||||
|
||||
/**
|
||||
* 新增点位与物料关联
|
||||
*
|
||||
* @param basProductPortRel 点位与物料关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBasProductPortRel(BasProductPortRel basProductPortRel);
|
||||
|
||||
/**
|
||||
* 修改点位与物料关联
|
||||
*
|
||||
* @param basProductPortRel 点位与物料关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBasProductPortRel(BasProductPortRel basProductPortRel);
|
||||
|
||||
/**
|
||||
* 批量删除点位与物料关联
|
||||
*
|
||||
* @param ids 需要删除的点位与物料关联主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasProductPortRelByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除点位与物料关联信息
|
||||
*
|
||||
* @param id 点位与物料关联主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasProductPortRelById(Long id);
|
||||
|
||||
int deleteRelBatch(BasProductPortRel basProductPortRel);
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.ruoyi.bas.portrel.service.impl;
|
||||
|
||||
import com.ruoyi.bas.BasProduct.domain.BasProduct;
|
||||
import com.ruoyi.bas.portrel.domain.BasProductPortRel;
|
||||
import com.ruoyi.bas.portrel.mapper.BasProductPortRelMapper;
|
||||
import com.ruoyi.bas.portrel.service.IBasProductPortRelService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 点位与物料关联Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-29
|
||||
*/
|
||||
@Service
|
||||
public class BasProductPortRelServiceImpl implements IBasProductPortRelService
|
||||
{
|
||||
@Autowired
|
||||
private BasProductPortRelMapper basProductPortRelMapper;
|
||||
|
||||
/**
|
||||
* 查询点位与物料关联
|
||||
*
|
||||
* @param id 点位与物料关联主键
|
||||
* @return 点位与物料关联
|
||||
*/
|
||||
@Override
|
||||
public BasProductPortRel selectBasProductPortRelById(Long id)
|
||||
{
|
||||
return basProductPortRelMapper.selectBasProductPortRelById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询点位与物料关联列表
|
||||
*
|
||||
* @param basProductPortRel 点位与物料关联
|
||||
* @return 点位与物料关联
|
||||
*/
|
||||
@Override
|
||||
public List<BasProduct> selectBasProductPortRelList(BasProductPortRel basProductPortRel)
|
||||
{
|
||||
return basProductPortRelMapper.selectNotBindProduct(basProductPortRel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增点位与物料关联
|
||||
*
|
||||
* @param basProductPortRel 点位与物料关联
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBasProductPortRel(BasProductPortRel basProductPortRel)
|
||||
{
|
||||
int i = 0;
|
||||
for (String productId : basProductPortRel.getProductIds()) {
|
||||
BasProductPortRel basProductPortRel1 = new BasProductPortRel();
|
||||
basProductPortRel1.setProductId(productId);
|
||||
basProductPortRel1.setPortId(basProductPortRel.getPortId());
|
||||
i +=basProductPortRelMapper.insertBasProductPortRel(basProductPortRel1);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改点位与物料关联
|
||||
*
|
||||
* @param basProductPortRel 点位与物料关联
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBasProductPortRel(BasProductPortRel basProductPortRel)
|
||||
{
|
||||
return basProductPortRelMapper.updateBasProductPortRel(basProductPortRel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除点位与物料关联
|
||||
*
|
||||
* @param ids 需要删除的点位与物料关联主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBasProductPortRelByIds(Long[] ids)
|
||||
{
|
||||
return basProductPortRelMapper.deleteBasProductPortRelByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除点位与物料关联信息
|
||||
*
|
||||
* @param id 点位与物料关联主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBasProductPortRelById(Long id)
|
||||
{
|
||||
return basProductPortRelMapper.deleteBasProductPortRelById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int deleteRelBatch(BasProductPortRel basProductPortRel) {
|
||||
return basProductPortRelMapper.deleteBasProductPortRel(basProductPortRel);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user