wlcb-system-base-data/src/main/resources/mybatis/mapper/keyplace/key-place-mapper.xml
2021-11-16 15:15:55 +08:00

442 lines
14 KiB
XML

<?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="cn.com.tenlion.systembase.dao.keyplace.IKeyPlaceDao">
<resultMap id="keyPlaceDTO" type="cn.com.tenlion.systembase.pojo.dtos.keyplace.KeyPlaceDTO">
<result column="key_place_id" property="keyPlaceId"/>
<result column="place_name" property="placeName"/>
<result column="place_type" property="placeType"/>
<result column="place_type_name" property="placeTypeName"/>
<result column="detail_type" property="detailType"/>
<result column="detail_type_name" property="detailTypeName"/>
<result column="area_code" property="areaCode"/>
<result column="area_name" property="areaName"/>
<result column="address" property="address"/>
<result column="link_man" property="linkMan"/>
<result column="link_phone" property="linkPhone"/>
<result column="phone" property="phone"/>
<result column="longitude" property="longitude"/>
<result column="latitude" property="latitude"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<resultMap id="keyPlaceBO" type="cn.com.tenlion.systembase.pojo.bos.keyplace.KeyPlaceBO">
<result column="key_place_id" property="keyPlaceId"/>
<result column="place_name" property="placeName"/>
<result column="place_type" property="placeType"/>
<result column="place_type_name" property="placeTypeName"/>
<result column="detail_type" property="detailType"/>
<result column="detail_type_name" property="detailTypeName"/>
<result column="area_code" property="areaCode"/>
<result column="area_name" property="areaName"/>
<result column="address" property="address"/>
<result column="link_man" property="linkMan"/>
<result column="link_phone" property="linkPhone"/>
<result column="phone" property="phone"/>
<result column="longitude" property="longitude"/>
<result column="latitude" property="latitude"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<resultMap id="keyPlacePO" type="cn.com.tenlion.systembase.pojo.pos.keyplace.KeyPlacePO">
<result column="key_place_id" property="keyPlaceId"/>
<result column="place_name" property="placeName"/>
<result column="place_type" property="placeType"/>
<result column="place_type_name" property="placeTypeName"/>
<result column="detail_type" property="detailType"/>
<result column="detail_type_name" property="detailTypeName"/>
<result column="area_code" property="areaCode"/>
<result column="area_name" property="areaName"/>
<result column="address" property="address"/>
<result column="link_man" property="linkMan"/>
<result column="link_phone" property="linkPhone"/>
<result column="phone" property="phone"/>
<result column="longitude" property="longitude"/>
<result column="latitude" property="latitude"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<!-- 新增重点场所 -->
<insert id="save" parameterType="map">
INSERT INTO data_key_place(
key_place_id,
place_name,
place_type,
place_type_name,
detail_type,
detail_type_name,
area_code,
area_name,
address,
link_man,
link_phone,
phone,
longitude,
latitude,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
#{keyPlaceId},
#{placeName},
#{placeType},
#{placeTypeName},
#{detailType},
#{detailTypeName},
#{areaCode},
#{areaName},
#{address},
#{linkMan},
#{linkPhone},
#{phone},
#{longitude},
#{latitude},
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<!-- 删除重点场所 -->
<update id="remove" parameterType="map">
UPDATE
data_key_place
SET
gmt_modified = #{gmtModified},
modifier = #{modifier},
is_delete = 1
WHERE
key_place_id IN
<foreach collection="keyPlaceIds" index="index" open="(" separator="," close=")">
#{keyPlaceIds[${index}]}
</foreach>
</update>
<!-- 删除重点场所(物理) -->
<update id="delete" parameterType="map">
DELETE FROM
data_key_place
WHERE
key_place_id IN
<foreach collection="keyPlaceIds" index="index" open="(" separator="," close=")">
#{keyPlaceIds[${index}]}
</foreach>
</update>
<!-- 修改重点场所 -->
<update id="update" parameterType="map">
UPDATE
data_key_place
SET
<if test="placeName != null and placeName != ''">
place_name = #{placeName},
</if>
<if test="placeType != null and placeType != ''">
place_type = #{placeType},
</if>
<if test="placeTypeName != null and placeTypeName != ''">
place_type_name = #{placeTypeName},
</if>
<if test="detailType != null and detailType != ''">
detail_type = #{detailType},
</if>
<if test="detailTypeName != null and detailTypeName != ''">
detail_type_name = #{detailTypeName},
</if>
<if test="areaCode != null and areaCode != ''">
area_code = #{areaCode},
</if>
<if test="areaName != null and areaName != ''">
area_name = #{areaName},
</if>
<if test="address != null and address != ''">
address = #{address},
</if>
<if test="linkMan != null and linkMan != ''">
link_man = #{linkMan},
</if>
<if test="linkPhone != null and linkPhone != ''">
link_phone = #{linkPhone},
</if>
<if test="phone != null and phone != ''">
phone = #{phone},
</if>
<if test="longitude != null and longitude != ''">
longitude = #{longitude},
</if>
<if test="latitude != null and latitude != ''">
latitude = #{latitude},
</if>
gmt_modified = #{gmtModified},
modifier = #{modifier},
key_place_id = key_place_id
WHERE
key_place_id = #{keyPlaceId}
</update>
<!-- 重点场所详情 -->
<select id="get" parameterType="map" resultMap="keyPlaceDTO">
SELECT
t1.place_name,
t1.place_type,
t1.place_type_name,
t1.detail_type,
t1.detail_type_name,
t1.area_code,
t1.area_name,
t1.address,
t1.link_man,
t1.link_phone,
t1.phone,
t1.longitude,
t1.latitude,
t1.key_place_id
FROM
data_key_place t1
WHERE
t1.is_delete = 0
<if test="keyPlaceId != null and keyPlaceId != ''">
AND
t1.key_place_id = #{keyPlaceId}
</if>
</select>
<!-- 重点场所详情 -->
<select id="getBO" parameterType="map" resultMap="keyPlaceBO">
SELECT
t1.key_place_id,
t1.place_name,
t1.place_type,
t1.place_type_name,
t1.detail_type,
t1.detail_type_name,
t1.area_code,
t1.area_name,
t1.address,
t1.link_man,
t1.link_phone,
t1.phone,
t1.longitude,
t1.latitude,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
data_key_place t1
WHERE
t1.is_delete = 0
<if test="keyPlaceId != null and keyPlaceId != ''">
AND
t1.key_place_id = #{keyPlaceId}
</if>
</select>
<!-- 重点场所详情 -->
<select id="getPO" parameterType="map" resultMap="keyPlacePO">
SELECT
t1.key_place_id,
t1.place_name,
t1.place_type,
t1.place_type_name,
t1.detail_type,
t1.detail_type_name,
t1.area_code,
t1.area_name,
t1.address,
t1.link_man,
t1.link_phone,
t1.phone,
t1.longitude,
t1.latitude,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
data_key_place t1
WHERE
t1.is_delete = 0
<if test="keyPlaceId != null and keyPlaceId != ''">
AND
t1.key_place_id = #{keyPlaceId}
</if>
</select>
<!-- 重点场所列表 -->
<select id="list" parameterType="map" resultMap="keyPlaceDTO">
SELECT
t1.key_place_id,
t1.place_name,
t1.place_type,
t1.place_type_name,
t1.detail_type,
t1.detail_type_name,
t1.area_code,
t1.area_name,
t1.address,
t1.link_man,
t1.link_phone,
t1.phone,
t1.longitude,
t1.latitude,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete,
1
FROM
data_key_place t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="keyPlaceIds != null and keyPlaceIds.size > 0">
AND
t1.key_place_id IN
<foreach collection="keyPlaceIds" index="index" open="(" separator="," close=")">
#{keyPlaceIds[${index}]}
</foreach>
</if>
</select>
<!-- 重点场所列表 -->
<select id="listBO" parameterType="map" resultMap="keyPlaceBO">
SELECT
t1.key_place_id,
t1.place_name,
t1.place_type,
t1.place_type_name,
t1.detail_type,
t1.detail_type_name,
t1.area_code,
t1.area_name,
t1.address,
t1.link_man,
t1.link_phone,
t1.phone,
t1.longitude,
t1.latitude,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
data_key_place t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="keyPlaceIds != null and keyPlaceIds.size > 0">
AND
t1.key_place_id IN
<foreach collection="keyPlaceIds" index="index" open="(" separator="," close=")">
#{keyPlaceIds[${index}]}
</foreach>
</if>
</select>
<!-- 重点场所列表 -->
<select id="listPO" parameterType="map" resultMap="keyPlacePO">
SELECT
t1.key_place_id,
t1.place_name,
t1.place_type,
t1.place_type_name,
t1.detail_type,
t1.detail_type_name,
t1.area_code,
t1.area_name,
t1.address,
t1.link_man,
t1.link_phone,
t1.phone,
t1.longitude,
t1.latitude,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
data_key_place t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="keyPlaceIds != null and keyPlaceIds.size > 0">
AND
t1.key_place_id IN
<foreach collection="keyPlaceIds" index="index" open="(" separator="," close=")">
#{keyPlaceIds[${index}]}
</foreach>
</if>
</select>
<!-- 重点场所统计 -->
<select id="count" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
data_key_place t1
WHERE
t1.is_delete = 0
</select>
</mapper>