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