Blame view

parking-module-park/src/main/resources/mybatis/smapper/TdGGuideParkRelSMapper.xml 4.89 KB
9af4a544   王彪总   新项目
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
  <?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.TdGGuideParkRelSMapper">
      <resultMap id="BaseResultMap" type="com.zteits.park.domain.TdGGuideParkRel">
          <id column="id" jdbcType="BIGINT" property="id" />
      <result column="guide_no" jdbcType="VARCHAR" property="guideNo" />
      <result column="pl_no" jdbcType="VARCHAR" property="plNo" />
      <result column="pl_name" jdbcType="VARCHAR" property="plName" />
      <result column="berth_num" jdbcType="INTEGER" property="berthNum" />
      <result column="floor_status" jdbcType="INTEGER" property="floorStatus" />
      <result column="floor" jdbcType="VARCHAR" property="floor" />
      <result column="high_limit_status" jdbcType="INTEGER" property="highLimitStatus" />
      <result column="high_limit_num" jdbcType="INTEGER" property="highLimitNum" />
      <result column="sharp_turn_status" jdbcType="INTEGER" property="sharpTurnStatus" />
      <result column="time_system" jdbcType="VARCHAR" property="timeSystem" />
      <result column="guide_point" jdbcType="INTEGER" property="guidePoint" />
      <result column="data_status" jdbcType="INTEGER" property="dataStatus" />
      <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
      <result column="create_op" jdbcType="BIGINT" property="createOp" />
      <result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
      <result column="org_id" jdbcType="BIGINT" property="orgId" />
      <result column="last_update_date" jdbcType="TIMESTAMP" property="lastUpdateDate" />
      </resultMap>
      <sql id="Base_Column_List">
      id, guide_no, pl_no, pl_name, berth_num, floor_status, floor, high_limit_status, 
      high_limit_num, sharp_turn_status, time_system, guide_point, data_status, create_time, 
      create_op, modify_time, org_id, last_update_date
    </sql>
  
  
      <select id="getGuideScreenInfo" resultMap="BaseResultMap">
          SELECT
          <include refid="Base_Column_List"/>
          FROM td_g_guide_park_rel
          <where>
              guide_no= #{guideNo}
              <if test="dataState !=null">
                  AND data_status = #{dataState}
              </if>
  
          </where>
      </select>
  
  	<!-- 修改停车场车位根据停车场编号 -->
      <update id="updateParkFreeBerthByPlno" parameterType="com.zteits.park.domain.TdGGuideParkRel">
  	    update td_g_guide_park_rel
  	    <set>
  	      <if test="modifyTime != null">
  	        modify_time = #{modifyTime,jdbcType=DATE},
  	      </if>
  	    </set>
      	where 1=1
          <choose>
              <when test="dataStatus != null">
                  and data_status = #{dataStatus,jdbcType=INTEGER}
              </when>
              <otherwise>
                  and data_status =1
              </otherwise>
          </choose>
          <if test="plNo != null">
              and pl_no = #{plNo,jdbcType=VARCHAR}
          </if>
      </update>
      
      <!-- 根据诱导屏编号LIST查询对应停车场的车位总数 -->
      <select id="getBerthNumByGuideNos" parameterType="java.util.List" resultType="com.zteits.park.domain.GuideParkBerth">
      	SELECT
  			SUM(berth_num) berthNum ,a.guide_no guideNo
  		FROM
  			td_g_guide_park_rel a
  		WHERE 1=1
  			and a.guide_no in 
  		<foreach collection="guideNos" index="index" item="guideNo" open="(" separator="," close=")">  
              #{guideNo}
          </foreach>
  		and a.data_status = 1
  		GROUP BY a.guide_no
      	
      </select>
  
  	<!-- 根据诱导屏编号查询对应停车场编号List -->
  	<select id="getPlNosByGuideNo" parameterType="java.util.List" resultType="java.lang.String">
  		SELECT 
  		pl_no plNo
  		FROM td_g_guide_park_rel 
  		where 1=1
  		and
  		data_status = 1
  		and guide_no=#{guideNo,jdbcType=VARCHAR}
  		
  	</select>
  
  	<insert id="bathInsertGuideParkRels" parameterType="java.util.List">
          insert into td_g_guide_park_rel (guide_no, pl_no, pl_name, 
  	      berth_num, floor_status, floor, 
  	      high_limit_status, high_limit_num, sharp_turn_status, 
  	      time_system, guide_point, data_status, 
  	      create_time, create_op, modify_time, 
  	      org_id, last_update_date)
  	    values 
          <foreach collection="tdGGuideParkRels" index="index" item="item" separator=",">
              (#{item.guideNo,jdbcType=VARCHAR}, #{item.plNo,jdbcType=VARCHAR}, #{item.plName,jdbcType=VARCHAR}, 
  		      #{item.berthNum,jdbcType=INTEGER}, #{item.floorStatus,jdbcType=INTEGER}, #{item.floor,jdbcType=VARCHAR}, 
  		      #{item.highLimitStatus,jdbcType=INTEGER}, #{item.highLimitNum,jdbcType=INTEGER}, #{item.sharpTurnStatus,jdbcType=INTEGER}, 
  		      #{item.timeSystem,jdbcType=VARCHAR}, #{item.guidePoint,jdbcType=INTEGER}, #{item.dataStatus,jdbcType=INTEGER}, 
  		      #{item.createTime,jdbcType=TIMESTAMP}, #{item.createOp,jdbcType=BIGINT}, #{item.modifyTime,jdbcType=TIMESTAMP}, 
  		      #{item.orgId,jdbcType=BIGINT}, #{item.lastUpdateDate,jdbcType=TIMESTAMP})
          </foreach>
      </insert>
  
  </mapper>