<?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.MedFactoryMapper">
<resultMap id="MedFactoryResultMap" type="com.lymsh.yimiao.main.data.model.MedFactory">
<result column="f_id" property="fId" jdbcType="VARCHAR" />
<result column="f_name" property="fName" jdbcType="VARCHAR" />
<result column="f_isValid" property="fIsValid" jdbcType="VARCHAR" />
</resultMap>
<select id="getMedFactory" resultMap="MedFactoryResultMap" parameterType="java.lang.String">
select f_id,f_name,f_isValid
FROM med_factory
WHERE f_id = #{f_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="MedFactoryCondition">
<where>
1 = 1
<if test="fId != null and fId != ''">
and f_id = #{fId,jdbcType=VARCHAR}
</if>
<if test="fName != null and fName != ''">
and f_name = #{fName,jdbcType=VARCHAR}
</if>
<if test="fIsValid != null and fIsValid != ''">
and f_isValid = #{fIsValid,jdbcType=VARCHAR}
</if>
</where>
</sql>
<select id="queryMedFactory" resultMap="MedFactoryResultMap" parameterType="com.lymsh.yimiao.main.data.model.MedFactoryQuery">
select f_id,f_name,f_isValid
from med_factory
<include refid="MedFactoryCondition" />
<include refid="orderAndLimit" />
</select>
<select id="queryMedFactoryCount" resultType="int" parameterType="com.lymsh.yimiao.main.data.model.MedFactoryQuery">
select count(1) from med_factory
<include refid="MedFactoryCondition" />
</select>
</mapper>