guoyuji
2024-02-02 d502cef3f9a2e033e6cebaef0f6153b802dae138
订单查询前后端文件代码
10个文件已修改
560 ■■■■ 已修改文件
north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/order/SelectOrder.vue 145 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/product/SelectProduct.vue 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/controller/sd/OrderController.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/mapper/sd/OrderGlassDetailMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/mapper/sd/OrderMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java 62 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/sd/OrderMapper.xml 133 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/test/java/com/example/erp/service/sd/OrderServiceTest.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/target/classes/mapper/sd/OrderMapper.xml 133 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue
@@ -174,6 +174,27 @@
            ElMessage.error('没有表格数据!')
            return
          }
          const project = titleUploadData.value.project
          if(project === null || project === undefined || project === ''){
            ElMessage.error('输入项目名称!')
            return
          }
          const customer = titleUploadData.value.customerId
          if(customer === null || customer === undefined || customer === ''){
            ElMessage.error('请选择客户!')
            return
          }
          const salasMan = titleUploadData.value.salesman
          if(salasMan === null || salasMan === undefined || salasMan === ''){
            ElMessage.error('请选择业务员!')
            return
          }
          const calculateType = titleUploadData.value.calculateType
          if(calculateType === null || calculateType === undefined || calculateType === ''){
            ElMessage.error('请选择计算方式!')
            return
          }
          if ($grid) {
            const errMap = await $grid.validate(true)
            if (errMap) {
@@ -279,6 +300,7 @@
const saveOrder = (order) => {
  request.post(`/order/saveOrder`,order).then((res) => {
    if(res.code==200){
      location.reload()
      ElMessage.success('保存成功')
    }else {
      ElMessage.error(res.msg)
@@ -327,7 +349,7 @@
    const workbook = XLXS.read(data, { type: 'binary' })
    let jsonData = XLXS.utils.sheet_to_json(workbook.Sheets.Sheet1).slice(1)
    if(jsonData.length>240){
      ElMessage.error('导入数据不能超过240条,请分订单导入')
      ElMessage.error(`导入${jsonData.length}条,数据不能超过240条,请分订单导入`)
      return
    }
    jsonData.forEach((item,index) => {
@@ -472,7 +494,6 @@
      <el-row>
        <el-col  :span="2"><el-text>总金额:</el-text></el-col>
        <el-col  :span="2"><el-text >{{titleUploadData.money}}</el-text></el-col>
        <el-col  :span="2"><el-text>合同编号:</el-text></el-col>
        <el-col  :span="2"><el-input v-model="titleUploadData.contractId"/></el-col>
        <el-col  :span="2"><el-text>客户批次:</el-text></el-col>
north-glass-erp/northglass-erp/src/views/sd/order/SelectOrder.vue
@@ -4,21 +4,12 @@
  import {reactive, ref} from "vue";
  const router = useRouter()
  import ProcessCardProgress from '@/views/pp/report/ProcessCardProgress.vue'
  import request from "@/utils/request";
  import deepClone from "@/utils/deepClone";
  import {ElMessage} from "element-plus";
  const getTableRow = (row,type) =>{
    switch (type) {
      case 'edit' :{
        //alert('我接收到子组件传送的编辑信息')
        router.push({path: '/main/order/createOrder', query: { orderID: 'NG24010101' }})
        break
      }
      case 'delete':{
        alert('我接收到子组件传送的删除信息')
        break
      }
    }
  }
  const xGrid = ref()
  const gridOptions = reactive({
    border:  "full",//表格加边框
    keepSource: true,//保持源数据
@@ -52,78 +43,49 @@
      {title: '操作', width: 110, slots: { default: 'button_slot' },fixed:"left",},
      {type: 'seq', title: '自序', width: 80 ,fixed:"left",},
      {title: '下单', width: 40, slots: { default: 'state' }},
      {title: '工艺', width: 40, slots: { default: 'state' }},
      {title: '审核', width: 40, slots: { default: 'state' }},
      {title: '生产', width: 40, slots: { default: 'state' }},
      {title: '交接', width: 40, slots: { default: 'state' }},
      {title: '下达', width: 40, slots: { default: 'state' }},
      {title: '入库', width: 40, slots: { default: 'state' }},
      {title: '发货', width: 40, slots: { default: 'state' }},
      {field:'createOrder',title: '下单', width: 40, slots: { default: 'state' }},
      {field:'processReview',title: '工艺', width: 40, slots: { default: 'state' }},
      {field:'orderReview',title: '审核', width: 40, slots: { default: 'state' }},
      {field:'productionOrder',title: '工单', width: 40, slots: { default: 'state' }},
      {field:'processingCard',title: '流程卡', width: 40, slots: { default: 'state' }},
      {field:'warehousing',title: '入库', width: 40, slots: { default: 'state' }},
      {field:'delivery',title: '发货', width: 40, slots: { default: 'state' }},
      {field: '1',width:120,  title: '销售单号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: '2',width:120,  title: '客户编号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: '3',width:120,  title: '客户名称',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: '4',width:120,  title: '总数量',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: '5',width:120,  title: '可用库存',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: '6',width:120,  title: '项目名称',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: '7',width:120,  title: '批次',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: '8',width:120,   title: '总金额',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: '9',width:120,  title: '结算总面积',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: '10',width:120,  title: '报表日期',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: '11',width:120,  title: '包装方式',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: '12',width:120,  title: '订单类型',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: '13',width:120,  title: '订单类型',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: '14',width:120,  title: '订单类型',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}
      {field: 'orderId',width:120,  title: '销售单号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: 'customerId',width:120,  title: '客户编号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: 'customerName',width:120,  title: '客户名称',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: 'project',width:120,  title: '项目名称',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: 'batch',width:120,  title: '批次',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: 'quantity',width:120,  title: '数量',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: '14',width:120,  title: '库存数', sortable: true},
      {field: 'area',width:120,  title: '总结算面积',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: 'createTime',width:120,   title: '报表日期',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: 'packType',width:120,  title: '包装方式',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: 'orderType',width:120,  title: '订单类型',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: 'salesman',width:120,  title: '业务员',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: 'perimeter',width:120,  title: '周长',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: 'deliveryDate',width:120,  title: '交货日期',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: 'customerBatch',width:120,  title: '客户批次',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      //{field: '14',width:120,  title: '备注',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
      {field: 'deliveryAddress',width:120,  title: '地址',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}
    ],//表头按钮
    toolbarConfig: {
      buttons: [
      ],
      import: false,
      export: true,
      print: true,
      slots:{
        buttons: "toolbar_buttons"
      },
      // import: false,
      // export: true,
      // print: true,
      zoom: true,
      custom: true
    },
    data:  [
      {
        '0': '1',
        '1': 'NG23110102',
        '2': '11',
        '3': '中建',
        '4': '534',
        '5': '116',
        '6': '黄石有轨电车',
        '7': '20批',
        '8': '111100.02',
        '9': '1008.38',
        '10': '2023-10-30',
        '11': '叉车木箱',
        '12': '普通订单',
        '13': '',
        '14': '王龙'
      },
      {
        '0': '1',
        '1': 'NG23110101',
        '2': '11',
        '3': '中建',
        '4': '534',
        '5': '116',
        '6': '黄石有轨电车',
        '7': '20批',
        '8': '111100.02',
        '9': '1008.38',
        '10': '2023-10-30',
        '11': '叉车木箱',
        '12': '普通订单',
        '13': '',
        '14': '王龙'
      }
    ],//table body实际数据
    footerMethod ({ columns, data }) {//页脚函数
      return[
        columns.map((column, columnIndex) => {
@@ -140,10 +102,25 @@
  })
  const dialogTableVisible = ref(false)
const cellClickEvent =()=>{
    dialogTableVisible.value = true
  let orderType = ref("2")
  let selectDate = ref(["",""])
  let filterData = ref({})
  let orderList = ref([])
  request.post(`/order/getOrderList/1/100/${orderType.value}/${selectDate.value}`,filterData).then((res) => {
    if(res.code==200){
      console.log(res.data)
      orderList.value = deepClone(res.data.data)
      xGrid.value.loadData(orderList.value)
    }else{
      ElMessage.warning(res.msg)
}
  })
  //双击表格行
  // const cellClickEvent =()=>{
  //     dialogTableVisible.value = true
  // }
@@ -176,8 +153,9 @@
        </ul>
      </template>
      <template #state="{ row}">
        <el-checkbox checked/>
      <template #state="{ row,column}">
<!--        <p>{{row[column.field]}}</p>-->
        <el-checkbox @click.native.prevent :indeterminate="row[column.field]===1" :checked="row[column.field]===2"/>
      </template>
      <!--左边固定显示的插槽-->
@@ -193,6 +171,15 @@
          </div>
        </div>
      </template>
      <template #toolbar_buttons>
        <vxe-select v-model="orderType" placeholder="订单类型">
          <vxe-option value="2" label="正常订单"></vxe-option>
          <vxe-option value="-2" label="作废订单"></vxe-option>
          <vxe-option value="" label="全部订单"></vxe-option>
        </vxe-select>
      </template>
    </vxe-grid>
    <el-dialog v-model="dialogTableVisible" title="流程卡进度" style="width: 80%;height:75% ">
north-glass-erp/northglass-erp/src/views/sd/product/SelectProduct.vue
@@ -149,22 +149,6 @@
/*const getTableRow = (row,type) =>{
  switch (type) {
    case 'edit' : {
      router.push({path: '/main/product/createProduct', query: { id: row.id }})
      break
    }
    case 'delete': {
      alert('我接收到子组件传送的删除信息')
      break
    }
  }
}*/
// const getCheckList = (row) =>{
//   alert('我接收到子组件传送的确认复选框信息可在控制台查看')
// }
const xGrid = ref()
north-glass-erp/src/main/java/com/example/erp/controller/sd/OrderController.java
@@ -1,26 +1,26 @@
package com.example.erp.controller.sd;
import cn.hutool.json.JSON;
import com.alibaba.fastjson.JSONObject;
import com.example.erp.common.Constants;
import com.example.erp.common.Result;
import com.example.erp.entity.sd.Order;
import com.example.erp.exception.ServiceException;
import com.example.erp.service.sd.OrderService;
import org.apache.tomcat.Jar;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService orderService;
    private final OrderService orderService;
    public OrderController(OrderService orderService) {
        this.orderService = orderService;
    }
    @PostMapping("/saveOrder")
    public Result saveOrder(@RequestBody Map<String, Object> orderMap) throws Exception {
@@ -30,4 +30,9 @@
            throw new ServiceException(Constants.Code_500,Constants.Code_msg);
        }
    }
    @PostMapping("/getOrderList/{pageNum}/{pageSize}/{orderType}/{selectDate}")
    public Result getOrderList(@PathVariable Integer pageNum, @PathVariable Integer pageSize,@PathVariable Integer orderType, @PathVariable List<LocalDate> selectDate, @RequestBody Order order)  {
        return Result.seccess(orderService.getOrderList(pageNum, pageSize, selectDate, order,orderType));
    }
}
north-glass-erp/src/main/java/com/example/erp/mapper/sd/OrderGlassDetailMapper.java
@@ -1,5 +1,6 @@
package com.example.erp.mapper.sd;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.erp.entity.sd.OrderGlassDetail;
import com.example.erp.entity.sd.OrderProcessDetail;
import org.apache.ibatis.annotations.Mapper;
@@ -8,7 +9,7 @@
import java.util.List;
@Mapper
public interface OrderGlassDetailMapper {
public interface OrderGlassDetailMapper  extends BaseMapper<OrderGlassDetail> {
    boolean insertOrderGlassDetail(@Param("orderId") String orderId);
    List<OrderGlassDetail> selectOrderGlassDetail(@Param("orderId") String orderId);
north-glass-erp/src/main/java/com/example/erp/mapper/sd/OrderMapper.java
@@ -2,12 +2,20 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.erp.entity.sd.Order;
import com.example.erp.entity.sd.Product;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
@Mapper
public interface OrderMapper extends BaseMapper<Order> {
    Integer selectMaxOrderId();
    boolean updateOrderParameter(@Param("orderId") String orderId);
    List<Order> getOrderList(Integer offset, Integer pageSize, LocalDate startDate, LocalDate endDate, Order order, Integer orderType);
    Integer getPageTotal(Integer offset, Integer pageSize, LocalDate startDate, LocalDate endDate, Order order , Integer orderType);
}
north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java
@@ -3,23 +3,24 @@
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.erp.common.Constants;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.example.erp.entity.sd.Order;
import com.example.erp.entity.sd.OrderDetail;
import com.example.erp.entity.sd.OrderGlassDetail;
import com.example.erp.entity.sd.OrderProcessDetail;
import com.example.erp.entity.userInfo.SysError;
import com.example.erp.exception.ServiceException;
import com.example.erp.mapper.sd.*;
import com.example.erp.mapper.sd.OrderDetailMapper;
import com.example.erp.mapper.sd.OrderGlassDetailMapper;
import com.example.erp.mapper.sd.OrderMapper;
import com.example.erp.mapper.sd.OrderProcessDetailMapper;
import com.example.erp.service.userInfo.SysErrorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
@Service
@@ -52,7 +53,7 @@
            if(order.getOrderId() == null || order.getOrderId().isEmpty()){
                insertOrder(order,OrderDetails);
            }else {
                saveState = updateOrder(order,OrderDetails);
                updateOrder(order,OrderDetails);
            }
        }catch (Exception e){
            TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);
@@ -65,7 +66,6 @@
            //throw new Exception();
        }
        System.out.println(saveState);
        return saveState;
    }
    //生成订单数据
@@ -81,6 +81,26 @@
        //往主表插数据
        order.setOrderId(orderId);
        orderMapper.insert(order);
        insertOtherDetail(orderId,OrderDetails);
    }
    //修改订单数据,并且重新生成多个副表数据
    public void updateOrder(Order order,List<OrderDetail> OrderDetails) {
        LambdaUpdateWrapper<Order> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(Order::getOrderId, order.getOrderId());
        orderMapper.update(order,updateWrapper);
        //删除订单明细表
        orderDetailMapper.delete(new LambdaQueryWrapper<OrderDetail>().eq(OrderDetail::getOrderId, order.getOrderId()));
        //删除订单小片表
        orderGlassDetailMapper.delete(new LambdaQueryWrapper<OrderGlassDetail>().eq(OrderGlassDetail::getOrderId, order.getOrderId()));
        //删除订单工艺表
        orderProcessDetailMapper.delete(new LambdaQueryWrapper<OrderProcessDetail>().eq(OrderProcessDetail::getOrderId, order.getOrderId()));
        insertOtherDetail(order.getOrderId(),OrderDetails);
    }
    //插入其他副表数据,被其他方法引用
    public void insertOtherDetail(String orderId,List<OrderDetail> OrderDetails) {
        //循环给订单明细表字段添加序号和周长
        for (int i = 0; i < OrderDetails.size(); i++) {
            OrderDetails.get(i).setOrderNumber(i+1);
@@ -96,6 +116,12 @@
        orderGlassDetailMapper.insertOrderGlassDetail(orderId);
        //查询订单小片表获取工艺传入小片工艺表
        List<OrderGlassDetail> orderGlassDetails = orderGlassDetailMapper.selectOrderGlassDetail(orderId);
        List<OrderProcessDetail> orderProcessDetailList = getOrderProcessDetails(orderGlassDetails);
        //赋值订单工艺表
        orderProcessDetailMapper.insertOrderProcessDetail(orderProcessDetailList);
    }
    private static List<OrderProcessDetail> getOrderProcessDetails(List<OrderGlassDetail> orderGlassDetails) {
        List<OrderProcessDetail> orderProcessDetailList = new ArrayList<>();
        for (OrderGlassDetail orderGlassDetail : orderGlassDetails) {
            String[] processList = orderGlassDetail.getProcess().split("->");
@@ -108,11 +134,25 @@
                orderProcessDetailList.add(orderProcessDetail);
            }
        }
       //赋值订单工艺表
        orderProcessDetailMapper.insertOrderProcessDetail(orderProcessDetailList);
        return orderProcessDetailList;
    }
    public boolean updateOrder(Order order,List<OrderDetail> OrderDetails) {
        return  false;
    //查询获取列表
    public Map<String,Object> getOrderList(Integer pageNum, Integer pageSize, List<LocalDate> selectDate, Order order,Integer orderType) {
        Integer offset = (pageNum-1)*pageSize;
        LocalDate endDate = LocalDate.now();
        LocalDate startDate = endDate.minusDays(15);
        if(selectDate == null && selectDate.size()==2){
            startDate = selectDate.get(0);
            endDate = selectDate.get(1);
        }
        Map<String,Object> map = new HashMap<>();
        map.put("data",orderMapper.getOrderList(offset, pageSize, startDate, endDate, order,orderType));
        map.put("total",orderMapper.getPageTotal(offset, pageSize, startDate, endDate, order,orderType));
        map.put("startDate",startDate);
        map.put("endDate",endDate);
        return map;
    }
}
north-glass-erp/src/main/resources/mapper/sd/OrderMapper.xml
@@ -27,5 +27,138 @@
            o.order_id = #{orderId}
    </update>
    <select id="getOrderList">
        select
            *
        from
            `order` as o
        where  o.create_time>=#{startDate} and o.create_time &lt;= #{endDate}
          <if test="orderType!= null and orderType != ''">
               and o.create_order = #{orderType}
           </if>
           <if test="order.orderId != null and order.orderId != ''">
               and o.order_id REGEXP #{order.orderId}
           </if>
           <if test="order.customerId != null and order.customerId != ''">
               and o.customer_id REGEXP #{customerId}
           </if>
           <if test="order.customerName != null and order.customerName != ''">
               and o.customer_name REGEXP #{customerName}
           </if>
           <if test="order.project != null and order.project != ''">
               and o.project REGEXP #{order.project}
           </if>
           <if test="order.batch != null and order.batch != ''">
               and o.batch REGEXP #{order.batch}
           </if>
           <if test="order.quantity != null and order.quantity != ''">
               and o.quantity REGEXP #{order.quantity}
           </if>
           <if test="order.area != null and order.area != ''">
               and o.area REGEXP #{order.area}
           </if>
           <if test="order.createTime != null and order.createTime != ''">
               and date(o.create_time) = #{order.createTime}
           </if>
           <if test="order.packType != null and order.packType != ''">
               and o.pack_type REGEXP #{order.packType}
           </if>
           <if test="order.orderType != null and order.orderType != ''">
               and o.order_type REGEXP #{order.orderType}
           </if>
           <if test="order.salesman != null and order.salesman != ''">
               and o.salesman REGEXP #{order.salesman}
           </if>
           <if test="order.perimeter != null and order.perimeter != ''">
               and o.perimeter REGEXP #{order.perimeter}
           </if>
           <if test="order.deliveryDate != null and order.deliveryDate != ''">
               and o.delivery_date REGEXP #{order.deliveryDate}
           </if>
           <if test="order.customerBatch != null and order.customerBatch != ''">
               and o.customer_batch REGEXP #{order.customerBatch}
           </if>
           <if test="order.otherRemarks != null and order.otherRemarks != ''">
               and o.other_remarks REGEXP #{order.otherRemarks}
           </if>
           <if test="order.deliveryAddress != null and order.deliveryAddress != ''">
               and o.delivery_address REGEXP #{order.deliveryAddress}
           </if>
        order by o.id desc
        limit #{offset},#{pageSize}
    </select>
    <select id="getPageTotal">
        select
            CEILING(count(o.id)/#{pageSize})
        from
        `order` as o
        where o.create_time>=#{startDate} and o.create_time &lt;= #{endDate}
            <if test="orderType!= null and orderType != ''">
                and o.create_order = #{orderType}
            </if>
            <if test="order.orderId != null and order.orderId != ''">
                and o.order_id REGEXP #{order.orderId}
            </if>
            <if test="order.customerId != null and order.customerId != ''">
                and o.customer_id REGEXP #{customerId}
            </if>
            <if test="order.customerName != null and order.customerName != ''">
                and o.customer_name REGEXP #{customerName}
            </if>
            <if test="order.project != null and order.project != ''">
                and o.project REGEXP #{order.project}
            </if>
            <if test="order.batch != null and order.batch != ''">
                and o.batch REGEXP #{order.batch}
            </if>
            <if test="order.quantity != null and order.quantity != ''">
                and o.quantity REGEXP #{order.quantity}
            </if>
            <if test="order.area != null and order.area != ''">
                and o.area REGEXP #{order.area}
            </if>
            <if test="order.createTime != null and order.createTime != ''">
                and date(o.create_time) = #{order.createTime}
            </if>
            <if test="order.packType != null and order.packType != ''">
                and o.pack_type REGEXP #{order.packType}
            </if>
            <if test="order.orderType != null and order.orderType != ''">
                and o.order_type REGEXP #{order.orderType}
            </if>
            <if test="order.salesman != null and order.salesman != ''">
                and o.salesman REGEXP #{order.salesman}
            </if>
            <if test="order.perimeter != null and order.perimeter != ''">
                and o.perimeter REGEXP #{order.perimeter}
            </if>
            <if test="order.deliveryDate != null and order.deliveryDate != ''">
                and o.delivery_date REGEXP #{order.deliveryDate}
            </if>
            <if test="order.customerBatch != null and order.customerBatch != ''">
                and o.customer_batch REGEXP #{order.customerBatch}
            </if>
            <if test="order.otherRemarks != null and order.otherRemarks != ''">
                and o.other_remarks REGEXP #{order.otherRemarks}
            </if>
            <if test="order.deliveryAddress != null and order.deliveryAddress != ''">
                and o.delivery_address REGEXP #{order.deliveryAddress}
            </if>
        order by o.id desc
        limit #{offset},#{pageSize}
    </select>
</mapper>
north-glass-erp/src/test/java/com/example/erp/service/sd/OrderServiceTest.java
@@ -1,10 +1,14 @@
package com.example.erp.service.sd;
import com.example.erp.entity.sd.Order;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.*;
@@ -15,9 +19,11 @@
    @Test
    void testCreateOrder() {
        Map<String, Object> order =new HashMap<>();
        //orderService.saveOrder();
        List<LocalDate> a = new ArrayList<>();
        a.add(LocalDate.now().minusDays(15));
        a.add(LocalDate.now().plusDays(1));
        Order order = new Order();
        orderService.getOrderList(1,100,a,order,null);
    }
}
north-glass-erp/target/classes/mapper/sd/OrderMapper.xml
@@ -27,5 +27,138 @@
            o.order_id = #{orderId}
    </update>
    <select id="getOrderList">
        select
            *
        from
            `order` as o
        where  o.create_time>=#{startDate} and o.create_time &lt;= #{endDate}
          <if test="orderType!= null and orderType != ''">
               and o.create_order = #{orderType}
           </if>
           <if test="order.orderId != null and order.orderId != ''">
               and o.order_id REGEXP #{order.orderId}
           </if>
           <if test="order.customerId != null and order.customerId != ''">
               and o.customer_id REGEXP #{customerId}
           </if>
           <if test="order.customerName != null and order.customerName != ''">
               and o.customer_name REGEXP #{customerName}
           </if>
           <if test="order.project != null and order.project != ''">
               and o.project REGEXP #{order.project}
           </if>
           <if test="order.batch != null and order.batch != ''">
               and o.batch REGEXP #{order.batch}
           </if>
           <if test="order.quantity != null and order.quantity != ''">
               and o.quantity REGEXP #{order.quantity}
           </if>
           <if test="order.area != null and order.area != ''">
               and o.area REGEXP #{order.area}
           </if>
           <if test="order.createTime != null and order.createTime != ''">
               and date(o.create_time) = #{order.createTime}
           </if>
           <if test="order.packType != null and order.packType != ''">
               and o.pack_type REGEXP #{order.packType}
           </if>
           <if test="order.orderType != null and order.orderType != ''">
               and o.order_type REGEXP #{order.orderType}
           </if>
           <if test="order.salesman != null and order.salesman != ''">
               and o.salesman REGEXP #{order.salesman}
           </if>
           <if test="order.perimeter != null and order.perimeter != ''">
               and o.perimeter REGEXP #{order.perimeter}
           </if>
           <if test="order.deliveryDate != null and order.deliveryDate != ''">
               and o.delivery_date REGEXP #{order.deliveryDate}
           </if>
           <if test="order.customerBatch != null and order.customerBatch != ''">
               and o.customer_batch REGEXP #{order.customerBatch}
           </if>
           <if test="order.otherRemarks != null and order.otherRemarks != ''">
               and o.other_remarks REGEXP #{order.otherRemarks}
           </if>
           <if test="order.deliveryAddress != null and order.deliveryAddress != ''">
               and o.delivery_address REGEXP #{order.deliveryAddress}
           </if>
        order by o.id desc
        limit #{offset},#{pageSize}
    </select>
    <select id="getPageTotal">
        select
            CEILING(count(o.id)/#{pageSize})
        from
        `order` as o
        where o.create_time>=#{startDate} and o.create_time &lt;= #{endDate}
            <if test="orderType!= null and orderType != ''">
                and o.create_order = #{orderType}
            </if>
            <if test="order.orderId != null and order.orderId != ''">
                and o.order_id REGEXP #{order.orderId}
            </if>
            <if test="order.customerId != null and order.customerId != ''">
                and o.customer_id REGEXP #{customerId}
            </if>
            <if test="order.customerName != null and order.customerName != ''">
                and o.customer_name REGEXP #{customerName}
            </if>
            <if test="order.project != null and order.project != ''">
                and o.project REGEXP #{order.project}
            </if>
            <if test="order.batch != null and order.batch != ''">
                and o.batch REGEXP #{order.batch}
            </if>
            <if test="order.quantity != null and order.quantity != ''">
                and o.quantity REGEXP #{order.quantity}
            </if>
            <if test="order.area != null and order.area != ''">
                and o.area REGEXP #{order.area}
            </if>
            <if test="order.createTime != null and order.createTime != ''">
                and date(o.create_time) = #{order.createTime}
            </if>
            <if test="order.packType != null and order.packType != ''">
                and o.pack_type REGEXP #{order.packType}
            </if>
            <if test="order.orderType != null and order.orderType != ''">
                and o.order_type REGEXP #{order.orderType}
            </if>
            <if test="order.salesman != null and order.salesman != ''">
                and o.salesman REGEXP #{order.salesman}
            </if>
            <if test="order.perimeter != null and order.perimeter != ''">
                and o.perimeter REGEXP #{order.perimeter}
            </if>
            <if test="order.deliveryDate != null and order.deliveryDate != ''">
                and o.delivery_date REGEXP #{order.deliveryDate}
            </if>
            <if test="order.customerBatch != null and order.customerBatch != ''">
                and o.customer_batch REGEXP #{order.customerBatch}
            </if>
            <if test="order.otherRemarks != null and order.otherRemarks != ''">
                and o.other_remarks REGEXP #{order.otherRemarks}
            </if>
            <if test="order.deliveryAddress != null and order.deliveryAddress != ''">
                and o.delivery_address REGEXP #{order.deliveryAddress}
            </if>
        order by o.id desc
        limit #{offset},#{pageSize}
    </select>
</mapper>