| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476 |
- <?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="cn.com.lzt.car.carshot.dao.TBCarShootDao">
- <resultMap type="cn.com.lzt.car.carshot.entity.TBCarShoot" id="TBCarShotResultMap">
- <result property="id" column="id" jdbcType=""/>
- <result property="plate" column="plate" jdbcType=""/>
- <result property="type" column="type" jdbcType=""/>
- <result property="camera" column="camera" jdbcType=""/>
- <result property="position" column="position" jdbcType=""/>
- <result property="uploadTime" column="upload_time" jdbcType=""/>
- <result property="shot" column="shot" jdbcType=""/>
- <result property="shotType" column="shot_type" jdbcType=""/>
- <result property="createTime" column="create_time" jdbcType=""/>
- <result property="updateTime" column="update_time" jdbcType=""/>
- <result property="status" column="status" jdbcType=""/>
- </resultMap>
- <sql id="table_field">
- #allSqlColumn()
-
- </sql>
-
- <!--通过Id查询单个-->
- <select id="getById" resultMap="TBCarShotResultMap" parameterType="java.lang.Integer">
- select
- <include refid="table_field" />
- from t_b_car_shot
- where id = #{id,jdbcType=}
- </select>
- <!--通过实体不为空的属性作为筛选条件查询列表-->
- <select id="listByEntity" resultMap="TBCarShotResultMap" parameterType="cn.com.lzt.car.carshot.entity.TBCarShoot">
- select
- <include refid="table_field" />
- from t_b_car_shot
- <where>
- <if test="id != null">
- and id = #{id,jdbcType=}
- </if>
- <if test="plate != null">
- and plate = #{plate,jdbcType=}
- </if>
- <if test="type != null">
- and type = #{type,jdbcType=}
- </if>
- <if test="camera != null">
- and camera = #{camera,jdbcType=}
- </if>
- <if test="position != null">
- and position = #{position,jdbcType=}
- </if>
- <if test="uploadTime != null">
- and upload_time = #{uploadTime,jdbcType=}
- </if>
- <if test="shot != null">
- and shot = #{shot,jdbcType=}
- </if>
- <if test="shotType != null">
- and shot_type = #{shotType,jdbcType=}
- </if>
- <if test="createTime != null">
- and create_time = #{createTime,jdbcType=}
- </if>
- <if test="updateTime != null">
- and update_time = #{updateTime,jdbcType=}
- </if>
- <if test="status != null">
- and status = #{status,jdbcType=}
- </if>
- </where>
- </select>
- <!--通过实体不为空的属性作为筛选条件查询单个-->
- <select id="getByEntity" resultMap="TBCarShotResultMap" parameterType="cn.com.lzt.car.carshot.entity.TBCarShoot">
- select
- <include refid="table_field" />
- from t_b_car_shot
- <where>
- <if test="id != null">
- and id = #{id,jdbcType=}
- </if>
- <if test="plate != null">
- and plate = #{plate,jdbcType=}
- </if>
- <if test="type != null">
- and type = #{type,jdbcType=}
- </if>
- <if test="camera != null">
- and camera = #{camera,jdbcType=}
- </if>
- <if test="position != null">
- and position = #{position,jdbcType=}
- </if>
- <if test="uploadTime != null">
- and upload_time = #{uploadTime,jdbcType=}
- </if>
- <if test="shot != null">
- and shot = #{shot,jdbcType=}
- </if>
- <if test="shotType != null">
- and shot_type = #{shotType,jdbcType=}
- </if>
- <if test="createTime != null">
- and create_time = #{createTime,jdbcType=}
- </if>
- <if test="updateTime != null">
- and update_time = #{updateTime,jdbcType=}
- </if>
- <if test="status != null">
- and status = #{status,jdbcType=}
- </if>
- </where>
- </select>
- <!--通过Id列表作为筛选条件查询列表,列表长度不为0-->
- <select id="listByIds" resultMap="TBCarShotResultMap" parameterType="list">
- select
- <include refid="table_field" />
- from t_b_car_shot
- where id in
- <foreach item="item" collection="list" separator="," open="(" close=")" index="index">
- #{item}
- </foreach>
- </select>
- <!--新增实体属性不为null的列-->
- <insert id="insert" keyProperty="id" useGeneratedKeys="true" parameterType="cn.com.lzt.car.carshot.entity.TBCarShoot">
- insert into t_b_car_shot
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">
- id,
- </if>
- <if test="plate != null">
- plate,
- </if>
- <if test="type != null">
- type,
- </if>
- <if test="camera != null">
- camera,
- </if>
- <if test="position != null">
- position,
- </if>
- <if test="uploadTime != null">
- upload_time,
- </if>
- <if test="shot != null">
- shot,
- </if>
- <if test="shotType != null">
- shot_type,
- </if>
- <if test="createTime != null">
- create_time,
- </if>
- <if test="updateTime != null">
- update_time,
- </if>
- <if test="status != null">
- status,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">
- #{id,jdbcType=},
- </if>
- <if test="plate != null">
- #{plate,jdbcType=},
- </if>
- <if test="type != null">
- #{type,jdbcType=},
- </if>
- <if test="camera != null">
- #{camera,jdbcType=},
- </if>
- <if test="position != null">
- #{position,jdbcType=},
- </if>
- <if test="uploadTime != null">
- #{uploadTime,jdbcType=},
- </if>
- <if test="shot != null">
- #{shot,jdbcType=},
- </if>
- <if test="shotType != null">
- #{shotType,jdbcType=},
- </if>
- <if test="createTime != null">
- #{createTime,jdbcType=},
- </if>
- <if test="updateTime != null">
- #{updateTime,jdbcType=},
- </if>
- <if test="status != null">
- #{status,jdbcType=},
- </if>
- </trim>
- </insert>
- <!--批量新增所有列,列表长度不能为0,且列表id统一为null或者统一不为null-->
- <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true" parameterType="list">
- insert into t_b_car_shot
- (id, plate, type, camera, position, upload_time, shot, shot_type, create_time, update_time, status)
- values
- <foreach item="item" collection="list" separator="," open="" close="" index="index">
- (#{item.id}, #{item.plate}, #{item.type}, #{item.camera}, #{item.position}, #{item.uploadTime}, #{item.shot}, #{item.shotType}, #{item.createTime}, #{item.updateTime}, #{item.status})
- </foreach>
- </insert>
- <!--通过主键修改实体属性不为null的列-->
- <update id="update" parameterType="cn.com.lzt.car.carshot.entity.TBCarShoot">
- update t_b_car_shot
- <set>
- <if test="plate != null and plate != ''">
- plate = #{plate,jdbcType=},
- </if>
- <if test="type != null">
- type = #{type,jdbcType=},
- </if>
- <if test="camera != null">
- camera = #{camera,jdbcType=},
- </if>
- <if test="position != null and position != ''">
- position = #{position,jdbcType=},
- </if>
- <if test="uploadTime != null">
- upload_time = #{uploadTime,jdbcType=},
- </if>
- <if test="shot != null and shot != ''">
- shot = #{shot,jdbcType=},
- </if>
- <if test="shotType != null">
- shot_type = #{shotType,jdbcType=},
- </if>
- <if test="createTime != null">
- create_time = #{createTime,jdbcType=},
- </if>
- <if test="updateTime != null">
- update_time = #{updateTime,jdbcType=},
- </if>
- <if test="status != null">
- status = #{status,jdbcType=},
- </if>
- </set>
- where id = #{id,jdbcType=}
- </update>
- <!--通过表字段修改实体属性不为null的列-->
- <update id="updateByField">
- update t_b_car_shot
- <set>
- <if test="where.plate == null and set.plate != null and set.plate != ''">
- plate = #{set.plate,jdbcType=},
- </if>
- <if test="where.type == null and set.type != null">
- type = #{set.type,jdbcType=},
- </if>
- <if test="where.camera == null and set.camera != null">
- camera = #{set.camera,jdbcType=},
- </if>
- <if test="where.position == null and set.position != null and set.position != ''">
- position = #{set.position,jdbcType=},
- </if>
- <if test="where.uploadTime == null and set.uploadTime != null">
- upload_time = #{set.uploadTime,jdbcType=},
- </if>
- <if test="where.shot == null and set.shot != null and set.shot != ''">
- shot = #{set.shot,jdbcType=},
- </if>
- <if test="where.shotType == null and set.shotType != null">
- shot_type = #{set.shotType,jdbcType=},
- </if>
- <if test="where.createTime == null and set.createTime != null">
- create_time = #{set.createTime,jdbcType=},
- </if>
- <if test="where.updateTime == null and set.updateTime != null">
- update_time = #{set.updateTime,jdbcType=},
- </if>
- <if test="where.status == null and set.status != null">
- status = #{set.status,jdbcType=},
- </if>
- </set>
- <where>
- <if test="where.id != null">
- and id = #{where.id,jdbcType=}
- </if>
- <if test="where.plate != null">
- and plate = #{where.plate,jdbcType=}
- </if>
- <if test="where.type != null">
- and type = #{where.type,jdbcType=}
- </if>
- <if test="where.camera != null">
- and camera = #{where.camera,jdbcType=}
- </if>
- <if test="where.position != null">
- and position = #{where.position,jdbcType=}
- </if>
- <if test="where.uploadTime != null">
- and upload_time = #{where.uploadTime,jdbcType=}
- </if>
- <if test="where.shot != null">
- and shot = #{where.shot,jdbcType=}
- </if>
- <if test="where.shotType != null">
- and shot_type = #{where.shotType,jdbcType=}
- </if>
- <if test="where.createTime != null">
- and create_time = #{where.createTime,jdbcType=}
- </if>
- <if test="where.updateTime != null">
- and update_time = #{where.updateTime,jdbcType=}
- </if>
- <if test="where.status != null">
- and status = #{where.status,jdbcType=}
- </if>
- </where>
- </update>
- <!--通过主键修改实体列表,列表长度不能为0,注意:当实体属性为null时,对应的列也会别更新为null-->
- <update id="updateBatch" parameterType="list">
- update t_b_car_shot
- <trim prefix="set" suffixOverrides=",">
- <trim prefix="plate = case" suffix="end,">
- <foreach collection="list" item="item" index="index">
- when id = #{item.id} then #{item.plate}
- </foreach>
- </trim>
- <trim prefix="type = case" suffix="end,">
- <foreach collection="list" item="item" index="index">
- when id = #{item.id} then #{item.type}
- </foreach>
- </trim>
- <trim prefix="camera = case" suffix="end,">
- <foreach collection="list" item="item" index="index">
- when id = #{item.id} then #{item.camera}
- </foreach>
- </trim>
- <trim prefix="position = case" suffix="end,">
- <foreach collection="list" item="item" index="index">
- when id = #{item.id} then #{item.position}
- </foreach>
- </trim>
- <trim prefix="upload_time = case" suffix="end,">
- <foreach collection="list" item="item" index="index">
- when id = #{item.id} then #{item.uploadTime}
- </foreach>
- </trim>
- <trim prefix="shot = case" suffix="end,">
- <foreach collection="list" item="item" index="index">
- when id = #{item.id} then #{item.shot}
- </foreach>
- </trim>
- <trim prefix="shot_type = case" suffix="end,">
- <foreach collection="list" item="item" index="index">
- when id = #{item.id} then #{item.shotType}
- </foreach>
- </trim>
- <trim prefix="create_time = case" suffix="end,">
- <foreach collection="list" item="item" index="index">
- when id = #{item.id} then #{item.createTime}
- </foreach>
- </trim>
- <trim prefix="update_time = case" suffix="end,">
- <foreach collection="list" item="item" index="index">
- when id = #{item.id} then #{item.updateTime}
- </foreach>
- </trim>
- <trim prefix="status = case" suffix="end,">
- <foreach collection="list" item="item" index="index">
- when id = #{item.id} then #{item.status}
- </foreach>
- </trim>
- </trim>
- where id in
- <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
- #{item.id,jdbcType=}
- </foreach>
- </update>
-
- <!--通过主键删除-->
- <delete id="deleteById" parameterType="java.lang.Integer">
- delete from t_b_car_shot where id = #{id,jdbcType=}
- </delete>
- <!--通过实体非空属性删除-->
- <delete id="deleteByEntity" parameterType="cn.com.lzt.car.carshot.entity.TBCarShoot">
- delete from t_b_car_shot
- <where>
- <if test="plate != null">
- and plate = #{plate,jdbcType=}
- </if>
- <if test="type != null">
- and type = #{type,jdbcType=}
- </if>
- <if test="camera != null">
- and camera = #{camera,jdbcType=}
- </if>
- <if test="position != null">
- and position = #{position,jdbcType=}
- </if>
- <if test="uploadTime != null">
- and upload_time = #{uploadTime,jdbcType=}
- </if>
- <if test="shot != null">
- and shot = #{shot,jdbcType=}
- </if>
- <if test="shotType != null">
- and shot_type = #{shotType,jdbcType=}
- </if>
- <if test="createTime != null">
- and create_time = #{createTime,jdbcType=}
- </if>
- <if test="updateTime != null">
- and update_time = #{updateTime,jdbcType=}
- </if>
- <if test="status != null">
- and status = #{status,jdbcType=}
- </if>
- </where>
- </delete>
-
- <!--通过主键列表删除,列表长度不能为0-->
- <delete id="deleteByIds" parameterType="list">
- delete from t_b_car_shot where id in
- <foreach item="item" collection="list" separator="," open="(" close=")" index="index">
- #{item}
- </foreach>
- </delete>
-
- <select id="countAll" resultType="int">
- select count(*) from t_b_car_shot
- </select>
-
- <select id="countByEntity" parameterType="cn.com.lzt.car.carshot.entity.TBCarShoot" resultType="int">
- select count(*) from t_b_car_shot
- <where>
- <if test="id != null">
- and id = #{id,jdbcType=}
- </if>
- <if test="plate != null">
- and plate = #{plate,jdbcType=}
- </if>
- <if test="type != null">
- and type = #{type,jdbcType=}
- </if>
- <if test="camera != null">
- and camera = #{camera,jdbcType=}
- </if>
- <if test="position != null">
- and position = #{position,jdbcType=}
- </if>
- <if test="uploadTime != null">
- and upload_time = #{uploadTime,jdbcType=}
- </if>
- <if test="shot != null">
- and shot = #{shot,jdbcType=}
- </if>
- <if test="shotType != null">
- and shot_type = #{shotType,jdbcType=}
- </if>
- <if test="createTime != null">
- and create_time = #{createTime,jdbcType=}
- </if>
- <if test="updateTime != null">
- and update_time = #{updateTime,jdbcType=}
- </if>
- <if test="status != null">
- and status = #{status,jdbcType=}
- </if>
- </where>
- </select>
- </mapper>
|