<?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.nbclass.szxgl.mapper.ListTypeMapper">
   <resultMap id="BaseResultMap" type="com.nbclass.szxgl.model.ListType">
    	<id column="id" jdbcType="CHAR" property="id" />
    	<result column="list_type" jdbcType="VARCHAR" property="listType" />
    	<result column="list_value" jdbcType="VARCHAR" property="listValue" />
	    <collection property="listTypes" ofType="com.nbclass.szxgl.model.ListType" column="id" select="getComboBoxPid">
			<id column="id" jdbcType="CHAR" property="id" />
			<result column="list_type" jdbcType="VARCHAR" property="listType" />
			<result column="list_value" jdbcType="VARCHAR" property="listValue" />
		</collection>
  	</resultMap>

 	<select id="getList" resultType="com.nbclass.szxgl.model.ListType">
 	SELECT * FROM list_values lv WHERE list_type = #{listType}
	</select>

	<select id="getListValue" resultType="string">
 	SELECT list_value FROM list_values lv WHERE list_type = #{listType} and id= #{id}
	</select>

	<select id="getAreaIdByName" resultType="string">
 	SELECT id FROM list_values WHERE list_value = #{areaName}
	</select>

	<select id="getComboBox" resultMap="BaseResultMap">
		select * from list_values WHERE parent_id = 0 and parent_id !='' and parent_id is not null
	</select>

	<select id="getComboBoxPid" resultMap="BaseResultMap">
		select  * from list_values WHERE parent_id = #{id} and parent_id !='' and parent_id is not null
	</select>

	<select id="getFontType" resultType="com.nbclass.szxgl.model.ListType">
		select id,list_value from list_values where list_value like CONCAT('%',#{name},'%') and list_type = 360
	</select>

</mapper>
