<?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">
<!-- namespace必须指向DAO接口 -->
<mapper namespace="com.jpsoft.shinestar.modules.business.dao.FillAttendanceFilesDAO">
    <sql id="Base_Column_List">
    id_,
    fill_attendance_id,
    file_name,
    file_url,
    create_by,
    create_time,
    update_by,
    update_time,
    del_flag
</sql>
    <resultMap id="FillAttendanceFilesMap" type="com.jpsoft.shinestar.modules.business.entity.FillAttendanceFiles">
		<id property="id" column="id_" />
			<result property="fillAttendanceId" column="fill_attendance_id" />
			<result property="fileName" column="file_name" />
			<result property="fileUrl" column="file_url" />
			<result property="createBy" column="create_by" />
			<result property="createTime" column="create_time" />
			<result property="updateBy" column="update_by" />
			<result property="updateTime" column="update_time" />
			<result property="delFlag" column="del_flag" />
			</resultMap>
	<insert id="insert" parameterType="com.jpsoft.shinestar.modules.business.entity.FillAttendanceFiles">
	<!--
	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
		select sys_guid() from dual
	</selectKey>
	-->
	<![CDATA[
		insert into business_fill_attendance_files
	    (id_,fill_attendance_id,file_name,file_url,create_by,create_time,update_by,update_time,del_flag)
		values
		(
			#{id,jdbcType=VARCHAR}
			,#{fillAttendanceId,jdbcType=VARCHAR}
			,#{fileName,jdbcType=VARCHAR}
			,#{fileUrl,jdbcType=VARCHAR}
			,#{createBy,jdbcType=VARCHAR}
			,#{createTime,jdbcType= TIMESTAMP }
			,#{updateBy,jdbcType=VARCHAR}
			,#{updateTime,jdbcType= TIMESTAMP }
			,#{delFlag,jdbcType= NUMERIC }
		)
	]]>
	</insert>
	<delete id="delete" parameterType="string">
		delete from business_fill_attendance_files where id_=#{id,jdbcType=VARCHAR}
	</delete>
	<update id="update" parameterType="com.jpsoft.shinestar.modules.business.entity.FillAttendanceFiles">
		update business_fill_attendance_files
		<set>
				<if test="fillAttendanceId!=null">
		fill_attendance_id=#{fillAttendanceId,jdbcType=VARCHAR},
		</if>
				<if test="fileName!=null">
		file_name=#{fileName,jdbcType=VARCHAR},
		</if>
				<if test="fileUrl!=null">
		file_url=#{fileUrl,jdbcType=VARCHAR},
		</if>
				<if test="createBy!=null">
		create_by=#{createBy,jdbcType=VARCHAR},
		</if>
				<if test="createTime!=null">
		create_time=#{createTime,jdbcType= TIMESTAMP },
		</if>
				<if test="updateBy!=null">
		update_by=#{updateBy,jdbcType=VARCHAR},
		</if>
				<if test="updateTime!=null">
		update_time=#{updateTime,jdbcType= TIMESTAMP },
		</if>
				<if test="delFlag!=null">
		del_flag=#{delFlag,jdbcType= NUMERIC },
		</if>
		</set>
	where id_=#{id}
	</update>
	<select id="get" parameterType="string" resultMap="FillAttendanceFilesMap">
		select  *	from business_fill_attendance_files where id_=#{0} and del_flag = 0
	</select>
	<select id="exist" parameterType="string" resultType="int">
		select count(*) from business_fill_attendance_files where id_=#{0} and del_flag = 0
	</select>
	<select id="list" resultMap="FillAttendanceFilesMap">
		select * from business_fill_attendance_files where del_flag = 0
	</select>
	<select id="search" parameterType="hashmap" resultMap="FillAttendanceFilesMap">
		<![CDATA[
			select * from business_fill_attendance_files
		]]>
		<where>
			del_flag = 0
			<if test="searchParams.id != null">
				and ID_ like #{searchParams.id}
			</if>
			<if test="searchParams.fillAttendanceId != null">
				and fill_attendance_id = #{searchParams.fillAttendanceId}
			</if>
		</where>
		<foreach item="sort" collection="sortList"  open="order by" separator=",">
	        ${sort.name} ${sort.order}
	 	</foreach>
	</select>

<!--auto generated by MybatisCodeHelper on 2020-04-27-->
    <select id="findByFillAttendanceId" resultMap="FillAttendanceFilesMap">
        select
        <include refid="Base_Column_List"/>
        from business_fill_attendance_files
        where fill_attendance_id=#{fillAttendanceId}
		and del_flag = 0
    </select>
</mapper>