From 05683f2b2bdbdbe21cf17ad523c21ab338bd1c54 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期二, 19 七月 2022 21:49:55 +0800
Subject: [PATCH] 优化添加设备 功能

---
 java110-db/src/main/resources/mapper/center/CenterServiceDAOImplMapper.xml |  189 ++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 152 insertions(+), 37 deletions(-)

diff --git a/java110-db/src/main/resources/mapper/center/CenterServiceDAOImplMapper.xml b/java110-db/src/main/resources/mapper/center/CenterServiceDAOImplMapper.xml
old mode 100644
new mode 100755
index 904e024..2a1356c
--- a/java110-db/src/main/resources/mapper/center/CenterServiceDAOImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/center/CenterServiceDAOImplMapper.xml
@@ -4,24 +4,89 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="centerServiceDAOImpl">
 
+
+    <!-- 鏌ヨ璁㈠崟淇℃伅 -->
+    <select id="getOrder" resultType="Map" parameterType="Map">
+        SELECT `o_id` oId, `app_id` appId, `ext_transaction_id` extTransactionId, `user_id` userId, `request_time`
+        requestTime,
+        `create_time` createTime,`order_type_cd` orderTypeCd, `finish_time` finishTime, `remark`,t.status_cd statusCd
+        from c_orders t
+        where 1=1
+        <if test="oId != null and oId != ''">
+            and t.o_id = #{oId}
+        </if>
+        <if test="extTransactionId != null and extTransactionId != ''">
+            and t.ext_transaction_id = #{extTransactionId}
+        </if>
+        <if test="appId != null and appId != ''">
+            and t.app_id = #{appId}
+        </if>
+    </select>
+
+    <!-- 鏌ヨ璁㈠崟椤逛俊鎭� -->
+    <select id="getOrderItems" resultType="Map" parameterType="Map">
+        select t.b_id bId,t.o_id oId,t.create_time createTime,t.action,t.action_obj actionObj,
+        t.finish_time finishTime,t.remark,ul.service_name serviceName,ul.log_text logText
+        from c_order_item t
+        LEFT JOIN unitem_log ul on t.b_id = ul.b_id and t.o_id = ul.o_id and ul.status_cd = '0'
+        where 1=1
+        <if test="oId != null and oId != ''">
+            and t.o_id = #{oId}
+        </if>
+        <if test="bId != null and bId != ''">
+            and t.b_id = #{bId}
+        </if>
+    </select>
+
+
     <!--淇濆瓨璁㈠崟淇℃伅 c_orders 涓� -->
     <insert id="saveOrder" parameterType="Map">
         <![CDATA[
 
                     insert into c_orders(o_id,app_id,ext_transaction_id,user_id,request_time,order_type_cd,remark,status_cd)
-                    values(#{oId},#{appId},#{extTransactionId},#{userId},#{requestTime},#{orderTypeCd},#{remark},#{statusCd})
+                    values(#{oId},#{appId},#{extTransactionId},#{userId},#{requestTime},#{orderTypeCd},#{remark},'S')
 
         ]]>
     </insert>
     <!-- 淇濆瓨灞炴�т俊鎭痗_orders_attrs 涓�-->
     <insert id="saveOrderAttrs" parameterType="Map">
         <![CDATA[
-
-                    insert into c_orders_attrs(o_id,attr_id,spec_cd,value)
-                    values(#{oId},#{attrId},#{specCd},#{value})
-
+            insert into c_orders_attrs(o_id,attr_id,spec_cd,value)
+            values(#{oId},#{attrId},#{specCd},#{value})
         ]]>
     </insert>
+
+    <!--淇濆瓨璁㈠崟淇℃伅 c_order_item 涓� -->
+    <insert id="saveOrderItem" parameterType="Map">
+        INSERT INTO `c_order_item` (`b_id`, `o_id`, `action`, `action_obj`, `finish_time`, `remark`,status_cd)
+        VALUES (#{bId}, #{oId}, #{action}, #{actionObj}, #{finishTime}, #{remark},'S')
+    </insert>
+
+    <!--淇濆瓨璁㈠崟淇℃伅 unitem_log 涓� -->
+    <insert id="saveUnItemLog" parameterType="Map">
+        INSERT INTO `unitem_log` (`b_id`, `o_id`, `service_name`, `log_text`,status_cd)
+        VALUES (#{bId}, #{oId}, #{serviceName}, #{logText},'0')
+    </insert>
+    <!-- 淇敼璁㈠崟椤逛俊鎭� -->
+    <update id="updateOrderItem" parameterType="Map">
+        update c_order_item t
+        set t.finish_time = #{finishTime},
+        t.status_cd = #{statusCd}
+        where t.o_id = #{oId}
+        <if test="bId !=null and bId != ''">
+            and t.b_id = #{bId}
+        </if>
+    </update>
+
+    <!-- 鍒犻櫎浜嬪姟鏃ュ織 -->
+    <update id="deleteUnItemLog" parameterType="Map">
+        delete from unitem_log where o_id = #{oId}
+        <if test="bId !=null and bId != ''">
+            and t.b_id = #{bId}
+        </if>
+    </update>
+
+
     <!-- 淇濆瓨璁㈠崟椤逛俊鎭� c_business -->
     <insert id="saveBusiness" parameterType="Map">
         <![CDATA[
@@ -53,14 +118,11 @@
     </update>
     <!-- 鏇存柊璁㈠崟椤逛俊鎭紙涓�鑸氨鏇存柊璁㈠崟椤圭姸鎬侊級-->
     <update id="updateBusiness" parameterType="Map">
-        <![CDATA[
 
-                    update c_business cb set
-                    cb.status_cd=#{statusCd},
-                    cb.finish_time=#{finishTime}
-                    where cb.o_id=#{oId}
-
-        ]]>
+        update c_business cb set
+        cb.status_cd=#{statusCd},
+        cb.finish_time=#{finishTime}
+        where cb.o_id=#{oId}
     </update>
     <!--鏍规嵁bId 淇敼涓氬姟椤逛俊鎭�-->
     <update id="updateBusinessByBId" parameterType="Map">
@@ -113,6 +175,24 @@
 
         ]]>
     </select>
+    <select id="queryOrderByBId" parameterType="Map" resultType="Map">
+        select distinct co.app_id appId,co.o_id oId,co.create_time createTime,
+        co.ext_transaction_id extTransactionId,co.user_id userId,cb.b_id bId
+        from c_orders co
+        INNER JOIN c_business cb on co.o_id = cb.o_id
+        where 1=1
+        <if test="bId != null and bId != ''">
+            cb.b_id = #{bId}
+        </if>
+        <if test="bIds !=null">
+            and cb.b_id in
+            <foreach collection="bIds" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+
+    </select>
+
     <!-- 鏍规嵁 OID 鏌ヨ business -->
     <select id="getBusinessByOId" parameterType="map" resultType="map">
         SELECT co.`o_id`,co.`app_id`,co.`order_type_cd`,co.`user_id`,cb.`business_type_cd`,cb.`b_id`,cb.`status_cd`
@@ -173,6 +253,28 @@
         ]]>
     </select>
 
+    <select id="getPrivilegeAll" resultType="com.java110.dto.basePrivilege.BasePrivilegeDto">
+        <![CDATA[
+              select t.p_id pId,t.name,t.domain,t.resource,t.description,t.create_time createTime from p_privilege t where t.status_cd = '0'
+        ]]>
+    </select>
+
+    <select id="getDatabusAll" resultType="com.java110.dto.businessDatabus.BusinessDatabusDto">
+        <![CDATA[
+            SELECT
+                t.databus_id databusId,
+                t.databus_name databusName,
+                t.business_type_cd businessTypeCd,
+                t.bean_name beanName,
+                t.seq
+            FROM
+                c_business_databus t
+            WHERE
+                t.status_cd = '0'
+            AND t.state = '1001'
+        ]]>
+    </select>
+
     <select id="judgeAllBusinessCompleted" parameterType="map" resultType="map">
         SELECT co.* FROM c_orders co WHERE co.`o_id` = #{oId} and not exists (
         SELECT 1 FROM c_business cb WHERE cb.`o_id` = co.`o_id`
@@ -229,7 +331,20 @@
         ]]>
     </select>
 
-    <update id="updateBusinessStatusCd" parameterType="Map" >
+    <select id="queryOrderByBusinessType" parameterType="map" resultType="map">
+        select cb.b_id bId,co.o_id oId,cb.business_type_cd businessTypeCd
+        from c_orders co,c_business cb
+        where co.o_id = cb.o_id
+        and cb.status_cd = 'C'
+        <if test="businessTypeCds !=null">
+            and cb.business_type_cd in
+            <foreach collection="businessTypeCds" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+
+    <update id="updateBusinessStatusCd" parameterType="Map">
         update c_business cb set cb.status_cd = 'C1'
         where cb.b_id = #{bId}
     </update>
@@ -238,30 +353,30 @@
     <!-- querySameOrderBusiness 鏌ヨ鍚岃鍗� 璁㈠崟椤� -->
     <select id="querySameOrderBusiness" parameterType="map" resultType="map">
 
-                SELECT
-                    cb1.b_id bId,
-                    cb1.o_id oId,
-                    cb1.create_time createTime,
-                    cb1.business_type_cd businessTypeCd,
-                    cb1.finish_time finishTime,
-                    cb1.status_cd statusCd
-                FROM
-                    c_business cb1
-                    <if test="bId != null and bId != ''">
-                        ,c_business cb2
-                    </if>
-                WHERE
-                    1=1
-                    <if test="bId != null and bId != ''">
-                        and cb1.o_id = cb2.o_id
-                        AND cb2.b_id = #{bId}
-                    </if>
-                    <if test="oId != null and oId != ''">
-                        and cb1.o_id = #{oId}
-                    </if>
-                    <if test="businessTypeCd != null and businessTypeCd != ''">
-                        and cb1.business_type_cd = #{businessTypeCd}
-                    </if>
+        SELECT
+        cb1.b_id bId,
+        cb1.o_id oId,
+        cb1.create_time createTime,
+        cb1.business_type_cd businessTypeCd,
+        cb1.finish_time finishTime,
+        cb1.status_cd statusCd
+        FROM
+        c_business cb1
+        <if test="bId != null and bId != ''">
+            ,c_business cb2
+        </if>
+        WHERE
+        1=1
+        <if test="bId != null and bId != ''">
+            and cb1.o_id = cb2.o_id
+            AND cb2.b_id = #{bId}
+        </if>
+        <if test="oId != null and oId != ''">
+            and cb1.o_id = #{oId}
+        </if>
+        <if test="businessTypeCd != null and businessTypeCd != ''">
+            and cb1.business_type_cd = #{businessTypeCd}
+        </if>
 
 
     </select>

--
Gitblit v1.8.0