<?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.qunzhixinxi.hnqz.admin.mapper.WmDaProjectMapper" >
	<resultMap id="BaseResultMap" type="com.qunzhixinxi.hnqz.admin.entity.WmDaProject" >
		<result column="id" property="id" jdbcType="INTEGER" />
		<result column="project_id" property="projectId" jdbcType="BIGINT" />
		<result column="project_name" property="projectName" jdbcType="VARCHAR" />
		<result column="partya" property="partya" jdbcType="VARCHAR" />
		<result column="partyb" property="partyb" jdbcType="VARCHAR" />
		<result column="sign_data" property="signData" jdbcType="TIMESTAMP" />
		<result column="expiration_date" property="expirationDate" jdbcType="TIMESTAMP" />
		<result column="project_status" property="projectStatus" jdbcType="INTEGER" />
		<result column="customer_care" property="customerCare" jdbcType="VARCHAR" />
		<result column="remark" property="remark" jdbcType="VARCHAR" />
		<result column="contract_file" property="contractFile" jdbcType="VARCHAR" />
		<result column="contract_name" property="contractName" jdbcType="VARCHAR" />
		<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
		<result column="create_user" property="createUser" jdbcType="INTEGER" />
		<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
		<result column="update_user" property="updateUser" jdbcType="INTEGER" />
		<result column="export1" property="export1" jdbcType="VARCHAR" />
		<result column="export2" property="export2" jdbcType="VARCHAR" />
		<result column="export3" property="export3" jdbcType="VARCHAR" />
	</resultMap>
	<sql id="Base_Column_List" >
     id,project_id, project_name, partya, partyb, sign_data, expiration_date, project_status,
    customer_care, remark, contract_file, contract_name, create_time, create_user, update_time,
    update_user, export1, export2, export3
  </sql>
	<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
		select
		<include refid="Base_Column_List" />
		from wm_da_project
		where id = #{id,jdbcType=INTEGER}
	</select>
	<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from wm_da_project
    where id = #{id,jdbcType=INTEGER}
  </delete>
	<insert id="insert" parameterType="com.qunzhixinxi.hnqz.admin.entity.WmDaProject" >
    insert into wm_da_project ( id,project_id, project_name,
      partya, partyb, sign_data,
      expiration_date, project_status, customer_care,
      remark, contract_file, contract_name,
      create_time, create_user, update_time,
      update_user, export1, export2,
      export3)
    values (  #{id,jdbcType=INTEGER},#{projectId,jdbcType=BIGINT}, #{projectName,jdbcType=VARCHAR},
      #{partya,jdbcType=VARCHAR}, #{partyb,jdbcType=VARCHAR}, #{signData,jdbcType=TIMESTAMP},
      #{expirationDate,jdbcType=TIMESTAMP}, #{projectStatus,jdbcType=INTEGER}, #{customerCare,jdbcType=VARCHAR},
      #{remark,jdbcType=VARCHAR}, #{contractFile,jdbcType=VARCHAR}, #{contractName,jdbcType=VARCHAR},
      #{createTime,jdbcType=TIMESTAMP}, #{createUser,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP},
      #{updateUser,jdbcType=INTEGER}, #{export1,jdbcType=VARCHAR}, #{export2,jdbcType=VARCHAR},
      #{export3,jdbcType=VARCHAR})
  </insert>
	<insert id="insertSelective" parameterType="com.qunzhixinxi.hnqz.admin.entity.WmDaProject" useGeneratedKeys="true" keyProperty="id">
		insert into wm_da_project
		<trim prefix="(" suffix=")" suffixOverrides="," >
			<if test="id != null">
				id,
			</if>
			<if test="projectId != null" >
				project_id,
			</if>
			<if test="projectName != null" >
				project_name,
			</if>
			<if test="partya != null" >
				partya,
			</if>
			<if test="partyb != null" >
				partyb,
			</if>
			<if test="signData != null" >
				sign_data,
			</if>
			<if test="expirationDate != null" >
				expiration_date,
			</if>
			<if test="projectStatus != null" >
				project_status,
			</if>
			<if test="customerCare != null" >
				customer_care,
			</if>
			<if test="remark != null" >
				remark,
			</if>
			<if test="contractFile != null" >
				contract_file,
			</if>
			<if test="contractName != null" >
				contract_name,
			</if>
			<if test="createTime != null" >
				create_time,
			</if>
			<if test="createUser != null" >
				create_user,
			</if>
			<if test="updateTime != null" >
				update_time,
			</if>
			<if test="updateUser != null" >
				update_user,
			</if>
			<if test="export1 != null" >
				export1,
			</if>
			<if test="export2 != null" >
				export2,
			</if>
			<if test="export3 != null" >
				export3,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides="," >
			<if test="id != null" >
				#{id,jdbcType=INTEGER},
			</if>
			<if test="projectId != null" >
				#{projectId,jdbcType=BIGINT},
			</if>
			<if test="projectName != null" >
				#{projectName,jdbcType=VARCHAR},
			</if>
			<if test="partya != null" >
				#{partya,jdbcType=VARCHAR},
			</if>
			<if test="partyb != null" >
				#{partyb,jdbcType=VARCHAR},
			</if>
			<if test="signData != null" >
				#{signData,jdbcType=TIMESTAMP},
			</if>
			<if test="expirationDate != null" >
				#{expirationDate,jdbcType=TIMESTAMP},
			</if>
			<if test="projectStatus != null" >
				#{projectStatus,jdbcType=INTEGER},
			</if>
			<if test="customerCare != null" >
				#{customerCare,jdbcType=VARCHAR},
			</if>
			<if test="remark != null" >
				#{remark,jdbcType=VARCHAR},
			</if>
			<if test="contractFile != null" >
				#{contractFile,jdbcType=VARCHAR},
			</if>
			<if test="contractName != null" >
				#{contractName,jdbcType=VARCHAR},
			</if>
			<if test="createTime != null" >
				#{createTime,jdbcType=TIMESTAMP},
			</if>
			<if test="createUser != null" >
				#{createUser,jdbcType=INTEGER},
			</if>
			<if test="updateTime != null" >
				#{updateTime,jdbcType=TIMESTAMP},
			</if>
			<if test="updateUser != null" >
				#{updateUser,jdbcType=INTEGER},
			</if>
			<if test="export1 != null" >
				#{export1,jdbcType=VARCHAR},
			</if>
			<if test="export2 != null" >
				#{export2,jdbcType=VARCHAR},
			</if>
			<if test="export3 != null" >
				#{export3,jdbcType=VARCHAR},
			</if>
		</trim>
	</insert>
	<update id="updateByPrimaryKeySelective" parameterType="com.qunzhixinxi.hnqz.admin.entity.WmDaProject"  >
		update wm_da_project
		<set >
			<if test="projectId != null" >
				project_id = #{projectId,jdbcType=BIGINT},
			</if>
			<if test="projectName != null" >
				project_name = #{projectName,jdbcType=VARCHAR},
			</if>
			<if test="partya != null" >
				partya = #{partya,jdbcType=VARCHAR},
			</if>
			<if test="partyb != null" >
				partyb = #{partyb,jdbcType=VARCHAR},
			</if>
			<if test="signData != null" >
				sign_data = #{signData,jdbcType=TIMESTAMP},
			</if>
			<if test="expirationDate != null" >
				expiration_date = #{expirationDate,jdbcType=TIMESTAMP},
			</if>
			<if test="projectStatus != null" >
				project_status = #{projectStatus,jdbcType=INTEGER},
			</if>
			<if test="customerCare != null" >
				customer_care = #{customerCare,jdbcType=VARCHAR},
			</if>
			<if test="remark != null" >
				remark = #{remark,jdbcType=VARCHAR},
			</if>
			<if test="contractFile != null" >
				contract_file = #{contractFile,jdbcType=VARCHAR},
			</if>
			<if test="contractName != null" >
				contract_name = #{contractName,jdbcType=VARCHAR},
			</if>
			<if test="createTime != null" >
				create_time = #{createTime,jdbcType=TIMESTAMP},
			</if>
			<if test="createUser != null" >
				create_user = #{createUser,jdbcType=INTEGER},
			</if>
			<if test="updateTime != null" >
				update_time = #{updateTime,jdbcType=TIMESTAMP},
			</if>
			<if test="updateUser != null" >
				update_user = #{updateUser,jdbcType=INTEGER},
			</if>
			<if test="export1 != null" >
				export1 = #{export1,jdbcType=VARCHAR},
			</if>
			<if test="export2 != null" >
				export2 = #{export2,jdbcType=VARCHAR},
			</if>
			<if test="export3 != null" >
				export3 = #{export3,jdbcType=VARCHAR},
			</if>
		</set>
		where id = #{id,jdbcType=INTEGER}
	</update>
	<update id="updateByPrimaryKey" parameterType="com.qunzhixinxi.hnqz.admin.entity.WmDaProject" >
    update wm_da_project
    set id = #{Id,jdbcType=INTEGER},project_id = #{projectId,jdbcType=BIGINT},
      project_name = #{projectName,jdbcType=VARCHAR},
      partya = #{partya,jdbcType=VARCHAR},
      partyb = #{partyb,jdbcType=VARCHAR},
      sign_data = #{signData,jdbcType=TIMESTAMP},
      expiration_date = #{expirationDate,jdbcType=TIMESTAMP},
      project_status = #{projectStatus,jdbcType=INTEGER},
      customer_care = #{customerCare,jdbcType=VARCHAR},
      remark = #{remark,jdbcType=VARCHAR},
      contract_file = #{contractFile,jdbcType=VARCHAR},
      contract_name = #{contractName,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      create_user = #{createUser,jdbcType=INTEGER},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      update_user = #{updateUser,jdbcType=INTEGER},
      export1 = #{export1,jdbcType=VARCHAR},
      export2 = #{export2,jdbcType=VARCHAR},
      export3 = #{export3,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>

	<select id="selectWmDaProjectList" resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List"/>
		from wm_da_project where 1=1
		<if test="query.id != null and query.id !=''">
			AND id like CONCAT('%',#{query.id},'%')
		</if>
		<if test="query.projectId != null">
			AND project_id like CONCAT('%',#{query.projectId},'%')
		</if>
		<if test="query.projectName != null and query.projectName !=''">
			AND project_name like CONCAT('%',#{query.projectName},'%')
		</if>
		<if test="query.partya != null and query.partya !=''">
			AND partya like CONCAT('%',#{query.partya},'%')
		</if>
		<if test="query.partyb != null and query.partyb!=''">
			AND partyb = #{query.partyb,jdbcType=VARCHAR}
		</if>
		<if test="query.projectStatus != null and query.projectStatus !=''">
			AND project_status = #{query.projectStatus,jdbcType=VARCHAR}
		</if>
		<if test="query.signData != null and query.signData!='' ">
			AND sign_data = #{query.signData,jdbcType=TIMESTAMP}
		</if>
		<if test="query.expirationDate != null and query.expirationDate !=''">
			AND expiration_date = #{query.expirationDate,jdbcType=TIMESTAMP}
		</if>
		<if test="query.customerCare != null and query.customerCare!='' ">
			AND customer_care like CONCAT('%',#{query.customerCare},'%')
		</if>
		<if test="query.remark != null and query.remark!='' ">
			AND remark = #{query.remark,jdbcType=VARCHAR}
		</if>
		<if test="query.contractFile != null and query.contractFile!='' ">
			AND contract_file = #{query.contractFile,jdbcType=VARCHAR}
		</if>
		<if test="query.contractName != null and query.contractName!='' ">
			AND contract_name = #{query.contractName,jdbcType=VARCHAR}
		</if>
		<if test="query.createUser != null">
			AND create_user = #{query.createUser,jdbcType=INTEGER}
		</if>
		<if test="query.createTime != null and query.createTime!=''">
			AND create_time = #{query.createTime,jdbcType=TIMESTAMP}
		</if>
		<if test="query.updateTime != null and query.updateTime!=''">
			AND update_time = #{query.updateTime,jdbcType=TIMESTAMP}
		</if>
		<if test="query.updateUser != null">
			AND update_user = #{query.updateUser,jdbcType=INTEGER}
		</if>
		<if test="query.export1 != null and query.export1!=''">
			AND export1 = #{query.export1,jdbcType=VARCHAR}
		</if>
		<if test="query.export2 != null and query.export2!=''">
			AND export2 = #{query.export2,jdbcType=VARCHAR}
		</if>
		<if test="query.export3 != null and query.export3!=''">
			AND export3 = #{query.export3,jdbcType=VARCHAR}
		</if>
	</select>

	<select id="selectWmDaProjectByParam" resultMap="BaseResultMap" parameterType="java.util.HashMap">
		select
		<include refid="Base_Column_List"/>
		from wm_da_project
		where 1=1
		<if test="id != null">
			AND id != #{id,jdbcType=INTEGER}
		</if>
		<if test="projectName != null and projectName != ''">
			and project_name = #{projectName,jdbcType=VARCHAR}
		</if>
		<if test="projectId != null and projectId != ''">
			and project_id = #{projectId,jdbcType=BIGINT}
		</if>
	</select>

</mapper>