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.Many;
import org.apache.ibatis.annotations.One;
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.Belanja;
import sikd.sikd5.sikd5bean.tabel.transaksi.Belanjapotongan;
import sikd.sikd5.sikd5bean.ws.transaksi.Belanja_WS;
import sikd.sikd5.sikd5bean.ws.transaksi.Belanjaakun_WS;

@SuppressWarnings("el-syntax")
public interface BelanjaMapper {
  
    @Delete({
        "delete from transaksi.belanja",
        "where belanjaid = #{belanjaid,jdbcType=BIGINT}"
    })
    int deleteBelanjaByPrimaryKey(Long belanjaid);

   
    @Select({
        "insert into transaksi.belanja (headerlogid,tahunanggaran, ",
        "kodesatker, kodepemda, ",
        "namapemda, jeniscoa, ",
        "nomorspm, nomorsp2d,",
        "sha256,",
        "jenissp2d, tanggalspm, ",
        "tanggalsp2d, nilaisp2d, ",
        "statussp2d, nilaitotalpajak, ",
        "nilaitotalpotongan, npwpbud, ",
        "npwpskpd, npwppenerima, ",
        "namapenerima, kodesumberdana, ",
        "namasumberdana, kodesubsumberdana, ",
        "subsumberdana, tahapsalurdana, ",
        "keterangan, kodekelompokurusan, ",
        "namakelompokurusan, kodeurusan, ",
        "namaurusan, kodeunitorganisasi, ",
        "namaunitorganisasi, kodesubunitorganisasi, ",
        "namasubunitorganisasi, kodeskpd, ",
        "namaskpd, kodeprogram, ",
        "namaprogram, kodekegiatan, ",
        "namakegiatan, kodepaketkegiatan, ",
        "namapaketkegiatan, kodeoutput, ",
        "namaoutput, satuanoutput, ",
        "capaianoutput)",
        "values (#{headerlogid,jdbcType=BIGINT},#{record.tahunanggaran,jdbcType=SMALLINT}, ",
        "#{record.kodesatker,jdbcType=CHAR}, #{record.kodepemda,jdbcType=CHAR}, ",
        "#{record.namapemda,jdbcType=VARCHAR}, #{record.jeniscoa,jdbcType=SMALLINT}, ",
        "#{record.nomorspm,jdbcType=VARCHAR}, #{record.nomorsp2d,jdbcType=VARCHAR}, ",
        "#{record.sha256,jdbcType=VARCHAR},",
        "#{record.jenissp2d,jdbcType=SMALLINT}, #{record.tanggalspm,jdbcType=DATE}, ",
        "#{record.tanggalsp2d,jdbcType=DATE}, #{record.nilaisp2d,jdbcType=DOUBLE}, ",
        "#{record.statussp2d,jdbcType=SMALLINT}, #{record.nilaitotalpajak,jdbcType=DOUBLE}, ",
        "#{record.nilaitotalpotongan,jdbcType=DOUBLE}, #{record.npwpbud,jdbcType=VARCHAR}, ",
        "#{record.npwpskpd,jdbcType=VARCHAR}, #{record.npwppenerima,jdbcType=VARCHAR}, ",
        "#{record.namapenerima,jdbcType=VARCHAR}, #{record.kodesumberdana,jdbcType=CHAR}, ",
        "#{record.namasumberdana,jdbcType=VARCHAR}, #{record.kodesubsumberdana,jdbcType=CHAR}, ",
        "#{record.subsumberdana,jdbcType=VARCHAR}, #{record.tahapsalurdana,jdbcType=SMALLINT}, ",
        "#{record.keterangan,jdbcType=VARCHAR}, #{record.kodekelompokurusan,jdbcType=CHAR}, ",
        "#{record.namakelompokurusan,jdbcType=VARCHAR}, #{record.kodeurusan,jdbcType=CHAR}, ",
        "#{record.namaurusan,jdbcType=VARCHAR}, #{record.kodeunitorganisasi,jdbcType=CHAR}, ",
        "#{record.namaunitorganisasi,jdbcType=VARCHAR}, #{record.kodesubunitorganisasi,jdbcType=CHAR}, ",
        "#{record.namasubunitorganisasi,jdbcType=VARCHAR}, #{record.kodeskpd,jdbcType=CHAR}, ",
        "#{record.namaskpd,jdbcType=VARCHAR}, #{record.kodeprogram,jdbcType=CHAR}, ",
        "#{record.namaprogram,jdbcType=VARCHAR}, #{record.kodekegiatan,jdbcType=CHAR}, ",
        "#{record.namakegiatan,jdbcType=VARCHAR}, #{record.kodepaketkegiatan,jdbcType=CHAR}, ",
        "#{record.namapaketkegiatan,jdbcType=VARCHAR}, #{record.kodeoutput,jdbcType=CHAR}, ",
        "#{record.namaoutput,jdbcType=VARCHAR}, #{record.satuanoutput,jdbcType=VARCHAR}, ",
        "#{record.capaianoutput,jdbcType=DOUBLE}) ",
        "returning belanjaid"
    })
    long insertBelanja(@Param("record") Belanja_WS record,@Param("headerlogid") long headerlogid);  
  
