<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap 
            PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
            "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="default">
  
  <!--  UC110 DBメッセージ機能 メッセージ取得用SQL -->
  <select id="getMessage" 
          parameterClass="jp.terasoluna.rich.functionsample.dbmessage.bean.MessageVO"
          resultClass="jp.terasoluna.rich.functionsample.dbmessage.bean.MessageVO">
    SELECT ID AS id,
           CODE AS code,
           LANGUAGES AS languages,
           CONTRY AS contry,
           VARIANT AS variant,
           MESSAGE AS message
    FROM 
           DBMESSAGES 
    WHERE 
           CODE = #code#
           <isNotNull prepend="AND" property="languages">
             LANGUAGES = #languages#
           </isNotNull>
           <isNotNull prepend="AND" property="contry">
             CONTRY = #contry#
           </isNotNull>
           <isNotNull prepend="AND" property="variant">
             VARIANT = #variant#
           </isNotNull>
           <isNull prepend="AND" property="languages">
             LANGUAGES IS NULL
           </isNull>
           <isNull prepend="AND" property="contry">
             CONTRY IS NULL
           </isNull>
           <isNull prepend="AND" property="variant">
             VARIANT IS NULL
           </isNull>
  </select>
  
  <!--  UC110 DBメッセージ機能 メッセージ更新用SQL -->
  <update id="updateMessage"
		  parameterClass="jp.terasoluna.rich.functionsample.dbmessage.bean.MessageVO">
    UPDATE
           DBMESSAGES
    SET
           MESSAGE = #message#           
    WHERE
           ID = #id#
  </update>
</sqlMap>