WorkstationOutsideGeoMapper.xml
3.1 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
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
<?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.laowu.mapper.WorkstationOutsideGeoMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.laowu.model.WorkstationOutsideGeoDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="workstation_id" property="workstationId" />
<result column="outside_geo_name" property="outsideGeoName" />
<result column="province" property="province" />
<result column="city" property="city" />
<result column="county" property="county" />
<result column="town" property="town" />
<result column="village" property="village" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, workstation_id, outside_geo_name, province, city, county, town, village
</sql>
<select id="geoCnt" resultType="integer">
SELECT
count( 1 )
FROM
workstation_outside_geo t
WHERE
t.delete_date IS NULL
AND t.workstation_id = #{workstationId}
AND t.province = #{province}
AND t.city = #{city}
AND t.town = #{town}
AND t.village = #{village}
<if test="id != null and id != null">
and t.id != #{id}
</if>
</select>
<update id="updateGeo">
update workstation_outside_geo
<trim suffixOverrides=",">
update_date = now(),
<if test="province !=null and province !=''">
province = #{province},
</if>
<if test="city !=null and city !=''">
city = #{city},
</if>
<if test="county !=null and county !=''">
county = #{county},
</if>
<if test="town !=null and town !=''">
town = #{town},
</if>
<if test="village !=null and village !=''">
village = #{village},
</if>
</trim>
where id = #{id}
</update>
<select id="queryGeos" resultType="com.laowu.model.WorkstationOutsideGeoDO">
SELECT
*
FROM
workstation_outside_geo t
WHERE
t.delete_date IS NULL
AND t.workstation_id = #{workstationId}
<if test="province != null and province != ''">
AND t.province = #{province}
</if>
<if test="city != null and city != ''">
AND t.city = #{city}
</if>
<if test="town != null and town != ''">
AND t.town = #{town}
</if>
<if test="village != null and village != ''">
AND t.village = #{village}
</if>
</select>
</mapper>