<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "classpath:resources/mybatis-3-config.dtd">


<mapper	namespace="com.mx.dla.dda.contrato.condicionesTransaccion.daos.CatalogosTransaccionDAO">

			<!-- MAPPER PASA SELECT DE categoia mg -->
	<resultMap id="resultCategoriaMg" type="CategoriaMgDTO">
		<id property="idCategoria" column="ID_CATEGORIA" />
		<result property="idBoxOffice" column="ID_BOXOFFICE" />
		<result property="descripcion" column="MG.DESCRIPCION" />
		<result property="tipoCategoria" column="TIPO_CATEGORIA" />
		<result property="estatus" column="MG.ESTATUS" />
	</resultMap>
	
				<!-- MAPPER PASA SELECT DE RELEASE DATE -->
	<resultMap id="resultReleaseDate" type="ReleaseDateDTO">
		<id property="idRelease" column="ID_RELEASE" />
		<result property="descripcion" column="DESCRIPCION" />
	</resultMap>
	
	
	
		<!-- MAPPER DE AGREGAR CONTRATO PTRANS -->
	<resultMap id="contratoPtrans" type="ContratoPtransDTO">
		<id property="idContratoPtrans" column="ID_CONTRATO_PTRANS" />
		<result property="idContrato" column="ID_CONTRATO" />
		<result property="tipoTrans" column="TIPO_TRANS" />
		<result property="tipoTitulo" column="TIPO_TITULO" />
		<result property="tipoAnnio" column="TIPO_ANNIO" />
		<result property="tipoMinimo" column="TIPO_MINIMO" />
	</resultMap>

	<!-- MAPPER DE AGREGAR CONTRATO PT ANNIO -->
	<resultMap id="contratoPtAnnio" type="ContratoPtAnnioDTO">
		<id property="idContratoPtrans" column="ID_CONTRATO_PTRANS" />
		<result property="annio" column="ANNIO" />
		<result property="titulos" column="TITULOS" />
		<result property="precio" column="PRECIO" />
		<result property="minimo" column="MINIMO" />
	</resultMap>


	<!-- MAPPER DE AGREGAR CONTRATO PT CMG -->
	<resultMap id="contratoPtCmg" type="ContratoPtCmgDTO">
		<id property="idPtcmg" column="ID_PTCMG" />
		<result property="idContratoPtrans" column="ID_CONTRATO_PTRANS" />
		<result property="idCategoria" column="ID_CATEGORIA" />
		<result property="annio" column="ANNIO" />
		<result property="minimo" column="MINIMO" />
	</resultMap>


	
	<resultMap id="contratoCategorias" type="ContratoCategoriasDTO">
		<id property="idContratoPtrans" column="ID_CONTRATO_PTRANS" />
		<result property="idCategoria" column="ID_CATEGORIA" />
		<result property="rsDLA" column="RS_DLA" />
		<result property="rsEstudio" column="RS_ESTUDIO" />
		<result property="tipoTitlo" column="TIPO_TITULO" />
	</resultMap>  

	<!-- MAPPER DE AGREGAR CONTRATO PTRS RD -->
	<resultMap id="contratoPtrsCatRd" type="ContratoPtrsRdDTO">
		<id property="idContratoPtrans" column="ID_CONTRATO_PTRANS" />
		<result property="idRelease" column="ID_RELEASE" />
		<result property="rsDLA" column="RS_DLA" />
		<result property="rsEstudio" column="RS_ESTUDIO" />
	</resultMap>
	
		<!-- MAPPER DE AGREGAR CONTRATO PTRS PRECIO -->
	<resultMap id="contratoPtrsPrecio" type="ContratoPtrsPrecioDTO">
		<id property="idContratoPtrans" column="ID_CONTRATO_PTRANS" />
		<result property="idCategoria" column="ID_CATEGORIA" />
		<result property="precio" column="PRECIO" />
	</resultMap>
	
	
	
	<!-- DEFINICION DE QUERYS -->
	
		<!-- selects para catalogos -->	
		<select id="obtenerCategoriaMG" resultMap="resultCategoriaMg" parameterType="map" >
			select MG.ID_CATEGORIA,MG.ID_BOXOFFICE,MG.DESCRIPCION,MG.TIPO_CATEGORIA,MG.ESTATUS
			from DDA_C_CATEGORIA_MG MG,DDA_C_BOXOFFICE BOX WHERE MG.ID_BOXOFFICE=BOX.ID_BOXOFFICE AND MG.ESTATUS=1
		</select>
		
		<select id="obtenerReleaseDate" resultMap="resultReleaseDate" parameterType="map" >
			select ID_RELEASE,DESCRIPCION from DDA_C_RELEASE_DATE
		</select>
		
	
	<!-- SELECTS PARA TABLAS INDIVIDAUALES T -->
	<select id="verificaTransaccion"  resultMap="contratoPtrans">
		SELECT * FROM DDA_T_CONTRATO_PTRANS WHERE ID_CONTRATO=#{idContrato}	ORDER BY ID_CONTRATO_PTRANS	 
	</select>
	 	
 	<select id="cargaContratoPagoAnnio" resultMap="contratoPtAnnio">
 		SELECT * FROM DDA_T_CONTRATO_PT_ANNIO WHERE ID_CONTRATO_PTRANS=#{idContratoPtrans} 
 	</select>
 	
 	<select id="cargaContratoPagoCmg" resultMap="contratoPtCmg">
 		SELECT * FROM DDA_T_CONTRATO_PT_CMG WHERE ID_CONTRATO_PTRANS=#{idContratoPtrans} 
 	</select>
 	
 	<select id="cargaContratoPagoCategorias" resultMap="contratoCategorias">
 		SELECT * FROM DDA_T_CONTRATO_PTRS_CAT WHERE ID_CONTRATO_PTRANS=#{idContratoPtrans} 
 	</select>
 	
 	<select id="cargaContratoPagoRD" resultMap="contratoPtrsCatRd">
 		SELECT * FROM DDA_T_CONTRATO_PTRS_RD WHERE ID_CONTRATO_PTRANS=#{idContratoPtrans} 
 	</select>
 	
 	<select id="cargaContratoPagoPrecio" resultMap="contratoPtrsPrecio">
 		SELECT * FROM DDA_T_CONTRATO_PTRS_PRECIO WHERE ID_CONTRATO_PTRANS=#{idContratoPtrans} 
 	</select>
 	
 
 
 
 	
 	
</mapper>