package sikd.sikd5.sikd5ejb.mapper.transaksi;

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

@SuppressWarnings("el-syntax")
public interface BelanjapotonganMapper {
	@Select({
		"insert into transaksi.belanjapotongan (belanjaid, ",
		"kodeakunpotongan, namaakunpotongan, ",
		"kodejenispotongan, namajenispotongan, ",
		"kodebilling, ntpn, ",
		"keterangan, nilaipotongan)",
		"values (#{belanjaid,jdbcType=BIGINT}, ",
		"#{record.kodeakunpotongan,jdbcType=VARCHAR}, #{record.namaakunpotongan,jdbcType=VARCHAR}, ",
		"#{record.kodejenispotongan,jdbcType=CHAR}, #{record.namajenispotongan,jdbcType=VARCHAR}, ",
		"#{record.kodebilling,jdbcType=VARCHAR}, #{record.ntpn,jdbcType=VARCHAR}, ",
		"#{record.keterangan,jdbcType=VARCHAR}, #{record.nilaipotongan,jdbcType=DOUBLE})",
		" returning belanjapotonganid "
})
long insertBelanjapotongan(@Param("record") Belanjapotongan_WS record, @Param("belanjaid") long belanjaid);
	
	@Update({
			"update transaksi.belanjapotongan",
			"set belanjaid = #{belanjaid,jdbcType=BIGINT},",
			"kodeakunpotongan = #{kodeakunpotongan,jdbcType=VARCHAR},",
			"namaakunpotongan = #{namaakunpotongan,jdbcType=VARCHAR},",
			"kodejenispotongan = #{kodejenispotongan,jdbcType=CHAR},",
			"namajenispotongan = #{namajenispotongan,jdbcType=VARCHAR},",
			"kodebilling = #{kodebilling,jdbcType=VARCHAR},",
			"ntpn = #{ntpn,jdbcType=VARCHAR},",
			"keterangan = #{keterangan,jdbcType=VARCHAR},",
			"nilaipotongan = #{nilaipotongan,jdbcType=DOUBLE}",
			"where belanjapotonganid = #{belanjapotonganid,jdbcType=BIGINT}"
	})
	int updateByPrimaryKey(Belanjapotongan record);

	@Delete({
			"delete from transaksi.belanjapotongan",
			"where belanjaid = #{belanjaid,jdbcType=BIGINT}"
	})
	int deleteBelanjapotonganByBelanjaid(Long belanjaid);
}