<?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="com.sooka.mybatis.mapper.TCmsFriendlinkMapper">
  <resultMap id="BaseResultMap" type="com.sooka.mybatis.model.TCmsFriendlink">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="link_name" jdbcType="VARCHAR" property="linkName" />
    <result column="link_type" jdbcType="INTEGER" property="linkType" />
    <result column="img" jdbcType="VARCHAR" property="img" />
    <result column="link_url" jdbcType="VARCHAR" property="linkUrl" />
    <result column="sort_id" jdbcType="INTEGER" property="sortId" />
    <result column="status" jdbcType="BIT" property="status" />
    <result column="group_id" jdbcType="INTEGER" property="groupId" />
  </resultMap>

      <select id="selectBySort" parameterType="com.sooka.mybatis.model.TCmsFriendlink" resultMap="BaseResultMap">
          select f.* from t_cms_friendlink f join t_cms_friendlink_group g on f.group_id = g.id
              <trim prefix="WHERE ("  suffix=")" prefixOverrides="AND|OR">
                  <if test="status!=null">
                      f.status=#{status}
                  </if>

                  <if test='linkType!=null'>
                      AND f.link_type=#{linkType}
                  </if>

                </trim>
          order by sort_id
  </select>


</mapper>