feat(sip): 添加发货清单功能
- 新增 DeliveryList域对象、Mapper、Service 及控制器 - 实现发货清单的增删查改功能 - 添加发货清单的导入功能 -优化订单列表查询,增加按发货单 ID 查询的功能 - 产品信息 Mapper 增加按产品编码列表查询的功能master
parent
23afe6f58b
commit
64770439b0
|
@ -14,7 +14,7 @@ PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
|||
<!-- 指定 MyBatis 所用日志的具体实现 -->
|
||||
<setting name="logImpl" value="SLF4J" />
|
||||
<!-- 使用驼峰命名法转换字段 -->
|
||||
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
|
||||
<setting name="mapUnderscoreToCamelCase" value="true"/>
|
||||
</settings>
|
||||
|
||||
</configuration>
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -97,4 +97,6 @@ public interface OrderInfoMapper
|
|||
* @param orderListList
|
||||
*/
|
||||
void updateListBatch(List<OrderList> orderListList);
|
||||
|
||||
List<OrderList> listOrderListByDeliveryId(Long deliveryId);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ruoyi.sip.mapper;
|
|||
|
||||
import java.util.List;
|
||||
import com.ruoyi.sip.domain.ProductInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 产品管理Mapper接口
|
||||
|
@ -58,4 +59,8 @@ public interface ProductInfoMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteProductInfoByIds(String[] ids);
|
||||
|
||||
|
||||
|
||||
List<ProductInfo> listByProductCodeList(@Param("list") List<String> productCodeList);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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>
|
|
@ -101,9 +101,34 @@
|
|||
</select>
|
||||
|
||||
<select id="selectOrderListList" resultMap="OrderListResult">
|
||||
select id, order_id, product_code, quantity, price, amount, remark, created_at, updated_at, deleted_at
|
||||
select id,
|
||||
order_id,
|
||||
product_code,
|
||||
quantity,
|
||||
price,
|
||||
amount,
|
||||
remark,
|
||||
created_at,
|
||||
updated_at,
|
||||
deleted_at
|
||||
from order_list
|
||||
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>
|
||||
|
||||
<insert id="insertOrderInfo" parameterType="OrderInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
|
@ -176,7 +201,7 @@
|
|||
<foreach item="item" index="index" collection="list" separator=";">
|
||||
update order_list
|
||||
<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="price != null">price = #{price},</if>
|
||||
<if test="amount != null">amount = #{amount},</if>
|
||||
|
@ -203,7 +228,7 @@
|
|||
</delete>
|
||||
|
||||
<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=")">
|
||||
#{orderId}
|
||||
</foreach>
|
||||
|
@ -216,9 +241,11 @@
|
|||
</delete>
|
||||
|
||||
<insert id="batchOrderList">
|
||||
insert into order_list( id, order_id, product_code, quantity, price, amount, remark, created_at, updated_at, deleted_at) values
|
||||
insert into order_list( id, order_id, product_code, quantity, price, amount, remark, created_at, updated_at,
|
||||
deleted_at) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.id}, #{item.orderId}, #{item.productCode}, #{item.quantity}, #{item.price}, #{item.amount}, #{item.remark}, #{item.createdAt}, #{item.updatedAt}, #{item.deletedAt})
|
||||
( #{item.id}, #{item.orderId}, #{item.productCode}, #{item.quantity}, #{item.price}, #{item.amount},
|
||||
#{item.remark}, #{item.createdAt}, #{item.updatedAt}, #{item.deletedAt})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
|
|
@ -34,6 +34,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="selectProductInfoVo"/>
|
||||
where id = #{id}
|
||||
</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 into product_info
|
||||
|
|
Loading…
Reference in New Issue