chenlu
2024-04-23 3f4c58d5b830d9e00454f62c6713566b6b8f127a
提交修改的问题
3个文件已修改
11个文件已添加
2064 ■■■■■ 已修改文件
north-glass-erp/northglass-erp/src/views/pp/processCard/SplittingDetails.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/workOrder/AddWorkOrder.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/target/classes/mapper/sd/BasicDataMapper.xml 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/target/classes/mapper/sd/BasicGlassTypeMapper.xml 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/target/classes/mapper/sd/BasicOtherMoneyMapper.xml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/target/classes/mapper/sd/CustomerMapper.xml 250 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/target/classes/mapper/sd/DeliveryDetailMapper.xml 701 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/target/classes/mapper/sd/DeliveryMapper.xml 311 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/target/classes/mapper/sd/OrderDetailMapper.xml 414 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/target/classes/mapper/sd/OrderOtherMoneyMapper.xml 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/target/classes/mapper/sd/OrderProcessDetailMapper.xml 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/target/classes/mapper/sd/ProductDetailMapper.xml 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/target/classes/mapper/sd/ProductMapper.xml 110 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/processCard/SplittingDetails.vue
@@ -58,7 +58,6 @@
const {currentRoute} = useRouter()
const route = currentRoute.value
let id = route.query.orderId
// 第一次加载查询
north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue
@@ -20,7 +20,7 @@
const titleUploadData = ref({
  reportingWorkId: null,
  //流程卡号
  processId: '',
  processId: null,
  //销售单号
  orderId: '',
  reviewedState:0,
@@ -105,6 +105,7 @@
        gridOptions.toolbarConfig.buttons.push(button)
      }
      getQuantity()
      inputDisabled.value = true
    })
  }
