master
rdpnr_hemingxia 2025-04-11 16:07:46 +08:00
commit 78882a5ca3
22 changed files with 750 additions and 100 deletions

View File

@ -8,7 +8,7 @@ spring:
master: master:
url: jdbc:mysql://121.199.168.157:3306/unis_pms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://121.199.168.157:3306/unis_pms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: root
password: unis@db password: unis@db
# 从库数据源 # 从库数据源
slave: slave:
# 从数据源开关/默认关闭 # 从数据源开关/默认关闭

View File

@ -14,7 +14,7 @@ PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
<!-- 指定 MyBatis 所用日志的具体实现 --> <!-- 指定 MyBatis 所用日志的具体实现 -->
<setting name="logImpl" value="SLF4J" /> <setting name="logImpl" value="SLF4J" />
<!-- 使用驼峰命名法转换字段 --> <!-- 使用驼峰命名法转换字段 -->
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> --> <setting name="mapUnderscoreToCamelCase" value="true"/>
</settings> </settings>
</configuration> </configuration>

View File

@ -170,11 +170,11 @@
} }
}, },
{ {
field: 'productId', field: 'productCode',
align: 'center', align: 'center',
title: '产品编码', title: 'BOM编码',
formatter: function(value, row, index) { formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='orderListList[%s].productId' value='%s'>", index, value); var html = $.common.sprintf("<input class='form-control' type='text' name='orderListList[%s].productCode' value='%s'>", index, value);
return html; return html;
} }
}, },
@ -214,33 +214,6 @@
return html; return html;
} }
}, },
{
field: 'createdAt',
align: 'center',
title: '创建时间',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='orderListList[%s].createdAt' value='%s'>", index, value);
return html;
}
},
{
field: 'updatedAt',
align: 'center',
title: '更新时间',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='orderListList[%s].updatedAt' value='%s'>", index, value);
return html;
}
},
{
field: 'deletedAt',
align: 'center',
title: '删除时间',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='orderListList[%s].deletedAt' value='%s'>", index, value);
return html;
}
},
{ {
title: '操作', title: '操作',
align: 'center', align: 'center',

View File

@ -172,11 +172,11 @@
} }
}, },
{ {
field: 'productId', field: 'productCode',
align: 'center', align: 'center',
title: '产品编码', title: 'BOM编码',
formatter: function(value, row, index) { formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='orderListList[%s].productId' value='%s'>", index, value); var html = $.common.sprintf("<input class='form-control' type='text' name='orderListList[%s].productCode' value='%s'>", index, value);
return html; return html;
} }
}, },
@ -221,36 +221,6 @@
} }
}, },
{
field: 'createdAt',
align: 'center',
title: '创建时间',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='orderListList[%s].createdAt' value='%s'>", index, value);
return html;
}
},
{
field: 'updatedAt',
align: 'center',
title: '更新时间',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='orderListList[%s].updatedAt' value='%s'>", index, value);
return html;
}
},
{
field: 'deletedAt',
align: 'center',
title: '删除时间',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='orderListList[%s].deletedAt' value='%s'>", index, value);
return html;
}
},
{ {
title: '操作', title: '操作',
align: 'center', align: 'center',

View File

@ -82,7 +82,7 @@
}, },
{ {
field: 'orderCode', field: 'orderCode',
title: '合同编号,唯一' title: '合同编号'
}, },
{ {
field: 'versionCode', field: 'versionCode',

View File

@ -9,7 +9,7 @@
<form class="form-horizontal m" id="form-product-add"> <form class="form-horizontal m" id="form-product-add">
<div class="col-xs-12"> <div class="col-xs-12">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">产品编码:</label> <label class="col-sm-3 control-label is-required">BOM编码:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="productCode" class="form-control" type="text" required> <input name="productCode" class="form-control" type="text" required>
</div> </div>
@ -25,7 +25,7 @@
</div> </div>
<div class="col-xs-12"> <div class="col-xs-12">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">产品代码</label> <label class="col-sm-3 control-label is-required">产品型号</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="model" class="form-control" type="text" required> <input name="model" class="form-control" type="text" required>
</div> </div>

View File

@ -9,7 +9,7 @@
<input name="id" th:field="*{id}" type="hidden"> <input name="id" th:field="*{id}" type="hidden">
<div class="col-xs-12"> <div class="col-xs-12">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">产品编码:</label> <label class="col-sm-3 control-label is-required">BOM编码:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="productCode" th:field="*{productCode}" class="form-control" type="text" required> <input name="productCode" th:field="*{productCode}" class="form-control" type="text" required>
</div> </div>
@ -25,7 +25,7 @@
</div> </div>
<div class="col-xs-12"> <div class="col-xs-12">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">产品代码</label> <label class="col-sm-3 control-label is-required">产品型号</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="model" th:field="*{model}" class="form-control" type="text" required> <input name="model" th:field="*{model}" class="form-control" type="text" required>
</div> </div>

View File

@ -11,7 +11,7 @@
<div class="select-list"> <div class="select-list">
<ul> <ul>
<li> <li>
<label>产品编码:</label> <label>BOM编码:</label>
<input type="text" name="productCode"/> <input type="text" name="productCode"/>
</li> </li>
<li> <li>
@ -19,7 +19,7 @@
<input type="text" name="productName"/> <input type="text" name="productName"/>
</li> </li>
<li> <li>
<label>产品代码</label> <label>产品型号</label>
<input type="text" name="model"/> <input type="text" name="model"/>
</li> </li>
<li> <li>
@ -74,7 +74,7 @@
}, },
{ {
field: 'productCode', field: 'productCode',
title: '产品编码' title: 'BOM编码'
}, },
{ {
field: 'productName', field: 'productName',
@ -82,7 +82,7 @@
}, },
{ {
field: 'model', field: 'model',
title: '产品代码' title: '产品型号'
}, },
{ {
field: 'description', field: 'description',

View File

@ -0,0 +1,136 @@
package com.ruoyi.sip.controller;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.sip.domain.DeliveryList;
import com.ruoyi.sip.service.IDeliveryListService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* Controller
*
* @author ruoyi
* @date 2025-04-11
*/
@Controller
@RequestMapping("/sip/list")
public class DeliveryListController extends BaseController {
private String prefix = "sip/list";
@Autowired
private IDeliveryListService deliveryListService;
@RequiresPermissions("sip:list:view")
@GetMapping()
public String list() {
return prefix + "/list";
}
/**
*
*/
@RequiresPermissions("sip:list:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(DeliveryList deliveryList) {
startPage();
List<DeliveryList> list = deliveryListService.selectDeliveryListList(deliveryList);
return getDataTable(list);
}
/**
*
*/
@PostMapping("/importData")
@ResponseBody
public AjaxResult importData(MultipartFile file, Long deliveryId) throws Exception
{
ExcelUtil<DeliveryList> util = new ExcelUtil<DeliveryList>(DeliveryList.class);
List<DeliveryList> deliveryList = util.importExcel(file.getInputStream());
deliveryListService.importData(deliveryList, deliveryId);
return AjaxResult.success("导入成功");
}
/**
*
*/
@RequiresPermissions("sip:list:export")
@Log(title = "发货清单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(DeliveryList deliveryList) {
List<DeliveryList> list = deliveryListService.selectDeliveryListList(deliveryList);
ExcelUtil<DeliveryList> util = new ExcelUtil<DeliveryList>(DeliveryList.class);
return util.exportExcel(list, "发货清单数据");
}
/**
*
*/
@RequiresPermissions("sip:list:add")
@GetMapping("/add")
public String add() {
return prefix + "/add";
}
/**
*
*/
@RequiresPermissions("sip:list:add")
@Log(title = "发货清单", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(DeliveryList deliveryList) {
return toAjax(deliveryListService.insertDeliveryList(deliveryList));
}
/**
*
*/
@RequiresPermissions("sip:list:edit")
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap) {
DeliveryList deliveryList = deliveryListService.selectDeliveryListById(id);
mmap.put("deliveryList", deliveryList);
return prefix + "/edit";
}
/**
*
*/
@RequiresPermissions("sip:list:edit")
@Log(title = "发货清单", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(DeliveryList deliveryList) {
return toAjax(deliveryListService.updateDeliveryList(deliveryList));
}
/**
*
*/
@RequiresPermissions("sip:list:remove")
@Log(title = "发货清单", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids) {
return toAjax(deliveryListService.deleteDeliveryListByIds(ids));
}
}

View File

@ -0,0 +1,158 @@
package com.ruoyi.sip.domain;
import java.util.Date;
import java.util.StringJoiner;
import com.fasterxml.jackson.annotation.JsonFormat;
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;
/**
* delivery_list
*
* @author ruoyi
* @date 2025-04-11
*/
public class DeliveryList extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键,自增 */
private Long id;
/** 关联发货单id */
// @Excel(name = "关联发货单id")
private Long deliveryId;
// @Excel(name = "合同编号")
private String orderCode;
/** 产品编码id */
@Excel(name = "产品编码")
private String productCode;
/** 产品序列号 */
@Excel(name = "产品序列号")
private String serialNumber;
@Excel(name = "备注")
private String remark;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
// @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createdAt;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
// @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedAt;
/** 删除时间 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
// @Excel(name = "删除时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date deletedAt;
public String getOrderCode() {
return orderCode;
}
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setDeliveryId(Long deliveryId)
{
this.deliveryId = deliveryId;
}
public Long getDeliveryId()
{
return deliveryId;
}
@Override
public String getRemark() {
return remark;
}
@Override
public void setRemark(String remark) {
this.remark = remark;
}
public void setSerialNumber(String serialNumber)
{
this.serialNumber = serialNumber;
}
public String getSerialNumber()
{
return serialNumber;
}
public void setCreatedAt(Date createdAt)
{
this.createdAt = createdAt;
}
public Date getCreatedAt()
{
return createdAt;
}
public void setUpdatedAt(Date updatedAt)
{
this.updatedAt = updatedAt;
}
public Date getUpdatedAt()
{
return updatedAt;
}
public void setDeletedAt(Date deletedAt)
{
this.deletedAt = deletedAt;
}
public Date getDeletedAt()
{
return deletedAt;
}
@Override
public String toString() {
return new StringJoiner(", ", DeliveryList.class.getSimpleName() + "[", "]")
.add("id=" + id)
.add("deliveryId=" + deliveryId)
.add("orderCode='" + orderCode + "'")
.add("productCode='" + productCode + "'")
.add("serialNumber='" + serialNumber + "'")
.add("remark='" + remark + "'")
.add("createdAt=" + createdAt)
.add("updatedAt=" + updatedAt)
.add("deletedAt=" + deletedAt)
.toString();
}
}

View File

@ -24,6 +24,9 @@ public class OrderDelivery extends BaseEntity
@Excel(name = "关联合同id") @Excel(name = "关联合同id")
private Long orderId; private Long orderId;
private String orderCode;
private String orderName;
/** 发货单号 */ /** 发货单号 */
@Excel(name = "发货单号") @Excel(name = "发货单号")
private String deliveryCode; private String deliveryCode;
@ -68,7 +71,23 @@ public class OrderDelivery extends BaseEntity
/** 删除时间 */ /** 删除时间 */
private Date deletedAt; private Date deletedAt;
public void setId(Long id) public String getOrderCode() {
return orderCode;
}
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
public String getOrderName() {
return orderName;
}
public void setOrderName(String orderName) {
this.orderName = orderName;
}
public void setId(Long id)
{ {
this.id = id; this.id = id;
} }

View File

@ -25,7 +25,7 @@ public class OrderInfo extends BaseEntity
private String projectCode; private String projectCode;
/** 合同编号,唯一 */ /** 合同编号,唯一 */
@Excel(name = "合同编号,唯一") @Excel(name = "合同编号")
private String orderCode; private String orderCode;
/** 版本号 */ /** 版本号 */

View File

@ -27,7 +27,7 @@ public class OrderList extends BaseEntity
/** 产品编码,关联产品编码表 */ /** 产品编码,关联产品编码表 */
@Excel(name = "产品编码,关联产品编码表") @Excel(name = "产品编码,关联产品编码表")
private Long productId; private String productCode;
/** 数量 */ /** 数量 */
@Excel(name = "数量") @Excel(name = "数量")
@ -55,7 +55,7 @@ public class OrderList extends BaseEntity
/** 删除时间,软删除 */ /** 删除时间,软删除 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "删除时间,软删除", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "删除时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date deletedAt; private Date deletedAt;
public void setId(Long id) public void setId(Long id)
@ -76,14 +76,14 @@ public class OrderList extends BaseEntity
{ {
return orderId; return orderId;
} }
public void setProductId(Long productId) public void setProductCode(String productCode)
{ {
this.productId = productId; this.productCode = productCode;
} }
public Long getProductId() public String getProductCode()
{ {
return productId; return productCode;
} }
public void setQuantity(Long quantity) public void setQuantity(Long quantity)
{ {
@ -153,7 +153,7 @@ public class OrderList extends BaseEntity
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("orderId", getOrderId()) .append("orderId", getOrderId())
.append("productId", getProductId()) .append("productCode", getProductCode())
.append("quantity", getQuantity()) .append("quantity", getQuantity())
.append("price", getPrice()) .append("price", getPrice())
.append("amount", getAmount()) .append("amount", getAmount())

View File

@ -0,0 +1,62 @@
package com.ruoyi.sip.mapper;
import java.util.List;
import com.ruoyi.sip.domain.DeliveryList;
/**
* Mapper
*
* @author ruoyi
* @date 2025-04-11
*/
public interface DeliveryListMapper
{
/**
*
*
* @param id
* @return
*/
public DeliveryList selectDeliveryListById(Long id);
/**
*
*
* @param deliveryList
* @return
*/
public List<DeliveryList> selectDeliveryListList(DeliveryList deliveryList);
/**
*
*
* @param deliveryList
* @return
*/
public int insertDeliveryList(DeliveryList deliveryList);
public int insertBatch(List<DeliveryList> deliveryList);
/**
*
*
* @param deliveryList
* @return
*/
public int updateDeliveryList(DeliveryList deliveryList);
/**
*
*
* @param id
* @return
*/
public int deleteDeliveryListById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteDeliveryListByIds(String[] ids);
}

View File

@ -97,4 +97,6 @@ public interface OrderInfoMapper
* @param orderListList * @param orderListList
*/ */
void updateListBatch(List<OrderList> orderListList); void updateListBatch(List<OrderList> orderListList);
List<OrderList> listOrderListByDeliveryId(Long deliveryId);
} }

View File

@ -2,6 +2,7 @@ package com.ruoyi.sip.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.sip.domain.ProductInfo; import com.ruoyi.sip.domain.ProductInfo;
import org.apache.ibatis.annotations.Param;
/** /**
* Mapper * Mapper
@ -58,4 +59,8 @@ public interface ProductInfoMapper
* @return * @return
*/ */
public int deleteProductInfoByIds(String[] ids); public int deleteProductInfoByIds(String[] ids);
List<ProductInfo> listByProductCodeList(@Param("list") List<String> productCodeList);
} }

