Newer
Older
huludao / src / main / resources / mapper / CameraPicDao.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.newfiber.api.pc.dao.CameraPicMapper">
  <resultMap id="BaseResultMap" type="com.newfiber.api.pc.model.entity.CameraPic">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="index_code" jdbcType="VARCHAR" property="indexCode" />
    <result column="file_path" jdbcType="VARCHAR" property="filePath" />
    <result column="file_name" jdbcType="VARCHAR" property="fileName" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  </resultMap>
  <sql id="Base_Column_List">
    id, index_code, file_path, file_name, create_time
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from camera_pic
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from camera_pic
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.newfiber.api.pc.model.entity.CameraPic">
    insert into camera_pic (id, index_code, file_path,
      file_name, create_time)
    values (#{id,jdbcType=INTEGER}, #{indexCode,jdbcType=VARCHAR}, #{filePath,jdbcType=VARCHAR}, 
      #{fileName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.newfiber.api.pc.model.entity.CameraPic">
    insert into camera_pic
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="indexCode != null">
        index_code,
      </if>
      <if test="filePath != null">
        file_path,
      </if>
      <if test="fileName != null">
        file_name,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="indexCode != null">
        #{indexCode,jdbcType=VARCHAR},
      </if>
      <if test="filePath != null">
        #{filePath,jdbcType=VARCHAR},
      </if>
      <if test="fileName != null">
        #{fileName,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.newfiber.api.pc.model.entity.CameraPic">
    update camera_pic
    <set>
      <if test="indexCode != null">
        index_code = #{indexCode,jdbcType=VARCHAR},
      </if>
      <if test="filePath != null">
        file_path = #{filePath,jdbcType=VARCHAR},
      </if>
      <if test="fileName != null">
        file_name = #{fileName,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.newfiber.api.pc.model.entity.CameraPic">
    update camera_pic
    set index_code = #{indexCode,jdbcType=VARCHAR},
      file_path = #{filePath,jdbcType=VARCHAR},
      file_name = #{fileName,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>

  <select id="imageList" parameterType="map" resultMap="BaseResultMap">
    select <include refid="Base_Column_List"/>
    from camera_pic
    where index_Code = #{indexCode}
    <if test="startTime != null and startTime != '' and startTime != 'null'">
      and create_time >=  concat('','${startTime}','00:00:00')
    </if>
    <if test="endTime != null and endTime != '' and endTime != 'null'">
      and create_time &lt; concat('','${endTime}','23:59:59')
    </if>
    order by id desc
  </select>

</mapper>