<?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.newfiber.api.pc.dao.monitoring.ProSiteEquipDao"> <!-- 可根据自己的需求,是否要使用 --> <resultMap type="com.newfiber.api.pc.model.entity.ProSiteEquipEntity" id="proSiteEquipMap"> <result property="id" column="id"/> <result property="siteNo" column="site_no"/> <result property="equipNo" column="equip_no"/> </resultMap> <!-- 通用查询结果列 --> <sql id="Base_Column_List"> <trim suffixOverrides=","> id, site_no, equip_no, </trim> </sql> <!-- 获取站点设备关联表列表 --> <select id="queryList" resultType="com.newfiber.api.pc.model.entity.ProSiteEquipEntity"> select <include refid="Base_Column_List" /> from pro_site_equip <choose> <when test="sidx != null and sidx.trim() != ''"> order by ${sidx} ${order} </when> <otherwise> order by id desc </otherwise> </choose> </select> <delete id="deleteByNos"> delete from pro_site_equip where <choose> <when test="flag"> site_no = #{mainNo} <if test="subNos != null and subNos.size() > 0"> and equip_no in <foreach collection="subNos" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> </when> <otherwise> equip_no = #{mainNo} <if test="subNos != null and subNos.size() > 0"> and site_no in <foreach collection="subNos" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> </otherwise> </choose> </delete> <insert id="insertBatchByNos"> insert into pro_site_equip (site_no,equip_no) values <foreach collection="equipNos" item="item" separator=","> (#{siteNo},#{item}) </foreach> </insert> </mapper>