|
@@ -7,98 +7,137 @@
|
|
|
<resultMap type="SysCamera" id="SysCameraResult">
|
|
|
<result property="id" column="id"/>
|
|
|
<result property="ascriptionStation" column="ascription_station"/>
|
|
|
+ <result property="policeId" column="police_id"/>
|
|
|
<result property="address" column="address"/>
|
|
|
<result property="longitude" column="longitude"/>
|
|
|
<result property="latitude" column="latitude"/>
|
|
|
<result property="buildType" column="build_type"/>
|
|
|
</resultMap>
|
|
|
|
|
|
+ <resultMap type="SysCameraPolice" id="SysPoliceStationResult">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="policeId" column="police_id"/>
|
|
|
+ <result property="policeName" column="police_name"/>
|
|
|
+ <result property="position" column="position"/>
|
|
|
+ <result property="ascriptionStation" column="ascription_station"/>
|
|
|
+ <result property="address" column="address"/>
|
|
|
+ <result property="longitude" column="longitude"/>
|
|
|
+ <result property="latitude" column="latitude"/>
|
|
|
+ <result property="buildType" column="build_type"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
<sql id="selectSysCameraVo">
|
|
|
select id, ascription_station, address, longitude, latitude, build_type
|
|
|
from sys_camera
|
|
|
</sql>
|
|
|
|
|
|
- <select id="selectSysCameraList" parameterType="SysCamera" resultMap="SysCameraResult">
|
|
|
- <include refid="selectSysCameraVo"/>
|
|
|
+ <select id="selectSysCameraList" resultMap="SysPoliceStationResult">
|
|
|
+ SELECT
|
|
|
+ a.id,
|
|
|
+ b.police_name,
|
|
|
+ a.ascription_station,
|
|
|
+ a.address,
|
|
|
+ a.longitude,
|
|
|
+ a.latitude,
|
|
|
+ a.build_type
|
|
|
+ FROM
|
|
|
+ sys_camera a
|
|
|
+ left join sys_police_station b on a.police_id = b.id
|
|
|
<where>
|
|
|
- <if test="ascriptionStation != null and ascriptionStation != ''">
|
|
|
- and ascription_station = #{ascriptionStation}
|
|
|
- </if>
|
|
|
- <if test="address != null and address != ''">
|
|
|
- and address = #{address}
|
|
|
- </if>
|
|
|
- <if test="longitude != null and longitude != ''">
|
|
|
- and longitude = #{longitude}
|
|
|
- </if>
|
|
|
- <if test="latitude != null and latitude != ''">
|
|
|
- and latitude = #{latitude}
|
|
|
- </if>
|
|
|
- <if test="buildType != null and buildType != ''">
|
|
|
- and build_type = #{buildType}
|
|
|
- </if>
|
|
|
+ <if test="ascriptionStation != null and ascriptionStation != ''">
|
|
|
+ and ascription_station = #{ascriptionStation}
|
|
|
+ </if>
|
|
|
+ <if test="policeName != null ">and b.police_name = #{policeName}</if>
|
|
|
+ <if test="longitude != null and longitude != ''">
|
|
|
+ and longitude = #{longitude}
|
|
|
+ </if>
|
|
|
+ <if test="latitude != null and latitude != ''">
|
|
|
+ and latitude = #{latitude}
|
|
|
+ </if>
|
|
|
+ <if test="buildType != null and buildType != ''">
|
|
|
+ and build_type = #{buildType}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectSysCameraById" parameterType="Long"
|
|
|
- resultMap="SysCameraResult">
|
|
|
- <include refid="selectSysCameraVo"/>
|
|
|
- where id = #{id}
|
|
|
+ <select id="selectSysCameraById" parameterType="Long" resultMap="SysPoliceStationResult">
|
|
|
+ SELECT
|
|
|
+ a.id,
|
|
|
+ b.police_name,
|
|
|
+ a.ascription_station,
|
|
|
+ a.address,
|
|
|
+ a.longitude,
|
|
|
+ a.latitude,
|
|
|
+ a.build_type
|
|
|
+ FROM
|
|
|
+ sys_camera a
|
|
|
+ left join sys_police_station b on a.police_id = b.id
|
|
|
+ where a.id = #{id}
|
|
|
</select>
|
|
|
|
|
|
- <insert id="insertSysCamera" parameterType="SysCamera">
|
|
|
+ <insert id="insertSysCamera" parameterType="SysCamera" useGeneratedKeys="true" keyProperty="id">
|
|
|
insert into sys_camera
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
- <if test="id != null">id,
|
|
|
- </if>
|
|
|
- <if test="ascriptionStation != null">ascription_station,
|
|
|
- </if>
|
|
|
- <if test="address != null">address,
|
|
|
- </if>
|
|
|
- <if test="longitude != null">longitude,
|
|
|
- </if>
|
|
|
- <if test="latitude != null">latitude,
|
|
|
- </if>
|
|
|
- <if test="buildType != null">build_type,
|
|
|
- </if>
|
|
|
+ <if test="id != null">id,
|
|
|
+ </if>
|
|
|
+ <if test="policeId != null">police_id,
|
|
|
+ </if>
|
|
|
+ <if test="ascriptionStation != null">ascription_station,
|
|
|
+ </if>
|
|
|
+ <if test="address != null">address,
|
|
|
+ </if>
|
|
|
+ <if test="longitude != null">longitude,
|
|
|
+ </if>
|
|
|
+ <if test="latitude != null">latitude,
|
|
|
+ </if>
|
|
|
+ <if test="buildType != null">build_type,
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
- <if test="id != null">#{id},
|
|
|
- </if>
|
|
|
- <if test="ascriptionStation != null">#{ascriptionStation},
|
|
|
- </if>
|
|
|
- <if test="address != null">#{address},
|
|
|
- </if>
|
|
|
- <if test="longitude != null">#{longitude},
|
|
|
- </if>
|
|
|
- <if test="latitude != null">#{latitude},
|
|
|
- </if>
|
|
|
- <if test="buildType != null">#{buildType},
|
|
|
- </if>
|
|
|
+ <if test="id != null">#{id},
|
|
|
+ </if>
|
|
|
+ <if test="policeId != null">#{policeId},
|
|
|
+ </if>
|
|
|
+ <if test="ascriptionStation != null">#{ascriptionStation},
|
|
|
+ </if>
|
|
|
+ <if test="address != null">#{address},
|
|
|
+ </if>
|
|
|
+ <if test="longitude != null">#{longitude},
|
|
|
+ </if>
|
|
|
+ <if test="latitude != null">#{latitude},
|
|
|
+ </if>
|
|
|
+ <if test="buildType != null">#{buildType},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
|
<update id="updateSysCamera" parameterType="SysCamera">
|
|
|
update sys_camera
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
- <if test="ascriptionStation != null">ascription_station =
|
|
|
- #{ascriptionStation},
|
|
|
- </if>
|
|
|
- <if test="address != null">address =
|
|
|
- #{address},
|
|
|
- </if>
|
|
|
- <if test="longitude != null">longitude =
|
|
|
- #{longitude},
|
|
|
- </if>
|
|
|
- <if test="latitude != null">latitude =
|
|
|
- #{latitude},
|
|
|
- </if>
|
|
|
- <if test="buildType != null">build_type =
|
|
|
- #{buildType},
|
|
|
- </if>
|
|
|
+ <if test="policeId != null">police_id = #{policeId},</if>
|
|
|
+ <if test="ascriptionStation != null">ascription_station =
|
|
|
+ #{ascriptionStation},
|
|
|
+ </if>
|
|
|
+ <if test="address != null">address =
|
|
|
+ #{address},
|
|
|
+ </if>
|
|
|
+ <if test="longitude != null">longitude =
|
|
|
+ #{longitude},
|
|
|
+ </if>
|
|
|
+ <if test="latitude != null">latitude =
|
|
|
+ #{latitude},
|
|
|
+ </if>
|
|
|
+ <if test="buildType != null">build_type =
|
|
|
+ #{buildType},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
where id = #{id}
|
|
|
</update>
|
|
|
|
|
|
+ <select id="getAllList" resultMap="SysPoliceStationResult">
|
|
|
+ <include refid="selectSysCameraVo"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
<delete id="deleteSysCameraById" parameterType="Long">
|
|
|
delete
|
|
|
from sys_camera where id = #{id}
|