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

<mapper namespace="cn.com.countrygarden.bi.main.dao.mediaResource.MediaResourceNewMapper">
	<resultMap id="BaseMediaResourceMap" type="cn.com.countrygarden.bi.main.dto.mediaResource.MediaResourceDto">
		<id 	column="media_id" 			property="mediaId"/>
		<result column="media_code" 		property="mediaCode"/>
		<result column="media_type" 		property="mediaType"/>
		<result column="media_form" 		property="mediaForm"/>
		<result column="media_width" 		property="mediaWidth"/>
		<result column="media_height" 		property="mediaHeight"/>
		<result column="media_unit" 		property="mediaUnit"/>
		<result column="media_price_unit" 	property="mediaPriceUnit"/>
		<result column="meida_number" 		property="meidaNumber"/>
		<result column="media_status" 		property="mediaStatus"/>
		<result column="site_one" 			property="siteOne"/>
		<result column="site_two" 			property="siteTwo"/>
		<result column="organ_code" 		property="organCode"/>
		<result column="organ_name" 		property="organName"/>
		<result column="comm_id" 			property="commId"/>
		<result column="comm_name" 			property="commName"/>
		<!--<result column="sort" 				property="sort"/>
		<result column="version" 			property="version"/>
		<result column="is_delete" 			property="isDelete"/>
		<result column="create_time" 		property="createTime"/>
		<result column="create_by" 			property="createBy"/>
		<result column="create_by_name" 	property="createByName"/>
		<result column="mod_time" 			property="modTime"/>
		<result column="mod_by" 			property="modBy"/>
		<result column="mod_by_name" 		property="modByName"/>-->
	</resultMap>

	<select id="getMediaResourceByOrderBillId" resultMap="BaseMediaResourceMap">
		SELECT
			r.media_id,
			r.media_code,
			r.media_type,
			r.media_form,
			r.media_width,
			r.media_height,
			r.media_unit,
			r.media_price_unit,
			r.meida_number,
			r.media_status,
			r.site_one,
			r.site_two,
			r.organ_code,
			r.organ_name,
			r.comm_id,
			r.comm_name
			/*r.sort,
			r.version,
			r.is_delete,
			r.create_time,
			r.create_by,
			r.create_by_name,
			r.mod_time,
			r.mod_by,
			r.mod_by_name*/
		FROM t_media_order_bill ob
		JOIN t_media_resource r on ob.media_id = r.media_id
		WHERE ob.order_bill_id = #{orderBillId}
	</select>

	<select id="selectByPrimaryKey" resultMap="BaseMediaResourceMap">
		SELECT
			r.media_id,
			r.media_code,
			r.media_type,
			r.media_form,
			r.media_width,
			r.media_height,
			r.media_unit,
			r.media_price_unit,
			r.meida_number,
			r.media_status,
			r.site_one,
			r.site_two,
			r.organ_code,
			r.organ_name,
			r.comm_id,
			r.comm_name
			/*r.sort,
			r.version,
			r.is_delete,
			r.create_time,
			r.create_by,
			r.create_by_name,
			r.mod_time,
			r.mod_by,
			r.mod_by_name*/
		FROM t_media_resource r
		WHERE r.media_id = #{mediaId}
	</select>
</mapper>