<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.device.pq.mapper.DevFuctionMapper">

    <insert id="addBatch">
        insert into cld_dev_fuction (id,line_id,fuc_name) values
        <foreach collection="list" item="item" separator="," index="index">
            (#{item.id},#{item.lineId},#{item.fucName})
        </foreach>
    </insert>

    <!--查询pq_line表等级为5的装置去device表查装置id与装置功能存入cld_dev_fuction表-->
    <select id="selectLineTable" resultType="com.njcn.device.pq.pojo.po.DevFuction">
        SELECT pd.id "lineId" FROM pq_device pd
                              inner join pq_line pl on pd.id = pl.id
        where pl.`Level` = 4
    </select>
    <select id="selectDictTable" resultType="com.njcn.device.pq.pojo.po.DevFuction">
        select sdd.id "fucName" from sys_dict_type sdt
                               inner join sys_dict_data sdd on sdd.Type_Id = sdt.Id
        where sdt.`Code` = 'Dev_Fun'
    </select>
</mapper>
