<?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.cku.dao.CkuDogClassMapper">
  <resultMap id="BaseResultMap" type="com.cku.model.CkuDogClass" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="dog_code" property="dogCode" jdbcType="VARCHAR" />
    <result column="dog_english_name" property="dogEnglishName" jdbcType="VARCHAR" />
    <result column="dog_english_nickname" property="dogEnglishNickname" jdbcType="VARCHAR" />
    <result column="dog_china_name" property="dogChinaName" jdbcType="VARCHAR" />
    <result column="dog_china_nickname" property="dogChinaNickname" jdbcType="VARCHAR" />
    <result column="dog_qz" property="dogQz" jdbcType="VARCHAR" />
    <result column="dog_gb" property="dogGb" jdbcType="VARCHAR" />
    <result column="dog_cacib" property="dogCacib" jdbcType="VARCHAR" />
    <result column="dog_time" property="dogTime" jdbcType="VARCHAR" />
    <result column="dog_z" property="dogZ" jdbcType="VARCHAR" />
    <result column="dog_j" property="dogJ" jdbcType="VARCHAR" />
    <result column="dog_w" property="dogW" jdbcType="VARCHAR" />
    <result column="dog_image" property="dogImage" jdbcType="VARCHAR" />
    <result column="dog_max_number" property="dogMaxNumber" jdbcType="VARCHAR" />
    <result column="dog_fyzs_number" property="dogFyzsNumber" jdbcType="VARCHAR" />
    <result column="dog_dna_number" property="dogDnaNumber" jdbcType="VARCHAR" />
    <result column="dog_hd_number" property="dogHdNumber" jdbcType="VARCHAR" />
    <result column="dog_add_day" property="dogAddDay" jdbcType="VARCHAR" />
    <result column="dog_update_day" property="dogUpdateDay" jdbcType="VARCHAR" />
    <result column="del_tag" property="delTag" jdbcType="VARCHAR" />
    <result column="short_name" property="shortName" jdbcType="VARCHAR"/>
    <result column="hot" property="hot" jdbcType="VARCHAR"/>
    <collection property="ckuImageList" javaType="list" ofType="com.cku.model.CkuImage">
			<id column="image_id" property="imageId"/>
			<result column="image_min_url" property="imageMinUrl"/>
			<result column="image_max_url" property="imageMaxUrl"/>
	</collection>
  </resultMap>
  <select id="getDogClass" resultMap="BaseResultMap" parameterType="java.lang.Long">
  	SELECT 
  		dogClass.id id,
  		dogClass.犬种类代码  dog_code,
  		dogClass.犬种类英文名称  dog_english_name,
  		dogClass.犬种类英文别名  dog_english_nickname,
  		dogClass.犬种类中文名称  dog_china_name,
  		dogClass.犬种类中文别名  dog_china_nickname,
  		<!-- dogClass.犬种  dog_qz,
  		dogClass.国别  dog_gb,
  		dogClass.CACIB dog_cacib,
  		dogClass.标准时间  dog_time,
  		dogClass.组  dog_z,
  		dogClass.节  dog_j,
  		dogClass.位  dog_w,
  		dogClass.犬种类照片 dog_image,
  		dogClass.当前最大序号  dog_max_number,
  		dogClass.繁育证书序号  dog_fyzs_number,
  		dogClass.DNA登记序号  dog_dna_number,
  		dogClass.HD证书序号 dog_hd_number,
  		dogClass.添加日期  dog_add_day,
  		dogClass.修改日期  dog_update_day, -->
  		dogClass.short_name short_name,
  		dogClass.hot hot,
  		dogClass.del_tag del_tag,
  		image.image_min_url image_min_url,
  		image.image_max_url image_max_url
  		
  		FROM tab_dog_class_code dogClass
  		LEFT JOIN cku_image image ON image.dog_class_id = dogClass.id
  	<if test="name != null and name != ''">
		WHERE 犬种类中文名称 like '%${name}%'
	</if>
	<if test="hot == 'hot'">
		WHERE dogClass.hot = '1'
	</if>
  </select>
</mapper>  