LinkResourceEventMapper.xml 3.68 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
<?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.link.dao.LinkResourceEventDao">
  <!-- Result Map -->
  <resultMap id="BaseResultMap" type="com.devplatform.equipment.modules.link.bean.LinkResourceEvent">
    <result column="id" property="id"/>
    <result column="resource_type" property="resourceType"/>
    <result column="event_id" property="eventId"/>
    <result column="sys_sign" property="sysSign"/>
    <result column="byx1" property="byx1"/>
    <result column="byx2" property="byx2"/>
    <result column="byx3" property="byx3"/>
    <result column="deleted" property="deleted"/>
    <result column="station_id" property="stationId"/>
  </resultMap>

  <!-- link_resource_event table all fields -->
  <sql id="Base_Column_List">
        id,resource_type,event_id,sys_sign,byx1,byx2,byx3,deleted,station_id
    </sql>

  <!-- 公共查询条件 -->
  <sql id="Example_Where_Clause">
    where deleted=0
    <if test="id!=null and id!=''">and id = #{id}</if>
    <if test="resourceType!=null and resourceId!=''">and resource_type = #{resourceType}</if>
    <if test="eventId!=null and eventId!=''">and event_id = #{eventId}</if>
    <if test="sysSign!=null and sysSign!=''">and sys_sign = #{sysSign}</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>
    <if test="stationId!=null and stationId!=''">and station_id = #{stationId}</if>
    <if test="deleted!=null and deleted!=''">and deleted = #{deleted}</if>
  </sql>

  <sql id="Example_Where_Clause1">
    where le.deleted=0
    <if test="model.id!=null and model.id!=''">and t.id = #{model.id}</if>
    <if test="model.resourceType!=null and model.resourceType!=''">and t.resource_type = #{model.resourceType}</if>
    <if test="model.eventId!=null and model.eventId!=''">and t.event_id = #{model.eventId}</if>
    <if test="model.sysSign!=null and model.sysSign!=''">and t.sys_sign = #{model.sysSign}</if>
    <if test="model.byx1!=null and model.byx1!=''">and t.byx1 = #{model.byx1}</if>
    <if test="model.byx2!=null and model.byx2!=''">and t.byx2 = #{model.byx2}</if>
    <if test="model.byx3!=null and model.byx3!=''">and t.byx3 = #{model.byx3}</if>
    <if test="model.stationId!=null and model.stationId!=''">and t.station_id = #{model.stationId}</if>
    <if test="model.deleted!=null and model.deleted!=''">and t.deleted = #{model.deleted}</if>
  </sql>

  <select id="getEventByResourceType" resultType="java.util.Map">
    SELECT t.*, le.event_name,le.event_level,le.byx1 as event_code
    FROM link_resource_event t
    LEFT JOIN link_event le ON t.event_id = le.id
    WHERE le.deleted=0 and t.resource_type = #{resourceType}
  </select>

  <select id="queryPageList" resultType="java.util.Map">
    SELECT t.*, le.event_name,le.event_level,le.byx1 as event_code
    FROM link_resource_event t
    LEFT JOIN link_event le ON t.event_id = le.id
    <include refid="Example_Where_Clause1"/>
    <if test="model.pager.orderCondition != null and model.pager.orderCondition != ''">
      ${model.pager.orderCondition}
    </if>
    <if test="model.pager.mysqlQueryCondition != null and model.pager.mysqlQueryCondition != ''">
      ${model.pager.mysqlQueryCondition}
    </if>
  </select>

  <select id="queryPageByCount" resultType="java.lang.Integer">
    select count(1)
    from link_resource_event t
    LEFT JOIN link_event le ON t.event_id = le.id
    <include refid="Example_Where_Clause1"/>
  </select>
</mapper>