| | |
| | | <select id="getPoleByBinding" resultType="com.sandu.ximon.dao.domain.Pole"> |
| | | SELECT t2.* |
| | | FROM `pole_binding` t1 |
| | | LEFT JOIN pole t2 ON t1.pole_id = t2.id |
| | | WHERE t1.device_type = #{type} |
| | | AND t1.device_code = #{Mac} |
| | | LEFT JOIN pole t2 ON t1.pole_id = t2.id AND t1.device_type=0 |
| | | <where> |
| | | t1.device_code = #{Mac} |
| | | AND t1.device_type=0 |
| | | <if test="type != null"> |
| | | AND t1.device_type = #{type} |
| | | </if> |
| | | <if test="userId != null"> |
| | | AND ( |
| | | t2.user_id = #{userId} |
| | | OR t2.client_id = #{userId} |
| | | ) |
| | | </if> |
| | | </where> |
| | | |
| | | </select> |
| | | </mapper> |