多类型查询

<select id="getByCondition" resultMap="BaseResultMap">
  SELECT
 sm.id id,
    sm.scene_id scene_id,
    sm.name name,
    sm.unit unit,
    sm.relation_id relation_id,
    sm.relation_type relation_type,
    sm.icon icon,
    sm.description description,
    sm.device_name device_name,
    sm.create_time create_time,
    sm.last_update_time last_update_time,
    sm.last_update_account last_update_account
  FROM sm_monitorpoint sm
  LEFT JOIN dm_virtualdeviceparam dvp ON sm.relation_id=dvp.id
  LEFT JOIN dm_virtualdevice dv ON dv.id=dvp.device_id
  WHERE relation_type=#{relationType}
  <if test="deviceTypeList!=null and deviceTypeList.size>0">
    AND  dv.device_type_id IN 
    <foreach collection="deviceTypeList" separator="," open="(" close=")" index="index">
      #{deviceTypeList[${index}]}
    </foreach>
  </if>
  <if test="sceneIdList!=null and sceneIdList.size>0">
    AND sm.scene_id IN
    <foreach collection="sceneIdList" separator="," open="(" close=")" index="index">
      #{sceneIdList[${index}]}
    </foreach>
  </if>
  <if test="keywords!=null and keywords!=''">
    AND (sm.name LIKE CONCAT('%',#{keywords},'%'))
  </if>
</select>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值