Guwan-smartSchool/shapelight-admin/src/main/resources/mapper/ten/TenCarDao.xml

216 lines
7.5 KiB
XML
Raw Normal View History

2020-10-19 17:44:19 +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="net.shapelight.modules.ten.dao.TenCarDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="net.shapelight.modules.ten.entity.TenCarEntity" id="tenCarMap">
<result property="carId" column="car_id"/>
<result property="vlp" column="vlp"/>
2020-10-19 17:44:19 +08:00
<result property="picture" column="picture"/>
<result property="cTypeName" column="c_type_name"/>
<result property="vTypeName" column="v_type_name"/>
<result property="vehicleName" column="vehicle_name"/>
<result property="certificate" column="certificate"/>
<result property="telephone" column="telephone"/>
<result property="registerTime" column="register_time"/>
<result property="refundTime" column="refund_time"/>
<result property="color" column="color"/>
<result property="parkName" column="park_name"/>
<result property="startTime" column="start_time"/>
<result property="endTime" column="end_time"/>
<result property="personId" column="person_id"/>
2020-10-19 17:44:19 +08:00
<result property="cellId" column="cell_id"/>
</resultMap>
<insert id="insert" parameterType="net.shapelight.modules.ten.entity.TenCarEntity">
insert into ten_car_${cellId}
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="carId != null">
car_id,
</if>
<if test="vlp != null">
vlp,
2020-10-19 17:44:19 +08:00
</if>
<if test="picture != null">
picture,
2020-10-19 17:44:19 +08:00
</if>
<if test="cTypeName != null">
c_type_name,
2020-10-19 17:44:19 +08:00
</if>
<if test="vTypeName != null">
v_type_name,
2020-10-19 17:44:19 +08:00
</if>
<if test="vehicleName != null">
vehicle_name,
2020-10-19 17:44:19 +08:00
</if>
<if test="certificate != null">
certificate,
2020-10-19 17:44:19 +08:00
</if>
<if test="telephone != null">
telephone,
2020-10-19 17:44:19 +08:00
</if>
<if test="registerTime != null">
register_time,
2020-10-19 17:44:19 +08:00
</if>
<if test="refundTime != null">
refund_time,
2020-10-19 17:44:19 +08:00
</if>
<if test="color != null">
color,
2020-10-19 17:44:19 +08:00
</if>
<if test="parkName != null">
park_name,
2020-10-19 17:44:19 +08:00
</if>
<if test="startTime != null">
start_time,
</if>
<if test="endTime != null">
end_time,
</if>
<if test="personId != null">
person_id,
2020-10-19 17:44:19 +08:00
</if>
<if test="cellId != null">
cell_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="carId != null">
#{carId,jdbcType=BIGINT},
</if>
<if test="vlp != null">
#{vlp,jdbcType=VARCHAR},
2020-10-19 17:44:19 +08:00
</if>
<if test="picture != null">
#{picture,jdbcType=VARCHAR},
2020-10-19 17:44:19 +08:00
</if>
<if test="cTypeName != null">
#{cTypeName,jdbcType=VARCHAR},
2020-10-19 17:44:19 +08:00
</if>
<if test="vTypeName != null">
#{vTypeName,jdbcType=VARCHAR},
2020-10-19 17:44:19 +08:00
</if>
<if test="vehicleName != null">
#{vehicleName,jdbcType=VARCHAR},
2020-10-19 17:44:19 +08:00
</if>
<if test="certificate != null">
#{certificate,jdbcType=VARCHAR},
2020-10-19 17:44:19 +08:00
</if>
<if test="telephone != null">
#{telephone,jdbcType=VARCHAR},
2020-10-19 17:44:19 +08:00
</if>
<if test="registerTime != null">
#{registerTime,jdbcType=TIMESTAMP},
2020-10-19 17:44:19 +08:00
</if>
<if test="refundTime != null">
#{refundTime,jdbcType=TIMESTAMP},
2020-10-19 17:44:19 +08:00
</if>
<if test="color != null">
#{color,jdbcType=VARCHAR},
2020-10-19 17:44:19 +08:00
</if>
<if test="parkName != null">
#{parkName,jdbcType=VARCHAR},
2020-10-19 17:44:19 +08:00
</if>
<if test="startTime != null">
#{startTime,jdbcType=TIMESTAMP},
</if>
<if test="endTime != null">
#{endTime,jdbcType=TIMESTAMP},
</if>
<if test="personId != null">
#{personId,jdbcType=BIGINT},
2020-10-19 17:44:19 +08:00
</if>
<if test="cellId != null">
#{cellId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<delete id="deleteById" parameterType="java.lang.Long">
delete from ten_car_${cellId}
where car_id = #{carId,jdbcType=BIGINT}
</delete>
<update id="updateById" parameterType="net.shapelight.modules.ten.entity.TenCarEntity">
update ten_car_${cellId}
<set>
<if test="carId != null">
car_id = #{carId,jdbcType=BIGINT},
</if>
<if test="vlp != null">
vlp = #{vlp,jdbcType=VARCHAR},
2020-10-19 17:44:19 +08:00
</if>
<if test="picture != null">
picture = #{picture,jdbcType=VARCHAR},
2020-10-19 17:44:19 +08:00
</if>
<if test="cTypeName != null">
c_type_name = #{cTypeName,jdbcType=VARCHAR},
2020-10-19 17:44:19 +08:00
</if>
<if test="vTypeName != null">
v_type_name = #{vTypeName,jdbcType=VARCHAR},
2020-10-19 17:44:19 +08:00
</if>
<if test="vehicleName != null">
vehicle_name = #{vehicleName,jdbcType=VARCHAR},
2020-10-19 17:44:19 +08:00
</if>
<if test="certificate != null">
certificate = #{certificate,jdbcType=VARCHAR},
2020-10-19 17:44:19 +08:00
</if>
<if test="telephone != null">
telephone = #{telephone,jdbcType=VARCHAR},
2020-10-19 17:44:19 +08:00
</if>
<if test="registerTime != null">
register_time = #{registerTime,jdbcType=TIMESTAMP},
2020-10-19 17:44:19 +08:00
</if>
<if test="refundTime != null">
refund_time = #{refundTime,jdbcType=TIMESTAMP},
2020-10-19 17:44:19 +08:00
</if>
<if test="color != null">
color = #{color,jdbcType=VARCHAR},
2020-10-19 17:44:19 +08:00
</if>
<if test="parkName != null">
park_name = #{parkName,jdbcType=VARCHAR},
2020-10-19 17:44:19 +08:00
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=TIMESTAMP},
</if>
<if test="endTime != null">
end_time = #{endTime,jdbcType=TIMESTAMP},
</if>
<if test="personId != null">
person_id = #{personId,jdbcType=BIGINT},
2020-10-19 17:44:19 +08:00
</if>
<if test="cellId != null">
cell_id = #{cellId,jdbcType=BIGINT},
</if>
</set>
where car_id = #{carId,jdbcType=BIGINT}
</update>
<select id="selectById" parameterType="java.lang.Long" resultMap="tenCarMap">
select * from ten_car_${cellId}
where car_id = #{carId,jdbcType=BIGINT}
</select>
<select id="selectByVlp" resultMap="tenCarMap">
select * from ten_car_${cellId}
where vlp = #{vlp}
</select>
2020-10-19 17:44:19 +08:00
<select id="findPageAll" resultMap="tenCarMap">
SELECT alias.* from (
<foreach collection="cellIds" item="item" index="index" separator="union all">
select * from ten_car_${item}
</foreach>
) alias where 1 = 1
<if test="params.plate != null and params.plate!=''">
and vlp like CONCAT('%', '${params.plate}', '%')
2020-10-19 17:44:19 +08:00
</if>
order by alias.register_time desc
2020-10-19 17:44:19 +08:00
</select>
</mapper>