From 781c2e20a4bb844dae3f4eafbf5f0e494b942ea8 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期四, 25 五月 2023 18:07:08 +0800
Subject: [PATCH] optimize

---
 java110-db/src/main/resources/mapper/common/MachineAttrServiceDaoImplMapper.xml |   37 +++++++++++++++++++++++++++----------
 1 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/java110-db/src/main/resources/mapper/common/MachineAttrServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/common/MachineAttrServiceDaoImplMapper.xml
old mode 100644
new mode 100755
index 680c7e5..1276edc
--- a/java110-db/src/main/resources/mapper/common/MachineAttrServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/common/MachineAttrServiceDaoImplMapper.xml
@@ -14,6 +14,15 @@
     </insert>
 
 
+    <insert id="saveMachineAttrs" parameterType="Map">
+        insert into machine_attrs(
+        machine_id,attr_id,spec_cd,community_id,b_id,value
+        ) values (
+        #{machineId},#{attrId},#{specCd},#{communityId},'-1',#{value}
+        )
+    </insert>
+
+
     <!-- 鏌ヨ璁惧灞炴�т俊鎭紙Business锛� add by wuxw 2018-07-03 -->
     <select id="getBusinessMachineAttrInfo" parameterType="Map" resultType="Map">
         select t.machine_id,t.machine_id machineId,t.attr_id,t.attr_id attrId,t.operate,t.spec_cd,t.spec_cd
@@ -77,11 +86,19 @@
     <!-- 鏌ヨ璁惧灞炴�т俊鎭� add by wuxw 2018-07-03 -->
     <select id="getMachineAttrInfo" parameterType="Map" resultType="Map">
         select t.machine_id,t.machine_id machineId,t.attr_id,t.attr_id attrId,t.spec_cd,t.spec_cd
-        specCd,t.status_cd,t.status_cd statusCd,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.value
+        specCd,t.status_cd,t.status_cd statusCd,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.value,
+        s.spec_name specName,
+        v.value_name valueName,
+        s.list_show listShow
         from machine_attrs t
+        left join attr_spec s on t.spec_cd = s.spec_cd and s.status_cd = '0' and t.spec_cd = s.spec_cd and s.table_name = 'machine_attr'
+        left join attr_value v on t.`value` = v.`value` and s.spec_id = v.spec_id and v.status_cd = '0'
         where 1 =1
         <if test="machineId !=null and machineId != ''">
             and t.machine_id= #{machineId}
+        </if>
+        <if test="domain !=null and domain != ''">
+            and s.domain= #{domain}
         </if>
         <if test="machineIds !=null ">
             and t.machine_id in
@@ -120,15 +137,6 @@
         <if test="newBId != null and newBId != ''">
             ,t.b_id = #{newBId}
         </if>
-        <if test="machineId !=null and machineId != ''">
-            , t.machine_id= #{machineId}
-        </if>
-        <if test="specCd !=null and specCd != ''">
-            , t.spec_cd= #{specCd}
-        </if>
-        <if test="communityId !=null and communityId != ''">
-            , t.community_id= #{communityId}
-        </if>
         <if test="value !=null and value != ''">
             , t.value= #{value}
         </if>
@@ -139,6 +147,15 @@
         <if test="bId !=null and bId != ''">
             and t.b_id= #{bId}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="specCd !=null and specCd != ''">
+            and t.spec_cd= #{specCd}
+        </if>
+        <if test="machineId !=null and machineId != ''">
+            and t.machine_id= #{machineId}
+        </if>
 
     </update>
 

--
Gitblit v1.8.0