ParkingLotEnclosedSMapper.xml
1.83 KB
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
<?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.ParkingLotEnclosedSMapper">
<resultMap id="BaseResultMap" type="com.zteits.park.domain.ParkingLotEnclosed">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="pl_no" jdbcType="VARCHAR" property="plNo" />
<result column="mch_id" jdbcType="VARCHAR" property="mchId" />
<result column="free_berth" jdbcType="INTEGER" property="freeBerth" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="create_op" jdbcType="VARCHAR" property="createOp" />
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
<result column="modify_op" jdbcType="VARCHAR" property="modifyOp" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
</resultMap>
<update id="decreaseFreeBerthEnclosed" parameterType="com.zteits.clouds.api.dto.park.param.DecreaseFreeBerthEnclosedRequest">
UPDATE parking_lot_enclosed
SET free_berth = (
CASE
WHEN free_berth > 0 THEN (free_berth - 1)
ELSE 0
END
)
WHERE
1=1
<if test="plNo != null and plNo != ''">
and pl_no = #{plNo}
</if>
</update>
<update id="increaseFreeBerthEnclosed" parameterType="com.zteits.clouds.api.dto.park.param.DecreaseFreeBerthEnclosedRequest">
UPDATE parking_lot_enclosed
SET free_berth = (
CASE
WHEN free_berth < #{berthNum,jdbcType=INTEGER} THEN (free_berth + 1)
ELSE #{berthNum}
END
)
WHERE
1=1
<if test="plNo != null and plNo != ''">
and pl_no = #{plNo}
</if>
</update>
</mapper>