<?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.lymsh.yimiao.main.data.dao.MedKidsMapper">
<resultMap id="MedKidsResultMap" type="com.lymsh.yimiao.main.data.model.MedKids">
<result column="ki_id" property="id" jdbcType="VARCHAR" />
<result column="ki_name" property="name" jdbcType="VARCHAR" />
<result column="ki_sex" property="sex" jdbcType="VARCHAR" />
<result column="ki_birthday" property="birthday" jdbcType="VARCHAR" />
<result column="ki_guardianid" property="guardianId" jdbcType="VARCHAR" />
<result column="ki_currentOrganizationid" property="currentOrganizationId" jdbcType="VARCHAR" />
<result column="ki_barCode" property="barCode" jdbcType="VARCHAR" />
<result column="phone" property="phone" jdbcType="VARCHAR" />
<result column="ki_buildoper" property="buildOPer" jdbcType="VARCHAR" />
<result column="ki_buildtime" property="buildTime" jdbcType="VARCHAR" />
<result column="isdelete" property="isDelete" jdbcType="VARCHAR" />
</resultMap>
<select id="getMedKids" resultMap="MedKidsResultMap" parameterType="java.lang.String">
select ki_id,ki_name,ki_sex,ki_birthday,ki_guardianid,ki_currentOrganizationid,ki_barCode,phone,ki_buildoper, ki_buildtime,isdelete,fathername,mothername
from med_kids
WHERE ki_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="MedKidsCondition">
<where>
1 = 1
<if test="id != null and id != ''">
and ki_id = #{id,jdbcType=VARCHAR}
</if>
<if test="name != null and name != ''">
and ki_name = #{name,jdbcType=VARCHAR}
</if>
<if test="sex != null and sex != ''">
and ki_sex = #{sex,jdbcType=VARCHAR}
</if>
<if test="birthday != null and birthday != ''">
and ki_birthday = #{birthday,jdbcType=VARCHAR}
</if>
<if test="guardianId != null and guardianId != ''">
and ki_guardianid = #{guardianId,jdbcType=VARCHAR}
</if>
<if test="currentOrganizationId != null and currentOrganizationId != ''">
and ki_currentOrganizationid = #{currentOrganizationId,jdbcType=VARCHAR}
</if>
<if test="barCode != null and barCode != ''">
and ki_barCode = #{barCode,jdbcType=VARCHAR}
</if>
<if test="phone != null and barCode != ''">
and phone = #{phone,jdbcType=VARCHAR}
</if>
<if test="buildOPer != null and buildOPer != ''">
and ki_buildoper = #{buildOPer,jdbcType=VARCHAR}
</if>
<if test="buildTime != null and buildTime != ''">
and ki_buildtime = #{buildTime,jdbcType=VARCHAR}
</if>
<if test="isDelete != null and isDelete != ''">
and isdelete = #{isDelete,jdbcType=VARCHAR}
</if>
</where>
</sql>
<select id="queryMedKids" resultMap="MedKidsResultMap" parameterType="com.lymsh.yimiao.main.data.model.MedKidsQuery">
select ki_id,ki_name,ki_sex,ki_birthday,ki_guardianid,ki_currentOrganizationid,ki_barCode,phone,ki_buildoper, ki_buildtime,isdelete,fathername,mothername
from med_kids
<include refid="MedKidsCondition" />
<include refid="orderAndLimit" />
</select>
<select id="queryMedKidsCount" resultType="int" parameterType="com.lymsh.yimiao.main.data.model.MedKidsQuery">
select count(1) from med_kids
<include refid="MedKidsCondition" />
</select>
</mapper>