<?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.WmProjectMapper" >
	<resultMap id="BaseResultMap" type="com.qunzhixinxi.hnqz.admin.entity.WmProject" >
		<result column="id" property="id" jdbcType="INTEGER" />
		<result column="project_number" property="projectNumber" jdbcType="VARCHAR" />
		<result column="project_name" property="projectName" jdbcType="VARCHAR" />
		<result column="delegate" property="delegate" jdbcType="VARCHAR" />
		<result column="sign_time" property="signTime" jdbcType="TIMESTAMP" />
		<result column="remark" property="remark" 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" />
		<!-- 根据项目id查询静态证据子表数据 -->
		<collection property="evidenceList" ofType="com.qunzhixinxi.hnqz.admin.entity.WmProjectEvidence"
					select="com.qunzhixinxi.hnqz.admin.mapper.WmProjectEvidenceMapper.listByProjectId" column="id"></collection>
	</resultMap>

	<!-- 分页查询 -->
	<select id="listProjectPage" resultMap="BaseResultMap">
		SELECT
			*
		FROM
			wm_project
		<where>
			dept_id = #{deptId}
			<if test="projectName != null and projectName != ''">
				AND project_name LIKE CONCAT('%',#{projectName},'%')
			</if>
			<if test="delegate != null and delegate != ''">
				AND delegate LIKE CONCAT('%',#{delegate},'%')
			</if>
		</where>
		ORDER BY create_time DESC
	</select>

	<!-- 根据id查询 -->
	<select id="getProjectById" resultMap="BaseResultMap">
		SELECT * FROM wm_project WHERE id = #{id}
	</select>
</mapper>