View File

@ -0,0 +1,63 @@
package com.ruoyi.sip.service;
import java.util.List;
import com.ruoyi.sip.domain.DeliveryList;
/**
* Service
*
* @author ruoyi
* @date 2025-04-11
*/
public interface IDeliveryListService
{
/**
*
*
* @param id
* @return
*/
public DeliveryList selectDeliveryListById(Long id);
/**
*
*
* @param deliveryList
* @return
*/
public List<DeliveryList> selectDeliveryListList(DeliveryList deliveryList);
/**
*
*
* @param deliveryList
* @return
*/
public int insertDeliveryList(DeliveryList deliveryList);
/**
*
*
* @param deliveryList
* @return
*/
public int updateDeliveryList(DeliveryList deliveryList);
/**
*
*
* @param ids
* @return
*/
public int deleteDeliveryListByIds(String ids);
/**
*
*
* @param id
* @return
*/
public int deleteDeliveryListById(Long id);
void importData(List<DeliveryList> deliveryList, Long deliveryId);
}

View File

@ -0,0 +1,130 @@
package com.ruoyi.sip.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.sip.domain.OrderList;
import com.ruoyi.sip.domain.ProductInfo;
import com.ruoyi.sip.mapper.OrderInfoMapper;
import com.ruoyi.sip.mapper.ProductInfoMapper;
import org.springframework.stereotype.Service;
import com.ruoyi.sip.mapper.DeliveryListMapper;
import com.ruoyi.sip.domain.DeliveryList;
import com.ruoyi.sip.service.IDeliveryListService;
import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* Service
*
* @author ruoyi
* @date 2025-04-11
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class DeliveryListServiceImpl implements IDeliveryListService {
@Resource
private DeliveryListMapper deliveryListMapper;
@Resource
private ProductInfoMapper productInfoMapper;
@Resource
private OrderInfoMapper infoMapper;
/**
*
*
* @param id
* @return
*/
@Override
public DeliveryList selectDeliveryListById(Long id) {
return deliveryListMapper.selectDeliveryListById(id);
}
/**
*
*
* @param deliveryList
* @return
*/
@Override
public List<DeliveryList> selectDeliveryListList(DeliveryList deliveryList) {
return deliveryListMapper.selectDeliveryListList(deliveryList);
}
/**
*
*
* @param deliveryList
* @return
*/
@Override
public int insertDeliveryList(DeliveryList deliveryList) {
return deliveryListMapper.insertDeliveryList(deliveryList);
}
/**
*
*
* @param deliveryList
* @return
*/
@Override
public int updateDeliveryList(DeliveryList deliveryList) {
return deliveryListMapper.updateDeliveryList(deliveryList);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteDeliveryListByIds(String ids) {
return deliveryListMapper.deleteDeliveryListByIds(Convert.toStrArray(ids));
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteDeliveryListById(Long id) {
return deliveryListMapper.deleteDeliveryListById(id);
}
@Override
public void importData(List<DeliveryList> deliveryList, Long deliveryId) {
List<String> productCodeList = deliveryList.stream().map(DeliveryList::getProductCode).collect(Collectors.toList());
if (productCodeList.isEmpty()) {
throw new ServiceException("产品编码为空");
}
List<OrderList> orderLists = infoMapper.listOrderListByDeliveryId(deliveryId);
if (orderLists.isEmpty()) {
throw new ServiceException("发货单中没有产品");
}
List<String> existsProductCodeList = orderLists.stream().map(OrderList::getProductCode).collect(Collectors.toList());
List<String> notExistsProductCodeList = productCodeList.stream().filter(productCode -> !existsProductCodeList.contains(productCode)).collect(Collectors.toList());
if (!notExistsProductCodeList.isEmpty()) {
throw new ServiceException(StringUtils.format("产品编码为[{}]的产品在发货单中未找到,请确认后重试;", String.join(",", notExistsProductCodeList)));
}
for (DeliveryList list : deliveryList) {
list.setDeliveryId(deliveryId);
}
deliveryListMapper.insertBatch(deliveryList);
}
}

View File

@ -0,0 +1,102 @@
<?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.sip.mapper.DeliveryListMapper">
<resultMap type="DeliveryList" id="DeliveryListResult">
<result property="id" column="id" />
<result property="deliveryId" column="delivery_id" />
<result property="productCode" column="product_code" />
<result property="serialNumber" column="serial_number" />
<result property="remark" column="remark" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
<result property="deletedAt" column="deleted_at" />
</resultMap>
<sql id="selectDeliveryListVo">
select id, delivery_id, product_code, serial_number, remark, created_at, updated_at, deleted_at from delivery_list
</sql>
<select id="selectDeliveryListList" parameterType="DeliveryList" resultMap="DeliveryListResult">
select t1.id, t1.delivery_id,t1.product_code, t1.serial_number, t1.remark, t1.created_at, t1.updated_at, t1.deleted_at,
t2.delivery_code,
t3.product_code, t3.product_name,
t4.order_code
from delivery_list t1
left join order_delivery t2 on t1.delivery_id = t2.id
left join order_info t4 on t2.order_id = t4.id
left join product_info t3 on t1.product_code = t3.product_code
<where>
<if test="deliveryId != null "> and t1.delivery_id = #{deliveryId}</if>
<if test="productCode != null "> and t1.product_code = #{productCode}</if>
<if test="serialNumber != null and serialNumber != ''"> and t1.serial_number = #{serialNumber}</if>
<if test="createdAt != null "> and t1.created_at = #{createdAt}</if>
<if test="updatedAt != null "> and t1.updated_at = #{updatedAt}</if>
<if test="deletedAt != null "> and t1.deleted_at = #{deletedAt}</if>
</where>
</select>
<select id="selectDeliveryListById" parameterType="Long" resultMap="DeliveryListResult">
<include refid="selectDeliveryListVo"/>
where id = #{id}
</select>
<insert id="insertDeliveryList" parameterType="DeliveryList" useGeneratedKeys="true" keyProperty="id">
insert into delivery_list
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deliveryId != null">delivery_id,</if>
<if test="productCode != null">product_code,</if>
<if test="serialNumber != null and serialNumber != ''">serial_number,</if>
<if test="remark != null">remark,</if>
<if test="createdAt != null">created_at,</if>
<if test="updatedAt != null">updated_at,</if>
<if test="deletedAt != null">deleted_at,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deliveryId != null">#{deliveryId},</if>
<if test="productCode != null">#{productCode},</if>
<if test="serialNumber != null and serialNumber != ''">#{serialNumber},</if>
<if test="remark != null">#{remark},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="updatedAt != null">#{updatedAt},</if>
<if test="deletedAt != null">#{deletedAt},</if>
</trim>
</insert>
<insert id="insertBatch">
insert into delivery_list (delivery_id, product_code, serial_number, remark, created_at, updated_at)
values
<foreach collection="list" item="item" index="index"
separator=",">
(#{item.deliveryId}, #{item.productCode}, #{item.serialNumber}, #{item.remark}, now(),now())
</foreach>
</insert>
<update id="updateDeliveryList" parameterType="DeliveryList">
update delivery_list
<trim prefix="SET" suffixOverrides=",">
<if test="deliveryId != null">delivery_id = #{deliveryId},</if>
<if test="productCode != null">product_code = #{productCode},</if>
<if test="serialNumber != null and serialNumber != ''">serial_number = #{serialNumber},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
<if test="deletedAt != null">deleted_at = #{deletedAt},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDeliveryListById" parameterType="Long">
delete from delivery_list where id = #{id}
</delete>
<delete id="deleteDeliveryListByIds" parameterType="String">
delete from delivery_list where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -28,14 +28,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql> </sql>
<select id="selectOrderDeliveryList" parameterType="OrderDelivery" resultMap="OrderDeliveryResult"> <select id="selectOrderDeliveryList" parameterType="OrderDelivery" resultMap="OrderDeliveryResult">
<include refid="selectOrderDeliveryVo"/> select t1.id, t1.order_id, t1.delivery_code, t1.delivery_date, t1.delivery_type, t1.logistics_company, t1.logistics_code, t1.receiver_name, t1.receiver_phone, t1.receiver_address, t1.delivery_status, t1.sign_time, t1.remark, t1.created_at, t1.updated_at, t1.deleted_at,
<where> t2.order_code,t2.order_name
<if test="orderId != null "> and order_id = #{orderId}</if>
<if test="deliveryCode != null and deliveryCode != ''"> and delivery_code like concat('%', #{deliveryCode}, '%')</if> from order_delivery t1
<if test="deliveryDate != null "> and delivery_date = #{deliveryDate}</if> left join order_info t2 on t1.order_id = t2.id
<if test="deliveryType != null and deliveryType != ''"> and delivery_type = #{deliveryType}</if> <where>
<if test="logisticsCompany != null and logisticsCompany != ''"> and logistics_company = #{logisticsCompany}</if> t1.status=0
<if test="deliveryStatus != null and deliveryStatus != ''"> and delivery_status = #{deliveryStatus}</if> <if test="orderId != null "> and t1.order_id = #{orderId}</if>
<if test="deliveryCode != null and deliveryCode != ''"> and t1.delivery_code like concat('%', #{deliveryCode}, '%')</if>
<if test="deliveryDate != null "> and t1.delivery_date = #{deliveryDate}</if>
<if test="deliveryType != null and deliveryType != ''"> and t1.delivery_type = #{deliveryType}</if>
<if test="logisticsCompany != null and logisticsCompany != ''"> and t1.logistics_company = #{logisticsCompany}</if>
<if test="deliveryStatus != null and deliveryStatus != ''"> and t1.delivery_status = #{deliveryStatus}</if>
</where> </where>
</select> </select>
@ -101,15 +106,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updatedAt != null">updated_at = #{updatedAt},</if> <if test="updatedAt != null">updated_at = #{updatedAt},</if>
<if test="deletedAt != null">deleted_at = #{deletedAt},</if> <if test="deletedAt != null">deleted_at = #{deletedAt},</if>
</trim> </trim>
where id = #{id} where id = #{id} and status=0
</update> </update>
<delete id="deleteOrderDeliveryById" parameterType="Long"> <delete id="deleteOrderDeliveryById" parameterType="Long">
delete from order_delivery where id = #{id} update order_delivery set status =1, deleted_at=now() where id = #{id}
</delete> </delete>
<delete id="deleteOrderDeliveryByIds" parameterType="String"> <delete id="deleteOrderDeliveryByIds" parameterType="String">
delete from order_delivery where id in update order_delivery set status =1, deleted_at=now() where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>

View File

@ -32,7 +32,7 @@
<resultMap type="OrderList" id="OrderListResult"> <resultMap type="OrderList" id="OrderListResult">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="orderId" column="order_id"/> <result property="orderId" column="order_id"/>
<result property="productId" column="product_id"/> <result property="productCode" column="product_code"/>
<result property="quantity" column="quantity"/> <result property="quantity" column="quantity"/>
<result property="price" column="price"/> <result property="price" column="price"/>
<result property="amount" column="amount"/> <result property="amount" column="amount"/>
@ -103,7 +103,7 @@
<select id="selectOrderListList" resultMap="OrderListResult"> <select id="selectOrderListList" resultMap="OrderListResult">
select id, select id,
order_id, order_id,
product_id, product_code,
quantity, quantity,
price, price,
amount, amount,
@ -113,6 +113,22 @@
deleted_at deleted_at
from order_list from order_list
where order_id = #{order_id} where order_id = #{order_id}
and status=0
</select>
<select id="listOrderListByDeliveryId" resultMap="OrderListResult">
select id,
order_id,
product_code,
quantity,
price,
amount,
remark,
created_at,
updated_at,
deleted_at
from order_list
where order_id = (select order_id from delivery_list where id = #{deliveryId})
and status=0
</select> </select>
<insert id="insertOrderInfo" parameterType="OrderInfo" useGeneratedKeys="true" keyProperty="id"> <insert id="insertOrderInfo" parameterType="OrderInfo" useGeneratedKeys="true" keyProperty="id">
@ -185,7 +201,7 @@
<foreach item="item" index="index" collection="list" separator=";"> <foreach item="item" index="index" collection="list" separator=";">
update order_list update order_list
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="productId != null">product_id = #{productId},</if> <if test="productCode != null">product_code = #{productCode},</if>
<if test="quantity != null ">quantity = #{quantity},</if> <if test="quantity != null ">quantity = #{quantity},</if>
<if test="price != null">price = #{price},</if> <if test="price != null">price = #{price},</if>
<if test="amount != null">amount = #{amount},</if> <if test="amount != null">amount = #{amount},</if>
@ -212,7 +228,7 @@
</delete> </delete>
<delete id="deleteOrderListByOrderIds" parameterType="String"> <delete id="deleteOrderListByOrderIds" parameterType="String">
delete from order_list where order_id in update order_list set status=1,delete_at=now() where order_id in
<foreach item="orderId" collection="array" open="(" separator="," close=")"> <foreach item="orderId" collection="array" open="(" separator="," close=")">
#{orderId} #{orderId}
</foreach> </foreach>
@ -225,10 +241,10 @@
</delete> </delete>
<insert id="batchOrderList"> <insert id="batchOrderList">
insert into order_list( id, order_id, product_id, quantity, price, amount, remark, created_at, updated_at, insert into order_list( id, order_id, product_code, quantity, price, amount, remark, created_at, updated_at,
deleted_at) values deleted_at) values
<foreach item="item" index="index" collection="list" separator=","> <foreach item="item" index="index" collection="list" separator=",">
( #{item.id}, #{item.orderId}, #{item.productId}, #{item.quantity}, #{item.price}, #{item.amount}, ( #{item.id}, #{item.orderId}, #{item.productCode}, #{item.quantity}, #{item.price}, #{item.amount},
#{item.remark}, #{item.createdAt}, #{item.updatedAt}, #{item.deletedAt}) #{item.remark}, #{item.createdAt}, #{item.updatedAt}, #{item.deletedAt})
</foreach> </foreach>
</insert> </insert>

View File

@ -34,6 +34,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectProductInfoVo"/> <include refid="selectProductInfoVo"/>
where id = #{id} where id = #{id}
</select> </select>
<select id="listByProductCodeList" resultMap="ProductInfoResult">
<include refid="selectProductInfoVo"/>
where product_code in
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{item}
</foreach>
</select>
<insert id="insertProductInfo" parameterType="ProductInfo" useGeneratedKeys="true" keyProperty="id"> <insert id="insertProductInfo" parameterType="ProductInfo" useGeneratedKeys="true" keyProperty="id">
insert into product_info insert into product_info