<?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.fdage.dao.base.SceneMapper">
  <resultMap id="BaseResultMap" type="com.fdage.entity.SceneEntity">
    <!--<id column="id" jdbcType="BIGINT" property="id" />-->
    <!--<result column="name" jdbcType="VARCHAR" property="name" />-->
  </resultMap>

  <select id="findAll" parameterType="java.lang.Long" resultMap="BaseResultMap">
   select * from tb_scene where is_delete=0 order by create_time desc;
  </select>

  <select id="findById" parameterType="java.lang.Long" resultMap="BaseResultMap">
   select * from tb_scene where is_delete=0 and id=#{id};
  </select>


    <insert id="insert" parameterType="com.fdage.entity.SceneEntity">
    insert into tb_scene (
    name, url_scene, thumb, file_name
    )
    values (
    #{name} ,#{urlScene} ,#{thumb} ,#{fileName}
    )
  </insert>


    <update id="update" parameterType="com.fdage.entity.SceneEntity">
    update tb_scene set
    name=#{name},
    url_scene=#{urlScene},
    thumb=#{thumb},
    file_name=#{fileName},
    update_time=#{updateTime}
   where id=#{id} and is_delete=0;
  </update>


    <update id="remove" parameterType="com.fdage.entity.SceneEntity">
      update tb_scene set is_delete=1, update_time=NOW() where id=#{id} and is_delete=0;
  </update>

</mapper>