<?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.lyms.platform.permission.dao.master.BabyPatientExtendEarFamilyMapper">
<resultMap id="BabyPatientExtendEarFamilyResultMap"
type="com.lyms.platform.permission.model.BabyPatientExtendEarFamily">
<id column="id" property="id" jdbcType="VARCHAR"/>
<result column="bad_life_history" property="badLifeHistory" jdbcType="VARCHAR"/>
<result column="deaf_type" property="deafType" jdbcType="INTEGER"/>
<result column="deat_relationship" property="deatRelationship" jdbcType="VARCHAR"/>
<result column="proximity_type" property="proximityType" jdbcType="INTEGER"/>
<result column="proximity_relationship" property="proximityRelationship" jdbcType="VARCHAR"/>
<result column="baby_patient_id" property="babyPatientId" jdbcType="VARCHAR"/>
<result column="baby_ear_id" property="babyEarId" jdbcType="VARCHAR"/>
</resultMap>
<insert id="addBabyPatientExtendEarFamily"
parameterType="com.lyms.platform.permission.model.BabyPatientExtendEarFamily">
insert into baby_patient_extend_ear_family (id,bad_life_history,deaf_type,deat_relationship,proximity_type,proximity_relationship,baby_patient_id,baby_ear_id) values (#{id},#{badLifeHistory},#{deafType},#{deatRelationship},#{proximityType},#{proximityRelationship},#{babyPatientId},#{babyEarId})
</insert>
<update id="updateBabyPatientExtendEarFamily"
parameterType="com.lyms.platform.permission.model.BabyPatientExtendEarFamily">
update baby_patient_extend_ear_family
<set>
<if test="badLifeHistory != null and badLifeHistory != ''">
bad_life_history = #{badLifeHistory,jdbcType=VARCHAR},
</if>
<if test="deafType != null and deafType >= 0">
deaf_type = #{deafType,jdbcType=INTEGER},
</if>
<if test="deatRelationship != null and deatRelationship != ''">
deat_relationship = #{deatRelationship,jdbcType=VARCHAR},
</if>
<if test="proximityType != null and proximityType >= 0">
proximity_type = #{proximityType,jdbcType=INTEGER},
</if>
<if test="proximityRelationship != null and proximityRelationship != ''">
proximity_relationship = #{proximityRelationship,jdbcType=VARCHAR},
</if>
<if test="babyPatientId != null and babyPatientId != ''">
baby_patient_id = #{babyPatientId,jdbcType=VARCHAR},
</if>
<if test="babyEarId != null and babyEarId != ''">
baby_ear_id = #{babyEarId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<delete id="deleteBabyPatientExtendEarFamily" parameterType="java.lang.String">
delete from baby_patient_extend_ear_family where id = #{id,jdbcType=VARCHAR}
</delete>
<select id="getBabyPatientExtendEarFamily" resultMap="BabyPatientExtendEarFamilyResultMap"
parameterType="java.lang.String">
select id,bad_life_history,deaf_type,deat_relationship,proximity_type,proximity_relationship,baby_patient_id,baby_ear_id
from baby_patient_extend_ear_family where id = #{id,jdbcType=VARCHAR}
</select>
<sql id="orderAndLimit">
<if test="sort != null and sort != '' ">
order by ${sort}
<if test="need != null">
limit #{offset, jdbcType=INTEGER} , #{limit, jdbcType=INTEGER}
</if>
</if>
</sql>
<sql id="BabyPatientExtendEarFamilyCondition">
<where>
1 = 1
<if test="id != null and id != ''">
and id = #{id,jdbcType=VARCHAR}
</if>
<if test="badLifeHistory != null and badLifeHistory != ''">
and bad_life_history = #{badLifeHistory,jdbcType=VARCHAR}
</if>
<if test="deafType != null and deafType >= 0">
and deaf_type = #{deafType,jdbcType=INTEGER}
</if>
<if test="deatRelationship != null and deatRelationship != ''">
and deat_relationship = #{deatRelationship,jdbcType=VARCHAR}
</if>
<if test="proximityType != null and proximityType >= 0">
and proximity_type = #{proximityType,jdbcType=INTEGER}
</if>
<if test="proximityRelationship != null and proximityRelationship != ''">
and proximity_relationship = #{proximityRelationship,jdbcType=VARCHAR}
</if>
<if test="babyPatientId != null and babyPatientId != ''">
and baby_patient_id = #{babyPatientId,jdbcType=VARCHAR}
</if>
<if test="babyEarId != null and babyEarId != ''">
and baby_ear_id = #{babyEarId,jdbcType=VARCHAR}
</if>
</where>
</sql>
<select id="queryBabyPatientExtendEarFamily" resultMap="BabyPatientExtendEarFamilyResultMap"
parameterType="com.lyms.platform.permission.model.BabyPatientExtendEarFamilyQuery">
select
id,bad_life_history,deaf_type,deat_relationship,proximity_type,proximity_relationship,baby_patient_id,baby_ear_id
from baby_patient_extend_ear_family
<include refid="BabyPatientExtendEarFamilyCondition"/>
<include refid="orderAndLimit"/>
</select>
<select id="queryBabyPatientExtendEarFamilyCount" resultType="int"
parameterType="com.lyms.platform.permission.model.BabyPatientExtendEarFamilyQuery">
select count(1) from baby_patient_extend_ear_family
<include refid="BabyPatientExtendEarFamilyCondition"/>
</select>
</mapper>