<?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="placeClassInformationSqlMapper">
	
	<select id="findById" parameterType="long" resultType="PlaceClassInformation">
		select id, name from t_place_class_info
		where id = #{id}
	</select>
	
	<select id="findPlaceClassByOperatorId" parameterType="long" resultType="PlaceClassInformation">
		select id,name from t_place_class_info
	</select>
	
	<select id="findAll" resultType="PlaceClassInformation">
		select * from t_place_class_info
	</select>
	
	<select id="queryPlaceClassInfoByplaceId" parameterType="java.util.Map" resultType="com.cloudcross.ssp.model.PlaceClassInformation">
		select DISTINCT(tpci.id) id,tpci.name name from t_place_class_info tpci,t_place_class tpc where tpci.id = tpc.class_id and place_id in
		<foreach item="placeId" collection="placeIdList" open="(" separator="," close=")">
		        #{placeId}
		</foreach>
	</select>
	
	<select id="queryClassIdByAdgroupId" parameterType="java.lang.Long" resultType="java.lang.Long">
		select DISTINCT(class_id) classId from t_place_class where place_id in (select place_id from t_adgroup_place where adgroup_id = #{adgroupId})
	</select>
	
	<select id="queryPlaceClass" parameterType="java.util.Map" resultType="com.cloudcross.ssp.model.PlaceClassInformation">
		select id,name from t_place_class_info order by id limit #{pager.offset}, #{pager.limit}
	</select>
	
	<select id="queryPlaceClassCount" resultType="java.lang.Integer">
		select count(id) from t_place_class_info
	</select>
</mapper>