From 84b085e7c1ae1f42d575258eb7edd022806eef20 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期五, 09 七月 2021 12:36:50 +0800
Subject: [PATCH] 优化代码
---
java110-db/src/main/resources/mapper/common/MachineTranslateServiceDaoImplMapper.xml | 42 ++++++++++++++++++++++++------------------
1 files changed, 24 insertions(+), 18 deletions(-)
diff --git a/java110-db/src/main/resources/mapper/common/MachineTranslateServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/common/MachineTranslateServiceDaoImplMapper.xml
old mode 100644
new mode 100755
index 39bfc08..42c1fd3
--- a/java110-db/src/main/resources/mapper/common/MachineTranslateServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/common/MachineTranslateServiceDaoImplMapper.xml
@@ -138,22 +138,17 @@
<!-- 鏌ヨ璁惧鍚屾淇℃伅 add by wuxw 2018-07-03 -->
<select id="getMachineTranslateInfo" parameterType="Map" resultType="Map">
- select t.machine_id,t.machine_id machineId,t.machine_code,t.machine_code machineCode,t.type_cd,t.type_cd
+ select t.machine_id,t.machine_id machineId,t.machine_code,t.machine_code machineCode,m.machine_name machineName,t.type_cd,t.type_cd
typeCd,t.machine_translate_id,t.machine_translate_id machineTranslateId,t.obj_id,t.obj_id
objId,t.status_cd,t.status_cd statusCd,t.obj_name,t.obj_name objName,t.state,t.community_id,t.community_id
communityId,t.b_id,t.b_id bId,td.name typeCdName,td1.name stateName,t.create_time createTime,t.update_time
updateTime,t.machine_cmd,t.obj_b_id,t.machine_cmd machineCmd,td2.`name` machineCmdName,t.obj_b_id objBId,t.remark
- from machine_translate t,t_dict td,t_dict td1,t_dict td2
+ from machine_translate t
+ inner join t_dict td on t.type_cd=td.status_cd and td.table_name='machine_translate' and td.table_columns='type_cd'
+ inner join t_dict td1 on t.state=td1.status_cd and td1.table_name='machine_translate' and td1.table_columns='state'
+ inner join t_dict td2 on t.machine_cmd = td2.status_cd and td2.table_name='machine_translate' and td2.table_columns='machine_cmd'
+ left join machine m on t.machine_id = m.machine_id and m.status_cd = '0' and t.community_id = m.community_id
where 1 =1
- and t.type_cd=td.status_cd
- and td.table_name='machine_translate'
- and td.table_columns='type_cd'
- and t.state=td1.status_cd
- and td1.table_name='machine_translate'
- and td1.table_columns='state'
- and t.machine_cmd = td2.status_cd
- and td2.table_name='machine_translate'
- and td2.table_columns='machine_cmd'
<if test="machineId !=null and machineId != ''">
and t.machine_id= #{machineId}
</if>
@@ -168,6 +163,12 @@
</if>
<if test="objId !=null and objId != ''">
and t.obj_id= #{objId}
+ </if>
+ <if test="machineCmd !=null and machineCmd != ''">
+ and t.machine_cmd= #{machineCmd}
+ </if>
+ <if test='isNow !=null and isNow == "Y"'>
+ and to_days(t.create_time) = to_days(now())
</if>
<if test="statusCd !=null and statusCd != ''">
and t.status_cd= #{statusCd}
@@ -236,14 +237,12 @@
<!-- 鏌ヨ璁惧鍚屾鏁伴噺 add by wuxw 2018-07-03 -->
<select id="queryMachineTranslatesCount" parameterType="Map" resultType="Map">
select count(1) count
- from machine_translate t,t_dict td,t_dict td1
+ from machine_translate t
+ inner join t_dict td on t.type_cd=td.status_cd and td.table_name='machine_translate' and td.table_columns='type_cd'
+ inner join t_dict td1 on t.state=td1.status_cd and td1.table_name='machine_translate' and td1.table_columns='state'
+ inner join t_dict td2 on t.machine_cmd = td2.status_cd and td2.table_name='machine_translate' and td2.table_columns='machine_cmd'
+ left join machine m on t.machine_id = m.machine_id and m.status_cd = '0' and t.community_id = m.community_id
where 1 =1
- and t.type_cd=td.status_cd
- and td.table_name='machine_translate'
- and td.table_columns='type_cd'
- and t.state=td1.status_cd
- and td1.table_name='machine_translate'
- and td1.table_columns='state'
<if test="machineId !=null and machineId != ''">
and t.machine_id= #{machineId}
</if>
@@ -259,6 +258,13 @@
<if test="objId !=null and objId != ''">
and t.obj_id= #{objId}
</if>
+ <if test="machineCmd !=null and machineCmd != ''">
+ and t.machine_cmd= #{machineCmd}
+ </if>
+ <if test='isNow !=null and isNow == "Y"'>
+ and to_days(t.create_time) = to_days(now())
+ </if>
+
<if test="statusCd !=null and statusCd != ''">
and t.status_cd= #{statusCd}
</if>
--
Gitblit v1.8.0