package sikd.sikd5.sikd5ejb.mapper.transaksi;

import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

import sikd.sikd5.sikd5bean.tabel.transaksi.Headerlog;
import sikd.sikd5.sikd5bean.ws.transaksi.Headerlog_WS;

@SuppressWarnings("el-syntax")
public interface HeaderlogMapper {

	@Delete({
			"delete from transaksi.headerlog",
			"where headerlogid = #{headerlogid,jdbcType=BIGINT}"
	})
	int deleteByPrimaryKey(Long headerlogid);

	@Select({
			"insert into transaksi.headerlog (jenisdata, ",
			"kodesatker, kodepemda, ",
			"namapemda, tahunanggaran, ",
			"tglpengiriman, selesaitglpengiriman, ",
			"isirow, diinsert, ",
			"diubah, dihapus, ",
			"ket, namaaplikasi, ",
			"versiaplikasi, pengembangaplikasi, ",
			"versisinergi, userpengirim, kelompokdataid)",
			"values ( #{jenisdata,jdbcType=VARCHAR}, ",
			"#{kodesatker,jdbcType=CHAR}, #{kodepemda,jdbcType=CHAR}, ",
			"#{namapemda,jdbcType=VARCHAR}, #{tahunanggaran,jdbcType=SMALLINT}, ",
			"#{tglpengiriman,jdbcType=TIMESTAMP}, #{selesaitglpengiriman,jdbcType=TIMESTAMP}, ",
			"#{isirow,jdbcType=INTEGER}, #{diinsert,jdbcType=INTEGER}, ",
			"#{diubah,jdbcType=INTEGER}, #{dihapus,jdbcType=INTEGER}, ",
			"#{ket,jdbcType=VARCHAR}, #{namaaplikasi,jdbcType=VARCHAR}, ",
			"#{versiaplikasi,jdbcType=VARCHAR}, #{pengembangaplikasi,jdbcType=VARCHAR}, ",
			"#{versisinergi,jdbcType=VARCHAR}, #{userpengirim,jdbcType=VARCHAR},#{kelompokdataid}) ",
			"returning headerlogid"
	})
	long insert(Headerlog_WS record);

	@Select({
			"select",
			"headerlogid,kelompokdataid, jenisdata, kodesatker, kodepemda, namapemda, tahunanggaran, tglpengiriman, ",
			"selesaitglpengiriman, isirow, diinsert, diubah, dihapus, ket, namaaplikasi, ",
			"versiaplikasi, pengembangaplikasi, versisinergi, userpengirim,kelompokdataid",
			"from transaksi.headerlog",
			"where headerlogid = #{headerlogid,jdbcType=BIGINT}"
	})
	@Results({
			@Result(column = "headerlogid", property = "headerlogid", jdbcType = JdbcType.BIGINT, id = true),
			@Result(column = "jenisdata", property = "jenisdata", jdbcType = JdbcType.VARCHAR),
			@Result(column = "kodesatker", property = "kodesatker", jdbcType = JdbcType.CHAR),
			@Result(column = "kodepemda", property = "kodepemda", jdbcType = JdbcType.CHAR),
			@Result(column = "namapemda", property = "namapemda", jdbcType = JdbcType.VARCHAR),
			@Result(column = "tahunanggaran", property = "tahunanggaran", jdbcType = JdbcType.SMALLINT),
			@Result(column = "tglpengiriman", property = "tglpengiriman", jdbcType = JdbcType.TIMESTAMP),
			@Result(column = "selesaitglpengiriman", property = "selesaitglpengiriman", jdbcType = JdbcType.TIMESTAMP),
			@Result(column = "isirow", property = "isirow", jdbcType = JdbcType.INTEGER),
			@Result(column = "diinsert", property = "diinsert", jdbcType = JdbcType.INTEGER),
			@Result(column = "diubah", property = "diubah", jdbcType = JdbcType.INTEGER),
			@Result(column = "dihapus", property = "dihapus", jdbcType = JdbcType.INTEGER),
			@Result(column = "ket", property = "ket", jdbcType = JdbcType.VARCHAR),
			@Result(column = "namaaplikasi", property = "namaaplikasi", jdbcType = JdbcType.VARCHAR),
			@Result(column = "versiaplikasi", property = "versiaplikasi", jdbcType = JdbcType.VARCHAR),
			@Result(column = "pengembangaplikasi", property = "pengembangaplikasi", jdbcType = JdbcType.VARCHAR),
			@Result(column = "versisinergi", property = "versisinergi", jdbcType = JdbcType.VARCHAR),
			@Result(column = "userpengirim", property = "userpengirim", jdbcType = JdbcType.VARCHAR),
			@Result(column = "kelompokdataid", property = "kelompokdataid", jdbcType = JdbcType.INTEGER)
	})
	Headerlog selectByPrimaryKey(Long headerlogid);

	@Update({
        "update transaksi.headerlog",
        "set jenisdata = #{record.jenisdata,jdbcType=VARCHAR},",
          "kodesatker = #{record.kodesatker,jdbcType=CHAR},",
          "kodepemda = #{record.kodepemda,jdbcType=CHAR},",
          "namapemda = #{record.namapemda,jdbcType=VARCHAR},",
          "tahunanggaran = #{record.tahunanggaran,jdbcType=SMALLINT},",
          "tglpengiriman = #{record.tglpengiriman,jdbcType=TIMESTAMP},",
          "selesaitglpengiriman = #{record.selesaitglpengiriman,jdbcType=TIMESTAMP},",
          "isirow = #{record.isirow,jdbcType=INTEGER},",
          "diinsert = #{record.diinsert,jdbcType=INTEGER},",
          "diubah = #{record.diubah,jdbcType=INTEGER},",
          "dihapus = #{record.dihapus,jdbcType=INTEGER},",
          "ket = #{record.ket,jdbcType=VARCHAR},",
          "namaaplikasi = #{record.namaaplikasi,jdbcType=VARCHAR},",
          "versiaplikasi = #{record.versiaplikasi,jdbcType=VARCHAR},",
          "pengembangaplikasi = #{record.pengembangaplikasi,jdbcType=VARCHAR},",
          "versisinergi = #{record.versisinergi,jdbcType=VARCHAR},",
          "userpengirim = #{record.userpengirim,jdbcType=VARCHAR}",
        "where headerlogid = #{headerlogid,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(@Param("record") Headerlog_WS record, @Param("headerlogid") long headerlogid);

	@Update({
	"UPDATE transaksi.headerlog ",
    		"SET ",
    		"selesaitglpengiriman=#{selesaitglpengiriman}, diinsert=#{diinsert}, diubah=#{diubah},dihapus=#{dihapus} ",
    		"WHERE headerlogid=#{headerlogid}" 
   })
    int updatePengiriman(@Param("headerlogid")long headerlogid,@Param("diinsert") int diinsert,
    		@Param("diubah") int diubah,@Param("dihapus") int dihapus,@Param("selesaitglpengiriman") Date selesaitglpengiriman);
    
   
       
}