<?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="com.ym.mec.biz.dal.dao.PracticeGroupSellPriceDao">

	<resultMap type="com.ym.mec.biz.dal.entity.PracticeGroupSellPrice" id="PracticeGroupSellPrice">
		<result column="organ_id_" property="organId" />
		<result column="once_original_price" property="onceOriginalPrice" />
		<result column="once_activity_price" property="onceActivityPrice" />
		<result column="twice_original_price" property="twiceOriginalPrice" />
		<result column="twice_activity_price" property="twiceActivityPrice" />
		<result column="create_time_" property="createTime" />
		<result column="update_time_" property="updateTime" />
	</resultMap>

	<!-- 根据主键查询一条记录 -->
	<select id="get" resultMap="PracticeGroupSellPrice">
		SELECT * FROM
		practice_group_sell_price WHERE organ_id_ = #{id}
	</select>

	<!-- 全查询 -->
	<select id="findAll" resultMap="PracticeGroupSellPrice">
		SELECT * FROM practice_group_sell_price
		ORDER BY id_
	</select>

	<!-- 向数据库增加一条记录 -->
	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.PracticeGroupSellPrice"
		useGeneratedKeys="true" keyColumn="organ_id_" keyProperty="organId">
		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
			AS ID FROM DUAL </selectKey> -->
		INSERT INTO practice_group_sell_price
		(`organ_id_`, `once_original_price`, `once_activity_price`, `twice_original_price`, `twice_activity_price`, `create_time_`, `update_time_`)
		VALUES(#{organId},#{onceOriginalPrice},#{onceActivityPrice},#{twiceOriginalPrice},#{twiceActivityPrice},#{createTime},#{updateTime})
	</insert>

	<!-- 根据主键查询一条记录 -->
	<update id="update" parameterType="com.ym.mec.biz.dal.entity.PracticeGroupSellPrice">
		UPDATE practice_group_sell_price
		<set>
			<if test="onceOriginalPrice != null">
				once_original_price = #{onceOriginalPrice},
			</if>
			<if test="onceActivityPrice != null">
				once_activity_price = #{onceActivityPrice},
			</if>
			<if test="twiceOriginalPrice != null">
				twice_original_price = #{twiceOriginalPrice},
			</if>
			<if test="twiceActivityPrice != null">
				twice_activity_price = #{twiceActivityPrice},
			</if>
			update_time_=NOW
		</set>
		WHERE organ_id_ = #{organId}
	</update>

	<!-- 根据主键删除一条记录 -->
	<delete id="delete">
		DELETE FROM practice_group_sell_price WHERE organ_id_ = #{id}
	</delete>

	<!-- 分页查询 -->
	<select id="queryPage" resultMap="PracticeGroupSellPrice" parameterType="map">
		SELECT * FROM practice_group_sell_price ORDER BY id_
		<include refid="global.limit" />
	</select>

	<!-- 查询当前表的总记录数 -->
	<select id="queryCount" resultType="int">
		SELECT COUNT(*) FROM practice_group_sell_price
	</select>
</mapper>
