<?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.RecruitmentInfoMapper">
	<resultMap id="BaseResultMap"
		type="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" />
	</resultMap>

	<resultMap id="BaseDetail"
		type="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 property="company" select="getCompnyById"
			column="company_id" javaType="cn.com.ty.lift.ud.maintenanceCompany.mapper.entity.MaintenanceCompanyEntity">
			<id property="id" column="id" />
			<result column="name" property="name" jdbcType="VARCHAR" />
			<result column="address" property="address" jdbcType="VARCHAR" />
			<result column="corporator" property="corporator" jdbcType="VARCHAR" />
			<result column="telephone" property="telephone" jdbcType="telephone" />
			<result column="mainbusiness" property="mainbusiness" jdbcType="VARCHAR" />
			<result column="type" property="type" jdbcType="INTRGER" />
			<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="getCompnyById" parameterType="long"
		resultType="cn.com.ty.lift.ud.maintenanceCompany.mapper.entity.MaintenanceCompanyEntity">
		select * from maintenance_company where id = #{id}
	</select>

	<select id="finOneById" resultMap="BaseDetail">
		select
		*
		from recruitment_info where id = #{id}
	</select>

   <select id="selectByQuery" resultMap="BaseDetail" >
    select *
    from recruitment_info as rinfo
    left join maintenance_company as c on rinfo.company_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_info as rinfo left join maintenance_company as c on rinfo.company_id=c.id
    <where>
        ${ew.sqlSegment}
    </where>
  </select>
</mapper>