<?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.bofeng.dao.PlaceMapper">
    <select id="selectAll" resultType="com.bofeng.entity.Place">
        select * from tb_place where be_active != 'D'
    </select>

    <select id="selectAllPlace" resultType="com.bofeng.entity.Place">
        select
          place_id,
          place_name
        from tb_place where be_active = 'Y'
    </select>

    <select id="selectByUserId" resultType="com.bofeng.entity.Place">
        select tb_place.* from tb_place left join tb_user_place
         on (tb_user_place.place_id = tb_place.place_id) WHERE tb_user_place.user_id = #{userId}
    </select>

    <select id="checkPlaceNameCount" resultType="java.lang.Integer">
select count(*) from tb_place p where p.place_id!=#{placeId} and p.place_name=#{placeName}
    </select>


</mapper>