<?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="fa_id" property="fId" jdbcType="VARCHAR" />
<result column="fa_name" property="fName" jdbcType="VARCHAR" />
<result column="fa_isValid" property="fIsValid" jdbcType="VARCHAR" />
<result column="fa_isDelete" property="isDelete" jdbcType="VARCHAR" />
</resultMap>
<select id="getMedFactory" resultMap="MedFactoryResultMap" parameterType="java.lang.String">
select fa_id,fa_name,fa_isValid,fa_isDelete
FROM med_factory
WHERE fa_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 fa_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 fa_isValid = #{fIsValid,jdbcType=VARCHAR}
</if>
<if test="isDelete != null and isDelete != ''">
and fa_isDelete = #{isDelete,jdbcType=VARCHAR}
</if>
</where>
</sql>
<select id="queryMedFactory" resultMap="MedFactoryResultMap" parameterType="com.lymsh.yimiao.main.data.model.MedFactoryQuery">
select fa_id,fa_name,fa_isValid,fa_isDelete
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>