配置hessian:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>

    <settings>
        <!-- 对在此配置文件下的所有cache 进行全局性开/关设置 true,false -->
        <setting name="cacheEnabled" value="true" />
        <!-- 全局性设置懒加载。如果设为‘false’,则所有相关联的都会被初始化加载 true,false -->
        <setting name="lazyLoadingEnabled" value="true" />
        <!-- 当设置为‘true’的时候,懒加载的对象可能被任何懒属性全部加载。否则,每个属性都按需加载 true,false -->
        <setting name="aggressiveLazyLoading" value="true" />
        <!-- 允许和不允许单条语句返回多个数据集(取决于驱动需求),默认true -->
        <setting name="multipleResultSetsEnabled" value="true" />
        <!-- 使用列标签代替列名称。不同的驱动器有不同的作法。参考一下驱动器文档,或者用这两个不同的选项进行测试一下 true,false -->
        <setting name="useColumnLabel" value="true" />
        <!-- 允许JDBC 生成主键。需要驱动器支持。如果设为了true,这个设置将强制使用被生成的主键,有一些驱动器不兼容不过仍然可以执行 true,false -->
        <setting name="useGeneratedKeys" value="false" />
        <!-- 指定MyBatis 是否并且如何来自动映射数据表字段与对象的属性。PARTIAL将只自动映射简单的,没有嵌套的结果。FULL将自动映射所有复杂的结果
            NONE,PARTIAL,FULL -->
        <setting name="autoMappingBehavior" value="PARTIAL" />
        <!-- 配置和设定执行器,SIMPLE执行器执行其它语句。REUSE执行器可能重复使用prepared statements语句,BATCH执行器可以重复执行语句和批量更新
            SIMPLE,REUSE,BATCH -->
        <setting name="defaultExecutorType" value="REUSE" />
        <!-- 设置一个时限,以决定让驱动器等待数据库回应的多长时间为超时 -->
        <setting name="defaultStatementTimeout" value="25000" />
    </settings>

<!-- 引入Model 对象 -->
    <typeAliases>
        <typeAlias alias="HwgActivityInfo" type="com.j1.hwg.model.HwgActivityInfo" />
        <typeAlias alias="HwgSelectGoods" type="com.j1.hwg.model.HwgSelectGoods" />
        <typeAlias alias="HwgHotBrand" type="com.j1.hwg.model.HwgHotBrand" />
        <typeAlias alias="HwgCategoryImage" type="com.j1.hwg.model.HwgCategoryImage" />
        <typeAlias alias="HwgCategoryProduct" type="com.j1.hwg.model.HwgProduct" />
        <typeAlias alias="HwgKeyword" type="com.j1.hwg.model.HwgKeyword" />
        <typeAlias alias="HwgProductEvaluation" type="com.j1.hwg.model.HwgProductEvaluation" />
        <typeAlias alias="HwgProductSaleLimit" type="com.j1.hwg.model.HwgProductSaleLimit" />
        <typeAlias alias="HwgCatalogBrand" type="com.j1.hwg.model.HwgCatalogBrand" />
    </typeAliases>
</configuration>

或者是Model的全路径:

" ?>
-mapper.dtd" >
<mapper namespace="com.j1.soa.resource.hwg.dao.oracle.HwgCatalogBrandMapper">

     <resultMap id="HwgCatalogBrandMap" type="HwgCatalogBrand">
        <result column="CATALOG_BRAND_ID" property="catalogBrandId" />
        <result column="PRO_CATALOG_ID" property="proCatalogId" />
        <result column="PRODUCT_BRAND_NAME" property="productBrandName" />
        <result column="PRODUCT_BRAND_IMG" property="productBrandImg" />
        <result column="PRODUCT_BRAND_URL" property="productBrandUrl" />
        <result column="PRO_CATALOG_NAME" property="proCatalogName" />
        <result column="CATALOG_BRAND_ORDER" property="catalogBrandOrder" />
    </resultMap>

    <resultMap id="hwgCategoryMap" type="com.j1.hwg.model.HwgCategory">
        <result column="PRO_CATALOG_ID" property="categoryId"/>
        <result column="PRO_CATALOG_NAME" property="categoryName"/>
    </resultMap>

    <!-- 用于分页查询的头部 -->
    <sql id="be_fy">
        select *
        from (select row_.*, rownum rownum_
        from (
    </sql>
    <!-- 用于分页的尾部 -->
    <sql id="ed_fy">
        ) row_

        <if test="endRow != null">
            <![CDATA[
             and rownum <= #{endRow}
             ]]>
        </if>
        )

        <if test="startRow != null">
            <![CDATA[
             and rownum_ >= #{startRow}
             ]]>
        </if>
    </sql>
    <!-- 查询 -->
    <select id="queryHwgCatalogBrandPages" resultMap="HwgCatalogBrandMap" parameterType="HwgCatalogBrand">
        <include refid="be_fy" />
        select
            t.catalog_brand_id,
           t.pro_catalog_id,
           t.product_brand_name,
           t.product_brand_img,
           t.product_brand_url,
           l.pro_catalog_name,
           t.catalog_brand_order
        from hwg_catalog_brand t inner join product_catalog l on  l.pro_catalog_id =t.pro_catalog_id
        <where>
             t.is_delete = 'N'
             <if test="productBrandName != null and productBrandName != ''">
                 and t.PRODUCT_BRAND_NAME like '%'||#{productBrandName}||'%'
             </if>
             ">
                 and t.PRO_CATALOG_ID =#{proCatalogId}
             </if>
        </where>
        order by t.ADD_TIME desc
        <include refid="ed_fy" />
    </select>
    <!-- 查询总数量 -->
    <select id="getHwgCatalogBrandCount" resultType="java.lang.Integer" parameterType="HwgCatalogBrand">
        ) from hwg_catalog_brand t
         <where>
             t.is_delete = 'N'
             <if test="productBrandName != null and productBrandName != ''">
                 and t.PRODUCT_BRAND_NAME like '%'||#{productBrandName}||'%'
             </if>
              ">
                 and t.PRO_CATALOG_ID =#{proCatalogId}
             </if>
        </where>
    </select>

    <!-- 根据主键查询 -->
    <select id="getHwgCatalogBrandById" resultMap="HwgCatalogBrandMap" parameterType="java.lang.Long">
        select t.catalog_brand_id,
           t.pro_catalog_id,
           t.product_brand_name,
           t.product_brand_img,
           t.product_brand_url,
           t.catalog_brand_order
        from hwg_catalog_brand t where t.catalog_brand_id = #{catalogBrandId}
    </select>

    <!-- 根据分类ID查询 -->
    <select id="getHwgCatalogBrandByCatalogId" resultMap="HwgCatalogBrandMap" parameterType="java.lang.Long">
        select t.catalog_brand_id,
        t.pro_catalog_id,
        t.product_brand_name,
        t.product_brand_img,
        t.product_brand_url,
        t.catalog_brand_order
        from hwg_catalog_brand t where t.PRO_CATALOG_ID = #{proCatalogId} AND t.is_delete='N'
        ORDER BY t.CATALOG_BRAND_ORDER
    </select>
    <!-- 保存 -->
    <insert id="save" parameterType="HwgCatalogBrand">
        <selectKey resultType="java.lang.Long" keyProperty="catalogBrandId"  order="BEFORE">
            SELECT HWG_CATALOG_BRAND_ID_SEQ.nextval from dual
        </selectKey>
        insert into HWG_CATALOG_BRAND
        <trim prefix="(" suffix=")" suffixOverrides=",">
            CATALOG_BRAND_ID,
            <if test="proCatalogId != null">
                PRO_CATALOG_ID,
            </if>
            <if test="productBrandName != null">
                PRODUCT_BRAND_NAME,
            </if>
            <if test="productBrandImg != null">
                PRODUCT_BRAND_IMG,
            </if>

            <if test="productBrandUrl != null">
                PRODUCT_BRAND_URL,
            </if>
             <if test="catalogBrandOrder != null">
                catalog_brand_order,
            </if>
            <if test="addUserId != null">
                ADD_USER_ID,
            </if>
            <if test="editTime != null">
                EDIT_TIME,
            </if>
            <if test="addTime != null">
                ADD_TIME,
            </if>
            <if test="editUserId != null">
                EDIT_USER_ID,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{catalogBrandId,jdbcType=NUMERIC},
            <if test="proCatalogId != null">
                #{proCatalogId,jdbcType=NUMERIC},
            </if>
            <if test="productBrandName != null">
                #{productBrandName,jdbcType=VARCHAR},
            </if>
            <if test="productBrandImg != null">
                #{productBrandImg,jdbcType=VARCHAR},
            </if>
            <if test="productBrandUrl != null">
                #{productBrandUrl,jdbcType=VARCHAR},
            </if>
            <if test="catalogBrandOrder != null">
                #{catalogBrandOrder,jdbcType=NUMERIC},
            </if>
            <if test="addUserId != null">
                #{addUserId,jdbcType=NUMERIC},
            </if>
            <if test="editTime != null">
                #{editTime,jdbcType=VARCHAR},
            </if>
            <if test="addTime != null">
                #{addTime,jdbcType=VARCHAR},
            </if>
            <if test="editUserId != null">
                #{editUserId,jdbcType=NUMERIC},
            </if>
        </trim>
    </insert>
    <!-- 修改 -->
    <update id="update" parameterType="HwgCatalogBrand">
        update HWG_CATALOG_BRAND
        <set>
            <if test="proCatalogId != null and proCatalogId != ''">
                PRO_CATALOG_ID =#{proCatalogId,jdbcType=NUMERIC},
            </if>
            <if test="productBrandName != null and productBrandName != ''">
                PRODUCT_BRAND_NAME = #{productBrandName,jdbcType=VARCHAR},
            </if>
            <if test="productBrandImg != null and productBrandImg != ''">
                PRODUCT_BRAND_IMG = #{productBrandImg,jdbcType=VARCHAR},
            </if>
            <if test="productBrandUrl != null and productBrandUrl != ''">
                PRODUCT_BRAND_URL = #{productBrandUrl,jdbcType=VARCHAR},
            </if>
            <if test="catalogBrandOrder != null and catalogBrandOrder != ''">
                CATALOG_BRAND_ORDER = #{catalogBrandOrder,jdbcType=NUMERIC},
            </if>
            <if test="addUserId != null and addUserId != ''">
                ADD_USER_ID = #{addUserId,jdbcType=NUMERIC},
            </if>
            <if test="addTime != null and addTime != ''">
                ADD_TIME = #{addTime,jdbcType=VARCHAR},
            </if>
            <if test="editUserId != null and editUserId != ''">
                EDIT_USER_ID = #{editUserId,jdbcType=NUMERIC},
            </if>
            <if test="editTime != null and editTime != ''">
                EDIT_TIME = #{editTime,jdbcType=VARCHAR},
            </if>
            <if test="isDelete != null and isDelete != ''">
                IS_DELETE = #{isDelete,jdbcType=VARCHAR}
            </if>
        </set>
        where catalog_brand_id = #{catalogBrandId,jdbcType=NUMERIC}
    </update>
    <!-- 删除 -->
    <update id="delete"  parameterType="java.util.List">
        update HWG_CATALOG_BRAND set IS_DELETE='Y' where catalog_brand_id
        in
        <foreach item="item" collection="list" separator="," open="(" close=")">
            #{item, jdbcType=NUMERIC}
        </foreach>
      </update>    

      <select id="queryCatalog" resultMap="hwgCategoryMap" parameterType="java.lang.String">
      select c.PRO_CATALOG_ID ,c.PRO_CATALOG_NAME
      from PRODUCT_CATALOG c
      where c.PRO_PARENT_CATALOG IN
      (select c.PRO_CATALOG_ID
      from PRODUCT_CATALOG c,PRODUCT_CATALOG_AUTH a
      where a.PRO_CATALOG_ID=c.PRO_CATALOG_ID 

      and a.AUTH_TYPE=#{value})
      </select>

      <!-- 查询所有楼层 -->
      <select id="getAbroadCategoryInfo" resultType="com.j1.hwg.webmodel.AbroadCategoryInfo" >
        select
          hc.category_id as categoryId, hc.category_name as categoryName
        from
          hwg_category hc
        where
          hc.is_delete='N'
        order by
          hc.category_order
      </select>

</mapper>

mybatis 之引入多个model的更多相关文章

  1. spring和mybatis集成,自动生成model、mapper,增加mybatis分页功能

    软件简介 Spring是一个流行的控制反转(IoC)和面向切面(AOP)的容器框架,在java webapp开发中使用广泛.http://projects.spring.io/spring-frame ...

  2. springboot和mybatis集成,自动生成model、mapper,增加mybatis分页功能

    整体思路和http://www.cnblogs.com/mahuan2/p/5859921.html相同. 主要讲maven的pom.xml和一些配置变化,详细说明. 软件简介 Spring是一个流行 ...

  3. MyBatis 使用Generator自动生成Model , Dao, mapper

    最近   我新建了一 个maven 项目,使用的是spring + springmvc + mybatis框架. 听说Mybatis可以自动生成model和mapper以及dao层,我就从网上查了查资 ...

  4. MyBatis generator 生成生成dao model mappper

    MyBatis GeneratorXML配置文件参考 在最常见的用例中,MyBatis Generator(MBG)由XML配置文件驱动. 配置文件告诉MBG: 如何连接到数据库 什么对象要生成,以及 ...

  5. SSM:Mybatis中引入通用mapper

    如果你是SSM项目引入通用mapper记得要引入hibernate中的一个hibernate-jpa-2.1-api-1.0.0.Final.jar包(注意必须要Mybatis整合Spring噢,其实 ...

  6. ibatis 引入多个model

    <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE sqlMap PUBLIC "- ...

  7. JavaEE开发之SpringBoot整合MyBatis以及Thymeleaf模板引擎

    上篇博客我们聊了<JavaEE开发之SpringBoot工程的创建.运行与配置>,从上篇博客的内容我们不难看出SpringBoot的便捷.本篇博客我们继续在上篇博客的基础上来看一下Spri ...

  8. MyBatis 3 User Guide Simplified Chinese.pdf

    MyBatis 3 用户指南 帮助我们把文档做得更好… 如果你发现了本文档的遗漏之处,或者丢失 MyBatis 特性的说明时,那么最好的方法就 是了解一下这个遗漏之处然后把它记录下来. 我们在 wik ...

  9. mybatis 自动生成代码(mybatis generator)

    pom.xml 文件配置 引入 mybatis generator <properties> <mysql.connector.version>5.1.44</mysql ...

随机推荐

  1. 8、QObject类 moc处理后代码

    QObject在QT中是所有类的基类,经过MOC处理后代码如下 之所以贴出这段代码,是因为很多流程追踪到最后一些关键性函数都是出自这个类 源码 4.8.6 MOC版本 63 1 /********** ...

  2. 动态SQL是什么??什么是静态SQL,动态SQL的动态体现在哪里???

    首先,所谓SQL的动态和静态,是指SQL语句在何时被编译和执行,二者都是用在SQL嵌入式编程中的,这里所说的嵌入式是指将SQL语句嵌入在高级语言中,而不是针对于单片机的那种嵌入式编程.在某种高级语言中 ...

  3. android 8 wifi wifi 扫描过程

    查看一下android wifi扫描的过程. packages\apps\Settings\src\com\android\settings\wifi\WifiSettings.java public ...

  4. (转)并行编译 Xoreax IncrediBuild

    出自:http://blog.csdn.net/yockie/article/details/16867457 以前完全没有接触过分布式编译,今天因工作需要尝试了一下,绝对很强大,体验也非常好,绝对让 ...

  5. (原)从mp4,flv文件中解析出h264和aac,送解码器解码失败

    转载请注明出处:http://www.cnblogs.com/lihaiping/p/5285166.html 今天在做本地文件解码测试,发现从mp4,flv文件中读出来的帧数据,h264和aac帧直 ...

  6. nginx配置一、二级域名、多域名对应(api接口、前端网站、后台管理网站)

    前提:安装好nginx,如果已经启动nginx,先停止,命令: ./usr/local/nginx/sbin/nginx -s stop 修改nginx配置 vi /usr/local/nginx/c ...

  7. lkl风控.随机森林模型测试代码spark1.6

    /** * Created by lkl on 2017/10/9. */ import org.apache.spark.sql.hive.HiveContext import org.apache ...

  8. XML 中可嵌入 cmd命令脚本

    原文要参照代码 1. XML解析 Task逻辑块可相互组合,形成复杂的树状结构,其结构用XML表示,即写成XML文件的形式. 样例如下: <!-- 顺序执行块 --> <seq> ...

  9. LinuxMint下的Orionode源码安装

    1. Orionode介绍 Eclipse-orion是Eclipse项目下面的一个子项目,orion是一个在在线版的代码编辑环境.其介绍参考http://wiki.eclipse.org/Orion ...

  10. 续:纠正:debian【4】可以安装,而且完美的安装 ! for《Oracle-10.2.0.1,打补丁10.2.0.5:在 debian 版本4【不含4】以上,及 ubuntu 7.04【不含7.04】以上都可以安装!》

    关键点: ip a ifconfig -a dhclient ifconfig -a poweroff ip a ifconfig -a apt-get update apt-get install ...