    @Select({
        "select ",
        "*",
        "from transaksi.belanjapotongan",
        "where belanjaid = #{belanjaid,jdbcType=BIGINT}"
    })
    @Results({
//        @Result(column="belanjaid", property="belanjaid", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="tahunanggaran", property="tahunanggaran", jdbcType=JdbcType.SMALLINT),
        @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="jeniscoa", property="jeniscoa", jdbcType=JdbcType.SMALLINT),
        @Result(column="nomorspm", property="nomorspm", jdbcType=JdbcType.VARCHAR),
        @Result(column="nomorsp2d", property="nomorsp2d", jdbcType=JdbcType.VARCHAR),
        @Result(column="sha256", property="sha256", jdbcType=JdbcType.VARCHAR),
        @Result(column="jenissp2d", property="jenissp2d", jdbcType=JdbcType.SMALLINT),
        @Result(column="tanggalspm", property="tanggalspm", jdbcType=JdbcType.DATE),
        @Result(column="tanggalsp2d", property="tanggalsp2d", jdbcType=JdbcType.DATE),
        @Result(column="nilaisp2d", property="nilaisp2d", jdbcType=JdbcType.DOUBLE),
        @Result(column="statussp2d", property="statussp2d", jdbcType=JdbcType.SMALLINT),
        @Result(column="nilaitotalpajak", property="nilaitotalpajak", jdbcType=JdbcType.DOUBLE),
        @Result(column="nilaitotalpotongan", property="nilaitotalpotongan", jdbcType=JdbcType.DOUBLE),
        @Result(column="npwpbud", property="npwpbud", jdbcType=JdbcType.VARCHAR),
        @Result(column="npwpskpd", property="npwpskpd", jdbcType=JdbcType.VARCHAR),
        @Result(column="npwppenerima", property="npwppenerima", jdbcType=JdbcType.VARCHAR),
        @Result(column="namapenerima", property="namapenerima", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodesumberdana", property="kodesumberdana", jdbcType=JdbcType.CHAR),
        @Result(column="namasumberdana", property="namasumberdana", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodesubsumberdana", property="kodesubsumberdana", jdbcType=JdbcType.CHAR),
        @Result(column="subsumberdana", property="subsumberdana", jdbcType=JdbcType.VARCHAR),
        @Result(column="tahapsalurdana", property="tahapsalurdana", jdbcType=JdbcType.SMALLINT),
        @Result(column="keterangan", property="keterangan", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodekelompokurusan", property="kodekelompokurusan", jdbcType=JdbcType.CHAR),
        @Result(column="namakelompokurusan", property="namakelompokurusan", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodeurusan", property="kodeurusan", jdbcType=JdbcType.CHAR),
        @Result(column="namaurusan", property="namaurusan", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodeunitorganisasi", property="kodeunitorganisasi", jdbcType=JdbcType.CHAR),
        @Result(column="namaunitorganisasi", property="namaunitorganisasi", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodesubunitorganisasi", property="kodesubunitorganisasi", jdbcType=JdbcType.CHAR),
        @Result(column="namasubunitorganisasi", property="namasubunitorganisasi", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodeskpd", property="kodeskpd", jdbcType=JdbcType.CHAR),
        @Result(column="namaskpd", property="namaskpd", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodeprogram", property="kodeprogram", jdbcType=JdbcType.CHAR),
        @Result(column="namaprogram", property="namaprogram", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodekegiatan", property="kodekegiatan", jdbcType=JdbcType.CHAR),
        @Result(column="namakegiatan", property="namakegiatan", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodepaketkegiatan", property="kodepaketkegiatan", jdbcType=JdbcType.CHAR),
        @Result(column="namapaketkegiatan", property="namapaketkegiatan", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodeoutput", property="kodeoutput", jdbcType=JdbcType.CHAR),
        @Result(column="namaoutput", property="namaoutput", jdbcType=JdbcType.VARCHAR),
        @Result(column="satuanoutput", property="satuanoutput", jdbcType=JdbcType.VARCHAR),
        @Result(column="capaianoutput", property="capaianoutput", jdbcType=JdbcType.DOUBLE)
    })
    List<Belanja_WS> selectBelanjaWSByTanggal(@Param("tahun") short tahun,@Param("kodesatker") String kodesatker,
    		@Param("tgawal") Date tgawal,@Param("tgakhir") Date tgakhir);

    @Select({
        "select",
        "belanjaid, tahunanggaran, kodesatker, kodepemda, namapemda, jeniscoa, nomorspm, ",
        "nomorsp2d, sha256, jenissp2d, tanggalspm, tanggalsp2d, nilaisp2d, statussp2d, nilaitotalpajak, ",
        "nilaitotalpotongan, npwpbud, npwpskpd, npwppenerima, namapenerima, kodesumberdana, ",
        "namasumberdana, kodesubsumberdana, subsumberdana, tahapsalurdana, keterangan, ",
        "kodekelompokurusan, namakelompokurusan, kodeurusan, namaurusan, kodeunitorganisasi, ",
        "namaunitorganisasi, kodesubunitorganisasi, namasubunitorganisasi, kodeskpd, ",
        "namaskpd, kodeprogram, namaprogram, kodekegiatan, namakegiatan, kodepaketkegiatan, ",
        "namapaketkegiatan, kodeoutput, namaoutput, satuanoutput, capaianoutput",
        "from transaksi.belanja",
        "where belanjaid = #{belanjaid,jdbcType=BIGINT}"
    })
    @Results({
//        @Result(column="belanjaid", property="belanjaid", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="tahunanggaran", property="tahunanggaran", jdbcType=JdbcType.SMALLINT),
        @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="jeniscoa", property="jeniscoa", jdbcType=JdbcType.SMALLINT),
        @Result(column="nomorspm", property="nomorspm", jdbcType=JdbcType.VARCHAR),
        @Result(column="nomorsp2d", property="nomorsp2d", jdbcType=JdbcType.VARCHAR),
        @Result(column="sha256", property="sha256", jdbcType=JdbcType.VARCHAR),
        @Result(column="jenissp2d", property="jenissp2d", jdbcType=JdbcType.SMALLINT),
        @Result(column="tanggalspm", property="tanggalspm", jdbcType=JdbcType.DATE),
        @Result(column="tanggalsp2d", property="tanggalsp2d", jdbcType=JdbcType.DATE),
        @Result(column="nilaisp2d", property="nilaisp2d", jdbcType=JdbcType.DOUBLE),
        @Result(column="statussp2d", property="statussp2d", jdbcType=JdbcType.SMALLINT),
        @Result(column="nilaitotalpajak", property="nilaitotalpajak", jdbcType=JdbcType.DOUBLE),
        @Result(column="nilaitotalpotongan", property="nilaitotalpotongan", jdbcType=JdbcType.DOUBLE),
        @Result(column="npwpbud", property="npwpbud", jdbcType=JdbcType.VARCHAR),
        @Result(column="npwpskpd", property="npwpskpd", jdbcType=JdbcType.VARCHAR),
        @Result(column="npwppenerima", property="npwppenerima", jdbcType=JdbcType.VARCHAR),
        @Result(column="namapenerima", property="namapenerima", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodesumberdana", property="kodesumberdana", jdbcType=JdbcType.CHAR),
        @Result(column="namasumberdana", property="namasumberdana", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodesubsumberdana", property="kodesubsumberdana", jdbcType=JdbcType.CHAR),
        @Result(column="subsumberdana", property="subsumberdana", jdbcType=JdbcType.VARCHAR),
        @Result(column="tahapsalurdana", property="tahapsalurdana", jdbcType=JdbcType.SMALLINT),
        @Result(column="keterangan", property="keterangan", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodekelompokurusan", property="kodekelompokurusan", jdbcType=JdbcType.CHAR),
        @Result(column="namakelompokurusan", property="namakelompokurusan", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodeurusan", property="kodeurusan", jdbcType=JdbcType.CHAR),
        @Result(column="namaurusan", property="namaurusan", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodeunitorganisasi", property="kodeunitorganisasi", jdbcType=JdbcType.CHAR),
        @Result(column="namaunitorganisasi", property="namaunitorganisasi", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodesubunitorganisasi", property="kodesubunitorganisasi", jdbcType=JdbcType.CHAR),
        @Result(column="namasubunitorganisasi", property="namasubunitorganisasi", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodeskpd", property="kodeskpd", jdbcType=JdbcType.CHAR),
        @Result(column="namaskpd", property="namaskpd", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodeprogram", property="kodeprogram", jdbcType=JdbcType.CHAR),
        @Result(column="namaprogram", property="namaprogram", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodekegiatan", property="kodekegiatan", jdbcType=JdbcType.CHAR),
        @Result(column="namakegiatan", property="namakegiatan", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodepaketkegiatan", property="kodepaketkegiatan", jdbcType=JdbcType.CHAR),
        @Result(column="namapaketkegiatan", property="namapaketkegiatan", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodeoutput", property="kodeoutput", jdbcType=JdbcType.CHAR),
        @Result(column="namaoutput", property="namaoutput", jdbcType=JdbcType.VARCHAR),
        @Result(column="satuanoutput", property="satuanoutput", jdbcType=JdbcType.VARCHAR),
        @Result(column="capaianoutput", property="capaianoutput", jdbcType=JdbcType.DOUBLE)
    })
    Belanja_WS selectBelanjaByPrimaryKey(Long belanjaid);

    @Update({
          "update transaksi.belanja",
          "set tahunanggaran = #{record.tahunanggaran,jdbcType=SMALLINT},",
          "kodesatker = #{record.kodesatker,jdbcType=CHAR},",
          "kodepemda = #{record.kodepemda,jdbcType=CHAR},",
          "namapemda = #{record.namapemda,jdbcType=VARCHAR},",
          "jeniscoa = #{record.jeniscoa,jdbcType=SMALLINT},",
          "nomorspm = #{record.nomorspm,jdbcType=VARCHAR},",
          "nomorsp2d = #{record.nomorsp2d,jdbcType=VARCHAR},",
          "jenissp2d = #{record.jenissp2d,jdbcType=SMALLINT},",
          "tanggalspm = #{record.tanggalspm,jdbcType=DATE},",
          "tanggalsp2d = #{record.tanggalsp2d,jdbcType=DATE},",
          "nilaisp2d = #{record.nilaisp2d,jdbcType=DOUBLE},",
          "statussp2d = #{record.statussp2d,jdbcType=SMALLINT},",
          "nilaitotalpajak = #{record.nilaitotalpajak,jdbcType=DOUBLE},",
          "nilaitotalpotongan = #{record.nilaitotalpotongan,jdbcType=DOUBLE},",
          "npwpbud = #{record.npwpbud,jdbcType=VARCHAR},",
          "npwpskpd = #{record.npwpskpd,jdbcType=VARCHAR},",
          "npwppenerima = #{record.npwppenerima,jdbcType=VARCHAR},",
          "namapenerima = #{record.namapenerima,jdbcType=VARCHAR},",
          "kodesumberdana = #{record.kodesumberdana,jdbcType=CHAR},",
          "namasumberdana = #{record.namasumberdana,jdbcType=VARCHAR},",
          "kodesubsumberdana = #{record.kodesubsumberdana,jdbcType=CHAR},",
          "subsumberdana = #{record.subsumberdana,jdbcType=VARCHAR},",
          "tahapsalurdana = #{record.tahapsalurdana,jdbcType=SMALLINT},",
          "keterangan = #{record.keterangan,jdbcType=VARCHAR},",
          "kodekelompokurusan = #{record.kodekelompokurusan,jdbcType=CHAR},",
          "namakelompokurusan = #{record.namakelompokurusan,jdbcType=VARCHAR},",
          "kodeurusan = #{record.kodeurusan,jdbcType=CHAR},",
          "namaurusan = #{record.namaurusan,jdbcType=VARCHAR},",
          "kodeunitorganisasi = #{record.kodeunitorganisasi,jdbcType=CHAR},",
          "namaunitorganisasi = #{record.namaunitorganisasi,jdbcType=VARCHAR},",
          "kodesubunitorganisasi = #{record.kodesubunitorganisasi,jdbcType=CHAR},",
          "namasubunitorganisasi = #{record.namasubunitorganisasi,jdbcType=VARCHAR},",
          "kodeskpd = #{record.kodeskpd,jdbcType=CHAR},",
          "namaskpd = #{record.namaskpd,jdbcType=VARCHAR},",
          "kodeprogram = #{record.kodeprogram,jdbcType=CHAR},",
          "namaprogram = #{record.namaprogram,jdbcType=VARCHAR},",
          "kodekegiatan = #{record.kodekegiatan,jdbcType=CHAR},",
          "namakegiatan = #{record.namakegiatan,jdbcType=VARCHAR},",
          "kodepaketkegiatan = #{record.kodepaketkegiatan,jdbcType=CHAR},",
          "namapaketkegiatan = #{record.namapaketkegiatan,jdbcType=VARCHAR},",
          "kodeoutput = #{record.kodeoutput,jdbcType=CHAR},",
          "namaoutput = #{record.namaoutput,jdbcType=VARCHAR},",
          "satuanoutput = #{record.satuanoutput,jdbcType=VARCHAR},",
          "capaianoutput = #{record.capaianoutput,jdbcType=DOUBLE}",
        "where belanjaid = #{belanjaid,jdbcType=BIGINT}"
    })
    int updateBelanjaByPrimaryKey(@Param("record") Belanja_WS record,@Param("belanjaid") long belanjaid);
    
    @Select({
        "select ",
        "belanjaakunid, belanjaid, kodeakunutama, namaakunutama, kodeakunkelompok, namaakunkelompok, ",
        "kodeakunjenis, namaakunjenis, kodeakunobjek, namaakunobjek, kodeakunrinci, namaakunrinci, ",
        "kodeakunsubrinci, namaakunsubrinci, kodeakunsubsubrinci, namaakunsubsubrinci, ",
        "nilaibelanja",
        "from transaksi.belanjaakun",
        "where belanjaid = #{belanjaid,jdbcType=BIGINT}"
    })
    @Results({
//        @Result(column="belanjaakunid", property="belanjaakunid", jdbcType=JdbcType.BIGINT, id=true),
//        @Result(column="belanjaid", property="belanjaid", jdbcType=JdbcType.BIGINT),
        @Result(column="kodeakunutama", property="kodeakunutama", jdbcType=JdbcType.CHAR),
        @Result(column="namaakunutama", property="namaakunutama", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodeakunkelompok", property="kodeakunkelompok", jdbcType=JdbcType.CHAR),
        @Result(column="namaakunkelompok", property="namaakunkelompok", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodeakunjenis", property="kodeakunjenis", jdbcType=JdbcType.CHAR),
        @Result(column="namaakunjenis", property="namaakunjenis", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodeakunobjek", property="kodeakunobjek", jdbcType=JdbcType.CHAR),
        @Result(column="namaakunobjek", property="namaakunobjek", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodeakunrinci", property="kodeakunrinci", jdbcType=JdbcType.CHAR),
        @Result(column="namaakunrinci", property="namaakunrinci", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodeakunsubrinci", property="kodeakunsubrinci", jdbcType=JdbcType.CHAR),
        @Result(column="namaakunsubrinci", property="namaakunsubrinci", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodeakunsubsubrinci", property="kodeakunsubsubrinci", jdbcType=JdbcType.CHAR),
        @Result(column="namaakunsubsubrinci", property="namaakunsubsubrinci", jdbcType=JdbcType.VARCHAR),
        @Result(column="nilaibelanja", property="nilaibelanja", jdbcType=JdbcType.DOUBLE)
    })
    List<Belanjaakun_WS> selectBelanjaakunsByBelanjaid(Long belanjaid);
    
    @Select({
        "select ",
        "belanjapotonganid, belanjaid, kodeakunpotongan, namaakunpotongan, kodejenispotongan, ",
        "namajenispotongan, kodebilling, ntpn, keterangan, nilaipotongan",
        "from transaksi.belanjapotongan",
        "where belanjaid = #{belanjaid,jdbcType=BIGINT}"
    })
    @Results({
//        @Result(column="belanjapotonganid", property="belanjapotonganid", jdbcType=JdbcType.BIGINT, id=true),
//        @Result(column="belanjaid", property="belanjaid", jdbcType=JdbcType.BIGINT),
        @Result(column="kodeakunpotongan", property="kodeakunpotongan", jdbcType=JdbcType.VARCHAR),
        @Result(column="namaakunpotongan", property="namaakunpotongan", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodejenispotongan", property="kodejenispotongan", jdbcType=JdbcType.CHAR),
        @Result(column="namajenispotongan", property="namajenispotongan", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodebilling", property="kodebilling", jdbcType=JdbcType.VARCHAR),
        @Result(column="ntpn", property="ntpn", jdbcType=JdbcType.VARCHAR),
        @Result(column="keterangan", property="keterangan", jdbcType=JdbcType.VARCHAR),
        @Result(column="nilaipotongan", property="nilaipotongan", jdbcType=JdbcType.DOUBLE)
    })
    List<Belanjapotongan> selectBelanjapotongansByBelanjaid(Long belanjaid);
    
    
    @Select({
        "select ",
        "*",
        "from transaksi.belanjapotongan",
        "where belanjaid = #{belanjaid,jdbcType=BIGINT}"
    })
    @Results({
//        @Result(column="belanjaid", property="belanjaid", jdbcType=JdbcType.BIGINT, id=true),

        @Result(property = "belanjapotongans", column = "belanjaid", javaType = List.class, many = @Many(select = "selectBelanjapotongansByBelanjaid")),
        @Result(property = "belanjaakuns", column = "belanjaid", javaType = List.class, many = @Many(select = "selectBelanjaakunsByBelanjaid"))
    })
    List<Belanja_WS> selectBelanjaDanAnakByTanggal(@Param("tahun") short tahun,@Param("kodesatker") String kodesatker,
    		@Param("tgawal") Date tgawal,@Param("tgakhir") Date tgakhir);
    
    @Select({
        "select ",
        "*",
        "from transaksi.belanjapotongan",
        "where belanjaid = #{belanjaid,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="belanjaid", property="belanjaid", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="tahunanggaran", property="tahunanggaran", jdbcType=JdbcType.SMALLINT),
        @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="jeniscoa", property="jeniscoa", jdbcType=JdbcType.SMALLINT),
        @Result(column="nomorspm", property="nomorspm", jdbcType=JdbcType.VARCHAR),
        @Result(column="nomorsp2d", property="nomorsp2d", jdbcType=JdbcType.VARCHAR),
        @Result(column="sha256", property="sha256", jdbcType=JdbcType.VARCHAR),
        @Result(column="jenissp2d", property="jenissp2d", jdbcType=JdbcType.SMALLINT),
        @Result(column="tanggalspm", property="tanggalspm", jdbcType=JdbcType.DATE),
        @Result(column="tanggalsp2d", property="tanggalsp2d", jdbcType=JdbcType.DATE),
        @Result(column="nilaisp2d", property="nilaisp2d", jdbcType=JdbcType.DOUBLE),
        @Result(column="statussp2d", property="statussp2d", jdbcType=JdbcType.SMALLINT),
        @Result(column="nilaitotalpajak", property="nilaitotalpajak", jdbcType=JdbcType.DOUBLE),
        @Result(column="nilaitotalpotongan", property="nilaitotalpotongan", jdbcType=JdbcType.DOUBLE),
        @Result(column="npwpbud", property="npwpbud", jdbcType=JdbcType.VARCHAR),
        @Result(column="npwpskpd", property="npwpskpd", jdbcType=JdbcType.VARCHAR),
        @Result(column="npwppenerima", property="npwppenerima", jdbcType=JdbcType.VARCHAR),
        @Result(column="namapenerima", property="namapenerima", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodesumberdana", property="kodesumberdana", jdbcType=JdbcType.CHAR),
        @Result(column="namasumberdana", property="namasumberdana", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodesubsumberdana", property="kodesubsumberdana", jdbcType=JdbcType.CHAR),
        @Result(column="subsumberdana", property="subsumberdana", jdbcType=JdbcType.VARCHAR),
        @Result(column="tahapsalurdana", property="tahapsalurdana", jdbcType=JdbcType.SMALLINT),
        @Result(column="keterangan", property="keterangan", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodekelompokurusan", property="kodekelompokurusan", jdbcType=JdbcType.CHAR),
        @Result(column="namakelompokurusan", property="namakelompokurusan", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodeurusan", property="kodeurusan", jdbcType=JdbcType.CHAR),
        @Result(column="namaurusan", property="namaurusan", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodeunitorganisasi", property="kodeunitorganisasi", jdbcType=JdbcType.CHAR),
        @Result(column="namaunitorganisasi", property="namaunitorganisasi", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodesubunitorganisasi", property="kodesubunitorganisasi", jdbcType=JdbcType.CHAR),
        @Result(column="namasubunitorganisasi", property="namasubunitorganisasi", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodeskpd", property="kodeskpd", jdbcType=JdbcType.CHAR),
        @Result(column="namaskpd", property="namaskpd", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodeprogram", property="kodeprogram", jdbcType=JdbcType.CHAR),
        @Result(column="namaprogram", property="namaprogram", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodekegiatan", property="kodekegiatan", jdbcType=JdbcType.CHAR),
        @Result(column="namakegiatan", property="namakegiatan", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodepaketkegiatan", property="kodepaketkegiatan", jdbcType=JdbcType.CHAR),
        @Result(column="namapaketkegiatan", property="namapaketkegiatan", jdbcType=JdbcType.VARCHAR),
        @Result(column="kodeoutput", property="kodeoutput", jdbcType=JdbcType.CHAR),
        @Result(column="namaoutput", property="namaoutput", jdbcType=JdbcType.VARCHAR),
        @Result(column="satuanoutput", property="satuanoutput", jdbcType=JdbcType.VARCHAR),
        @Result(column="capaianoutput", property="capaianoutput", jdbcType=JdbcType.DOUBLE)
    })
    List<Belanja_WS> selectBelanjaByTanggal(@Param("tahun") short tahun,@Param("kodesatker") String kodesatker,
    		@Param("tgawal") Date tgawal,@Param("tgakhir") Date tgakhir);

}