廖井涛
2024-02-22 e4fe69941b2dd4582ec0bd82c32b8dfbc30d85b5
north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
@@ -4,14 +4,23 @@
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.erp.mapper.pp.FlowCardMapper">
    <resultMap id="flowCardMap" type="com.example.erp.entity.pp.FlowCard">
        <result column="order_id" property="orderId"/>
        <result column="process_Id" property="processId"/>
        <result column="binning_quantity" property="binningQuantity"/>
        <result column="founder" property="founder"/>
        <result column="create_time" property="createTime"/>
        <!--接收其他外键实体类数据-->
        <association property="order" javaType="com.example.erp.entity.sd.Order">
            <result column="project" property="project"/>
            <result column="order_id" property="orderId"/>
            <result column="customer_name" property="customerName"/>
            <result column="batch" property="batch"/>
            <result column="other_remarks" property="otherRemarks"/>
            <result column="icon" property="icon"/>
            <result column="order_type" property="orderType"/>
            <result column="salesman" property="salesman"/>
            <result column="processing_note" property="processingNote"/>
            <result column="delivery_address" property="deliveryAddress"/>
        </association>
        <association property="orderDetail" javaType="com.example.erp.entity.sd.OrderDetail">
            <result column="product_id" property="productId"/>
@@ -37,65 +46,88 @@
        c.processing_note
        from flow_card as a left join sd.`order` as b on a.order_Id=b.order_id
        left join sd.order_detail as c on a.order_Id=c.order_id and a.order_Number=c.order_number
        <where>
            <if test="flowCard.orderId != null and flowCard.orderId != ''">
                and a.order_id regexp #{flowCard.orderId}
            </if>
            <if test="flowCard.productionId != null and flowCard.productionId != ''">
                and a.process_Id regexp #{flowCard.productionId}
            </if>
            <if test="flowCard.orderDetail.productId != null and flowCard.orderDetail.productId != ''">
                and c.product_id regexp #{flowCard.orderDetail.productId}
            </if>
            <if test="flowCard.orderDetail.productName != null and flowCard.orderDetail.productName!= ''">
                and c.product_name regexp #{flowCard.orderDetail.productName}
            </if>
       where a.create_time between #{selectTime1} and #{selectTime2}
<!--        <where>-->
<!--            <if test="flowCard.orderId != null and flowCard.orderId != ''">-->
<!--                and a.order_id regexp #{flowCard.orderId}-->
<!--            </if>-->
<!--            <if test="flowCard.productionId != null and flowCard.productionId != ''">-->
<!--                and a.process_Id regexp #{flowCard.productionId}-->
<!--            </if>-->
<!--            <if test="flowCard.orderDetail.productId != null and flowCard.orderDetail.productId != ''">-->
<!--                and c.product_id regexp #{flowCard.orderDetail.productId}-->
<!--            </if>-->
<!--            <if test="flowCard.orderDetail.productName != null and flowCard.orderDetail.productName!= ''">-->
<!--                and c.product_name regexp #{flowCard.orderDetail.productName}-->
<!--            </if>-->
            <if test="flowCard.order.project != null and flowCard.order.project!= ''">
                and b.project regexp #{flowCard.order.project}
            </if>
            <if test="flowCard.createTime != ''">
                and DATE_FORMAT((a.create_time),'%Y-%m-%d') BETWEEN #{ selectTime1 } AND #{ selectTime2 }
            </if>
        </where>
        group by a.process_Id
<!--            <if test="flowCard.order.project != null and flowCard.order.project!= ''">-->
<!--                and b.project regexp #{flowCard.order.project}-->
<!--            </if>-->
<!--            <if test="flowCard.createTime != null and flowCard.createTime != ''">-->
<!--                and DATE_FORMAT((a.create_time),'%Y-%m-%d') BETWEEN #{ selectTime1 } AND #{ selectTime2 }-->
<!--            </if>-->
        ;
<!--        </where>-->
        group by a.process_Id;
    </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-->
    <!--        ;-->
    <!--    </select>-->
    <select id="selectFlowCardMp">
        select o.order_id,
        o.customer_name,
        o.project,
        o.batch,
        o.other_remarks,
        o.icon,
        o.order_type,
        o.salesman,
        o.processing_note,
        o.delivery_address
        from sd.`order`  as o
        where o.create_time between #{selectTime1} and #{selectTime2}
        <!--        <where>-->
        <!--            <if test="flowCard.orderId != null and flowCard.orderId != ''">-->
        <!--                and a.order_id regexp #{flowCard.orderId}-->
        <!--            </if>-->
        <!--            <if test="flowCard.productionId != null and flowCard.productionId != ''">-->
        <!--                and a.process_Id regexp #{flowCard.productionId}-->
        <!--            </if>-->
        <!--            <if test="flowCard.orderDetail.productId != null and flowCard.orderDetail.productId != ''">-->
        <!--                and c.product_id regexp #{flowCard.orderDetail.productId}-->
        <!--            </if>-->
        <!--            <if test="flowCard.orderDetail.productName != null and flowCard.orderDetail.productName!= ''">-->
        <!--                and c.product_name regexp #{flowCard.orderDetail.productName}-->
        <!--            </if>-->
        <!--            <if test="flowCard.order.project != null and flowCard.order.project!= ''">-->
        <!--                and b.project regexp #{flowCard.order.project}-->
        <!--            </if>-->
        <!--            <if test="flowCard.createTime != null and flowCard.createTime != ''">-->
        <!--                and DATE_FORMAT((a.create_time),'%Y-%m-%d') BETWEEN #{ selectTime1 } AND #{ selectTime2 }-->
        <!--            </if>-->
        <!--        </where>-->
      ;
    </select>
    <select id="DetailsSelectMp">
        select od.order_id,
               ogd.production_id,
               od.product_id,
               od.product_name,
               od.quantity,
               od.compute_gross_area,
               od.perimeter
        from sd.order_detail as od
        left join sd.order_glass_detail as ogd
        on od.order_id = ogd.order_id and od.order_number = ogd.order_number
        where od.order_id = #{orderId}
        group by od.order_id,ogd.production_id
    </select>
</mapper>