关闭

Mybatis.net sqlmap.xml简单配置

2259人阅读 评论(0) 收藏 举报
<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="Org" xmlns="http://ibatis.apache.org/mapping"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <alias>
    <typeAlias alias="Org" type="GrassInfo.BMS.Model.SystemManage.Org,GrassInfo.BMS.Model.SystemManageModel"></typeAlias>
  </alias>
  <resultMaps>
    <resultMap id="Org-Result" class="Org">
      <result property="ID" column="ID"/>
      <result property="ORG_NAME" column="ORG_NAME"/>
      <result property="ORG_IP" column="ORG_IP"/>
      <result property="PARENT_ID" column="PARENT_ID"/>
      <result property="SITE_NO" column="SITE_NO"/>
      <result property="ADDRESS" column="ADDRESS"/>
      <result property="CREATE_USER" column="CREATE_USER"/>
      <result property="CREATE_TIME" column="CREATE_TIME"/>
      <result property="UPDATE_USER" column="UPDATE_USER"/>
      <result property="UPDATE_TIME" column="UPDATE_TIME"/>
      <result property="IS_VALID" column="IS_VALID"/>
    </resultMap>
  </resultMaps>
  <statements>
    <select id="GetOrg" parameterClass="int" resultMap="Org-Result">
      SELECT * FROM SYS_T_ORG WHERE ID=#id#
    </select>
    <insert id="InsertOrg" parameterClass="GrassInfo.BMS.Model.SystemManage.Org" >
      <selectKey property="ID" type="post" resultClass="int"> 
        ${selectKey}  
      </selectKey> 
      INSERT SYS_T_ORG (ORG_NAME,ORG_IP,PARENT_ID,SITE_NO,ADDRESS,CREATE_USER,CREATE_TIME,UPDATE_USER,UPDATE_TIME,IS_VALID)
      VALUES  (#ORG_NAME#,#ORG_IP#,#PARENT_ID#,#SITE_NO#,#ADDRESS#,#CREATE_USER#,#CREATE_TIME#,#UPDATE_USER#,#UPDATE_TIME#,#IS_VALID#)
    </insert>
    <!--<delete id="DeleteOrg" parameterClass="int" resultClass="int">
      DELETE FROM SYS_T_ORG WHERE ID=#id#
    </delete>-->
    <update id="UpdateOrg" parameterClass="GrassInfo.BMS.Model.SystemManage.Org" resultClass="int">
      UPDATE SYS_T_ORG SET ORG_NAME=#ORG_NAME#,ORG_IP=#ORG_IP#,PARENT_ID=#PARENT_ID#,SITE_NO=#SITE_NO#,ADDRESS=#ADDRESS#,CREATE_USER=#CREATE_USER#,CREATE_TIME=#CREATE_TIME#,UPDATE_USER=#UPDATE_USER#,UPDATE_TIME=#UPDATE_TIME#,IS_VALID=#IS_VALID# WHERE ID=#ID#
    </update>
    <update id="DeleteOrg" parameterClass="int" resultClass="int">
      UPDATE SYS_T_ORG SET IS_VALID='0' WHERE ID=#value#
    </update>
    <select id="GetAllOrgList" resultClass="List" resultMap="Org-Result">
      SELECT * FROM SYS_T_ORG WHERE IS_VALID='1'
    </select>
    <select id="GetOrgList" resultClass="List" resultMap="Org-Result" parameterClass="System.Collections.IDictionary">
      SELECT TOP (#PageSize#*#Page#) * FROM SYS_T_ORG WHERE ID NOT IN (SELECT TOP ((#PageSize#-1)*#Page#) ID FROM SYS_T_ORG WHERE IS_VALID='1' ORDER BY $Order$ $Desc$) AND IS_VALID='1' ORDER BY $Order$  $Desc$
    </select>
  </statements>
</sqlMap>

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:395095次
    • 积分:5651
    • 等级:
    • 排名:第4898名
    • 原创:166篇
    • 转载:55篇
    • 译文:0篇
    • 评论:35条
    文章分类
    最新评论