From f7da0c38c517bde37cd30bc060c11d15ba124d56 Mon Sep 17 00:00:00 2001
From: jyy <935090232@qq.com>
Date: Thu, 28 Jan 2021 14:32:15 +0800
Subject: [PATCH] 1、修复若干问题

---
 zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml |   61 +++++++++++++++++++-----------
 1 files changed, 38 insertions(+), 23 deletions(-)

diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml
index d3edbfd..0053d74 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml
@@ -31,6 +31,7 @@
         <result property="deductionNum" column="deductionNum"/>
         <result property="isCourse" column="is_course"/>
         <result property="timeLength" column="time_length"/>
+        <result property="orderId" column="orderId"/>
         <!-- 对应项目信息-->
         <association property="projInfo" javaType="ShoppingGoods"
                      resultMap="com.matrix.system.hive.dao.ShoppingGoodsDao.ShoppingGoodsMap"/>
@@ -331,10 +332,13 @@
     <select id="selectInPage" resultMap="SysProjUseMap">
         select
         a.*,
+        d.id as orderId,
         b.TIME_LENGTH,
         b.img
         from sys_proj_use a
         left join shopping_goods b on a.proj_id=b.id
+        left join sys_order_item c on a.ORDER_ITEM_ID=c.id
+        left join sys_order d on c.ORDER_ID=d.id
         where 1=1
         <if test="record!=null">
             <if test="record.id != null and record.id !='' ">
@@ -440,70 +444,81 @@
     <!-- 查询总条数 -->
     <select id="selectTotalRecord" resultType="java.lang.Integer">
         select count(*)
-        from sys_proj_use
+        from sys_proj_use a
+        left join shopping_goods b on a.proj_id=b.id
+        left join sys_order_item c on a.ORDER_ITEM_ID=c.id
+        left join sys_order d on c.ORDER_ID=d.id
         where 1=1
         <if test="record!=null">
             <if test="record.id != null and record.id !='' ">
-                and ID = #{record.id}
+                and a.ID = #{record.id}
+            </if>
+            <if test="record.queryKey != null and record.queryKey !='' ">
+                and (instr(b.name, #{record.queryKey}) or instr(b.zjm, #{record.queryKey}) or instr(goods_no, #{record.queryKey}))
             </if>
             <if test="record.orderItemId != null and record.orderItemId !='' ">
-                and ORDER_ITEM_ID = #{record.orderItemId}
+                and a.ORDER_ITEM_ID = #{record.orderItemId}
             </if>
             <if test="record.projId != null and record.projId !='' ">
-                and PROJ_ID = #{record.projId}
+                and a.PROJ_ID = #{record.projId}
             </if>
             <if test="record.surplusCount != null and record.surplusCount !='' ">
-                and SURPLUS_COUNT = #{record.surplusCount}
+                and a.SURPLUS_COUNT = #{record.surplusCount}
             </if>
             <if test="record.isOver != null and record.isOver !='' ">
-                and IS_OVER = #{record.isOver}
+                and a.IS_OVER = #{record.isOver}
             </if>
             <!-- 查询具体某一个套餐的使用情况 -->
             <if
                     test="record.taocanId != null and record.taocanId !=-1 and record.taocanId !=-2">
-                and TAOCAN_ID = #{record.taocanId}
+                and a.TAOCAN_ID = #{record.taocanId}
             </if>
             <!-- 查询所有的项目使用情况 -->
             <if test="record.taocanId != null and record.taocanId ==-1 ">
-                and TAOCAN_ID IS NULL
+                and a.TAOCAN_ID IS NULL
             </if>
             <!-- 查询所有的套餐使用情况 -->
             <if test="record.taocanId != null and record.taocanId ==-2 ">
-                and TAOCAN_ID IS NOT NULL
+                and a.TAOCAN_ID IS NOT NULL
             </if>
             <if test="record.vipId != null and record.vipId !='' ">
-                and VIP_ID = #{record.vipId}
+                and a.VIP_ID = #{record.vipId}
+            </if>
+            <if test="record.failTime != null  ">
+                and a.FAIL_TIME = #{record.failTime}
+            </if>
+            <if test="record.targetFailTime != null  ">
+                and date_format(#{record.targetFailTime}, '%Y-%m-%d') > date_format(a.FAIL_TIME, '%Y-%m-%d')
             </if>
             <if test="record.price != null and record.price !='' ">
-                and PRICE = #{record.price}
+                and a.PRICE = #{record.price}
             </if>
             <if test="record.assembleId != null and record.assembleId !='' ">
-                and ASSEMBLE_ID = #{record.assembleId}
+                and a.ASSEMBLE_ID = #{record.assembleId}
             </if>
             <if test="record.source != null and record.source !='' ">
-                and SOURCE like concat('%',#{record.source},'%')
+                and a.SOURCE like concat('%',#{record.source},'%')
             </if>
             <if test="record.status != null and record.status !='' ">
-                and STATUS = #{record.status}
+                and a.STATUS = #{record.status}
             </if>
             <if test="record.platformFlag != null and record.platformFlag !='' ">
-                and PLATFORM_FLAG = #{record.platformFlag}
-            </if>
-            <if test="record.projName != null and record.projName !='' ">
-                and PROJ_NAME like concat('%',#{record.projName},'%')
+                and a.PLATFORM_FLAG = #{record.platformFlag}
             </if>
             <if test="record.type != null and record.type !='' ">
-                and type = #{record.type}
+                and a.type = #{record.type}
+            </if>
+            <if test="record.projName != null and record.projName !='' ">
+                and a.PROJ_NAME like concat('%',#{record.projName},'%')
             </if>
             <if test="record.balance != null and record.balance !='' ">
-                and balance = #{record.balance}
+                and a.balance = #{record.balance}
             </if>
             <if test="record.remark != null and record.remark !='' ">
-                and remark = #{record.remark}
+                and a.remark = #{record.remark}
             </if>
-
             <if test="record.isCourse != null and record.isCourse !='' ">
-                and   is_course = #{record.isCourse},
+                and  a.is_course = #{record.isCourse},
             </if>
         </if>
     </select>

--
Gitblit v1.9.1