<?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.jeeplus.modules.project.dao.ProjectgeneralDao">
    
	<sql id="projectgeneralColumns">
		a.id AS "id",
		a.create_by AS "createBy.id",
		a.create_date AS "createDate",
		a.update_by AS "updateBy.id",
		a.update_date AS "updateDate",
		a.remarks AS "remarks",
		a.del_flag AS "delFlag",
		a.demand_department AS "demandDepartment",
		a.project_type AS "projectType",
		a.construction_site AS "constructionSite",
		a.supervision_unit AS "supervisionUnit",
		a.service_classification AS "serviceClassification",
		a.fund_attribute AS "fundAttribute",
		a.asset_nature AS "assetNature",
		a.tender_scope AS "tenderScope",
		a.online_bidding AS "onlineBidding",
		a.evaluation_expert AS "evaluationExpert",
		a.price_ceiling AS "priceCeiling",
		a.bid_price_or_bid_control_price AS "bidPriceOrBidControlPrice",
		a.bid_price_or_bid_control_price_money AS "bidPriceOrBidControlPriceMoney",
		a.bid_evaluation_officer AS "bidEvaluationOfficer",
		a.bid_evaluation_staff AS "bidEvaluationStaff",
		a.project_id AS "projectId"
	</sql>
	
	<sql id="projectgeneralJoins">
	</sql>
	
    
	<select id="get" resultType="Projectgeneral" >
		SELECT 
			<include refid="projectgeneralColumns"/>
		FROM project_general a
		<include refid="projectgeneralJoins"/>
		WHERE a.id = #{id}
	</select>
	
	<select id="findList" resultType="Projectgeneral" >
		SELECT 
			<include refid="projectgeneralColumns"/>
		FROM project_general a
		<include refid="projectgeneralJoins"/>
		<where>
			a.del_flag = #{DEL_FLAG_NORMAL}
		</where>
		<choose>
			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
				ORDER BY ${page.orderBy}
			</when>
			<otherwise>
				ORDER BY a.update_date DESC
			</otherwise>
		</choose>
	</select>
	
	<select id="findAllList" resultType="Projectgeneral" >
		SELECT 
			<include refid="projectgeneralColumns"/>
		FROM project_general a
		<include refid="projectgeneralJoins"/>
		<where>
			a.del_flag = #{DEL_FLAG_NORMAL}
		</where>		
		<choose>
			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
				ORDER BY ${page.orderBy}
			</when>
			<otherwise>
				ORDER BY a.update_date DESC
			</otherwise>
		</choose>
	</select>
	
	<insert id="insert">
		INSERT INTO project_general(
			id,
			create_by,
			create_date,
			update_by,
			update_date,
			remarks,
			del_flag,
			demand_department,
			project_type,
			construction_site,
			supervision_unit,
			service_classification,
			fund_attribute,
			asset_nature,
			tender_scope,
			online_bidding,
			evaluation_expert,
			price_ceiling,
			bid_price_or_bid_control_price,
			bid_price_or_bid_control_price_money,
			bid_evaluation_officer,
			bid_evaluation_staff,
			project_id
		) VALUES (
			#{id},
			#{createBy.id},
			#{createDate},
			#{updateBy.id},
			#{updateDate},
			#{remarks},
			#{delFlag},
			#{demandDepartment},
			#{projectType},
			#{constructionSite},
			#{supervisionUnit},
			#{serviceClassification},
			#{fundAttribute},
			#{assetNature},
			#{tenderScope},
			#{onlineBidding},
			#{evaluationExpert},
			#{priceCeiling},
			#{bidPriceOrBidControlPrice},
			#{bidPriceOrBidControlPriceMoney},
			#{bidEvaluationOfficer},
			#{bidEvaluationStaff},
			#{projectId}
		)
	</insert>
	
	<update id="update">
		UPDATE project_general SET 	
			update_by = #{updateBy.id},
			update_date = #{updateDate},
			remarks = #{remarks},
			demand_department = #{demandDepartment},
			project_type = #{projectType},
			construction_site = #{constructionSite},
			supervision_unit = #{supervisionUnit},
			service_classification = #{serviceClassification},
			fund_attribute = #{fundAttribute},
			asset_nature = #{assetNature},
			tender_scope = #{tenderScope},
			online_bidding = #{onlineBidding},
			evaluation_expert = #{evaluationExpert},
			price_ceiling = #{priceCeiling},
			bid_price_or_bid_control_price = #{bidPriceOrBidControlPrice},
			bid_price_or_bid_control_price_money = #{bidPriceOrBidControlPriceMoney},
			bid_evaluation_officer = #{bidEvaluationOfficer},
			bid_evaluation_staff = #{bidEvaluationStaff},
			project_id = #{projectId}
		WHERE id = #{id}
	</update>
	
	
	<!--物理删除-->
	<update id="delete">
		DELETE FROM project_general
		WHERE id = #{id}
	</update>
	
	<!--逻辑删除-->
	<update id="deleteByLogic">
		UPDATE project_general SET 
			del_flag = #{DEL_FLAG_DELETE}
		WHERE id = #{id}
	</update>
	
	
	<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
	<select id="findUniqueByProperty" resultType="Projectgeneral" statementType="STATEMENT">
		select * FROM project_general  where ${propertyName} = '${value}'
	</select>
	
</mapper>