<?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.hotent.project.dao.CostProjectMemoDao">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hotent.project.model.CostProjectMemo">
        <id column="id" property="id" />
    <result column="project_id" property="projectId" />
    <result column="title" property="title" />
    <result column="content" property="content" />
    <result column="memo_date" property="memoDate" />
    <result column="time_period" property="timePeriod" />
    <result column="reminder_type" property="reminderType" />
    <result column="attachment_url" property="attachmentUrl" />
    <result column="attachment_name" property="attachmentName" />
    <result column="attachment_size" property="attachmentSize" />
    <result column="area_code" property="areaCode" />
    <result column="area_level" property="areaLevel" />
    <result column="create_by" property="createBy" />
    <result column="create_time" property="createTime" />
		<result column="update_by" property="updateBy" />
    <result column="update_time" property="updateTime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, project_id, title, content, memo_date, time_period, reminder_type, attachment_url, attachment_name, attachment_size, area_code, area_level, create_by, create_time, update_time,update_by
    </sql>
	<update id="updateMemo">
		update cost_project_memo
		<trim prefix="set" suffixOverrides=",">
			<if test="projectId!= null">
				project_id = #{projectId},
			</if>
			<if test="title != null">
				title = #{title},
			</if>
			<if test="content != null">
				content = #{content},
			</if>
			<if test="memoDate != null">
				memo_date = #{memoDate},
			</if>
			<if test="timePeriod != null">
				time_period = #{timePeriod},
			</if>
			<if test="reminderType != null">
				reminder_type = #{reminderType},
			</if>
			<if test="attachmentUrl != null">
				attachment_url = #{attachmentUrl},
			</if>
		where id = #{id}
		</trim>
	</update>

	<select id="selectPage" resultMap="BaseResultMap">
		select 
			<include refid="Base_Column_List"/> 
		from
			cost_project_memo
		${ew.customSqlSegment}
	</select>
	
	<select id="selectList" resultMap="BaseResultMap">
		select 
			<include refid="Base_Column_List"/> 
		from
			cost_project_memo
		${ew.customSqlSegment}
	</select>
	
	<select id="selectById" resultMap="BaseResultMap">
		select 
			<include refid="Base_Column_List"/> 
		from
			cost_project_memo
		where 
		    id = ${id}
	</select>
</mapper>