@@ -784,17 +785,18 @@
const getWork = () => {
  let processId = titleUploadData.value.processId
  // if (processId.indexOf("/") < 0) {
  //
  //   ElMessage.warning("请输入正确格式流程卡")
  //   return
  // }
  // let indexOfChar = processId.indexOf("/")
  // let leftString = processId.slice(0, indexOfChar)
  // if (leftString.length != 13) {
  //   ElMessage.warning("请输入正确位数的流程卡")
  //   return
  // }
  let parts = processId.split('/');
  if (processId.indexOf("/") < 0 ||parts[1].trim() == '') {
    ElMessage.warning("请输入正确格式流程卡")
    return
  }
  let indexOfChar = processId.indexOf("/")
  let leftString = processId.slice(0, indexOfChar)
  if (leftString.length != 14) {
    ElMessage.warning("请输入正确位数的流程卡")
    return
  }
//工序
  let process = titleUploadData.value.thisProcess
  if (process == "" || process == null) {
@@ -817,10 +819,11 @@
  request.post(`/reportingWork/addSelectLastWork/${processIdStr}/${technologyStr}/${process}`).then((res) => {
    if (res.code == 200) {
      if(res.data.data===null){
      if(res.data.data==null){
        ElMessage.error("未查询到此流程卡数据")
        return
      }
      //表头赋值
      titleUploadData.value = res.data.data
      titleUploadData.value.processId = processId
@@ -917,6 +920,8 @@
  }
}
const  getQuantity = () => {
  titleUploadData.value.thisCompletedQuantity = 0
  titleUploadData.value.thisWornQuantity = 0
  const arr = xGrid.value.getTableData().fullData
  const returnArr =  arr.filter((obj, index, self) =>
      self.findIndex((t) => t.order_number === obj.order_number) === index
@@ -935,16 +940,21 @@
  titleUploadData.value.thisWornQuantity = sumBreak
}
const changeTable=()=>{
  const $grid = xGrid.value
  this.$grid.commitProxy('data', yourData)
}
</script>
<template>
  <div style="height: 100%;width: 100%">
    <div id="head" style="height: 5%;width: 100%;margin-bottom: 5px">
      <el-input :disabled="inputDisabled" v-if="titleUploadData.reportingWorkId" v-model="titleUploadData.reportingWorkId" placeholder="报工编号" style="width: 200px" />
      <el-input :disabled="inputDisabled" v-model="titleUploadData.processId" placeholder="流程卡号" style="width: 200px" @keyup.enter.native="getWork"/>
      <el-input :disabled="inputDisabled" v-model="titleUploadData.processId" placeholder="流程卡号" style="width: 200px" @keyup.enter.native="getWork();getQuantity()"/>
      &nbsp;
      <el-select :disabled="inputDisabled" v-model="titleUploadData.thisProcess" clearable placeholder="请选择工序" style="width: 120px"
                 @change="getWork">
                 @change="getWork();getQuantity()">
        <el-option
            v-for="item in titleSelectJson['processType']"
            :key="item.id"
@@ -998,7 +1008,7 @@
          <el-text>{{$t('reportingWorks.deviceType')}}:</el-text>
        </el-col>
        <el-col :span="3">
          <el-select v-model="titleUploadData.deviceName" clearable :placeholder="$t('reportingWorks.pleaseDevice')">
          <el-select @change="getQuantity" v-model="titleUploadData.deviceName" clearable :placeholder="$t('reportingWorks.pleaseDevice')">
            <el-option
                v-for="item in titleSelectJson['deviceType']"
                :key="item.id"
@@ -1040,7 +1050,7 @@
          <el-text>{{$t('reportingWorks.teamsType')}}:</el-text>
        </el-col>
        <el-col :span="3">
          <el-select v-model="titleUploadData.teamsGroupsName" clearable :placeholder="$t('reportingWorks.selectTeam')">
          <el-select  v-model="titleUploadData.teamsGroupsName" clearable :placeholder="$t('reportingWorks.selectTeam')">
            <el-option
                v-for="item in titleSelectJson['teamsType']"
                :key="item.id"
north-glass-erp/northglass-erp/src/views/pp/workOrder/AddWorkOrder.vue
@@ -224,7 +224,8 @@
            request.post("/workOrder/addOrderWork", workOrderData.value).then((res) => {
              if (res.code == 200) {
                ElMessage.success(t('basicData.msg.saveSuccess'))
                location.reload();
                //location.reload();
                router.push({path: '/main/workOrder/addWorkOrder', query: {orderId:id,random:Math.random()}})
              } else {
                ElMessage.warning(res.msg)
               // router.push("/login")
north-glass-erp/target/classes/mapper/sd/BasicDataMapper.xml
New file
@@ -0,0 +1,44 @@
<?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.example.erp.mapper.sd.BasicDateMapper">
    <select id="getOrderBasicData">
        select
            *
        from
            basic_data as a
        where a.basic_type=#{type}
    </select>
    <select id="getOrderBasicDataByTypeAndChildType">
        select
            *
        from
            basic_data as a
        where a.basic_type=#{type} and a.basic_category = #{childType}
    </select>
    <select id="getOrderBasicDataType">
        select
            a.basic_category
        from
            basic_data as a
        where a.basic_type=#{type}
        group by  a.basic_category
    </select>
    <select id="getBasicData">
        select * from basic_data
        order by id desc
    </select>
    <select id="getBasicDataFirstType">
        select * from basic_data
        group by basic_type
    </select>
    <select id="getBasicDataLastType">
        select * from basic_data
        group by basic_category
    </select>
</mapper>
north-glass-erp/target/classes/mapper/sd/BasicGlassTypeMapper.xml
New file
@@ -0,0 +1,22 @@
<?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.example.erp.mapper.sd.BasicGlassTypeMapper">
    <select id="getOneLevel">
        select
            *
        from
            basic_glass_type as a
        where a.level=1
    </select>
    <select id="getTwoLevel">
        select
            *
        from
            basic_glass_type as a
        where a.level=2
        ORDER BY  a.id ;
    </select>
</mapper>
north-glass-erp/target/classes/mapper/sd/BasicOtherMoneyMapper.xml
New file
@@ -0,0 +1,8 @@
<?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.example.erp.mapper.sd.BasicOtherMoneyMapper">
</mapper>
north-glass-erp/target/classes/mapper/sd/CustomerMapper.xml
New file
@@ -0,0 +1,250 @@
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.erp.mapper.sd.CustomerMapper">
    <resultMap id="selectCustomerOrderDetail" type="com.example.erp.entity.sd.OrderDetail">
        <result column="order_id" property="orderId"/>
        <result column="order_number" property="orderNumber"/>
        <result column="quantity" property="quantity"/>
        <result column="building_number" property="buildingNumber"/>
        <result column="product_name" property="productName"/>
        <result column="product_id" property="productId"/>
        <result column="price" property="price"/>
        <result column="width" property="width"/>
        <result column="height" property="height"/>
        <result column="area" property="area"/>
        <result column="shape" property="shape"/>
        <result column="gross_area" property="grossArea"/>
        <result column="compute_area" property="computeArea"/>
        <result column="compute_gross_area" property="computeGrossArea"/>
        <result column="processing_note" property="processingNote"/>
        <result column="edging_type" property="edgingType"/>
        <result column="perimeter" property="perimeter"/>
        <result column="batch" property="order.batch"/>
        <result column="project" property="order.project"/>
        <result column="customer_id" property="order.customerId"/>
        <result column="customer_name" property="order.customerName"/>
        <result column="money" property="order.money"/>
        <result column="order_type" property="order.orderType"/>
        <result column="salesman" property="order.salesman"/>
        <result column="create_time" property="order.createTime"/>
    </resultMap>
    <select id="getSelectCustomerOderDate" resultMap="selectCustomerOrderDetail">
        select od.order_id,
               od.order_number,
               o.project,
               od.product_id,
               od.product_name,
               o.customer_id,
               o.customer_name,
               sum(od.quantity) as quantity,
               sum(od.area) as area,
               od.shape,
               od.width,
               od.height,
               o.batch,
               o.money,
               o.order_type,
               o.salesman,
               o.create_time
        from order_detail od
                 left join `order` o on o.order_id = od.order_id
        <where>
                and date(o.create_time)>=#{startDate} and date(o.create_time) &lt;= #{endDate}
            <if test="orderDetail.order.customerId != null and orderDetail.order.customerId != ''">
                and o.customer_id = #{orderDetail.order.customerId}
            </if>
            <if test="orderDetail.order.project != null and orderDetail.order.project != ''">
                and o.project regexp #{orderDetail.order.project}
            </if>
            <if test="orderDetail.order.batch != null and orderDetail.order.batch != ''">
                and o.batch regexp #{orderDetail.order.batch}
            </if>
            <if test="orderDetail.order.money != null and orderDetail.order.money != ''">
                and o.money regexp REGEXP_REPLACE(#{orderDetail.order.money},'\\.0+$','')
            </if>
            <if test="orderDetail.order.orderType != null and orderDetail.order.orderType != ''">
                and o.order_type regexp #{orderDetail.order.orderType}
            </if>
            <if test="orderDetail.order.salesman != null and orderDetail.order.salesman != ''">
                and o.salesman regexp #{orderDetail.order.salesman}
            </if>
            <if test="orderDetail.orderId != null and orderDetail.orderId != ''">
                and od.order_id regexp #{orderDetail.orderId}
            </if>
            <if test="orderDetail.orderNumber != null and orderDetail.orderNumber != ''">
                and od.order_number regexp #{orderDetail.orderNumber}
            </if>
            <if test="orderDetail.productId != null and orderDetail.productId != ''">
                and od.product_id regexp #{orderDetail.productId}
            </if>
            <if test="orderDetail.productName != null and orderDetail.productName != ''">
                and od.product_name regexp #{orderDetail.productName}
            </if>
            <if test="orderDetail.shape != null and orderDetail.shape != ''">
                and od.shape regexp #{orderDetail.shape}
            </if>
            <if test="orderDetail.width != null and orderDetail.width != ''">
                and od.width regexp  REGEXP_REPLACE(#{orderDetail.width},'\\.0+$','')
            </if>
            <if test="orderDetail.height != null and orderDetail.height != ''">
                and od.height regexp  REGEXP_REPLACE(#{orderDetail.height},'\\.0+$','')
            </if>
        </where>
        group by od.product_id, od.width, od.height
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectCustomerOderDatePageTotal" >
        select
        CEILING(count(zu.id)/#{pageSize}) as 'pageTotal',
        count(zu.id) as 'total' from (select od.product_id,od.id
        from order_detail od
        left join `order` o on o.order_id = od.order_id
        <where>
            and date(o.create_time)>=#{startDate} and date(o.create_time) &lt;= #{endDate}
            <if test="orderDetail.order.customerId != null and orderDetail.order.customerId != ''">
                and o.customer_id = #{orderDetail.order.customerId}
            </if>
            <if test="orderDetail.order.project != null and orderDetail.order.project != ''">
                and o.project regexp #{orderDetail.order.project}
            </if>
            <if test="orderDetail.order.batch != null and orderDetail.order.batch != ''">
                and o.batch regexp #{orderDetail.order.batch}
            </if>
            <if test="orderDetail.order.money != null and orderDetail.order.money != ''">
                and o.money regexp REGEXP_REPLACE(#{orderDetail.order.money},'\\.0+$','')
            </if>
            <if test="orderDetail.order.orderType != null and orderDetail.order.orderType != ''">
                and o.order_type regexp #{orderDetail.order.orderType}
            </if>
            <if test="orderDetail.order.salesman != null and orderDetail.order.salesman != ''">
                and o.salesman regexp #{orderDetail.order.salesman}
            </if>
            <if test="orderDetail.orderId != null and orderDetail.orderId != ''">
                and od.order_id regexp #{orderDetail.orderId}
            </if>
            <if test="orderDetail.orderNumber != null and orderDetail.orderNumber != ''">
                and od.order_number regexp #{orderDetail.orderNumber}
            </if>
            <if test="orderDetail.productId != null and orderDetail.productId != ''">
                and od.product_id regexp #{orderDetail.productId}
            </if>
            <if test="orderDetail.productName != null and orderDetail.productName != ''">
                and od.product_name regexp #{orderDetail.productName}
            </if>
            <if test="orderDetail.shape != null and orderDetail.shape != ''">
                and od.shape regexp #{orderDetail.shape}
            </if>
            <if test="orderDetail.width != null and orderDetail.width != ''">
                and od.width regexp  REGEXP_REPLACE(#{orderDetail.width},'\\.0+$','')
            </if>
            <if test="orderDetail.height != null and orderDetail.height != ''">
                and od.height regexp  REGEXP_REPLACE(#{orderDetail.height},'\\.0+$','')
            </if>
        </where>
        group by od.product_id, od.width, od.height) as zu
    </select>
    <select id="getCustomerList">
        select
            *
        from
            sd.customer
    </select>
    <select id="getSelectCustomer">
        select
            *
        from
            sd.customer c
        <where>
            <if test="customer.id != null and customer.id != ''">
                and c.id regexp #{customer.id}
            </if>
            <if test="customer.customerName != null and customer.customerName != ''">
                and c.customer_name regexp #{customer.customerName}
            </if>
            <if test="customer.grade != null and customer.grade != ''">
                and c.grade regexp #{customer.grade}
            </if>
            <if test="customer.moneyLimit != null and customer.moneyLimit != ''">
                and c.money_limit regexp REGEXP_REPLACE(#{customer.moneyLimit},'\\.0+$','')
            </if>
            <if test="customer.address != null and customer.address != ''">
                and c.address regexp #{customer.address}
            </if>
            <if test="customer.contact != null and customer.contact != ''">
                and c.contact regexp #{customer.contact}
            </if>
            <if test="customer.phone != null and customer.phone != ''">
                and c.phone regexp #{customer.phone}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectCustomerPageTotal">
        select
            CEILING(count(id)/#{pageSize}) as 'pageTotal',
            count(id) as 'total'
        from
            sd.customer c
        <where>
            <if test="customer.id != null and customer.id != ''">
                and c.id regexp #{customer.id}
            </if>
            <if test="customer.customerName != null and customer.customerName != ''">
                and c.customer_name regexp #{customer.customerName}
            </if>
            <if test="customer.grade != null and customer.grade != ''">
                and c.grade regexp #{customer.grade}
            </if>
            <if test="customer.moneyLimit != null and customer.moneyLimit != ''">
                and c.money_limit regexp REGEXP_REPLACE(#{customer.moneyLimit},'\\.0+$','')
            </if>
            <if test="customer.address != null and customer.address != ''">
                and c.address regexp #{customer.address}
            </if>
            <if test="customer.contact != null and customer.contact != ''">
                and c.contact regexp #{customer.contact}
            </if>
            <if test="customer.phone != null and customer.phone != ''">
                and c.phone regexp #{customer.phone}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
    <insert id="insertCustomer"  useGeneratedKeys="true" >
        insert into sd.customer(customer_name,grade,money_limit,address,contact,phone)
        values (
                   #{customer.customerName},#{customer.grade},#{customer.moneyLimit},
                #{customer.address},#{customer.contact},#{customer.phone}
               )
    </insert>
    <update id="updateCustomer"  useGeneratedKeys="true" >
        update sd.customer set customer_name=#{customer.customerName},grade=#{customer.grade},
                                    money_limit=#{customer.moneyLimit},address= #{customer.address},
                                    contact=#{customer.contact},phone=#{customer.phone} where id=#{customer.id}
    </update>
    <delete id="deleteCustomer" >
        delete from sd.customer  where id=#{customer.id}
    </delete>
</mapper>
north-glass-erp/target/classes/mapper/sd/DeliveryDetailMapper.xml
New file
@@ -0,0 +1,701 @@
<?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.example.erp.mapper.sd.DeliveryDetailMapper">
    <resultMap id="selectDeliveryFinishedGoodsInventoryOrderDetail" type="com.example.erp.entity.sd.OrderDetail">
        <result column="order_id" property="orderId"/>
        <result column="order_number" property="orderNumber"/>
        <result column="o_quantity" property="quantity"/>
        <result column="building_number" property="buildingNumber"/>
        <result column="product_name" property="productName"/>
        <result column="product_id" property="productId"/>
        <result column="price" property="price"/>
        <result column="width" property="width"/>
        <result column="height" property="height"/>
        <result column="shape" property="shape"/>
        <result column="gross_area" property="grossArea"/>
        <result column="compute_area" property="computeArea"/>
        <result column="compute_gross_area" property="computeGrossArea"/>
        <result column="processing_note" property="processingNote"/>
        <result column="edging_type" property="edgingType"/>
        <result column="perimeter" property="perimeter"/>
        <result column="delivery_num" property="deliveryNum"/>
        <result column="delivery_id" property="deliveryDetail.deliveryid"/>
        <result column="d_quantity" property="deliveryDetail.quantity"/>
        <result column="money" property="deliveryDetail.money"/>
        <result column="delivery_number" property="deliveryDetail.deliveryNumber"/>
        <result column="delivery_detail_remakes" property="deliveryDetail.deliveryDetailRemakes"/>
        <result column="batch" property="order.batch"/>
        <result column="t_quantity" property="order.quantity"/>
        <result column="customer_id" property="delivery.customerId"/>
        <result column="customer_name" property="delivery.customerName"/>
        <result column="project" property="delivery.project"/>
        <result column="pay_method" property="delivery.payMethod"/>
        <result column="pay_date" property="delivery.payDate"/>
        <result column="contacts" property="delivery.contacts"/>
        <result column="contact_number" property="delivery.contactNumber"/>
        <result column="delivery_address" property="delivery.deliveryAddress"/>
        <result column="remarks" property="delivery.remarks"/>
        <result column="create_time" property="delivery.createTime"/>
        <result column="delivery_date" property="delivery.deliveryDate"/>
        <result column="creator" property="delivery.creator"/>
        <result column="quantity_available" property="finishedGoodsInventory.quantityAvailable"/>
        <result column="storage_region" property="finishedGoodsInventory.storageRegion"/>
        <result column="actual_signal_area" property="finishedGoodsInventory.actualSignalArea"/>
    </resultMap>
    <resultMap id="selectDeliveryDetail" type="com.example.erp.entity.sd.DeliveryDetail">
        <result column="order_id" property="orderId"/>
        <result column="order_number" property="orderNumber"/>
        <result column="o_quantity" property="quantity"/>
        <result column="delivery_id" property="deliveryId"/>
        <result column="delivery_number" property="deliveryNumber"/>
        <result column="quantity" property="quantity"/>
        <result column="area" property="area"/>
        <result column="money" property="money"/>
        <result column="delivery_detail_remakes" property="deliveryDetailRemakes"/>
        <result column="delivery_detail_state" property="deliveryDetailState"/>
        <result column="create_time" property="createTime"/>
        <result column="customer_id" property="delivery.customerId"/>
        <result column="customer_name" property="delivery.customerName"/>
        <result column="project" property="delivery.project"/>
        <result column="pay_method" property="delivery.payMethod"/>
        <result column="payment_terms" property="delivery.paymentTerms"/>
        <result column="pay_date" property="delivery.payDate"/>
        <result column="contacts" property="delivery.contacts"/>
        <result column="contact_number" property="delivery.contactNumber"/>
        <result column="delivery_address" property="delivery.deliveryAddress"/>
        <result column="delivery_date" property="delivery.deliveryDate"/>
        <result column="creator" property="delivery.creator"/>
        <result column="salesman" property="delivery.salesman"/>
    </resultMap>
    <resultMap id="selectDeliveryDetailOrderDetail" type="com.example.erp.entity.sd.DeliveryDetail">
        <result column="order_number" property="orderNumber"/>
        <result column="o_quantity" property="quantity"/>
        <result column="delivery_id" property="deliveryId"/>
        <result column="delivery_number" property="deliveryNumber"/>
        <result column="quantity" property="quantity"/>
        <result column="area" property="area"/>
        <result column="money" property="money"/>
        <result column="delivery_detail_remakes" property="deliveryDetailRemakes"/>
        <result column="delivery_detail_state" property="deliveryDetailState"/>
        <result column="create_time" property="createTime"/>
        <result column="product_id" property="orderDetail.productId"/>
        <result column="product_name" property="orderDetail.productName"/>
        <result column="order_id" property="orderDetail.orderId"/>
    </resultMap>
    <delete id="deleteDeliveryDetail">
        delete from sd.delivery_detail where delivery_id=#{deliveryId}
    </delete>
    <update id="updateOrderDetailDeliveryNum">
        update sd.order_detail set delivery_num=delivery_num+#{deliveryDetail.quantity} where order_id=#{orderId} and order_number=#{orderNumber}
    </update>
    <update id="updateIsNotOrderDetailDeliveryNum">
        update sd.order_detail set delivery_num=delivery_num-#{quantity} where order_id=#{orderId} and order_number=#{orderNumber}
    </update>
    <select id="getdeliveryDetailmaximum" >
        select count(*) from sd.delivery_detail where  delivery_id=#{deliveryId}
    </select>
    <select id="getIsNotDeliveryDetail" >
        select * from sd.delivery_detail where  delivery_id=#{deliveryId}
    </select>
    <insert id="insertDeliveryDetail"  useGeneratedKeys="true" >
        insert into sd.delivery_detail (delivery_id,delivery_number,order_number,
                                        area,order_id,quantity,money,delivery_detail_remakes,delivery_detail_state,create_time)
        values (
                   #{number} ,#{deliveryNumber},#{orderDetail.orderNumber},#{orderDetail.computeGrossArea},
                #{orderDetail.orderId},#{orderDetail.deliveryDetail.quantity},
                #{orderDetail.price}*#{orderDetail.deliveryDetail.quantity},'',1,now()
               )
    </insert>
    <select id="getSelectShippingOrderDetail" resultMap="selectDeliveryFinishedGoodsInventoryOrderDetail">
        select od.order_id,
               o.batch,
               dd.delivery_number,
               fgi.quantity_available + dd.quantity as quantity_available,
               od.order_number,
               od.quantity-dd.quantity as t_quantity,
               od.quantity as o_quantity,
               dd.quantity as d_quantity,
               od.building_number,
               od.product_id,
               od.product_name,
               od.price,
               fgi.storage_region,
               dd.money,
               od.width,
               od.height,
               od.shape,
               fgi.actual_signal_area,
               od.gross_area,
               od.compute_area,
               od.compute_gross_area,
               od.processing_note,
               od.edging_type,
               od.perimeter,
               dd.delivery_detail_remakes
        from sd.delivery_detail dd
        left join sd.delivery d on dd.delivery_id=d.delivery_id
        left join sd.order_detail od on dd.order_id=od.order_id and dd.order_number=od.order_number
        left join sd.`order` o on dd.order_id=o.order_id
        left join mm.finished_goods_inventory fgi on dd.order_id=fgi.order_id and dd.order_number=fgi.order_number
        <where>
            <if test="orderDetail.deliveryDetail.deliveryId != null and orderDetail.deliveryDetail.deliveryId != ''">
                and dd.delivery_id regexp #{orderDetail.deliveryDetail.deliveryId}
            </if>
            <if test="orderDetail.orderId != null and orderDetail.orderId != ''">
                and od.order_id regexp #{orderDetail.orderId}
            </if>
            <if test="orderDetail.order.batch != null and orderDetail.order.batch != ''">
                and o.batch regexp #{orderDetail.order.batch}
            </if>
            <if test="orderDetail.finishedGoodsInventory.quantityAvailable != null and orderDetail.finishedGoodsInventory.quantityAvailable != ''">
                and fgi.quantity_available regexp #{orderDetail.finishedGoodsInventory.quantityAvailable}
            </if>
            <if test="orderDetail.quantity != null and orderDetail.quantity != ''">
                and od.quantity regexp #{orderDetail.quantity}
            </if>
            <if test="orderDetail.deliveryDetail.quantity != null and orderDetail.deliveryDetail.quantity != ''">
                and dd.quantity regexp #{orderDetail.deliveryDetail.quantity}
            </if>
            <if test="orderDetail.buildingNumber != null and orderDetail.buildingNumber != ''">
                and od.building_number regexp #{orderDetail.buildingNumber}
            </if>
            <if test="orderDetail.productId != null and orderDetail.productId != ''">
                and od.product_id regexp #{orderDetail.productId}
            </if>
            <if test="orderDetail.productName != null and orderDetail.productName != ''">
                and od.product_name regexp #{orderDetail.productName}
            </if>
            <if test="orderDetail.price != null and orderDetail.price != ''">
                and od.price regexp #{orderDetail.price}
            </if>
            <if test="orderDetail.finishedGoodsInventory.storageRegion != null and orderDetail.finishedGoodsInventory.storageRegion != ''">
                and fgi.storage_region regexp #{orderDetail.finishedGoodsInventory.storageRegion}
            </if>
            <if test="orderDetail.deliveryDetail.money != null and orderDetail.deliveryDetail.money != ''">
                and dd.money regexp  REGEXP_REPLACE(#{orderDetail.deliveryDetail.money},'\\.0+$','')
            </if>
            <if test="orderDetail.width != null and orderDetail.width != ''">
                and od.width regexp REGEXP_REPLACE(#{orderDetail.width},'\\.0+$','')
            </if>
            <if test="orderDetail.height != null and orderDetail.height != ''">
                and od.height regexp REGEXP_REPLACE(#{orderDetail.height},'\\.0+$','')
            </if>
            <if test="orderDetail.shape != null and orderDetail.shape != ''">
                and od.shape regexp #{orderDetail.shape}
            </if>
            <if test="orderDetail.finishedGoodsInventory.actualSignalArea != null and orderDetail.finishedGoodsInventory.actualSignalArea != ''">
                and fgi.actual_signal_area regexp REGEXP_REPLACE(#{orderDetail.finishedGoodsInventory.actualSignalArea},'\\.0+$','')
            </if>
            <if test="orderDetail.grossArea != null and orderDetail.grossArea != ''">
                and od.gross_area regexp REGEXP_REPLACE(#{orderDetail.grossArea},'\\.0+$','')
            </if>
            <if test="orderDetail.computeArea != null and orderDetail.computeArea != ''">
                and od.compute_area regexp REGEXP_REPLACE(#{orderDetail.computeArea},'\\.0+$','')
            </if>
            <if test="orderDetail.computeGrossArea != null and orderDetail.computeGrossArea != ''">
                and od.compute_gross_area regexp REGEXP_REPLACE(#{orderDetail.computeGrossArea},'\\.0+$','')
            </if>
            <if test="orderDetail.processingNote != null and orderDetail.processingNote != ''">
                and od.processing_note regexp #{orderDetail.processingNote}
            </if>
            <if test="orderDetail.edgingType != null and orderDetail.edgingType != ''">
                and od.edging_type regexp #{orderDetail.edgingType}
            </if>
            <if test="orderDetail.perimeter != null and orderDetail.perimeter != ''">
                and od.perimeter regexp #{orderDetail.perimeter}
            </if>
            <if test="orderDetail.deliveryDetail.deliveryDetailRemakes != null and orderDetail.deliveryDetail.deliveryDetailRemakes != ''">
                and dd.delivery_detail_remakes regexp #{orderDetail.deliveryDetail.deliveryDetailRemakes}
            </if>
        </where>
        order by dd.id desc
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectShippingOrderDetailPageTotal">
        select
            CEILING(count(dd.id)/#{pageSize})
        from sd.delivery_detail dd
                 left join sd.delivery d on dd.delivery_id=d.delivery_id
                 left join sd.order_detail od on dd.order_id=od.order_id and dd.order_number=od.order_number
                 left join sd.`order` o on dd.order_id=o.order_id
                 left join mm.finished_goods_inventory fgi on dd.order_id=fgi.order_id and dd.order_number=fgi.order_number
        <where>
            <if test="orderDetail.deliveryDetail.deliveryId != null and orderDetail.deliveryDetail.deliveryId != ''">
                and dd.delivery_id regexp #{orderDetail.deliveryDetail.deliveryId}
            </if>
            <if test="orderDetail.orderId != null and orderDetail.orderId != ''">
                and od.order_id regexp #{orderDetail.orderId}
            </if>
            <if test="orderDetail.order.batch != null and orderDetail.order.batch != ''">
                and o.batch regexp #{orderDetail.order.batch}
            </if>
            <if test="orderDetail.finishedGoodsInventory.quantityAvailable != null and orderDetail.finishedGoodsInventory.quantityAvailable != ''">
                and fgi.quantity_available regexp #{orderDetail.finishedGoodsInventory.quantityAvailable}
            </if>
            <if test="orderDetail.quantity != null and orderDetail.quantity != ''">
                and od.quantity regexp #{orderDetail.quantity}
            </if>
            <if test="orderDetail.deliveryDetail.quantity != null and orderDetail.deliveryDetail.quantity != ''">
                and dd.quantity regexp #{orderDetail.deliveryDetail.quantity}
            </if>
            <if test="orderDetail.buildingNumber != null and orderDetail.buildingNumber != ''">
                and od.building_number regexp #{orderDetail.buildingNumber}
            </if>
            <if test="orderDetail.productId != null and orderDetail.productId != ''">
                and od.product_id regexp #{orderDetail.productId}
            </if>
            <if test="orderDetail.productName != null and orderDetail.productName != ''">
                and od.product_name regexp #{orderDetail.productName}
            </if>
            <if test="orderDetail.price != null and orderDetail.price != ''">
                and od.price regexp #{orderDetail.price}
            </if>
            <if test="orderDetail.finishedGoodsInventory.storageRegion != null and orderDetail.finishedGoodsInventory.storageRegion != ''">
                and fgi.storage_region regexp #{orderDetail.finishedGoodsInventory.storageRegion}
            </if>
            <if test="orderDetail.deliveryDetail.money != null and orderDetail.deliveryDetail.money != ''">
                and dd.money regexp  REGEXP_REPLACE(#{orderDetail.deliveryDetail.money},'\\.0+$','')
            </if>
            <if test="orderDetail.width != null and orderDetail.width != ''">
                and od.width regexp REGEXP_REPLACE(#{orderDetail.width},'\\.0+$','')
            </if>
            <if test="orderDetail.height != null and orderDetail.height != ''">
                and od.height regexp REGEXP_REPLACE(#{orderDetail.height},'\\.0+$','')
            </if>
            <if test="orderDetail.shape != null and orderDetail.shape != ''">
                and od.shape regexp #{orderDetail.shape}
            </if>
            <if test="orderDetail.finishedGoodsInventory.actualSignalArea != null and orderDetail.finishedGoodsInventory.actualSignalArea != ''">
                and fgi.actual_signal_area regexp REGEXP_REPLACE(#{orderDetail.finishedGoodsInventory.actualSignalArea},'\\.0+$','')
            </if>
            <if test="orderDetail.grossArea != null and orderDetail.grossArea != ''">
                and od.gross_area regexp REGEXP_REPLACE(#{orderDetail.grossArea},'\\.0+$','')
            </if>
            <if test="orderDetail.computeArea != null and orderDetail.computeArea != ''">
                and od.compute_area regexp REGEXP_REPLACE(#{orderDetail.computeArea},'\\.0+$','')
            </if>
            <if test="orderDetail.computeGrossArea != null and orderDetail.computeGrossArea != ''">
                and od.compute_gross_area regexp REGEXP_REPLACE(#{orderDetail.computeGrossArea},'\\.0+$','')
            </if>
            <if test="orderDetail.processingNote != null and orderDetail.processingNote != ''">
                and od.processing_note regexp #{orderDetail.processingNote}
            </if>
            <if test="orderDetail.edgingType != null and orderDetail.edgingType != ''">
                and od.edging_type regexp #{orderDetail.edgingType}
            </if>
            <if test="orderDetail.perimeter != null and orderDetail.perimeter != ''">
                and od.perimeter regexp #{orderDetail.perimeter}
            </if>
            <if test="orderDetail.deliveryDetail.deliveryDetailRemakes != null and orderDetail.deliveryDetail.deliveryDetailRemakes != ''">
                and dd.delivery_detail_remakes regexp #{orderDetail.deliveryDetail.deliveryDetailRemakes}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectShippingOrderDetails" resultMap="selectDeliveryFinishedGoodsInventoryOrderDetail">
        select od.order_id,
               od.order_number,
               o.batch,
               fgi.quantity_available,
               od.quantity- od.delivery_num as t_quantity,
               od.quantity as o_quantity,
               fgi.quantity_available as d_quantity,
               od.building_number,
               od.product_id,
               od.product_name,
               od.price,
               fgi.storage_region,
               od.width,
               od.height,
               od.shape,
               fgi.actual_signal_area,
               od.gross_area,
               od.compute_area,
               od.compute_gross_area,
               od.processing_note,
               od.edging_type,
               od.perimeter
        from sd.order_detail od
                 left join sd.`order` o on od.order_id = o.order_id
                 left join mm.finished_goods_inventory fgi
                 on od.order_id = fgi.order_id and od.order_number = fgi.order_number
        <where>
            fgi.quantity_available > 0 and od.quantity > od.delivery_num
            <if test="orderDetail.orderId != null and orderDetail.orderId != ''">
                and od.order_id regexp #{orderDetail.orderId}
            </if>
            <if test="orderDetail.order.batch != null and orderDetail.order.batch != ''">
                and o.batch regexp #{orderDetail.order.batch}
            </if>
            <if test="orderDetail.finishedGoodsInventory.quantityAvailable != null and orderDetail.finishedGoodsInventory.quantityAvailable != ''">
                and fgi.quantity_available regexp #{orderDetail.finishedGoodsInventory.quantityAvailable}
            </if>
            <if test="orderDetail.quantity != null and orderDetail.quantity != ''">
                and od.quantity regexp #{orderDetail.quantity}
            </if>
            <if test="orderDetail.deliveryNum != null and orderDetail.deliveryNum != ''">
                and od.delivery_num regexp #{orderDetail.deliveryNum}
            </if>
            <if test="orderDetail.buildingNumber != null and orderDetail.buildingNumber != ''">
                and od.building_number regexp #{orderDetail.buildingNumber}
            </if>
            <if test="orderDetail.productId != null and orderDetail.productId != ''">
                and od.product_id regexp #{orderDetail.productId}
            </if>
            <if test="orderDetail.productName != null and orderDetail.productName != ''">
                and od.product_name regexp #{orderDetail.productName}
            </if>
            <if test="orderDetail.price != null and orderDetail.price != ''">
                and od.price regexp  REGEXP_REPLACE(#{orderDetail.price},'\\.0+$','')
            </if>
            <if test="orderDetail.finishedGoodsInventory.storageRegion != null and orderDetail.finishedGoodsInventory.storageRegion != ''">
                and fgi.storage_region regexp #{orderDetail.finishedGoodsInventory.storageRegion}
            </if>
            <if test="orderDetail.width != null and orderDetail.width != ''">
                and od.width regexp REGEXP_REPLACE(#{orderDetail.width},'\\.0+$','')
            </if>
            <if test="orderDetail.height != null and orderDetail.height != ''">
                and od.height regexp REGEXP_REPLACE(#{orderDetail.height},'\\.0+$','')
            </if>
            <if test="orderDetail.shape != null and orderDetail.shape != ''">
                and od.shape regexp #{orderDetail.shape}
            </if>
            <if test="orderDetail.finishedGoodsInventory.actualSignalArea != null and orderDetail.finishedGoodsInventory.actualSignalArea != ''">
                and fgi.actual_signal_area regexp REGEXP_REPLACE(#{orderDetail.finishedGoodsInventory.actualSignalArea},'\\.0+$','')
            </if>
            <if test="orderDetail.grossArea != null and orderDetail.grossArea != ''">
                and od.gross_area regexp REGEXP_REPLACE(#{orderDetail.grossArea},'\\.0+$','')
            </if>
            <if test="orderDetail.computeArea != null and orderDetail.computeArea != ''">
                and od.compute_area regexp REGEXP_REPLACE(#{orderDetail.computeArea},'\\.0+$','')
            </if>
            <if test="orderDetail.computeGrossArea != null and orderDetail.computeGrossArea != ''">
                and od.compute_gross_area regexp REGEXP_REPLACE(#{orderDetail.computeGrossArea},'\\.0+$','')
            </if>
            <if test="orderDetail.processingNote != null and orderDetail.processingNote != ''">
                and od.processing_note regexp #{orderDetail.processingNote}
            </if>
            <if test="orderDetail.edgingType != null and orderDetail.edgingType != ''">
                and od.edging_type regexp #{orderDetail.edgingType}
            </if>
            <if test="orderDetail.perimeter != null and orderDetail.perimeter != ''">
                and od.perimeter regexp #{orderDetail.perimeter}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectShippingOrderDetailsPageTotal">
        select
        CEILING(count(od.id)/#{pageSize})
        from sd.order_detail od
        left join sd.`order` o on od.order_id = o.order_id
        left join mm.finished_goods_inventory fgi
        on od.order_id = fgi.order_id and od.order_number = fgi.order_number
        <where>
            fgi.quantity_available > 0 and od.quantity > od.delivery_num
            <if test="orderDetail.orderId != null and orderDetail.orderId != ''">
                and od.order_id regexp #{orderDetail.orderId}
            </if>
            <if test="orderDetail.order.batch != null and orderDetail.order.batch != ''">
                and o.batch regexp #{orderDetail.order.batch}
            </if>
            <if test="orderDetail.finishedGoodsInventory.quantityAvailable != null and orderDetail.finishedGoodsInventory.quantityAvailable != ''">
                and fgi.quantity_available regexp #{orderDetail.finishedGoodsInventory.quantityAvailable}
            </if>
            <if test="orderDetail.quantity != null and orderDetail.quantity != ''">
                and od.quantity regexp #{orderDetail.quantity}
            </if>
            <if test="orderDetail.deliveryNum != null and orderDetail.deliveryNum != ''">
                and od.delivery_num regexp #{orderDetail.deliveryNum}
            </if>
            <if test="orderDetail.buildingNumber != null and orderDetail.buildingNumber != ''">
                and od.building_number regexp #{orderDetail.buildingNumber}
            </if>
            <if test="orderDetail.productId != null and orderDetail.productId != ''">
                and od.product_id regexp #{orderDetail.productId}
            </if>
            <if test="orderDetail.productName != null and orderDetail.productName != ''">
                and od.product_name regexp #{orderDetail.productName}
            </if>
            <if test="orderDetail.price != null and orderDetail.price != ''">
                and od.price regexp  REGEXP_REPLACE(#{orderDetail.price},'\\.0+$','')
            </if>
            <if test="orderDetail.finishedGoodsInventory.storageRegion != null and orderDetail.finishedGoodsInventory.storageRegion != ''">
                and fgi.storage_region regexp #{orderDetail.finishedGoodsInventory.storageRegion}
            </if>
            <if test="orderDetail.width != null and orderDetail.width != ''">
                and od.width regexp REGEXP_REPLACE(#{orderDetail.width},'\\.0+$','')
            </if>
            <if test="orderDetail.height != null and orderDetail.height != ''">
                and od.height regexp REGEXP_REPLACE(#{orderDetail.height},'\\.0+$','')
            </if>
            <if test="orderDetail.shape != null and orderDetail.shape != ''">
                and od.shape regexp #{orderDetail.shape}
            </if>
            <if test="orderDetail.finishedGoodsInventory.actualSignalArea != null and orderDetail.finishedGoodsInventory.actualSignalArea != ''">
                and fgi.actual_signal_area regexp REGEXP_REPLACE(#{orderDetail.finishedGoodsInventory.actualSignalArea},'\\.0+$','')
            </if>
            <if test="orderDetail.grossArea != null and orderDetail.grossArea != ''">
                and od.gross_area regexp REGEXP_REPLACE(#{orderDetail.grossArea},'\\.0+$','')
            </if>
            <if test="orderDetail.computeArea != null and orderDetail.computeArea != ''">
                and od.compute_area regexp REGEXP_REPLACE(#{orderDetail.computeArea},'\\.0+$','')
            </if>
            <if test="orderDetail.computeGrossArea != null and orderDetail.computeGrossArea != ''">
                and od.compute_gross_area regexp REGEXP_REPLACE(#{orderDetail.computeGrossArea},'\\.0+$','')
            </if>
            <if test="orderDetail.processingNote != null and orderDetail.processingNote != ''">
                and od.processing_note regexp #{orderDetail.processingNote}
            </if>
            <if test="orderDetail.edgingType != null and orderDetail.edgingType != ''">
                and od.edging_type regexp #{orderDetail.edgingType}
            </if>
            <if test="orderDetail.perimeter != null and orderDetail.perimeter != ''">
                and od.perimeter regexp #{orderDetail.perimeter}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectDeliveryDetailReport" resultMap="selectDeliveryDetail">
        select dd.delivery_id,
        dd.delivery_number,
        d.payment_terms,
        d.project,
        d.customer_id,
        d.customer_name,
        d.delivery_date,
        d.pay_method,
        d.pay_date,
        d.salesman,
        d.creator,
        d.contacts,
        d.contact_number,
        d.delivery_address,
        dd.order_id,
        dd.order_number,
        dd.area,
        dd.money,
        dd.quantity,
        dd.delivery_detail_remakes,
        dd.create_time
        from sd.delivery_detail dd
        left join sd.delivery d on dd.delivery_id=d.delivery_id
        <where>
               and date(dd.create_time)>=#{startDate} and date(dd.create_time) &lt;= #{endDate}
            <if test="deliveryDetail.deliveryId != null and deliveryDetail.deliveryId != ''">
                and dd.delivery_id like concat('%',#{deliveryDetail.deliveryId},'%')
            </if>
            <if test="deliveryDetail.deliveryNumber != null and deliveryDetail.deliveryNumber != ''">
                and dd.delivery_number like concat('%',#{deliveryDetail.deliveryNumber},'%')
            </if>
            <if test="deliveryDetail.orderId != null and deliveryDetail.orderId != ''">
                and dd.order_id like concat('%', #{deliveryDetail.orderId},'%')
            </if>
            <if test="deliveryDetail.orderNumber != null and deliveryDetail.orderNumber != ''">
                and dd.order_number like concat('%', #{deliveryDetail.orderNumber},'%')
            </if>
            <if test="deliveryDetail.area != null and deliveryDetail.area != ''">
                and dd.area like concat('%', #{deliveryDetail.area},'%')
            </if>
            <if test="deliveryDetail.money != null and deliveryDetail.money != ''">
                and dd.money like concat('%', #{deliveryDetail.money},'%')
            </if>
            <if test="deliveryDetail.quantity != null and deliveryDetail.quantity != ''">
                and dd.quantity like concat('%', #{deliveryDetail.quantity},'%')
            </if>
            <if test="deliveryDetail.deliveryDetailRemakes != null and deliveryDetail.deliveryDetailRemakes != ''">
                and dd.delivery_detail_remakes like concat('%', #{deliveryDetail.deliveryDetailRemakes},'%')
            </if>
            <if test="deliveryDetail.createTime != null and deliveryDetail.createTime != ''">
                and dd.create_time like concat('%', #{deliveryDetail.createTime},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.paymentTerms != null and deliveryDetail.delivery.paymentTerms != '')">
                and d.payment_terms like concat('%', #{deliveryDetail.delivery.paymentTerms},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.project != null and deliveryDetail.delivery.project != '')">
                and d.project like concat('%', #{deliveryDetail.delivery.project},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.customerId != null and deliveryDetail.delivery.customerId != '')">
                and d.customer_id like concat('%', #{deliveryDetail.delivery.customerId},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.customerName != null and deliveryDetail.delivery.customerName != '')">
                and d.customer_name like concat('%', #{deliveryDetail.delivery.customerName},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.deliveryDate != null and deliveryDetail.delivery.deliveryDate != '')">
                and d.delivery_date like concat('%', #{deliveryDetail.delivery.deliveryDate},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.payMethod != null and deliveryDetail.delivery.payMethod != '')">
                and d.pay_method like concat('%', #{deliveryDetail.delivery.payMethod},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.payDate != null and deliveryDetail.delivery.payDate != '')">
                and d.pay_date like concat('%', #{deliveryDetail.delivery.payDate},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.salesman != null and deliveryDetail.delivery.salesman != '')">
                and d.salesman like concat('%', #{deliveryDetail.delivery.salesman},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.creator != null and deliveryDetail.delivery.creator != '')">
                and d.creator like concat('%', #{deliveryDetail.delivery.creator},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.contacts != null and deliveryDetail.delivery.contacts != '')">
                and d.contacts like concat('%', #{deliveryDetail.delivery.contacts},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.contactNumber != null and deliveryDetail.delivery.contactNumber != '')">
                and d.contact_number like concat('%', #{deliveryDetail.delivery.contactNumber},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.deliveryAddress != null and deliveryDetail.delivery.deliveryAddress != '')">
                and d.delivery_address like concat('%', #{deliveryDetail.delivery.deliveryAddress},'%')
            </if>
        </where>
        order by dd.delivery_id,dd.delivery_number
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectDeliveryDetailReportPageTotal">
        select CEILING(count(dd.id)/#{pageSize}) as 'pageTotal',
        count(dd.id) as 'total'
        from sd.delivery_detail dd
        left join sd.delivery d on dd.delivery_id=d.delivery_id
        <where>
            and date(dd.create_time)>=#{startDate} and date(dd.create_time) &lt;= #{endDate}
            <if test="deliveryDetail.deliveryId != null and deliveryDetail.deliveryId != ''">
                and dd.delivery_id like concat('%',#{deliveryDetail.deliveryId},'%')
            </if>
            <if test="deliveryDetail.deliveryNumber != null and deliveryDetail.deliveryNumber != ''">
                and dd.delivery_number like concat('%',#{deliveryDetail.deliveryNumber},'%')
            </if>
            <if test="deliveryDetail.orderId != null and deliveryDetail.orderId != ''">
                and dd.order_id like concat('%', #{deliveryDetail.orderId},'%')
            </if>
            <if test="deliveryDetail.orderNumber != null and deliveryDetail.orderNumber != ''">
                and dd.order_number like concat('%', #{deliveryDetail.orderNumber},'%')
            </if>
            <if test="deliveryDetail.area != null and deliveryDetail.area != ''">
                and dd.area like concat('%', #{deliveryDetail.area},'%')
            </if>
            <if test="deliveryDetail.money != null and deliveryDetail.money != ''">
                and dd.money like concat('%', #{deliveryDetail.money},'%')
            </if>
            <if test="deliveryDetail.quantity != null and deliveryDetail.quantity != ''">
                and dd.quantity like concat('%', #{deliveryDetail.quantity},'%')
            </if>
            <if test="deliveryDetail.deliveryDetailRemakes != null and deliveryDetail.deliveryDetailRemakes != ''">
                and dd.delivery_detail_remakes like concat('%', #{deliveryDetail.deliveryDetailRemakes},'%')
            </if>
            <if test="deliveryDetail.createTime != null and deliveryDetail.createTime != ''">
                and dd.create_time like concat('%', #{deliveryDetail.createTime},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.paymentTerms != null and deliveryDetail.delivery.paymentTerms != '')">
                and d.payment_terms like concat('%', #{deliveryDetail.delivery.paymentTerms},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.project != null and deliveryDetail.delivery.project != '')">
                and d.project like concat('%', #{deliveryDetail.delivery.project},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.customerId != null and deliveryDetail.delivery.customerId != '')">
                and d.customer_id like concat('%', #{deliveryDetail.delivery.customerId},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.customerName != null and deliveryDetail.delivery.customerName != '')">
                and d.customer_name like concat('%', #{deliveryDetail.delivery.customerName},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.deliveryDate != null and deliveryDetail.delivery.deliveryDate != '')">
                and d.delivery_date like concat('%', #{deliveryDetail.delivery.deliveryDate},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.payMethod != null and deliveryDetail.delivery.payMethod != '')">
                and d.pay_method like concat('%', #{deliveryDetail.delivery.payMethod},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.payDate != null and deliveryDetail.delivery.payDate != '')">
                and d.pay_date like concat('%', #{deliveryDetail.delivery.payDate},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.salesman != null and deliveryDetail.delivery.salesman != '')">
                and d.salesman like concat('%', #{deliveryDetail.delivery.salesman},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.creator != null and deliveryDetail.delivery.creator != '')">
                and d.creator like concat('%', #{deliveryDetail.delivery.creator},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.contacts != null and deliveryDetail.delivery.contacts != '')">
                and d.contacts like concat('%', #{deliveryDetail.delivery.contacts},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.contactNumber != null and deliveryDetail.delivery.contactNumber != '')">
                and d.contact_number like concat('%', #{deliveryDetail.delivery.contactNumber},'%')
            </if>
            <if test="deliveryDetail.delivery!=null and (deliveryDetail.delivery.deliveryAddress != null and deliveryDetail.delivery.deliveryAddress != '')">
                and d.delivery_address like concat('%', #{deliveryDetail.delivery.deliveryAddress},'%')
            </if>
        </where>
        order by dd.delivery_id,dd.delivery_number
    </select>
    <select id="getSelectDeliveryPrinting" resultMap="selectDeliveryDetailOrderDetail" >
        select dd.delivery_id,od.order_id,od.product_id,od.product_name,sum(dd.area) as area,sum(dd.money) as money,sum(dd.quantity) as quantity from
        delivery_detail dd left join order_detail od on dd.order_id=od.order_id and dd.order_number=od.order_number
        <where>
            <if test="deliveryDetail.deliveryId != null and deliveryDetail.deliveryId != ''">
                and dd.delivery_id like concat('%',#{deliveryDetail.deliveryId},'%')
            </if>
        </where>
        group by od.order_id,od.product_name,od.product_id
    </select>
    <select id="getSelectDeliveryDetailPrinting" >
        select od.order_id,
               od.order_number,
               od.product_name,
               od.width,
               od.height,
               dd.quantity,
               dd.money,
               dd.area,
               ifnull(od.processing_note,"") as processingNote,
               ifnull(od.building_number,"") as buildingNumber,
               od.price
        from delivery_detail dd
                 left join order_detail od on dd.order_id = od.order_id and dd.order_number = od.order_number
        where delivery_id = #{deliveryId}
          and od.order_id = #{orderId}
          and od.product_id = #{productId}
    </select>
</mapper>
north-glass-erp/target/classes/mapper/sd/DeliveryMapper.xml
New file
@@ -0,0 +1,311 @@
<?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.example.erp.mapper.sd.DeliveryMapper">
    <resultMap id="selectOrderInventory" type="com.example.erp.entity.sd.Order">
        <result column="create_order" property="createOrder"/>
        <result column="process_review" property="processReview"/>
        <result column="order_review" property="orderReview"/>
        <result column="production_order" property="productionOrder"/>
        <result column="processing_card" property="processingCard"/>
        <result column="warehousing" property="warehousing"/>
        <result column="delivery" property="delivery"/>
        <result column="order_id" property="orderId"/>
        <result column="customer_id" property="customerId"/>
        <result column="customer_name" property="customerName"/>
        <result column="quantity" property="quantity"/>
        <result column="project" property="project"/>
        <result column="batch" property="batch"/>
        <result column="money" property="money"/>
        <result column="area" property="area"/>
        <result column="create_time" property="createTime"/>
        <result column="pack_type" property="packType"/>
        <result column="order_type" property="orderType"/>
        <result column="creator" property="creator"/>
        <result column="quantity_available" property="finishedGoodsInventory.quantityAvailable"/>
    </resultMap>
    <delete id="deleteDelivery">
        delete from sd.delivery where delivery_id=#{deliveryId}
    </delete>
    <update id="updateDeliveryToExamine">
        update sd.delivery set delivery_state=#{deliveryState} where delivery_id=#{deliveryId}
    </update>
    <update id="updatedelivery">
        update sd.delivery set area=#{area},quantity=#{quantity},money=#{money} where delivery_id=#{oddNumber}
    </update>
    <select id="getmaximum" >
        select count(*) from sd.delivery where  date(create_time)=CURDATE()
    </select>
    <select id="getDeliveryConut" >
        select count(*) from sd.delivery where  delivery_id=#{deliveryId}
    </select>
    <insert id="insertDelivery"  useGeneratedKeys="true" >
        insert into sd.delivery(delivery_state,stock_state,payment_terms,delivery_id,order_id,project,customer_id,customer_name,
            delivery_date,pay_method,pay_date,salesman_id,salesman,creator_id,creator,contacts,contact_number,delivery_address,
                                area,quantity,money,remarks,create_time)
        values (
                   0,0,#{delivery.paymentTerms},#{number} ,#{orderId},#{delivery.project},#{delivery.customerId},#{delivery.customerName},#{delivery.deliveryDate},#{delivery.payMethod},
                #{delivery.payDate},#{delivery.salesmanId},#{delivery.salesman},#{delivery.creatorId},#{delivery.creator},#{delivery.contacts},#{delivery.contactNumber},#{delivery.deliveryAddress},
                   0,0,0,#{delivery.remarks},now()
               )
    </insert>
    <select id="getSelectOrderInventory" resultMap="selectOrderInventory">
        select o.create_order,
        o.process_review,
        o.order_review,
        o.production_order,
        o.processing_card,
        o.warehousing,
        o.delivery,
        o.order_id,
        o.customer_id,
        o.customer_name,
        o.quantity,
        sum(fgi.quantity_available) as quantity_available,
        o.project,
        o.batch,
        o.money,
        o.area,
        o.create_time,
        o.pack_type,
        o.order_type,
        o.creator
        from sd.`order` o
        left join mm.finished_goods_inventory fgi on o.order_id = fgi.order_id
        <where>
            fgi.quantity_available > 0 and date(o.create_time)>=#{startDate} and date(o.create_time) &lt;= #{endDate}
            <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 #{order.customerId}
            </if>
            <if test="order.customerName != null and order.customerName != ''">
                and o.customer_name REGEXP #{order.customerName}
            </if>
            <if test="order.quantity != null and order.quantity != ''">
                and o.quantity REGEXP #{order.quantity}
            </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.money != null and order.money != ''">
                and o.money REGEXP REGEXP_REPLACE(#{order.money},'\\.0+$','')
            </if>
            <if test="order.area != null and order.area != ''">
                and o.area REGEXP REGEXP_REPLACE(#{order.area},'\\.0+$','')
            </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.creator != null and order.creator != ''">
                and o.creator REGEXP #{order.creator}
            </if>
            <if test="order.createTime != null and order.createTime != ''">
                and o.create_time REGEXP #{order.createTime}
            </if>
            <if test="order.finishedGoodsInventory.quantityAvailable != null and order.finishedGoodsInventory.quantityAvailable != ''">
                and fgi.quantity_available REGEXP #{order.finishedGoodsInventory.quantityAvailable}
            </if>
        </where>
        group by o.order_id order by o.id desc
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectOrderInventoryPageTotal" >
        select CEILING(count(zu.order_id)/#{pageSize}) as 'pageTotal',
        count(zu.order_id) as 'total' from
        (select o.create_order,o.process_review,o.order_review,o.production_order,
        o.processing_card,o.warehousing,o.delivery,o.order_id,o.customer_id,
        o.customer_name,o.quantity,sum(fgi.quantity_available),o.project,o.batch,
        o.money,o.area,o.create_time,o.pack_type,o.order_type,o.creator
        from sd.`order` o left join mm.finished_goods_inventory fgi on o.order_id=fgi.order_id
        <where>
            fgi.quantity_available > 0 and date(o.create_time)>=#{startDate} and date(o.create_time) &lt;= #{endDate}
            <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 #{order.customerId}
            </if>
            <if test="order.customerName != null and order.customerName != ''">
                and o.customer_name REGEXP #{order.customerName}
            </if>
            <if test="order.quantity != null and order.quantity != ''">
                and o.quantity REGEXP #{order.quantity}
            </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.money != null and order.money != ''">
                and o.money REGEXP REGEXP_REPLACE(#{order.money},'\\.0+$','')
            </if>
            <if test="order.area != null and order.area != ''">
                and o.area REGEXP REGEXP_REPLACE(#{order.area},'\\.0+$','')
            </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.creator != null and order.creator != ''">
                and o.creator REGEXP #{order.creator}
            </if>
            <if test="order.createTime != null and order.createTime != ''">
                and o.create_time REGEXP #{order.createTime}
            </if>
            <if test="order.finishedGoodsInventory.quantityAvailable != null and order.finishedGoodsInventory.quantityAvailable != ''">
                and fgi.quantity_available REGEXP #{order.finishedGoodsInventory.quantityAvailable}
            </if>
        </where>
        group by o.order_id limit #{offset},#{pageSize}) as zu;
    </select>
    <select id="getSelectShippingOrderDetailDelivery" >
        select
        d.delivery_state,d.stock_state,d.payment_terms,
        d.customer_id,d.customer_name,d.project,d.pay_method,d.pay_date,d.contacts,d.contact_number,
        d.delivery_address,d.remarks,d.create_time,d.delivery_date,d.creator,d.salesman,d.salesman_id
        from sd.delivery d
        <where>
            <if test="orderDetail.deliveryDetail.deliveryId != null and orderDetail.deliveryDetail.deliveryId != ''">
                and d.delivery_id regexp #{orderDetail.deliveryDetail.deliveryId}
            </if>
        </where>
        limit 0,1
    </select>
    <select id="getSelectShippingOrderDetailDeliveryPrinting" >
        select
        d.delivery_id,d.quantity,d.money,d.area,d.project,
        d.customer_id,d.customer_name,d.project,d.pay_method,d.pay_date,d.contacts,d.contact_number,
        d.delivery_address,d.remarks,d.create_time,d.delivery_date,d.creator,d.salesman,d.salesman_id
        from sd.delivery d
        <where>
            <if test="deliveryDetail.deliveryId != null and deliveryDetail.deliveryId != ''">
                and d.delivery_id like concat('%',#{deliveryDetail.deliveryId},'%')
            </if>
        </where>
    </select>
    <select id="getSelectShippingOrderDetailDeliverys" >
        select customer_id,customer_name,project,salesman,salesman_id,contacts,contact_number,delivery_address from sd.`order`
        <where>
            <if test="orderDetail.orderId != null and orderDetail.orderId != ''">
                and order_id regexp #{orderDetail.orderId}
            </if>
         </where>
        limit 0,1
    </select>
    <select id="getSelectShippingOrder">
        select * from sd.delivery d
        <where>
            date(d.create_time)>=#{startDate} and date(d.create_time) &lt;= #{endDate}
            <if test="delivery.deliveryId != null and delivery.deliveryId != ''">
                and d.delivery_id regexp #{delivery.deliveryId}
            </if>
            <if test="delivery.creator != null and delivery.creator != ''">
                and d.creator regexp #{delivery.creator}
            </if>
            <if test="delivery.deliveryDate != null and delivery.deliveryDate != ''">
                and d.delivery_date regexp #{delivery.deliveryDate}
            </if>
            <if test="delivery.customerId != null and delivery.customerId != ''">
                and d.customer_id regexp #{delivery.customerId}
            </if>
            <if test="delivery.customerName != null and delivery.customerName != ''">
                and d.customer_name regexp #{delivery.customerName}
            </if>
            <if test="delivery.project != null and delivery.project != ''">
                and d.project regexp #{delivery.project}
            </if>
            <if test="delivery.orderId != null and delivery.orderId != ''">
                and d.order_id regexp #{delivery.orderId}
            </if>
            <if test="delivery.payMethod != null and delivery.payMethod != ''">
                and d.pay_method regexp #{delivery.payMethod}
            </if>
            <if test="delivery.quantity != null and delivery.quantity != ''">
                and d.quantity regexp #{delivery.quantity}
            </if>
            <if test="delivery.area != null and delivery.area != ''">
                and d.area regexp REGEXP_REPLACE(#{delivery.area},'\\.0+$','')
            </if>
            </where>
        order by d.id desc
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectShippingOrderPageTotal">
        select
            CEILING(count(id)/#{pageSize}) as 'pageTotal',
            count(id) as 'total'
        from sd.delivery d
        <where>
            date(d.create_time)>=#{startDate} and date(d.create_time) &lt;= #{endDate}
            <if test="delivery.deliveryId != null and delivery.deliveryId != ''">
                and d.delivery_id regexp #{delivery.deliveryId}
            </if>
            <if test="delivery.creator != null and delivery.creator != ''">
                and d.creator regexp #{delivery.creator}
            </if>
            <if test="delivery.deliveryDate != null and delivery.deliveryDate != ''">
                and d.delivery_date regexp #{delivery.deliveryDate}
            </if>
            <if test="delivery.customerId != null and delivery.customerId != ''">
                and d.customer_id regexp #{delivery.customerId}
            </if>
            <if test="delivery.customerName != null and delivery.customerName != ''">
                and d.customer_name regexp #{delivery.customerName}
            </if>
            <if test="delivery.project != null and delivery.project != ''">
                and d.project regexp #{delivery.project}
            </if>
            <if test="delivery.orderId != null and delivery.orderId != ''">
                and d.order_id regexp #{delivery.orderId}
            </if>
            <if test="delivery.payMethod != null and delivery.payMethod != ''">
                and d.pay_method regexp #{delivery.payMethod}
            </if>
            <if test="delivery.quantity != null and delivery.quantity != ''">
                and d.quantity regexp #{delivery.quantity}
            </if>
            <if test="delivery.area != null and delivery.area != ''">
                and d.area regexp REGEXP_REPLACE(#{delivery.area},'\\.0+$','')
            </if>
        </where>
        limit #{offset},#{pageSize};
</select>
</mapper>
north-glass-erp/target/classes/mapper/sd/OrderDetailMapper.xml
New file
@@ -0,0 +1,414 @@
<?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.example.erp.mapper.sd.OrderDetailMapper">
    <insert id="insertBatch" parameterType="java.util.List">
        INSERT INTO
            order_detail (order_id,
                            order_number,
                            building_number,
                            product_id,
                            product_name,
                            price,
                            quantity,
                            gross_amount,
                            width,
                            height,
                            shape,
                            area,
                            gross_area,
                            compute_area,
                            compute_gross_area,
                            processing_note,
                            remarks,
                            bend_radius,
                            edging_type,
                            weight,
                            perimeter,
                            other_columns
                          )
        values
        <foreach collection ="orderDetails" item="orderDetail" separator =",">
            (#{orderDetail.orderId},
            #{orderDetail.orderNumber},
            #{orderDetail.buildingNumber},
            #{orderDetail.productId},
            #{orderDetail.productName},
            #{orderDetail.price},
            #{orderDetail.quantity},
            #{orderDetail.grossAmount},
            #{orderDetail.width},
            #{orderDetail.height},
            #{orderDetail.shape},
            #{orderDetail.area},
            #{orderDetail.grossArea},
            #{orderDetail.computeArea},
            #{orderDetail.computeGrossArea},
            #{orderDetail.processingNote},
            #{orderDetail.remarks},
            #{orderDetail.bendRadius},
            #{orderDetail.edgingType},
            #{orderDetail.weight},
            #{orderDetail.perimeter},
            #{orderDetail.otherColumns}
             )
        </foreach>
    </insert>
    <update id="updateOrderMoney" parameterType="java.util.List">
        <foreach collection="orderDetails"  item="item" index="index" open="" close="" separator=";">
            update order_detail as a
            set
                a.price = #{item.price},
                a.gross_amount = #{item.grossAmount}
            where
                a.order_id = #{item.orderId} and
                a.order_number =  #{item.orderNumber}
        </foreach>
    </update>
    <resultMap id="orderMap" type="com.example.erp.entity.sd.OrderDetail">
        <result column="order_number" property="orderNumber"/>
        <result column="product_id" property="productId"/>
        <result column="product_name" property="productName"/>
        <result column="price" property="price"/>
        <result column="width" property="width"/>
        <result column="height" property="height"/>
        <result column="quantity" property="quantity"/>
        <result column="bend_radius" property="bendRadius"/>
        <result column="gross_area" property="grossArea"/>
        <result column="compute_gross_area" property="computeGrossArea"/>
        <result column="shape" property="shape"/>
        <result column="edging_type" property="edgingType"/>
        <result column="processing_note" property="processingNote"/>
        <result column="remarks" property="remarks"/>
        <result column="perimeter" property="perimeter"/>
        <result column="gross_amount" property="grossAmount"/>
        <result column="levelOne" property="levelOne"/>
        <result column="levelTwo" property="levelTwo"/>
        <result column="total_thickness" property="totalThickness"/>
        <result column="createTime" property="createTime"/>
        <result column="order_type" property="order.orderType"/>
        <result column="customer_name" property="order.customerName"/>
        <result column="project" property="order.project"/>
        <result column="order_id" property="order.orderId"/>
        <result column="batch" property="order.batch"/>
        <result column="b.processing_note" property="order.processingNote"/>
        <result column="icon" property="order.icon"/>
        <result column="packType" property="order.packType"/>
        <result column="salesman" property="order.salesman"/>
        <result column="delivery_address" property="order.deliveryAddress"/>
        <result column="creator" property="order.creator"/>
        <result column="verifier" property="order.verifier"/>
        <result column="customer_batch" property="order.customerBatch"/>
    </resultMap>
    <select id="getOrderReport" resultMap="orderMap">
        SELECT
            *,
            a.create_time as createTime,
            d.type_name as levelOne,
            e.type_name as levelTwo
        from order_detail as a
        left join sd.`order` as b
            on b.order_id = a.order_id
        left join sd.product as c
            on c.id = a.product_id
        left join sd.basic_glass_type as d
            on d.type_id = c.type_id
        left join sd.basic_glass_type as e
            on e.type_id = d.belong
        where  date(b.create_time)>=#{startDate} and date(b.create_time) &lt;= #{endDate}
        <if test="orderDetail.order!=null and (orderDetail.order.orderType != null and orderDetail.order.orderType != '')">
            and b.order_type like concat('%',#{orderDetail.order.orderType},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.customerId != null and orderDetail.order.customerId != ''">
            and b.customer_id like concat('%',#{orderDetail.order.customerId},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.project != null and orderDetail.order.project != ''">
            and b.project like concat('%',#{orderDetail.order.project},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.orderId != null and orderDetail.order.orderId != ''">
            and b.order_id like concat('%',#{orderDetail.order.orderId},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.batch != null and orderDetail.order.batch != ''">
            and b.batch like concat('%',#{orderDetail.order.batch},'%')
        </if>
        <if test="orderDetail.productId != null and orderDetail.productId != ''">
            and a.product_id like concat('%',#{orderDetail.productId},'%')
        </if>
        <if test="orderDetail.productName != null and orderDetail.productName != ''">
            and a.product_name like concat('%',#{orderDetail.productName},'%')
        </if>
        <if test="orderDetail.orderNumber != null and orderDetail.orderNumber != ''">
            and a.order_number like concat('%',#{orderDetail.orderNumber},'%')
        </if>
        <if test="orderDetail.width != null and orderDetail.width != ''">
            and a.width like concat('%',#{orderDetail.width},'%')
        </if>
        <if test="orderDetail.height != null and orderDetail.height != ''">
            and a.height like concat('%',#{orderDetail.height},'%')
        </if>
        <if test="orderDetail.quantity != null and orderDetail.quantity != ''">
            and a.quantity like concat('%',#{orderDetail.quantity},'%')
        </if>
        <if test="orderDetail.bendRadius != null and orderDetail.bendRadius != ''">
            and a.bend_radius like concat('%',#{orderDetail.bendRadius},'%')
        </if>
        <if test="orderDetail.grossArea != null and orderDetail.grossArea != ''">
            and a.gross_area like concat('%',#{orderDetail.grossArea},'%')
        </if>
        <if test="orderDetail.computeGrossArea != null and orderDetail.computeGrossArea != ''">
            and a.compute_gross_area like concat('%',#{orderDetail.computeGrossArea},'%')
        </if>
        <if test="orderDetail.shape != null and orderDetail.shape != ''">
            and a.shape like concat('%',#{orderDetail.shape},'%')
        </if>
        <if test="orderDetail.edgingType != null and orderDetail.edgingType != ''">
            and a.edging_type like concat('%',#{orderDetail.edgingType},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.processingNote != null and orderDetail.order.processingNote != ''">
            and b.processing_note like concat('%',#{orderDetail.order.processingNote},'%')
        </if>
        <if test="orderDetail.processingNote != null and orderDetail.processingNote != ''">
            and a.processing_note like concat('%',#{orderDetail.processingNote},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.icon != null and orderDetail.order.icon != ''">
            and b.icon like concat('%',#{orderDetail.order.icon},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.packType != null and orderDetail.order.packType != ''">
            and b.pack_type like concat('%',#{orderDetail.order.packType},'%')
        </if>
        <if test="orderDetail.perimeter != null and orderDetail.perimeter != ''">
            and a.perimeter like concat('%',#{orderDetail.perimeter},'%')
        </if>
        <if test="orderDetail.price != null and orderDetail.price != ''">
            and a.price like concat('%',#{orderDetail.price},'%')
        </if>
        <if test="orderDetail.grossAmount != null and orderDetail.grossAmount != ''">
            and a.gross_amount like concat('%',#{orderDetail.grossAmount},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.alType != null and orderDetail.order.alType != ''">
            and b.al_type like concat('%',#{orderDetail.order.alType},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.salesman != null and orderDetail.order.salesman != ''">
            and b.salesman like concat('%',#{orderDetail.order.salesman},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.deliveryAddress != null and orderDetail.order.deliveryAddress != ''">
            and b.delivery_address like concat('%',#{orderDetail.order.deliveryAddress},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.creator != null and orderDetail.order.creator != ''">
            and b.creator like concat('%',#{orderDetail.order.creator},'%')
        </if>
        <if test="orderDetail.totalThickness != null and orderDetail.totalThickness != ''">
            and c.total_thickness like concat('%',#{orderDetail.totalThickness},'%')
        </if>
        <if test="orderDetail.levelOne != null and orderDetail.levelOne != ''">
            and d.type_name like concat('%',#{orderDetail.levelOne},'%')
        </if>
        <if test="orderDetail.levelTwo != null and orderDetail.levelTwo != ''">
            and e.type_name like concat('%',#{orderDetail.levelTwo},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.customerBatch != null and orderDetail.order.customerBatch != ''">
            and b.customer_batch like concat('%',#{orderDetail.order.customerBatch},'%')
        </if>
        order by a.id desc
        limit #{offset},#{pageSize}
    </select>
    <select id="getOrderReportTotal" >
        SELECT
            CEILING(count(a.id)/#{pageSize}) as 'pageTotal',
            count(a.id) as 'total'
        from order_detail as a
                 left join sd.`order` as b
                           on b.order_id = a.order_id
                 left join sd.product as c
                           on c.id = a.product_id
                 left join sd.basic_glass_type as d
                           on d.type_id = c.type_id
                 left join sd.basic_glass_type as e
                           on e.type_id = d.belong
        where  date(b.create_time)>=#{startDate} and date(b.create_time) &lt;= #{endDate}
        <if test="orderDetail.order!=null and (orderDetail.order.orderType != null and orderDetail.order.orderType != '')">
            and b.order_type like concat('%',#{orderDetail.order.orderType},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.customerId != null and orderDetail.order.customerId != ''">
            and b.customer_id like concat('%',#{orderDetail.order.customerId},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.project != null and orderDetail.order.project != ''">
            and b.project like concat('%',#{orderDetail.order.project},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.orderId != null and orderDetail.order.orderId != ''">
            and b.order_id like concat('%',#{orderDetail.order.orderId},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.batch != null and orderDetail.order.batch != ''">
            and b.batch like concat('%',#{orderDetail.order.batch},'%')
        </if>
        <if test="orderDetail.productId != null and orderDetail.productId != ''">
            and a.product_id like concat('%',#{orderDetail.productId},'%')
        </if>
        <if test="orderDetail.productName != null and orderDetail.productName != ''">
            and a.product_name like concat('%',#{orderDetail.productName},'%')
        </if>
        <if test="orderDetail.orderNumber != null and orderDetail.orderNumber != ''">
            and a.order_number like concat('%',#{orderDetail.orderNumber},'%')
        </if>
        <if test="orderDetail.width != null and orderDetail.width != ''">
            and a.width like concat('%',#{orderDetail.width},'%')
        </if>
        <if test="orderDetail.height != null and orderDetail.height != ''">
            and a.height like concat('%',#{orderDetail.height},'%')
        </if>
        <if test="orderDetail.quantity != null and orderDetail.quantity != ''">
            and a.quantity like concat('%',#{orderDetail.quantity},'%')
        </if>
        <if test="orderDetail.bendRadius != null and orderDetail.bendRadius != ''">
            and a.bend_radius like concat('%',#{orderDetail.bendRadius},'%')
        </if>
        <if test="orderDetail.grossArea != null and orderDetail.grossArea != ''">
            and a.gross_area like concat('%',#{orderDetail.grossArea},'%')
        </if>
        <if test="orderDetail.computeGrossArea != null and orderDetail.computeGrossArea != ''">
            and a.compute_gross_area like concat('%',#{orderDetail.computeGrossArea},'%')
        </if>
        <if test="orderDetail.shape != null and orderDetail.shape != ''">
            and a.shape like concat('%',#{orderDetail.shape},'%')
        </if>
        <if test="orderDetail.edgingType != null and orderDetail.edgingType != ''">
            and a.edging_type like concat('%',#{orderDetail.edgingType},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.processingNote != null and orderDetail.order.processingNote != ''">
            and b.processing_note like concat('%',#{orderDetail.order.processingNote},'%')
        </if>
        <if test="orderDetail.processingNote != null and orderDetail.processingNote != ''">
            and a.processing_note like concat('%',#{orderDetail.processingNote},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.icon != null and orderDetail.order.icon != ''">
            and b.icon like concat('%',#{orderDetail.order.icon},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.packType != null and orderDetail.order.packType != ''">
            and b.pack_type like concat('%',#{orderDetail.order.packType},'%')
        </if>
        <if test="orderDetail.perimeter != null and orderDetail.perimeter != ''">
            and a.perimeter like concat('%',#{orderDetail.perimeter},'%')
        </if>
        <if test="orderDetail.price != null and orderDetail.price != ''">
            and a.price like concat('%',#{orderDetail.price},'%')
        </if>
        <if test="orderDetail.grossAmount != null and orderDetail.grossAmount != ''">
            and a.gross_amount like concat('%',#{orderDetail.grossAmount},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.alType != null and orderDetail.order.alType != ''">
            and b.al_type like concat('%',#{orderDetail.order.alType},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.salesman != null and orderDetail.order.salesman != ''">
            and b.salesman like concat('%',#{orderDetail.order.salesman},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.deliveryAddress != null and orderDetail.order.deliveryAddress != ''">
            and b.delivery_address like concat('%',#{orderDetail.order.deliveryAddress},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.creator != null and orderDetail.order.creator != ''">
            and b.creator like concat('%',#{orderDetail.order.creator},'%')
        </if>
        <if test="orderDetail.totalThickness != null and orderDetail.totalThickness != ''">
            and c.total_thickness like concat('%',#{orderDetail.totalThickness},'%')
        </if>
        <if test="orderDetail.levelOne != null and orderDetail.levelOne != ''">
            and d.type_name like concat('%',#{orderDetail.levelOne},'%')
        </if>
        <if test="orderDetail.levelTwo != null and orderDetail.levelTwo != ''">
            and e.type_name like concat('%',#{orderDetail.levelTwo},'%')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.customerBatch != null and orderDetail.order.customerBatch != ''">
            and b.customer_batch like concat('%',#{orderDetail.order.customerBatch},'%')
        </if>
        order by a.id desc
    </select>
    <select id="exportOrderReport">
        SELECT
            *,
            a.create_time as createTime,
            d.type_name as levelOne,
            e.type_name as levelTwo
        from order_detail as a
         left join sd.`order` as b
                   on b.order_id = a.order_id
         left join sd.product as c
                   on c.id = a.product_id
         left join sd.basic_glass_type as d
                   on d.type_id = c.type_id
         left join sd.basic_glass_type as e
                   on e.type_id = d.belong
    </select>
</mapper>
north-glass-erp/target/classes/mapper/sd/OrderOtherMoneyMapper.xml
New file
@@ -0,0 +1,17 @@
<?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.example.erp.mapper.sd.OrderOtherMoneyMapper">
    <select id="findById">
        select
            a.*,
            b.alias
        from order_other_money as a
        left join  basic_other_money as b
        on a.`column` = b.`column`
        where a.order_id = #{orderId}
    </select>
</mapper>
north-glass-erp/target/classes/mapper/sd/OrderProcessDetailMapper.xml
New file
@@ -0,0 +1,111 @@
<?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.example.erp.mapper.sd.OrderProcessDetailMapper">
    <insert id="insertOrderProcessDetail" >
        insert into
            order_process_detail(
                order_id,
                order_number,
                technology_number,
                process,
                process_id
            )
        values
        <foreach collection ="processDetailList" item="processDetail" separator =",">
            (
             #{processDetail.orderId},
             #{processDetail.orderNumber},
             #{processDetail.technologyNumber},
             #{processDetail.process},
              #{processDetail.processId}
             )
        </foreach>
    </insert>
    <update id="updateQuantity">
        update sd.order_process_detail as a
        inner join
        (select
             rwd.completed_quantity,
             rwd.breakage_quantity,
             rw.process_id,
             rwd.order_number,
             rwd.technology_number
              from pp.reporting_work_detail as rwd
            left join pp.reporting_work as rw
                on rwd.reporting_work_id =  rw.reporting_work_id
            where rwd.reporting_work_id =#{reportingWorkId} )  as b
        on a.process_id = b.process_id
        and a.order_number = b.order_number
        and a.technology_number = b.technology_number
        <if test="type == 'delete'">
            set a.reporting_work_num_count
                = a.reporting_work_num_count-b.completed_quantity,
            a.reporting_work_num
                = a.reporting_work_num-b.completed_quantity,
            a.broken_num
                = a.broken_num-b.breakage_quantity
        </if>
        <if test="type == 'add'">
            set a.reporting_work_num_count
            = a.reporting_work_num_count+b.completed_quantity,
            a.reporting_work_num
            = a.reporting_work_num+b.completed_quantity,
            a.broken_num
            = a.broken_num+b.breakage_quantity
        </if>
        where a.process = #{process}
    </update>
    <!--查询筛选后唯一的流程卡号-->
    <select id="filterOrderProcess">
        select id,process,order_number,technology_number
        from order_process_detail
        where order_id = #{orderId}
        group by process
    </select>
    <select id="filterLastProcess">
        select id,process,order_number,technology_number
        from order_process_detail
        where order_id = #{orderId}
        and order_number = #{orderNumber}
        and technology_number = #{technologyNumber}
        and id &gt; #{id}
        group by process
    </select>
    <select id="getGlassLRow">
        select
             max(a.technology_number) as rowCount,
             RowNum
        from order_process_detail as a
        left join
            (select min((@i:=@i+1)) AS RowNum,c.*
             from sd.order_glass_detail as c,
                  (SELECT @i:=-1) as d
             where order_id = #{orderId}
             GROUP BY order_number
             ) as b
        on b.order_number = a.order_number
        where a.order_id = #{orderId}
        group by a.order_number
    </select>
</mapper>
north-glass-erp/target/classes/mapper/sd/ProductDetailMapper.xml
New file
@@ -0,0 +1,28 @@
<?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.example.erp.mapper.sd.ProductDetailMapper">
    <select id="getGlassDetailList">
        select * from product_detail where prod_id = #{productId} and detail_type = 'glass'
    </select>
    <insert id="insertList">
        insert into product_detail (
            prod_id, sort_num, glass_sort, detail_type, detail, glass_group, process,separation
        )
        values
        <foreach collection ="getProductDetails" item="ProductDetail" separator =",">
            (
                #{ProductDetail.prodId},
                #{ProductDetail.sortNum},
                #{ProductDetail.glassSort},
                #{ProductDetail.detailType},
                #{ProductDetail.detail},
                #{ProductDetail.glassGroup},
                #{ProductDetail.process},
               #{ProductDetail.separation}
                )
        </foreach>
    </insert>
</mapper>
north-glass-erp/target/classes/mapper/sd/ProductMapper.xml
New file
@@ -0,0 +1,110 @@
<?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.example.erp.mapper.sd.ProductMapper">
    <resultMap id="productMap" type="com.example.erp.entity.sd.Product" >
        <id column="id" property="id"/>
        <result column="product_name" property="productName"/>
        <result column="product" property="productName"/>
        <result column="total_thickness" property="totalThickness"/>
        <result column="thickness" property="thickness"/>
        <result column="query" property="query"/>
        <result column="remarks" property="remarks"/>
        <result column="state" property="state"/>
        <result column="creator" property="creator"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
        <!--接收其他外键实体类数据-->
        <association property="basicGlassType" javaType="com.example.erp.entity.sd.BasicGlassType">
            <result column="type_id" property="typeID"/>
            <result column="type_name" property="typeName"/>
        </association>
        <!--<result column="g_typeId" property="glassTypes.typeId"/>
        <result column="g_type" property="glassTypes.type"/>-->
    </resultMap>
    <select id="defaultProduct" resultMap="productMap">
        select a.id ,
        a.product_name,
        a.total_thickness,
        a.thickness,
        a.query,
        a.remarks,
        a.state,
        a.creator,
        date(a.create_time) as create_time,
        a.update_time       as update_time,
        a.type_id         as type_id,
        bgt.type_name
        from product as a
        left join basic_glass_type bgt on bgt.type_id = a.type_id
        <where>
            <if test="glassTypeId != null and glassTypeId != ''">
                and a.type_id regexp #{glassTypeId}
            </if>
            <if test="product.id != null and product.id != ''">
                and a.id regexp #{product.id}
            </if>
            <if test="product.productName != null and product.productName != ''">
                and a.product_name regexp #{product.productName}
            </if>
            <if test="product.basicGlassType.typeName != null and product.basicGlassType.typeName!= ''">
                and bgt.type_name regexp #{product.basicGlassType.typeName}
            </if>
            <if test="product.query != null and product.query != ''">
                and a.query regexp #{product.query}
            </if>
            <if test="product.creator != null and product.creator != ''">
                and a.creator regexp #{product.creator}
            </if>
            <if test="product.createTime != null and product.createTime != ''">
                and date(a.create_time) regexp #{product.createTime}
            </if>
        </where>
        order by id desc
        limit #{offset},#{pageSize}
        ;
    </select>
    <select id="getPageTotal" >
        select
            CEILING(count(a.id)/#{pageSize})
        from product as a
        left join basic_glass_type bgt on bgt.type_id = a.type_id
        <where>
            <if test="glassTypeId != null and glassTypeId != ''">
                and a.type_id regexp #{glassTypeId}
            </if>
            <if test="product.id != null and product.id != ''">
                and a.id regexp #{product.id}
            </if>
            <if test="product.productName != null and product.productName != ''">
                and a.product_name regexp #{product.productName}
            </if>
            <if test="product.basicGlassType.typeName != null and product.basicGlassType.typeName!= ''">
                and bgt.type_name regexp #{product.basicGlassType.typeName}
            </if>
            <if test="product.query != null and product.query != ''">
                and a.query regexp #{product.query}
            </if>
            <if test="product.creator != null and product.creator != ''">
                and a.creator regexp #{product.creator}
            </if>
            <if test="product.createTime != null and product.createTime != ''">
                and date(a.create_time) regexp #{product.createTime}
            </if>
        </where>
        order by a.id desc
        limit #{offset},#{pageSize}
        ;
    </select>
    <update id="updateProductStateById">
        update product set state = #{state} where id = #{id}
    </update>
</mapper>