<?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.goafanti.common.dao.OrgHumanResourceMapper">
	<resultMap id="BaseResultMap" type="com.goafanti.common.model.OrgHumanResource">
		<id column="id" property="id" jdbcType="VARCHAR" />
		<result column="uid" property="uid" jdbcType="VARCHAR" />
		<result column="firm_total" property="firmTotal" jdbcType="INTEGER" />
		<result column="tech_total" property="techTotal" jdbcType="INTEGER" />
		<result column="firm_in_service" property="firmInService"
			jdbcType="INTEGER" />
		<result column="tech_in_service" property="techInService"
			jdbcType="INTEGER" />
		<result column="firm_part_time" property="firmPartTime"
			jdbcType="INTEGER" />
		<result column="tech_part_time" property="techPartTime"
			jdbcType="INTEGER" />
		<result column="firm_temporary" property="firmTemporary"
			jdbcType="INTEGER" />
		<result column="tech_temporary" property="techTemporary"
			jdbcType="INTEGER" />
		<result column="firm_foreign" property="firmForeign" jdbcType="INTEGER" />
		<result column="tech_foreign" property="techForeign" jdbcType="INTEGER" />
		<result column="firm_abroad" property="firmAbroad" jdbcType="INTEGER" />
		<result column="tech_abroad" property="techAbroad" jdbcType="INTEGER" />
		<result column="firm_core" property="firmCore" jdbcType="INTEGER" />
		<result column="tech_core" property="techCore" jdbcType="INTEGER" />
		<result column="doctor" property="doctor" jdbcType="INTEGER" />
		<result column="master" property="master" jdbcType="INTEGER" />
		<result column="undergraduate" property="undergraduate"
			jdbcType="INTEGER" />
		<result column="college" property="college" jdbcType="INTEGER" />
		<result column="senior_title" property="seniorTitle" jdbcType="INTEGER" />
		<result column="intermediate_title" property="intermediateTitle"
			jdbcType="INTEGER" />
		<result column="junior_title" property="juniorTitle" jdbcType="INTEGER" />
		<result column="senior_mechanic" property="seniorMechanic"
			jdbcType="INTEGER" />
		<result column="below_thirty" property="belowThirty" jdbcType="INTEGER" />
		<result column="thirtyone_to_thirtyfour" property="thirtyoneToThirtyfour"
			jdbcType="INTEGER" />
		<result column="fortyone_to_fifty" property="fortyoneToFifty"
			jdbcType="INTEGER" />
		<result column="above_fifty" property="aboveFifty" jdbcType="INTEGER" />
		<result column="year" property="year" jdbcType="INTEGER" />
		<result column="new_employment" property="newEmployment"
			jdbcType="INTEGER" />
		<result column="graduate_number" property="graduateNumber"
			jdbcType="INTEGER" />
		<result column="roster_url" property="rosterUrl" jdbcType="VARCHAR" />
		<result column="social_security_url" property="socialSecurityUrl"
			jdbcType="VARCHAR" />
		<result column="deleted_sign" property="deletedSign" jdbcType="INTEGER" />
	</resultMap>
	<sql id="Base_Column_List">
		id, uid, firm_total, tech_total, firm_in_service, tech_in_service,
		firm_part_time,
		tech_part_time, firm_temporary, tech_temporary, firm_foreign, tech_foreign,
		firm_abroad,
		tech_abroad, firm_core, tech_core, doctor, master, undergraduate, college,
		senior_title, intermediate_title, junior_title, senior_mechanic,
		below_thirty,
		thirtyone_to_thirtyfour, fortyone_to_fifty, above_fifty, year, new_employment,
		graduate_number,
		roster_url, social_security_url, deleted_sign
	</sql>
	<select id="selectByPrimaryKey" resultMap="BaseResultMap"
		parameterType="java.lang.String">
		select
		<include refid="Base_Column_List" />
		from org_human_resource
		where id = #{id,jdbcType=VARCHAR}
	</select>
	<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
		delete from org_human_resource
		where id = #{id,jdbcType=VARCHAR}
	</delete>
	<insert id="insert" parameterType="com.goafanti.common.model.OrgHumanResource">
		insert into org_human_resource (id, uid, firm_total,
		tech_total, firm_in_service, tech_in_service,
		firm_part_time, tech_part_time, firm_temporary,
		tech_temporary, firm_foreign, tech_foreign,
		firm_abroad, tech_abroad, firm_core,
		tech_core, doctor, master,
		undergraduate, college, senior_title,
		intermediate_title, junior_title, senior_mechanic,
		below_thirty, thirtyone_to_thirtyfour, fortyone_to_fifty,
		above_fifty, year, new_employment, graduate_number, roster_url,
		social_security_url, deleted_sign)
		values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR},
		#{firmTotal,jdbcType=INTEGER},
		#{techTotal,jdbcType=INTEGER}, #{firmInService,jdbcType=INTEGER}, #{techInService,jdbcType=INTEGER},
		#{firmPartTime,jdbcType=INTEGER}, #{techPartTime,jdbcType=INTEGER},
		#{firmTemporary,jdbcType=INTEGER},
		#{techTemporary,jdbcType=INTEGER}, #{firmForeign,jdbcType=INTEGER}, #{techForeign,jdbcType=INTEGER},
		#{firmAbroad,jdbcType=INTEGER}, #{techAbroad,jdbcType=INTEGER},
		#{firmCore,jdbcType=INTEGER},
		#{techCore,jdbcType=INTEGER}, #{doctor,jdbcType=INTEGER}, #{master,jdbcType=INTEGER},
		#{undergraduate,jdbcType=INTEGER}, #{college,jdbcType=INTEGER},
		#{seniorTitle,jdbcType=INTEGER},
		#{intermediateTitle,jdbcType=INTEGER},
		#{juniorTitle,jdbcType=INTEGER}, #{seniorMechanic,jdbcType=INTEGER},
		#{belowThirty,jdbcType=INTEGER},
		#{thirtyoneToThirtyfour,jdbcType=INTEGER},
		#{fortyoneToFifty,jdbcType=INTEGER},
		#{aboveFifty,jdbcType=INTEGER}, #{year,jdbcType=INTEGER}, #{newEmployment,jdbcType=INTEGER},
		#{graduateNumber,jdbcType=INTEGER},
		#{rosterUrl,jdbcType=VARCHAR}, #{socialSecurityUrl,jdbcType=VARCHAR},
		#{deletedSign,jdbcType=INTEGER})
	</insert>
	<insert id="insertSelective" parameterType="com.goafanti.common.model.OrgHumanResource">
		insert into org_human_resource
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="id != null">
				id,
			</if>
			<if test="uid != null">
				uid,
			</if>
			<if test="firmTotal != null">
				firm_total,
			</if>
			<if test="techTotal != null">
				tech_total,
			</if>
			<if test="firmInService != null">
				firm_in_service,
			</if>
			<if test="techInService != null">
				tech_in_service,
			</if>
			<if test="firmPartTime != null">
				firm_part_time,
			</if>
			<if test="techPartTime != null">
				tech_part_time,
			</if>
			<if test="firmTemporary != null">
				firm_temporary,
			</if>
			<if test="techTemporary != null">
				tech_temporary,
			</if>
			<if test="firmForeign != null">
				firm_foreign,
			</if>
			<if test="techForeign != null">
				tech_foreign,
			</if>
			<if test="firmAbroad != null">
				firm_abroad,
			</if>
			<if test="techAbroad != null">
				tech_abroad,
			</if>
			<if test="firmCore != null">
				firm_core,
			</if>
			<if test="techCore != null">
				tech_core,
			</if>
			<if test="doctor != null">
				doctor,
			</if>
			<if test="master != null">
				master,
			</if>
			<if test="undergraduate != null">
				undergraduate,
			</if>
			<if test="college != null">
				college,
			</if>
			<if test="seniorTitle != null">
				senior_title,
			</if>
			<if test="intermediateTitle != null">
				intermediate_title,
			</if>
			<if test="juniorTitle != null">
				junior_title,
			</if>
			<if test="seniorMechanic != null">
				senior_mechanic,
			</if>
			<if test="belowThirty != null">
				below_thirty,
			</if>
			<if test="thirtyoneToThirtyfour != null">
				thirtyone_to_thirtyfour,
			</if>
			<if test="fortyoneToFifty != null">
				fortyone_to_fifty,
			</if>
			<if test="aboveFifty != null">
				above_fifty,
			</if>
			<if test="year != null">
				year,
			</if>
			<if test="newEmployment != null">
				new_employment,
			</if>
			<if test="graduateNumber != null">
				graduate_number,
			</if>
			<if test="rosterUrl != null">
				roster_url,
			</if>
			<if test="socialSecurityUrl != null">
				social_security_url,
			</if>
			<if test="deletedSign != null">
				deleted_sign,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="id != null">
				#{id,jdbcType=VARCHAR},
			</if>
			<if test="uid != null">
				#{uid,jdbcType=VARCHAR},
			</if>
			<if test="firmTotal != null">
				#{firmTotal,jdbcType=INTEGER},
			</if>
			<if test="techTotal != null">
				#{techTotal,jdbcType=INTEGER},
			</if>
			<if test="firmInService != null">
				#{firmInService,jdbcType=INTEGER},
			</if>
			<if test="techInService != null">
				#{techInService,jdbcType=INTEGER},
			</if>
			<if test="firmPartTime != null">
				#{firmPartTime,jdbcType=INTEGER},
			</if>
			<if test="techPartTime != null">
				#{techPartTime,jdbcType=INTEGER},
			</if>
			<if test="firmTemporary != null">
				#{firmTemporary,jdbcType=INTEGER},
			</if>
			<if test="techTemporary != null">
				#{techTemporary,jdbcType=INTEGER},
			</if>
			<if test="firmForeign != null">
				#{firmForeign,jdbcType=INTEGER},
			</if>
			<if test="techForeign != null">
				#{techForeign,jdbcType=INTEGER},
			</if>
			<if test="firmAbroad != null">
				#{firmAbroad,jdbcType=INTEGER},
			</if>
			<if test="techAbroad != null">
				#{techAbroad,jdbcType=INTEGER},
			</if>
			<if test="firmCore != null">
				#{firmCore,jdbcType=INTEGER},
			</if>
			<if test="techCore != null">
				#{techCore,jdbcType=INTEGER},
			</if>
			<if test="doctor != null">
				#{doctor,jdbcType=INTEGER},
			</if>
			<if test="master != null">
				#{master,jdbcType=INTEGER},
			</if>
			<if test="undergraduate != null">
				#{undergraduate,jdbcType=INTEGER},
			</if>
			<if test="college != null">
				#{college,jdbcType=INTEGER},
			</if>
			<if test="seniorTitle != null">
				#{seniorTitle,jdbcType=INTEGER},
			</if>
			<if test="intermediateTitle != null">
				#{intermediateTitle,jdbcType=INTEGER},
			</if>
			<if test="juniorTitle != null">
				#{juniorTitle,jdbcType=INTEGER},
			</if>
			<if test="seniorMechanic != null">
				#{seniorMechanic,jdbcType=INTEGER},
			</if>
			<if test="belowThirty != null">
				#{belowThirty,jdbcType=INTEGER},
			</if>
			<if test="thirtyoneToThirtyfour != null">
				#{thirtyoneToThirtyfour,jdbcType=INTEGER},
			</if>
			<if test="fortyoneToFifty != null">
				#{fortyoneToFifty,jdbcType=INTEGER},
			</if>
			<if test="aboveFifty != null">
				#{aboveFifty,jdbcType=INTEGER},
			</if>
			<if test="year != null">
				#{year,jdbcType=INTEGER},
			</if>
			<if test="newEmployment != null">
				#{newEmployment,jdbcType=INTEGER},
			</if>
			<if test="graduateNumber != null">
				#{graduateNumber,jdbcType=INTEGER},
			</if>
			<if test="rosterUrl != null">
				#{rosterUrl,jdbcType=VARCHAR},
			</if>
			<if test="socialSecurityUrl != null">
				#{socialSecurityUrl,jdbcType=VARCHAR},
			</if>
			<if test="deletedSign != null">
				#{deleted_sign,jdbcType=INTEGER},
			</if>
		</trim>
	</insert>
	<update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.OrgHumanResource">
		update org_human_resource
		<set>
			<if test="uid != null">
				uid = #{uid,jdbcType=VARCHAR},
			</if>
			<if test="firmTotal != null">
				firm_total = #{firmTotal,jdbcType=INTEGER},
			</if>
			<if test="techTotal != null">
				tech_total = #{techTotal,jdbcType=INTEGER},
			</if>
			<if test="firmInService != null">
				firm_in_service = #{firmInService,jdbcType=INTEGER},
			</if>
			<if test="techInService != null">
				tech_in_service = #{techInService,jdbcType=INTEGER},
			</if>
			<if test="firmPartTime != null">
				firm_part_time = #{firmPartTime,jdbcType=INTEGER},
			</if>
			<if test="techPartTime != null">
				tech_part_time = #{techPartTime,jdbcType=INTEGER},
			</if>
			<if test="firmTemporary != null">
				firm_temporary = #{firmTemporary,jdbcType=INTEGER},
			</if>
			<if test="techTemporary != null">
				tech_temporary = #{techTemporary,jdbcType=INTEGER},
			</if>
			<if test="firmForeign != null">
				firm_foreign = #{firmForeign,jdbcType=INTEGER},
			</if>
			<if test="techForeign != null">
				tech_foreign = #{techForeign,jdbcType=INTEGER},
			</if>
			<if test="firmAbroad != null">
				firm_abroad = #{firmAbroad,jdbcType=INTEGER},
			</if>
			<if test="techAbroad != null">
				tech_abroad = #{techAbroad,jdbcType=INTEGER},
			</if>
			<if test="firmCore != null">
				firm_core = #{firmCore,jdbcType=INTEGER},
			</if>
			<if test="techCore != null">
				tech_core = #{techCore,jdbcType=INTEGER},
			</if>
			<if test="doctor != null">
				doctor = #{doctor,jdbcType=INTEGER},
			</if>
			<if test="master != null">
				master = #{master,jdbcType=INTEGER},
			</if>
			<if test="undergraduate != null">
				undergraduate = #{undergraduate,jdbcType=INTEGER},
			</if>
			<if test="college != null">
				college = #{college,jdbcType=INTEGER},
			</if>
			<if test="seniorTitle != null">
				senior_title = #{seniorTitle,jdbcType=INTEGER},
			</if>
			<if test="intermediateTitle != null">
				intermediate_title = #{intermediateTitle,jdbcType=INTEGER},
			</if>
			<if test="juniorTitle != null">
				junior_title = #{juniorTitle,jdbcType=INTEGER},
			</if>
			<if test="seniorMechanic != null">
				senior_mechanic = #{seniorMechanic,jdbcType=INTEGER},
			</if>
			<if test="belowThirty != null">
				below_thirty = #{belowThirty,jdbcType=INTEGER},
			</if>
			<if test="thirtyoneToThirtyfour != null">
				thirtyone_to_thirtyfour = #{thirtyoneToThirtyfour,jdbcType=INTEGER},
			</if>
			<if test="fortyoneToFifty != null">
				fortyone_to_fifty = #{fortyoneToFifty,jdbcType=INTEGER},
			</if>
			<if test="aboveFifty != null">
				above_fifty = #{aboveFifty,jdbcType=INTEGER},
			</if>
			<if test="year != null">
				year = #{year,jdbcType=INTEGER},
			</if>
			<if test="newEmployment != null">
				new_employment = #{newEmployment,jdbcType=INTEGER},
			</if>
			<if test="graduateNumber != null">
				graduate_number = #{graduateNumber,jdbcType=INTEGER},
			</if>
			<if test="rosterUrl != null">
				roster_url = #{rosterUrl,jdbcType=VARCHAR},
			</if>
			<if test="socialSecurityUrl != null">
				social_security_url = #{socialSecurityUrl,jdbcType=VARCHAR},
			</if>
			<if test="deletedSign != null">
				deleted_sign = #{deletedSign,jdbcType=INTEGER},
			</if>
		</set>
		where id = #{id,jdbcType=VARCHAR}
	</update>
	<update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.OrgHumanResource">
		update org_human_resource
		set uid = #{uid,jdbcType=VARCHAR},
		firm_total = #{firmTotal,jdbcType=INTEGER},
		tech_total = #{techTotal,jdbcType=INTEGER},
		firm_in_service = #{firmInService,jdbcType=INTEGER},
		tech_in_service = #{techInService,jdbcType=INTEGER},
		firm_part_time = #{firmPartTime,jdbcType=INTEGER},
		tech_part_time = #{techPartTime,jdbcType=INTEGER},
		firm_temporary = #{firmTemporary,jdbcType=INTEGER},
		tech_temporary = #{techTemporary,jdbcType=INTEGER},
		firm_foreign = #{firmForeign,jdbcType=INTEGER},
		tech_foreign = #{techForeign,jdbcType=INTEGER},
		firm_abroad = #{firmAbroad,jdbcType=INTEGER},
		tech_abroad = #{techAbroad,jdbcType=INTEGER},
		firm_core = #{firmCore,jdbcType=INTEGER},
		tech_core = #{techCore,jdbcType=INTEGER},
		doctor = #{doctor,jdbcType=INTEGER},
		master = #{master,jdbcType=INTEGER},
		undergraduate = #{undergraduate,jdbcType=INTEGER},
		college = #{college,jdbcType=INTEGER},
		senior_title = #{seniorTitle,jdbcType=INTEGER},
		intermediate_title = #{intermediateTitle,jdbcType=INTEGER},
		junior_title = #{juniorTitle,jdbcType=INTEGER},
		senior_mechanic = #{seniorMechanic,jdbcType=INTEGER},
		below_thirty = #{belowThirty,jdbcType=INTEGER},
		thirtyone_to_thirtyfour = #{thirtyoneToThirtyfour,jdbcType=INTEGER},
		fortyone_to_fifty = #{fortyoneToFifty,jdbcType=INTEGER},
		above_fifty = #{aboveFifty,jdbcType=INTEGER},
		year = #{year,jdbcType=INTEGER},
		new_employment = #{newEmployment,jdbcType=INTEGER},
		graduate_number = #{graduateNumber,jdbcType=INTEGER},
		roster_url = #{rosterUrl,jdbcType=VARCHAR},
		social_security_url = #{socialSecurityUrl,jdbcType=VARCHAR},
		deleted_sign = #{deletedSign,jdbcType=INTEGER}
		where id = #{id,jdbcType=VARCHAR}
	</update>

	<select id="findOrgHumanResourceListByPage" parameterType="java.lang.String"
		resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		from org_human_resource
		where deleted_sign = 0
		<if test="uid != null">
			and uid = #{uid,jdbcType=VARCHAR}
		</if>
		<if test="year != null">
			and year = #{year,jdbcType=INTEGER}
		</if>
		order by year desc
		<if test="page_sql != null">
			${page_sql}
		</if>

	</select>

	<select id="findOrgHumanResourceCount" resultType="java.lang.Integer"
		parameterType="String">
		select count(1) from
		org_human_resource
		where deleted_sign = 0
		<if test="uid != null">
			and uid = #{uid,jdbcType=VARCHAR}
		</if>
		<if test="year != null">
			and year = #{year,jdbcType=INTEGER}
		</if>

	</select>

	<update id="batchDeleteByPrimaryKey" parameterType="java.util.List">
		update org_human_resource set deleted_sign = 1
		where id in
		<foreach item="item" collection="list" open="(" separator=","
			close=")">
			#{item}
		</foreach>
	</update>

	<select id="selectOrgHumanResourceByUidAndYear" resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		from org_human_resource
		where 
			year = #{0} 
		and uid = #{1} 
		and deleted_sign = 0
	</select>
</mapper>