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

190 lines
6.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="plate" column="plate"/>
<result property="personId" column="person_id"/>
<result property="linkMobile" column="link_mobile"/>
<result property="brand" column="brand"/>
<result property="brandSub" column="brand_sub"/>
<result property="parkType" column="park_type"/>
<result property="remark" column="remark"/>
<result property="plateType" column="plate_type"/>
<result property="plateColor" column="plate_color"/>
<result property="carType" column="car_type"/>
<result property="carColor" column="car_color"/>
<result property="picture" column="picture"/>
<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="plate != null">
plate,
</if>
<if test="personId != null">
person_id,
</if>
<if test="linkMobile != null">
link_mobile,
</if>
<if test="brand != null">
brand,
</if>
<if test="brandSub != null">
brand_sub,
</if>
<if test="parkType != null">
park_type,
</if>
<if test="remark != null">
remark,
</if>
<if test="plateType != null">
plate_type,
</if>
<if test="plateColor != null">
plate_color,
</if>
<if test="carType != null">
car_type,
</if>
<if test="carColor != null">
car_color,
</if>
<if test="picture != null">
picture,
</if>
<if test="cellId != null">
cell_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="carId != null">
#{carId,jdbcType=BIGINT},
</if>
<if test="plate != null">
#{plate,jdbcType=VARCHAR},
</if>
<if test="personId != null">
#{personId,jdbcType=BIGINT},
</if>
<if test="linkMobile != null">
#{linkMobile,jdbcType=VARCHAR},
</if>
<if test="brand != null">
#{brand,jdbcType=VARCHAR},
</if>
<if test="brandSub != null">
#{brandSub,jdbcType=VARCHAR},
</if>
<if test="parkType != null">
#{parkType,jdbcType=TINYINT},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="plateType != null">
#{plateType,jdbcType=TINYINT},
</if>
<if test="plateColor != null">
#{plateColor,jdbcType=TINYINT},
</if>
<if test="carType != null">
#{carType,jdbcType=TINYINT},
</if>
<if test="carColor != null">
#{carColor,jdbcType=TINYINT},
</if>
<if test="picture != null">
#{picture,jdbcType=VARCHAR},
</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="plate != null">
plate = #{plate,jdbcType=VARCHAR},
</if>
<if test="personId != null">
person_id = #{personId,jdbcType=BIGINT},
</if>
<if test="linkMobile != null">
link_mobile = #{linkMobile,jdbcType=VARCHAR},
</if>
<if test="brand != null">
brand = #{brand,jdbcType=VARCHAR},
</if>
<if test="brandSub != null">
brand_sub = #{brandSub,jdbcType=VARCHAR},
</if>
<if test="parkType != null">
park_type = #{parkType,jdbcType=TINYINT},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="plateType != null">
plate_type = #{plateType,jdbcType=TINYINT},
</if>
<if test="plateColor != null">
plate_color = #{plateColor,jdbcType=TINYINT},
</if>
<if test="carType != null">
car_type = #{carType,jdbcType=TINYINT},
</if>
<if test="carColor != null">
car_color = #{carColor,jdbcType=TINYINT},
</if>
<if test="picture != null">
picture = #{picture,jdbcType=VARCHAR},
</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="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 plate like CONCAT('%', '${params.plate}', '%')
</if>
</select>
</mapper>