RtEqEquipmentMapper.xml 6.53 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 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
<?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.routes.modules.eqequipment.dao.RtEqEquipmentDao">
  <!-- Result Map -->
  <resultMap id="BaseResultMap" type="com.devplatform.routes.modules.eqequipment.bean.RtEqEquipment">
    <result column="id" property="id"/>
    <result column="name" property="name"/>
    <result column="code" property="code"/>
    <result column="specifications" property="specifications"/>
    <result column="port" property="port"/>
    <result column="level" property="level"/>
    <result column="type" property="type"/>
    <result column="line_id" property="lineId"/>
    <result column="line_name" property="lineName"/>
    <result column="station_id" property="stationId"/>
    <result column="station_name" property="stationName"/>
    <result column="regional_server" property="regionalServer"/>
    <result column="topology_equipment" property="topologyEquipment"/>
    <result column="factory" property="factory"/>
    <result column="deploy_address" property="deployAddress"/>
    <result column="remark" property="remark"/>
    <result column="status" property="status"/>
    <result column="sys_sign" property="sysSign"/>
    <result column="deleted" property="deleted"/>
    <result column="create_user_id" property="createUserId"/>
    <result column="create_time" property="createTime"/>
    <result column="update_user_id" property="updateUserId"/>
    <result column="update_time" property="updateTime"/>
    <result column="byx1" property="byx1"/>
    <result column="byx2" property="byx2"/>
    <result column="byx3" property="byx3"/>
  </resultMap>

  <!-- eq_equipment table all fields -->
  <sql id="Base_Column_List">
           id,name,code,specifications,port,level,type,line_id,station_id,station_name,regional_server,topology_equipment,factory,deploy_address,remark,status,sys_sign,deleted,create_user_id,create_time,update_user_id,update_time,byx1,byx2,byx3
	</sql>

  <!-- 公共查询条件 -->
  <sql id="Example_Where_Clause">
    where deleted=0
    <if test="id!=null and id!=''">and id = #{id}</if>
    <if test="name!=null and name!=''">and name = #{name}</if>
    <if test="code!=null and code!=''">and code = #{code}</if>
    <if test="specifications!=null and specifications!=''">and specifications = #{specifications}</if>
    <if test="port!=null and port!=''">and port = #{port}</if>
    <if test="level!=null ">and level = #{level}</if>
    <if test="type!=null ">and type = #{type}</if>
    <if test="stationId!=null and stationId!=''">and station_id = #{stationId}</if>
    <if test="stationName!=null and stationName!=''">and station_name = #{stationName}</if>
    <if test="regionalServer!=null and regionalServer!=''">and regional_server = #{regionalServer}</if>
    <if test="topologyEquipment!=null and topologyEquipment!=''">and topology_equipment = #{topologyEquipment}</if>
    <if test="factory!=null and factory!=''">and factory = #{factory}</if>
    <if test="deployAddress!=null and deployAddress!=''">and deploy_address = #{deployAddress}</if>
    <if test="remark!=null and remark!=''">and remark = #{remark}</if>
    <if test="status!=null ">and status = #{status}</if>
    <if test="sysSign!=null and sysSign!=''">and sys_sign = #{sysSign}</if>
    <if test="deleted!=null ">and deleted = #{deleted}</if>
    <if test="createUserId!=null and createUserId!=''">and create_user_id = #{createUserId}</if>
    <if test="createTime!=null ">and create_time = #{createTime}</if>
    <if test="updateUserId!=null and updateUserId!=''">and update_user_id = #{updateUserId}</if>
    <if test="updateTime!=null ">and update_time = #{updateTime}</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>

  <!--逻辑删除-->
  <update id="removeById">
		update rt_eq_equipment set deleted = 1,sys_sign=#{sysSign}  where id = #{id}
	</update>

  <!--分页统计总数-->
  <select id="queryPageByCount" parameterType="object" resultType="java.lang.Integer">
    select count(1) from rt_eq_equipment eq
    <include refid="queryPageByListClause"></include>
  </select>

  <select id="queryPageByList" parameterType="object" resultMap="BaseResultMap">
    SELECT
      eq.*,
      li.station_name  as sname,
      lil.name  as liName
    FROM
    rt_eq_equipment eq
    LEFT JOIN li_station li ON li.id = eq.byx3
    LEFT JOIN li_line lil ON lil.id = eq.line_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>

  <select id="queryPageRoutesByList" parameterType="object" resultMap="BaseResultMap">
    SELECT
    eq.*,
    lil.name  as liName
    FROM
    rt_eq_equipment eq
    LEFT JOIN li_line lil ON lil.id = eq.byx3
    <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 eq.deleted=0
    <if test="level!=null ">
      <if test="level == 1">
        and eq.level = 1
      </if>
      <if test="level == 2">
        and eq.level in (2,3)
      </if>
      <if test="level == 3">
        and eq.level in (1,2,3)
      </if>
    </if>
    <if test="stationId!=null and stationId!=''">and eq.station_id = #{stationId}</if>
  </sql>

  <select id="queryById" resultMap="BaseResultMap" parameterType="java.lang.String">
    SELECT
      DISTINCT(eq.id),
      eq.*,
      li.station_name  as sname,
      lil.name  as liName
    FROM
        rt_eq_equipment eq
	LEFT JOIN li_station li ON li.id = eq.byx3
	LEFT JOIN li_line lil ON lil.id = eq.line_id
	where eq.id = #{id}
  </select>

  <select id="queryRoutesById" resultMap="BaseResultMap" parameterType="java.lang.String">
    SELECT
      DISTINCT(eq.id),
      eq.*,
      lil.name  as liName
    FROM
        rt_eq_equipment eq
	LEFT JOIN li_line lil ON lil.id = eq.byx3
	where eq.id = #{id}
  </select>


</mapper>