selectByMPointID/Code

This commit is contained in:
Timer
2026-03-23 22:28:19 +08:00
parent c3a6ba2467
commit ffeda063c2
5 changed files with 53 additions and 2 deletions

View File

@ -16,4 +16,12 @@ public class MPointDao extends CommDaoImpl<MPoint> {
public int updateValueByKey(MPoint t) { public int updateValueByKey(MPoint t) {
return getSqlSession().update("scada.MPointMapper."+Thread.currentThread().getStackTrace()[1].getMethodName(), t); return getSqlSession().update("scada.MPointMapper."+Thread.currentThread().getStackTrace()[1].getMethodName(), t);
} }
public MPoint selectByMPointID(String mpointid) {
return getSqlSession().selectOne("scada.MPointMapper."+Thread.currentThread().getStackTrace()[1].getMethodName(), mpointid);
}
public MPoint selectByMPointCode(String mpointcode) {
return getSqlSession().selectOne("scada.MPointMapper."+Thread.currentThread().getStackTrace()[1].getMethodName(), mpointcode);
}
} }

View File

@ -581,8 +581,8 @@ public class MqttServiceImpl implements MqttService {
loggger.debug("已标记未找到跳过ES查询: key={}", key); loggger.debug("已标记未找到跳过ES查询: key={}", key);
return null; return null;
} }
// 从ES查询 // 查询 MPointID
MPoint mPoint = mPointService.selectById(unitId, key); MPoint mPoint = mPointService.selectByMPointID(key);
if (mPoint != null) { if (mPoint != null) {
//添加缓存 //添加缓存
mPointCache.put(key, mPoint); mPointCache.put(key, mPoint);

View File

@ -19,6 +19,20 @@ import java.util.Map;
public interface MPointService { public interface MPointService {
MPoint selectById(String unitId,String id); MPoint selectById(String unitId,String id);
/**
* 根据MPointID查询测点
* @param mpointid 测点ID
* @return MPoint
*/
MPoint selectByMPointID(String mpointid);
/**
* 根据MPointCode查询测点
* @param mpointcode 测点编码
* @return MPoint
*/
MPoint selectByMPointCode(String mpointcode);
MPoint selectById4Es(String id); MPoint selectById4Es(String id);
List<MPoint> selectListByWhere(String wherestr); List<MPoint> selectListByWhere(String wherestr);

View File

@ -87,6 +87,18 @@ public class MPointServiceImpl implements MPointService {
return mPointDao.selectByPrimaryKey(id); return mPointDao.selectByPrimaryKey(id);
} }
@DataSourceTypeAnno(DataSourceEnum.SCADA_JSWS)
@Override
public MPoint selectByMPointID(String mpointid) {
return mPointDao.selectByMPointID(mpointid);
}
@DataSourceTypeAnno(DataSourceEnum.SCADA_JSWS)
@Override
public MPoint selectByMPointCode(String mpointcode) {
return mPointDao.selectByMPointCode(mpointcode);
}
/** /**
* es查询 * es查询
* *

View File

@ -77,6 +77,23 @@
from TB_MeasurePoint from TB_MeasurePoint
where ID = #{id,jdbcType=VARCHAR} where ID = #{id,jdbcType=VARCHAR}
</select> </select>
<select id="selectByMPointCode" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from TB_MeasurePoint
where MPointCode = #{id,jdbcType=VARCHAR}
limit 1
</select>
<select id="selectByMPointID" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from TB_MeasurePoint
where MPointID = #{id,jdbcType=VARCHAR}
limit 1
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String"> <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from TB_MeasurePoint delete from TB_MeasurePoint
where ID = #{id,jdbcType=VARCHAR} where ID = #{id,jdbcType=VARCHAR}