Newer
Older
huludao / src / main / resources / mapper / ProEquipInfoDao.xml
<?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.ProEquipInfoDao">
	
	<!-- 可根据自己的需求,是否要使用 -->
    <resultMap type="com.newfiber.api.pc.model.entity.ProEquipInfoEntity" id="proEquipInfoMap">
            <result property="id" column="id"/>
            <result property="equipNo" column="equip_no"/>
            <result property="equipDesc" column="equip_desc"/>
            <result property="equipFactory" column="equip_factory"/>
            <result property="createTime" column="create_time"/>
        </resultMap>
    
	<!-- 通用查询结果列 -->
	<sql id="Base_Column_List">
	<trim suffixOverrides=",">
			id,
			equip_no,
			equip_desc,
			equip_factory,
			create_time,
	    </trim>
	</sql>
	
	<!-- 获取设备基础表列表 -->
	<select id="queryList" resultType="com.newfiber.api.pc.model.entity.ProEquipInfoEntity">
		select
		<include refid="Base_Column_List" />
		from pro_equip_info
		where 1 = 1
		<if test="equipDesc != null">
			and concat(equip_desc,equip_factory) like concat('%',#{equipDesc},'%')
		</if>
        <choose>
            <when test="sidx != null and sidx.trim() != ''">
                order by ${sidx} ${order}
            </when>
			<otherwise>
                order by id desc
			</otherwise>
        </choose>
	</select>

	<select id="havaAllocated" resultType="com.newfiber.api.pc.model.entity.ProFactorsInfoEntity">
		select f.id,f.factors_no,f.factors_code,f.factors_ascii,f.factors_name,f.factors_unit,f.factors_max_v,f.factors_mix_v,f.factors_order,f.create_time,f.factors_reserve1,f.factors_reserve2
		from pro_factors_info f
		<choose>
			<when test="flag">
				inner join pro_equip_factors ef on f.factors_no = ef.factors_no
				where ef.equip_no = #{equipNo}
			</when>
			<otherwise>
				left join pro_equip_factors ef on f.factors_no = ef.factors_no and ef.equip_no = #{equipNo}
				where ef.factors_no is null
			</otherwise>
		</choose>
		<if test="factorsName != null and factorsName.trim() != ''">
			and f.factors_name like concat('%',#{factorsName},'%')
		</if>

	</select>
	
</mapper>