105 lines
3.7 KiB
XML
105 lines
3.7 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.haitongauto.mapper.base.TruckManagementMapper">
|
||
|
<!--BaseSql-->
|
||
|
<!--添加数据-->
|
||
|
<select id="insert" parameterType="com.haitongauto.models.pojo.TruckManagement" resultType="String">
|
||
|
insert into applet_truck_management
|
||
|
(
|
||
|
id,
|
||
|
users_id,
|
||
|
truck_number,
|
||
|
cause,
|
||
|
drivers_name,
|
||
|
drivers_phone,
|
||
|
administrators_name,
|
||
|
administrators_phone,
|
||
|
enter_time,
|
||
|
create_time,
|
||
|
update_time,
|
||
|
is_del
|
||
|
)
|
||
|
values
|
||
|
(
|
||
|
#{id},
|
||
|
#{users_id},
|
||
|
#{truck_number},
|
||
|
#{cause},
|
||
|
#{drivers_name},
|
||
|
#{drivers_phone},
|
||
|
#{administrators_name},
|
||
|
#{administrators_phone},
|
||
|
#{enter_time}::timestamp,
|
||
|
current_timestamp,
|
||
|
current_timestamp,
|
||
|
0
|
||
|
)
|
||
|
returning id
|
||
|
</select>
|
||
|
<!--软删除-->
|
||
|
<update id="logicDel" parameterType="String">
|
||
|
update applet_truck_management set is_del=1 where id=#{id}
|
||
|
</update>
|
||
|
<!--硬删除-->
|
||
|
<delete id="delete" parameterType="String">
|
||
|
delete from applet_truck_management where id=#{id}
|
||
|
</delete>
|
||
|
<!--数据更新-->
|
||
|
<update id="update" parameterType="com.haitongauto.models.pojo.TruckManagement">
|
||
|
update applet_truck_management
|
||
|
<set>
|
||
|
<if test="id != null and id != ''">
|
||
|
id = #{id},
|
||
|
</if>
|
||
|
<if test="users_id != null and users_id != ''">
|
||
|
users_id = #{users_id},
|
||
|
</if>
|
||
|
<if test="truck_number != null and truck_number != ''">
|
||
|
truck_number = #{truck_number},
|
||
|
</if>
|
||
|
<if test="cause != null and cause != ''">
|
||
|
cause = #{cause},
|
||
|
</if>
|
||
|
<if test="drivers_name != null and drivers_name != ''">
|
||
|
drivers_name = #{drivers_name},
|
||
|
</if>
|
||
|
<if test="drivers_phone != null and drivers_phone != ''">
|
||
|
drivers_phone = #{drivers_phone},
|
||
|
</if>
|
||
|
<if test="administrators_name != null and administrators_name != ''">
|
||
|
administrators_name = #{administrators_name},
|
||
|
</if>
|
||
|
<if test="administrators_phone != null and administrators_phone != ''">
|
||
|
administrators_phone = #{administrators_phone},
|
||
|
</if>
|
||
|
<if test="enter_time != null and enter_time != ''">
|
||
|
enter_time = #{enter_time}::timestamp,
|
||
|
</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.TruckManagement">
|
||
|
select
|
||
|
id,users_id,truck_number,cause,drivers_name,drivers_phone,administrators_name,administrators_phone,enter_time,create_time,update_time,is_del
|
||
|
from applet_truck_management
|
||
|
where id=#{id} and is_del=0
|
||
|
</select>
|
||
|
<!--数据列表-->
|
||
|
<select id="getList" resultType="com.haitongauto.models.pojo.TruckManagement">
|
||
|
select
|
||
|
id,users_id,truck_number,cause,drivers_name,drivers_phone,administrators_name,administrators_phone,enter_time,create_time,update_time,is_del
|
||
|
from applet_truck_management
|
||
|
where is_del=0
|
||
|
order by create_time desc
|
||
|
</select>
|
||
|
</mapper>
|