<?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.MedGuardianMapper">
<resultMap id="MedGuardianResultMap" type="com.lymsh.yimiao.main.data.model.MedGuardian">
<result column="g_id" property="id" jdbcType="VARCHAR" />
<result column="g_name" property="name" jdbcType="VARCHAR" />
<result column="g_relationid" property="relationId" jdbcType="VARCHAR" />
<result column="g_linkway" property="linkWay" jdbcType="VARCHAR" />
</resultMap>
<select id="getMedGuardian" resultMap="MedGuardianResultMap" parameterType="java.lang.String">
select g_id,g_name,g_relationid,g_linkway
FROM med_guardian
WHERE g_id = g_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="MedGuardianCondition">
<where>
1 = 1
<if test="id != null and id != ''">
and g_id = #{id,jdbcType=VARCHAR}
</if>
<if test="name != null and name != ''">
and g_name = #{name,jdbcType=VARCHAR}
</if>
<if test="relationId != null and relationId != ''">
and g_relationid = #{relationId,jdbcType=VARCHAR}
</if>
<if test="linkWay != null and linkWay != ''">
and g_linkway = #{linkWay,jdbcType=VARCHAR}
</if>
</where>
</sql>
<select id="queryMedGuardian" resultMap="MedGuardianResultMap" parameterType="com.lymsh.yimiao.main.data.model.MedGuardianQuery">
select g_id,g_name,g_relationid,g_linkway
from med_guardian
<include refid="MedGuardianCondition" />
<include refid="orderAndLimit" />
</select>
<select id="queryMedGuardianCount" resultType="int" parameterType="com.lymsh.yimiao.main.data.model.MedGuardianQuery">
select count(1) from med_guardian
<include refid="MedGuardianCondition" />
</select>
</mapper>