All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.jinahya.openfire.persistence.ibatis.mapper.OfMucMemberMapper.xml Maven / Gradle / Ivy

There is a newer version: 0.1.9
Show newest version
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2017 Jin Kwon &lt;onacit at gmail.com&gt;.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!DOCTYPE mapper PUBLIC '-//mybatis.org//DTD Mapper 3.0//EN' 'http://mybatis.org/dtd/mybatis-3-mapper.dtd'>

<mapper namespace="com.github.jinahya.openfire.persistence.ibatis.mapper.OfMucMemberMapper">
    
  <resultMap id="resultMap" type="com.github.jinahya.openfire.persistence.OfMucMember">
    <id column="roomID" property="room.roomId"/>
    <id column="jid" property="jid"/>
    <result column="nickname" property="nickname"/>
    <result column="firstName" property="firstName"/>
    <result column="lastName" property="lastName"/>
    <result column="url" property="url"/>
    <result column="email" property="email"/>
    <result column="faqentry" property="fawentry"/>
  </resultMap>

  <resultMap id="resultMapAssociative" type="com.github.jinahya.openfire.persistence.OfMucMember">
    <id column="ofMucMember_roomID" property="room.roomId"/>
    <id column="ofMucMember_jid" property="jid"/>
    <result column="ofMucMember_nickname" property="nickname"/>
    <result column="ofMucMember_firstName" property="firstName"/>
    <result column="ofMucMember_lastName" property="lastName"/>
    <result column="ofMucMember_url" property="url"/>
    <result column="ofMucMember_email" property="email"/>
    <result column="ofMucMember_faqentry" property="faqentry"/>
    <association column="ofMucMember_roomID" property="room"
                 resultMap="com.github.jinahya.openfire.persistence.ibatis.mapper.OfMucRoomMapper.resultMapAssociative"/>
  </resultMap>

  <sql id="sqlColumns">
    ${alias}roomID    AS ${prefix}roomID,
    ${alias}jid       AS ${prefix}jid,
    ${alias}nickname  AS ${prefix}nickname,
    ${alias}firstName AS ${prefix}firstName,
    ${alias}lastName  AS ${prefix}lastName,
    ${alias}url       AS ${prefix}url,
    ${alias}email     AS ${prefix}email,
    ${alias}faqentry  AS ${prefix}faqentry
  </sql>

  <select id="selectOne01" resultMap="resultMapAssociative" fetchSize="1">
    SELECT
    <include refid="sqlColumns">
      <property name="alias" value="ofMucMember."/>
      <property name="prefix" value="ofMucMember_"/>
    </include>
    ,
    <include refid="com.github.jinahya.openfire.persistence.ibatis.mapper.OfMucRoomMapper.sqlColumns">
      <property name="alias" value="ofMucRoom."/>
      <property name="prefix" value="ofMucRoom_"/>
    </include>
    ,
    <include refid="com.github.jinahya.openfire.persistence.ibatis.mapper.OfMucServiceMapper.sqlColumns">
      <property name="alias" value="ofMucService."/>
      <property name="prefix" value="ofMucService_"/>
    </include>
    FROM
    <include refid="com.github.jinahya.openfire.persistence.ibatis.mapper.OfMappedMapper.sqlTable">
      <property name="table" value="ofMucMember"/>
    </include>
    AS ofMucMember
    INNER JOIN
    <include refid="com.github.jinahya.openfire.persistence.ibatis.mapper.OfMappedMapper.sqlTable">
      <property name="table" value="ofMucRoom"/>
    </include>
    AS ofMucRoom
    ON ofMucMember.roomID = ofMucRoom.roomID
    INNER JOIN
    <include refid="com.github.jinahya.openfire.persistence.ibatis.mapper.OfMappedMapper.sqlTable">
      <property name="table" value="ofMucService"/>
    </include>
    AS ofMucService
    ON ofMucRoom.serviceID = ofMucService.serviceID
    WHERE
    ofMucMember.roomID = #{roomId} AND ofMucMember.jid = #{jid}
  </select>

  <select id="selectList01" resultMap="resultMapAssociative">
    SELECT
    <include refid="sqlColumns">
      <property name="alias" value="ofMucMember."/>
      <property name="prefix" value="ofMucMember_"/>
    </include>
    ,
    <include refid="com.github.jinahya.openfire.persistence.ibatis.mapper.OfMucRoomMapper.sqlColumns">
      <property name="alias" value="ofMucRoom."/>
      <property name="prefix" value="ofMucRoom_"/>
    </include>
    ,
    <include refid="com.github.jinahya.openfire.persistence.ibatis.mapper.OfMucServiceMapper.sqlColumns">
      <property name="alias" value="ofMucService."/>
      <property name="prefix" value="ofMucService_"/>
    </include>
    FROM
    <include refid="com.github.jinahya.openfire.persistence.ibatis.mapper.OfMappedMapper.sqlTable">
      <property name="table" value="ofMucMember"/>
    </include>
    AS ofMucMember
    INNER JOIN
    <include refid="com.github.jinahya.openfire.persistence.ibatis.mapper.OfMappedMapper.sqlTable">
      <property name="table" value="ofMucRoom"/>
    </include>
    AS ofMucRoom
    ON ofMucMember.roomID = ofMucRoom.roomID
    INNER JOIN
    <include refid="com.github.jinahya.openfire.persistence.ibatis.mapper.OfMappedMapper.sqlTable">
      <property name="table" value="ofMucService"/>
    </include>
    AS ofMucService
    ON ofMucRoom.serviceID = ofMucService.serviceID
    WHERE 1 = 1
    <if test="roomId != null">
      AND ofMucMember.roomID = #{roomId}
    </if>
    ORDER BY
    <if test="roomId == null">
      <choose>
        <when test="natural">ofMucRoom.name</when>
        <otherwise>ofMucMember.roomID</otherwise>
      </choose>
      <include refid="com.github.jinahya.openfire.persistence.ibatis.mapper.OfMappedMapper.sqlAscending"/>
      ,
    </if>
    ofMucMember.jid
    <include refid="com.github.jinahya.openfire.persistence.ibatis.mapper.OfMappedMapper.sqlAscending"/>
  </select>

</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy