<?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="cn.com.ty.lift.ud.recruitmentInfos.mapper.RecruitmentDeliveryMapper">
	<resultMap id="BaseResultMap"
		type="cn.com.ty.lift.ud.recruitmentInfos.mapper.entity.RecruitmentDeliveryEntity">
		<id column="id" property="id" jdbcType="INTEGER" />
		<result column="data_id" property="dataId" jdbcType="INTEGER" />
		<result column="user_id" property="userId" jdbcType="INTEGER" />
		<result column="resume_id" property="resumeId"
			jdbcType="INTEGER" />
		<result column="create_by" property="createBy"
			jdbcType="VARCHAR" />
		<result column="create_time" property="createTime"
			jdbcType="TIMESTAMP" />
		<result column="update_by" property="updateBy"
			jdbcType="VARCHAR" />
		<result column="update_time" property="updateTime"
			jdbcType="TIMESTAMP" />
	</resultMap>

	<resultMap id="BaseDetail"
		type="cn.com.ty.lift.ud.recruitmentInfos.mapper.entity.RecruitmentDeliveryEntity">
		<id column="id" property="id" jdbcType="INTEGER" />
		<result column="data_id" property="dataId" jdbcType="INTEGER" />
		<result column="user_id" property="userId" jdbcType="INTEGER" />
		<result column="resume_id" property="resumeId"
			jdbcType="INTEGER" />
		<result column="create_by" property="createBy"
			jdbcType="VARCHAR" />
		<result column="create_time" property="createTime"
			jdbcType="TIMESTAMP" />
		<result column="update_by" property="updateBy"
			jdbcType="VARCHAR" />
		<result column="update_time" property="updateTime"
			jdbcType="TIMESTAMP" />
		<association property="recruitmentInfoEntity" select="getRecruitmentInfoEntityById"
			column="data_id"
			javaType="cn.com.ty.lift.ud.recruitmentInfos.mapper.entity.RecruitmentInfoEntity">
			<id column="id" property="id" jdbcType="INTEGER" />
		<result column="job" property="job" jdbcType="VARCHAR" />
		<result column="upper_salary" property="upperSalary"
			jdbcType="DECIMAL" />
		<result column="lower_salary" property="lowerSalary"
			jdbcType="DECIMAL" />
		<result column="upper_working" property="upperWorking"
			jdbcType="INTEGER" />
		<result column="lower_working" property="lowerWorking"
			jdbcType="INTEGER" />
		<result column="edu_level" property="eduLevel"
			jdbcType="INTEGER" />
		<result column="address" property="address" jdbcType="VARCHAR" />
		<result column="company_id" property="companyId"
			jdbcType="INTEGER" />
		<result column="info" property="info" jdbcType="VARCHAR" />
		<result column="favorite_num" property="favoriteNum"
			jdbcType="INTEGER" />
		<result column="like_num" property="likeNum" jdbcType="INTEGER" />
		<result column="browse_num" property="browseNum"
			jdbcType="INTEGER" />
		<result column="hot_flag" property="hotFlag" jdbcType="INTEGER" />
		<result column="check_flag" property="checkFlag"
			jdbcType="INTEGER" />
		<result column="sort" property="sort" jdbcType="INTEGER" />
		<result column="statuz" property="statuz" jdbcType="INTEGER" />
		<result column="create_by" property="createBy"
			jdbcType="VARCHAR" />
		<result column="create_time" property="createTime"
			jdbcType="TIMESTAMP" />
		<result column="update_by" property="updateBy"
			jdbcType="VARCHAR" />
		<result column="update_time" property="updateTime"
			jdbcType="TIMESTAMP" />
		</association>
		<association property="userResume" select="getUserResumeEntityById"
			column="resume_id"
			javaType="cn.com.ty.lift.ud.userresume.mapper.entity.UserResume">
			<id column="id" property="id" jdbcType="INTEGER" />
		<result column="user_id" property="userId" jdbcType="INTEGER" />
		<result column="name" property="name"
			jdbcType="VARCHAR" />
		<result column="gender" property="gender"
			jdbcType="INTEGER" />
		<result column="age" property="age"
			jdbcType="INTEGER" />
			<result column="edu_level" property="eduLevel"
			jdbcType="INTEGER" />
		<result column="working_time" property="workingTime"
			jdbcType="INTEGER" />
		<result column="telephone" property="telephone"
			jdbcType="VARCHAR" />
		<result column="residence" property="residence" jdbcType="VARCHAR" />
		<result column="salary" property="salary"
			jdbcType="DECIMAL" />
		<result column="ability" property="ability" jdbcType="VARCHAR" />
		<result column="intro" property="intro"
			jdbcType="VARCHAR" />
		<result column="create_by" property="createBy"
			jdbcType="VARCHAR" />
		<result column="create_time" property="createTime"
			jdbcType="TIMESTAMP" />
		<result column="update_by" property="updateBy"
			jdbcType="VARCHAR" />
		<result column="update_time" property="updateTime"
			jdbcType="TIMESTAMP" />
		</association>
	</resultMap>

	<select id="getRecruitmentInfoEntityById" parameterType="int"
		resultType="cn.com.ty.lift.ud.recruitmentInfos.mapper.entity.RecruitmentInfoEntity">
		select * from recruitment_info where id = #{id}
	</select>
	
	<select id="getUserResumeEntityById" parameterType="int"
		resultType="cn.com.ty.lift.ud.userresume.mapper.entity.UserResume">
		select * from user_resume where id = #{id}
	</select>
	
	<select id="finOneById" resultMap="BaseDetail">
		select
		*
		from recruitment_delivery where id = #{id}
	</select>

   <select id="selectByQuery" resultMap="BaseDetail" >
    select * from recruitment_delivery as a left join recruitment_info as b on a.data_id=b.id left join user_resume as c on a.resume_id=c.id
    <where>
        ${ew.sqlSegment}
    </where>
    limit #{page.pageIndex},#{page.pageSize}
  </select>
  <select id="countByQuery" resultType="java.lang.Integer">
    select count(0)  from recruitment_delivery as a left join recruitment_info as b on a.data_id=b.id left join user_resume as c on a.resume_id=c.id
    <where>
        ${ew.sqlSegment}
    </where>
  </select>
</mapper>