| | |
| | | where a.mac = #{0} |
| | | </select> |
| | | |
| | | <update id="updateStateByMac"> |
| | | UPDATE equipment SET state=#{1} WHERE mac=#{0} |
| | | </update> |
| | | |
| | | <insert id="batchInsertHistory" parameterType="java.util.List" > |
| | | <selectKey resultType ="java.lang.Integer" keyProperty="id" order="AFTER"> |
| | | SELECT LAST_INSERT_ID() |
| | | </selectKey > |
| | | insert into history |
| | | (mac, sensor, mac_key, mac_value, time) |
| | | values |
| | | <foreach collection="list" item="item" index="index" separator=","> |
| | | ( |
| | | #{item.mac}, |
| | | #{item.sensor}, |
| | | #{item.mac_key}, |
| | | #{item.mac_value}, |
| | | #{item.time} |
| | | ) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | <select id="getAllEquipment" resultType="com.moral.monitor.entity.Equipment"> |
| | | select mac from equipment |
| | | </select> |
| | | |
| | | <select id="getLoggerByMac" resultType="com.moral.monitor.entity.Logger"> |
| | | select time from logger where mac=#{0} order by time DESC limit 1 |
| | | </select> |
| | | |
| | | </mapper> |