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.Apbddetil;
import sikd.sikd5.sikd5bean.ws.transaksi.Headerapbd_WS;

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

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

	
	@Select({
			"insert into transaksi.apbddetil (kodesatker, ",
			"kodepemda, namapemda, ",
			"tahunanggaran, tglpengiriman, ",
			"kodedata, statusdata, ",
			"jeniscoa, nomorperda, ",
			"tanggalperda, namaaplikasi, ",
			"pengembangaplikasi, versisinergi) ",
//        "nmfile)",
			"values (#{record.kodesatker,jdbcType=CHAR}, ",
			"#{record.kodepemda,jdbcType=CHAR}, #{record.namapemda,jdbcType=VARCHAR}, ",
			"#{record.tahunanggaran,jdbcType=SMALLINT}, #{record.tglpengiriman,jdbcType=TIMESTAMP}, ",
			"#{record.kodedata,jdbcType=SMALLINT}, #{record.statusdata,jdbcType=SMALLINT}, ",
			"#{record.jeniscoa,jdbcType=SMALLINT}, #{record.nomorperda,jdbcType=VARCHAR}, ",
			"#{record.tanggalperda,jdbcType=DATE}, #{record.namaaplikasi,jdbcType=VARCHAR}, ",
			"#{record.pengembangaplikasi,jdbcType=VARCHAR}, #{record.versisinergi,jdbcType=VARCHAR}, ",
			") returning apbddetilid"
	})
	long insertApbddetil(@Param("record") Headerapbd_WS record, @Param("tglpengiriman") Date tglpengiriman);

	@Select({
			"select",
			"apbddetilid, kodesatker, kodepemda, namapemda, tahunanggaran, tglpengiriman, ",
			"kodedata, statusdata, jeniscoa, nomorperda, tanggalperda, namaaplikasi, pengembangaplikasi, ",
			"versisinergi, nmfile",
			"from transaksi.apbddetil",
			"where apbddetilid = #{apbddetilid,jdbcType=BIGINT}"
	})
	@Results({
			@Result(column = "apbddetilid", property = "apbddetilid", jdbcType = JdbcType.BIGINT, id = true),
			@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 = "kodedata", property = "kodedata", jdbcType = JdbcType.SMALLINT),
			@Result(column = "statusdata", property = "statusdata", jdbcType = JdbcType.SMALLINT),
			@Result(column = "jeniscoa", property = "jeniscoa", jdbcType = JdbcType.SMALLINT),
			@Result(column = "nomorperda", property = "nomorperda", jdbcType = JdbcType.VARCHAR),
			@Result(column = "tanggalperda", property = "tanggalperda", jdbcType = JdbcType.DATE),
			@Result(column = "namaaplikasi", property = "namaaplikasi", jdbcType = JdbcType.VARCHAR),
			@Result(column = "pengembangaplikasi", property = "pengembangaplikasi", jdbcType = JdbcType.VARCHAR),
			@Result(column = "versisinergi", property = "versisinergi", jdbcType = JdbcType.VARCHAR),
			@Result(column = "nmfile", property = "nmfile", jdbcType = JdbcType.VARCHAR)
	})
	Apbddetil selectByPrimaryKey(Long apbddetilid);

	@Update({
			"update transaksi.apbddetil",
			"set 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},",
			"kodedata = #{record.kodedata,jdbcType=SMALLINT},",
			"statusdata = #{record.statusdata,jdbcType=SMALLINT},",
			"jeniscoa = #{record.jeniscoa,jdbcType=SMALLINT},",
			"nomorperda = #{record.nomorperda,jdbcType=VARCHAR},",
			"tanggalperda = #{record.tanggalperda,jdbcType=DATE},",
			"namaaplikasi = #{record.namaaplikasi,jdbcType=VARCHAR},",
			"pengembangaplikasi = #{record.pengembangaplikasi,jdbcType=VARCHAR},",
			"versisinergi = #{record.versisinergi,jdbcType=VARCHAR},",
			"nmfile = #{record.nmfile,jdbcType=VARCHAR}",
			"where apbddetilid = #{apbddetilid,jdbcType=BIGINT}"
	})
	int updateApbddetilByPrimaryKey(@Param("record")Headerapbd_WS record,@Param("apbddetilid") long apbddetilid );
}