<?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="cn.com.countrygarden.bi.main.dao.ModuleMapper">
    <resultMap id="ModuleResultMap" type="cn.com.countrygarden.bi.main.model.Module">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="title" jdbcType="VARCHAR" property="title"/>
        <result column="content" jdbcType="VARCHAR" property="content"/>
        <result column="image" jdbcType="VARCHAR" property="image"/>
        <result column="type" jdbcType="VARCHAR" property="type"/>
        <result column="sort" jdbcType="VARCHAR" property="sort"/>
        <result column="ios_controller" jdbcType="VARCHAR" property="iosController"/>
        <result column="android_activity" jdbcType="VARCHAR" property="androidActivity"/>
        <result column="url" jdbcType="VARCHAR" property="url"/>
        <result column="param" jdbcType="VARCHAR" property="param"/>
        <result column="is_deleted" jdbcType="VARCHAR" property="isDeleted"/>
    </resultMap>

    <sql id="selectModuleAll">
    <![CDATA[
            SELECT m.id, m.title, m.content, m.image, m.type, m.sort, m.ios_controller, m.android_activity, m.url, m.param
            FROM module AS m
        ]]>
    </sql>

    <select id="getMainModule" parameterType="int" resultMap="ModuleResultMap">
        <include refid="selectModuleAll" />
        <![CDATA[
          WHERE m.is_delete = 0
          ORDER BY m.sort
          LIMIT 0, #{limit}
        ]]>
    </select>
</mapper>