From 06d3d15a5a08637041cc601101c063b11b07a346 Mon Sep 17 00:00:00 2001 From: net <net@netdeMBP.lan> Date: 星期五, 14 二月 2025 17:25:21 +0800 Subject: [PATCH] 合并理去杀杀人 --- zhitan-system/src/main/resources/mapper/model/EnergyIndexMapper.xml | 39 +++++++++++++++++++++++++++++++++++---- 1 files changed, 35 insertions(+), 4 deletions(-) diff --git a/zhitan-system/src/main/resources/mapper/model/EnergyIndexMapper.xml b/zhitan-system/src/main/resources/mapper/model/EnergyIndexMapper.xml index d38240b..78d0144 100644 --- a/zhitan-system/src/main/resources/mapper/model/EnergyIndexMapper.xml +++ b/zhitan-system/src/main/resources/mapper/model/EnergyIndexMapper.xml @@ -184,7 +184,7 @@ <if test="energyId != null">#{energyId}, </if> </trim> - + </insert> <insert id="insertNodeIndex"> insert into node_index (node_id, index_id) values (#{nodeId}, #{indexId}); @@ -331,7 +331,7 @@ and ei.meter_id = me.id order by ei.order_num </select> - + <select id="selectEnergyIndexPage" resultMap="EnergyIndexResult"> select ni.index_id, name, code, index_type, remark, unit_id, index_category from energy_index ei left join node_index ni on ei.index_id = ni.index_id @@ -346,7 +346,7 @@ </if> </where> order by ei.order_num - + </select> <select id="listIndexByMeterIds" resultType="com.zhitan.model.domain.EnergyIndex"> select ei.index_id, @@ -363,7 +363,7 @@ from energy_index ei left join node_index ni on ei.index_id = ni.index_id <where> - + <if test="nodeId != null and nodeId != ''">and ni.node_id = #{nodeId}</if> <if test="meterIds != null"> and ei.meter_id in @@ -377,4 +377,35 @@ <include refid="selectEnergyIndexVo"/> where code = #{cdoe} </select> + <select id="getIndexByCode" resultType="com.zhitan.model.domain.EnergyIndex"> + SELECT ei.code,mi.meter_name||'_'||ei.name as name from energy_index ei + LEFT JOIN node_device nd on ei.meter_id = nd.device_id + LEFT JOIN meter_implement mi on mi."id" = nd.device_id + <where> + <if test="nodeId != null and nodeId != ''">and nd.node_id = #{nodeId}</if> + <if test="code != null and code != ''"> + and (mi.meter_name like concat('%', #{code}, '%') + or ei.code like concat('%', #{code}, '%') + or ei.name like concat('%', #{code}, '%') + ) + </if> + </where> + </select> + <select id="getIndexByMeterIdIndexCode" resultType="com.zhitan.model.domain.EnergyIndex"> + SELECT ei.code,mi.meter_name||'_'||ei.name as name from energy_index ei + LEFT JOIN node_device nd on ei.meter_id = nd.device_id + LEFT JOIN meter_implement mi on mi."id" = nd.device_id + <where> + <if test="nodeId != null and nodeId != ''">and nd.node_id = #{nodeId}</if> + <if test="indexCode != null and indexCode != ''"> + and (mi.meter_name like concat('%', #{indexCode}, '%') + or ei.code like concat('%', #{indexCode}, '%') + or ei.name like concat('%', #{indexCode}, '%') + ) + </if> + <if test="meterId != null and meterId != ''"> + and ei.meter_id = #{meterId} + </if> + </where> + </select> </mapper> -- Gitblit v1.9.3