rtos-mini-service4/mapper/target/classes/mappers/base/PortAreasMapper.xml

115 lines
3.7 KiB
XML
Raw Normal View History

2024-06-13 15:27:54 +08:00
<?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.haitongauto.mapper.base.PortAreasMapper">
<!--添加数据-->
<select id="insert" parameterType="com.haitongauto.models.pojo.PortArea" resultType="String">
insert into applet_port_areas
(
id,
port_area_name,
port_area_name_en,
port_area_code,
port_area_address,
area_center_poi,
punch_range,
is_enable,
order_items,
create_time,
update_time,
is_del
)
values
(
#{id},
#{port_area_name},
#{port_area_name_en},
#{port_area_code},
#{port_area_address},
#{area_center_poi},
#{punch_range},
#{is_enable},
#{order_items},
current_timestamp,
current_timestamp,
0
)
returning id
</select>
<!--软删除-->
<update id="logicDel" parameterType="String">
update applet_port_areas set is_del=1 where id=#{id}
</update>
<!--硬删除-->
<delete id="delete" parameterType="String">
delete from applet_port_areas where id=#{id}
</delete>
<!--数据更新-->
<update id="update" parameterType="com.haitongauto.models.pojo.PortArea">
update applet_port_areas
<set>
<if test="id != null and id != ''">
id = #{id},
</if>
<if test="port_area_name != null and port_area_name != ''">
port_area_name = #{port_area_name},
</if>
<if test="port_area_name_en != null and port_area_name_en != ''">
port_area_name_en = #{port_area_name_en},
</if>
<if test="port_area_code != null and port_area_code != ''">
port_area_code = #{port_area_code},
</if>
<if test="port_area_address != null and port_area_address != ''">
port_area_address = #{port_area_address},
</if>
<if test="area_center_poi != null and area_center_poi != ''">
area_center_poi = #{area_center_poi},
</if>
<if test="punch_range != null">
punch_range = #{punch_range},
</if>
<if test="is_enable != null">
is_enable = #{is_enable},
</if>
<if test="order_items != null and order_items != ''">
order_items = #{order_items},
</if>
<if test="create_time != null and create_time != ''">
create_time = #{create_time}::timestamp,
</if>
<if test="is_del != null">
is_del = #{is_del},
</if>
update_time = current_timestamp
</set>
where id = #{id}
</update>
<!--指定Id的记录-->
<select id="getById" parameterType="String" resultType="com.haitongauto.models.pojo.PortArea">
select
id,port_area_name,port_area_name_en,port_area_code,port_area_address,area_center_poi,punch_range,is_enable,order_items,create_time,update_time,is_del
from applet_port_areas
where id=#{id} and is_del=0
</select>
<!--数据列表-->
<select id="getList" resultType="com.haitongauto.models.pojo.PortArea">
select
id,
port_area_name,
port_area_name_en,
port_area_code,
port_area_address,
area_center_poi,
punch_range,
is_enable,
order_items,
create_time,
update_time,
is_del
from applet_port_areas
where is_del=0
order by create_time desc
</select>
</mapper>