OrIntrudeMapper.xml 8.4 KB
Newer Older
葛齐林's avatar
葛齐林 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
<?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.devplatform.equipment.modules.orintrude.dao.OrIntrudeDao">
  <!-- Result Map -->
  <resultMap id="BaseResultMap" type="com.devplatform.equipment.modules.orintrude.bean.OrIntrude">
    <result column="id" property="id"/>
    <result column="resource_id" property="resourceId"/>
    <result column="station_id" property="stationId"/>
    <result column="resource_name" property="resourceName"/>
    <result column="instruction" property="instruction"/>
    <result column="action_name" property="actionName"/>
    <result column="result" property="result"/>
    <result column="create_user_id" property="createUserId"/>
    <result column="create_user" property="createUser"/>
    <result column="create_time" property="createTime"/>
    <result column="type" property="type"/>
    <result column="line_station_name" property="lineStationName"/>
    <result column="sys_sign" property="sysSign"/>
    <result column="link_rule_action_Id" property="linkRuleActionId"/>
    <result column="byx1" property="byx1"/>
    <result column="byx2" property="byx2"/>
    <result column="byx3" property="byx3"/>
  </resultMap>

  <!-- or_intrude table all fields -->
  <sql id="Base_Column_List">
		id,resource_id,station_id,resource_name,instruction,action_name,result,create_user_id,create_user,create_time,type,line_station_name,sys_sign,link_rule_action_Id,byx1,byx2,byx3
	</sql>

  <!-- 公共查询条件 -->
  <sql id="Example_Where_Clause">
    where deleted=0
    <if test="id!=null and id!=''">and id = #{id}</if>
    <if test="resourceId!=null and resourceId!=''">and resource_id = #{resourceId}</if>
    <if test="stationId!=null and stationId!=''">and station_id = #{stationId}</if>
    <if test="resourceName!=null and resourceName!=''">and resource_name = #{resourceName}</if>
    <if test="instruction!=null and instruction!=''">and instruction = #{instruction}</if>
    <if test="actionName!=null and actionName!=''">and action_name = #{actionName}</if>
    <if test="result!=null ">and result = #{result}</if>
    <if test="createUserId!=null and createUserId!=''">and create_user_id = #{createUserId}</if>
    <if test="createUser!=null and createUser!=''">and create_user = #{createUser}</if>
    <if test="createTime!=null ">and create_time = #{createTime}</if>
    <if test="type!=null and type!=''">and type = #{type}</if>
    <if test="lineStationName!=null and lineStationName!=''">and line_station_name = #{lineStationName}</if>
    <if test="sysSign!=null and sysSign!=''">and sys_sign = #{sysSign}</if>
    <if test="linkRuleActionId!=null and linkRuleActionId!=''">and link_rule_action_Id = #{linkRuleActionId}</if>
    <if test="byx1!=null and byx1!=''">and byx1 = #{byx1}</if>
    <if test="byx2!=null and byx2!=''">and byx2 = #{byx2}</if>
    <if test="byx3!=null and byx3!=''">and byx3 = #{byx3}</if>
  </sql>
  <select id="queryPageByCount" parameterType="com.devplatform.equipment.modules.orintrude.model.OrIntrudeModel" resultType="java.lang.Integer">
    select count(1) from or_intrude oi
    <include refid="queryPageByListClause"></include>
  </select>
  <select id="queryPageByList" parameterType="com.devplatform.equipment.modules.orintrude.model.OrIntrudeModel"
    resultType="com.devplatform.equipment.modules.orintrude.bean.OrIntrude">
    select oi.* ,lr.status as status,lr.deploy_location as deployLocation
    from or_intrude oi
    left join li_resource lr on lr.id = oi.resource_id and lr.station_id = oi.station_id
    <include refid="queryPageByListClause"></include>
    <if test="pager.orderCondition != null and pager.orderCondition != ''">
      ${pager.orderCondition}
    </if>
    <if test="pager.mysqlQueryCondition != null and pager.mysqlQueryCondition != ''">
      ${pager.mysqlQueryCondition}
    </if>
  </select>
  <sql id="queryPageByListClause">
    <where>
      <if test="id!=null and id!=''">and oi.id = #{id}</if>
      <if test="resourceId!=null and resourceId!=''">and oi.resource_id = #{resourceId}</if>
      <if test="stationId!=null and stationId!=''">and oi.station_id = #{stationId}</if>
      <if test="resourceName!=null and resourceName!=''">and INSTR(oi.resource_name, #{resourceName})</if>
      <if test="instruction!=null and instruction!=''">and oi.instruction = #{instruction}</if>
      <if test="actionName!=null and actionName!=''">and oi.action_name = #{actionName}</if>
      <if test="result!=null ">and oi.result = #{result}</if>
      <if test="createUserId!=null and createUserId!=''">and oi.create_user_id = #{createUserId}</if>
      <if test="createUser!=null and createUser!=''">and INSTR(oi.create_user, #{createUser})</if>
      <if test="startTime!=null">and oi.create_time &gt;= #{startTime}</if>
      <if test="endTime!=null">and oi.create_time &lt;= #{endTime}</if>
      <if test="sysSign!=null and sysSign!=''">and oi.sys_sign = #{sysSign}</if>
    </where>
  </sql>

  <select id="queryById" resultType="java.util.Map">
    select og.id,og.instruction,og.resource_name as resourceName,
    og.line_station_name as lineStationName,og.create_user as createUser,
    lr.sub_system as subSystem,og.type,lr.status,lr.code,lr.address_code as addressCode,
    lr.port,lr.deploy_location as deployLocation,lr.attached_info as attachedInfo,og.action_name as actionName,
    lra.params_name1 as paramsName1,lra.params_value1 as paramsValue1,lra.params_name2 as paramsName2,lra.params_value2 as paramsValue2,
    og.create_time as createTime,og.source,og.result,ai.event_level as eventLevel
    from or_intrude og
    left join li_resource lr on lr.id = og.resource_id and lr.station_id = og.station_id
    left join link_rule_action lra on lra.id = og.link_rule_action_Id and lra.station_id = og.station_id
    left join link_action la on la.id = lra.action_id and la.station_id = og.station_id
    left join alarms_info ai on ai.id = og.alarms_code and ai.station_id = og.station_id
    where og.id = #{id}
    <if test="stationId!=null and stationId!=''">and og.station_id = #{stationId}</if>
  </select>

  <select id="queryById1" resultType="java.util.Map">
    select og.id,og.instruction,og.resource_name as resourceName,
    og.line_station_name as lineStationName,og.create_user as createUser,
    lr.sub_system as subSystem,og.type,lr.status,lr.code,lr.address_code as addressCode,
    lr.port,lr.deploy_location as deployLocation,lr.attached_info as attachedInfo,og.action_name as actionName,
    la.params_name1 as paramsName1,pi.param as paramsValue1,la.params_name2 as paramsName2,pi.param_two as paramsValue2,
    og.create_time as createTime,og.source,og.result,ai.event_level as eventLevel
    from or_intrude og
    left join li_resource lr on lr.id = og.resource_id and lr.station_id = og.station_id
    left join alarms_plan_step aps on aps.id = og.byx1 and aps.station_id = og.station_id
    LEFT JOIN plan_register_instruct pi ON aps.instruct_id = pi.id and pi.station_id = og.station_id
    left join link_action la on la.id = pi.type and la.station_id = og.station_id
    left join alarms_info ai on ai.id = og.alarms_code and ai.station_id = og.station_id
    where og.id = #{id}
    <if test="stationId!=null and stationId!=''">and og.station_id = #{stationId}</if>
  </select>

    <select id="queryById2" resultType="java.util.Map">
      select og.id,og.instruction,og.resource_name as resourceName,
      og.line_station_name as lineStationName,og.create_user as createUser,
      lr.sub_system as subSystem,og.type,lr.status,lr.code,lr.address_code as addressCode,
      lr.port,lr.deploy_location as deployLocation,lr.attached_info as attachedInfo,og.action_name as actionName,
      la.params_name1 as paramsName1,pi.param as paramsValue1,la.params_name2 as paramsName2,pi.param_two as paramsValue2,
      og.create_time as createTime,og.source,og.result,ai.event_level as eventLevel
      from or_intrude og
      left join li_resource lr on lr.id = og.resource_id and lr.station_id = og.station_id
      left join plan_log_instruct pli on pli.id = og.byx2 and pli.station_id = og.station_id
      LEFT JOIN plan_register_instruct pi ON pli.instruct_id = pi.id and pi.station_id = og.station_id
      left join link_action la on la.id = pi.type and la.station_id = og.station_id
      left join alarms_info ai on ai.id = og.alarms_code and ai.station_id = og.station_id
      where og.id = #{id}
      <if test="stationId!=null and stationId!=''">and og.station_id = #{stationId}</if>
    </select>
</mapper>