TdGGuideParkBerthsSMapper.xml 2.9 KB
<?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.zteits.park.mapper.smapper.TdGGuideParkBerthsSMapper" >
  <resultMap id="BaseResultMap" type="com.zteits.park.domain.TdGGuideParkBerths" >
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="berth_no" property="berthNo" jdbcType="VARCHAR" />
    <result column="berth_out_no" property="berthOutNo" jdbcType="VARCHAR" />
    <result column="pl_no" property="plNo" jdbcType="VARCHAR" />
    <result column="pl_out_no" property="plOutNo" jdbcType="VARCHAR" />
    <result column="berth_state" property="berthState" jdbcType="INTEGER" />
    <result column="berth_type" property="berthType" jdbcType="INTEGER" />
    <result column="berth_address" property="berthAddress" jdbcType="VARCHAR" />
    <result column="remark" property="remark" jdbcType="VARCHAR" />
    <result column="data_state" property="dataState" jdbcType="INTEGER" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="create_op" property="createOp" jdbcType="BIGINT" />
    <result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP" />
    <result column="modify_op" property="modifyOp" jdbcType="BIGINT" />
  </resultMap>
  
  <!-- 修改停车场车位状态,根据外部停车场编号和外部停车位编号 -->
    <update id="updateBerthStateByPlOutNoAndBerthOutNo" parameterType="com.zteits.park.domain.TdGGuideParkBerths">
	    update td_g_guide_park_berths
	    <set>
	      <if test="berthState != null">
	        berth_state = #{berthState,jdbcType=INTEGER},
	      </if>
	      <if test="modifyTime != null">
	        modify_time = #{modifyTime,jdbcType=DATE},
	      </if>
	    </set>
    	where 1=1
        <choose>
            <when test="dataState != null">
                and data_state = #{dataState,jdbcType=INTEGER}
            </when>
            <otherwise>
                and data_state =1
            </otherwise>
        </choose>
            and pl_out_no = #{plOutNo,jdbcType=VARCHAR}
            and berth_out_no = #{berthOutNo,jdbcType=VARCHAR}
    </update>
    
    <!-- 根据外部停车场编号获取内部停车场编号 -->
    <select id="getPlNoByPlOutNo" parameterType="java.lang.String" resultType="java.lang.String">
    	select pl_no plNo from td_g_guide_park_berths 
    	where 1=1
    	and data_state=1 
    	and pl_out_no = #{plOutNo,jdbcType=VARCHAR}
    	LIMIT 1
    </select>
    
    <!-- 根据停车场编号获取空闲停车位个数 -->
    <select id="getFreeBrethsNumByPlNo" parameterType="java.lang.String" resultType="com.zteits.park.domain.ParkFreeBerth">
    	select count(*) freeBerth,pl_no plNo from td_g_guide_park_berths 
    	where 1=1
    	and berth_state=0 
    	and data_state=1 
    	and pl_no = #{plNo,jdbcType=VARCHAR}
    	GROUP BY pl_no LIMIT 1
    </select>
</mapper>