You've already forked FrameTour-BE
139 lines
5.3 KiB
XML
139 lines
5.3 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="com.ycwl.basic.mapper.pc.ScenicMapper">
|
|
<insert id="add">
|
|
insert into scenic(id, `name`, introduction, longitude, latitude, radius, province, city, area, address)
|
|
values (#{id}, #{name}, #{introduction}, #{longitude}, #{latitude}, #{radius}, #{province}, #{city}, #{area}, #{address})
|
|
</insert>
|
|
<insert id="addConfig">
|
|
insert into scenic_config(id, scenic_id, start_time, end_time, is_default)
|
|
values (#{id}, #{scenicId}, #{startTime}, #{endTime}, #{isDefault})
|
|
</insert>
|
|
<update id="update">
|
|
update
|
|
scenic
|
|
<set>
|
|
<if test="name!=null and name!=''">
|
|
`name`=#{name},
|
|
</if>
|
|
<if test="introduction!=null and introduction!=''">
|
|
introduction=#{introduction},
|
|
</if>
|
|
<if test="longitude!=null">
|
|
longitude=#{longitude},
|
|
</if>
|
|
<if test="latitude!=null">
|
|
latitude=#{latitude},
|
|
</if>
|
|
<if test="radius!=null">
|
|
radius=#{radius},
|
|
</if>
|
|
<if test="province!=null and province!=''">
|
|
province=#{province},
|
|
</if>
|
|
<if test="city!=null and city!=''">
|
|
city=#{city},
|
|
</if>
|
|
<if test="area!=null and area!=''">
|
|
area=#{area},
|
|
</if>
|
|
<if test="address!=null and address!=''">
|
|
address=#{address},
|
|
</if>
|
|
</set>
|
|
where id = #{id}
|
|
</update>
|
|
<update id="updateStatus">
|
|
update
|
|
scenic
|
|
set status = (CASE
|
|
status
|
|
WHEN 1 THEN
|
|
0
|
|
WHEN 0 THEN
|
|
1
|
|
END)
|
|
where id = #{id}
|
|
</update>
|
|
<update id="updateConfigById">
|
|
update scenic_config
|
|
<set>
|
|
<if test="startTime!=null">
|
|
start_time=#{startTime},
|
|
</if>
|
|
<if test="endTime!=null">
|
|
end_time=#{endTime},
|
|
</if>
|
|
<if test="isDefault!=null">
|
|
is_default=#{isDefault},
|
|
</if>
|
|
</set>
|
|
where id = #{id}
|
|
</update>
|
|
<delete id="deleteById">
|
|
delete from scenic where id = #{id}
|
|
</delete>
|
|
<delete id="deleteConfigByscenicId">
|
|
delete from scenic_config where scenic_id = #{scenicId}
|
|
</delete>
|
|
<select id="list" resultMap="scenicAndConfig">
|
|
select s.id, `name`, introduction, longitude, latitude, radius, province, city, area, address, `status`, s.create_time, update_time,
|
|
c.start_time, c.end_time, c.is_default, c.create_time
|
|
from scenic s
|
|
left join scenic_config c on s.id = c.id
|
|
<where>
|
|
<if test="name!=null and name!=''">
|
|
and locate(#{name},`name`) > 0
|
|
</if>
|
|
<if test="province!=null and province!=''">
|
|
and locate(#{province},`province`) > 0
|
|
</if>
|
|
<if test="city!=null and city!=''">
|
|
and locate(#{city},`city`) > 0
|
|
</if>
|
|
<if test="area!=null and area!=''">
|
|
and locate(#{area},`area`) > 0
|
|
</if>
|
|
<if test="status!=null">
|
|
and `status` = #{status}
|
|
</if>
|
|
<if test="startTime!=null">
|
|
and s.create_time >= #{startTime}
|
|
</if>
|
|
<if test="endTime!=null">
|
|
and s.create_time <= #{endTime}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
<select id="getById" resultMap="scenicAndConfig">
|
|
select s.id, `name`, introduction, longitude, latitude, radius, province, city, area, address, `status`, s.create_time, update_time,
|
|
c.start_time, c.end_time, c.is_default, c.create_time
|
|
from scenic s
|
|
left join scenic_config c on s.id = c.id
|
|
where s.id = #{id}
|
|
</select>
|
|
|
|
<resultMap id="scenicAndConfig" type="com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO">
|
|
<id property="id" column="s.id"/>
|
|
<result property="name" column="name"/>
|
|
<result property="introduction" column="introduction"/>
|
|
<result property="longitude" column="longitude"/>
|
|
<result property="latitude" column="latitude"/>
|
|
<result property="radius" column="radius"/>
|
|
<result property="province" column="province"/>
|
|
<result property="city" column="city"/>
|
|
<result property="area" column="area"/>
|
|
<result property="address" column="address"/>
|
|
<result property="status" column="status"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<association property="scenicConfig" javaType="com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity">
|
|
<id property="id" column="c.id"/>
|
|
<result property="scenicId" column="s.id"/>
|
|
<result property="startTime" column="c.start_time"/>
|
|
<result property="endTime" column="c.end_time"/>
|
|
<result property="isDefault" column="c.is_default"/>
|
|
<result property="createTime" column="c.create_time"/>
|
|
</association>
|
|
</resultMap>
|
|
</mapper> |