MedVaccinename.xml 3.97 KB
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
<?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.MedVaccineNameMapper">

<resultMap id="MedVaccineNameResultMap" type="com.lymsh.yimiao.main.data.model.MedVaccineName">
<result column="vn_id" property="vnId" jdbcType="VARCHAR" />
<result column="vn_name" property="vnName" jdbcType="VARCHAR" />
<result column="vn_preventDisease" property="vnPreventDisease" jdbcType="VARCHAR" />
<result column="vn_monthAge" property="vnMonthAge" jdbcType="VARCHAR" />
<result column="vn_position" property="vnPosition" jdbcType="VARCHAR" />
<result column="vn_taboo" property="vnTaboo" jdbcType="VARCHAR" />
<result column="vn_description" property="vnDescription" jdbcType="VARCHAR" />
<result column="vn_isValid" property="vnIsValid" jdbcType="VARCHAR" />
<result column="vn_vaccineType" property="vnVaccineType" jdbcType="INTEGER" />
<result column="isDelete" property="isDelete" jdbcType="INTEGER" />
<result column="MONTH_AGE" property="mouthAge" jdbcType="INTEGER" />
</resultMap>



<select id="getMedVaccineName" resultMap="MedVaccineNameResultMap" parameterType="java.lang.String">
select vn_id,vn_name,vn_preventDisease,vn_monthAge,vn_position,vn_taboo,vn_description,vn_isValid,vn_vaccineType,isDelete
from med_vaccinename
WHERE vn_id = #{vnId,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="MedVaccineNameCondition">
<where>
1 = 1 and VN_ISINPLAN = 1
<if test="vnId != null and vnId != ''">
and vn_id = #{vnId,jdbcType=VARCHAR}
</if>
<if test="vnName != null and vnName != ''">
and vn_name = #{vnName,jdbcType=VARCHAR}
</if>
<if test="vnPreventDisease != null and vnPreventDisease != ''">
and vn_preventDisease = #{vnPreventDisease,jdbcType=VARCHAR}
</if>
<if test="vnMonthAge != null and vnMonthAge != ''">
and (vn_monthAge = #{vnMonthAge,jdbcType=VARCHAR}
OR vn_monthAge like CONCAT(#{vnMonthAge,jdbcType=VARCHAR}, ',%')
OR vn_monthAge LIKE CONCAT('%,',#{vnMonthAge,jdbcType=VARCHAR})
OR vn_monthAge LIKE '%,'||#{vnMonthAge,jdbcType=VARCHAR}||',%'
)
</if>
<if test="vnPosition != null and vnPosition != ''">
and vn_position = #{vnPosition,jdbcType=VARCHAR}
</if>
<if test="vnTaboo != null and vnTaboo != ''">
and vn_taboo = #{vnTaboo,jdbcType=VARCHAR}
</if>
<if test="vnDescription != null and vnDescription != ''">
and vn_description = #{vnDescription,jdbcType=VARCHAR}
</if>
<if test="vnIsValid != null and vnIsValid != ''">
and vn_isValid = #{vnIsValid,jdbcType=VARCHAR}
</if>
<if test="vnVaccineType != null and vnVaccineType != ''">
and vn_vaccineType = #{vnVaccineType,jdbcType=INTEGER}
</if>
<if test="isDelete != null and isDelete != ''">
and isDelete = #{isDelete,jdbcType=INTEGER}
</if>
<if test="mouthAge != null and mouthAge != ''">
and MONTH_AGE = #{mouthAge,jdbcType=INTEGER}
</if>
</where>
</sql>



<select id="queryMedVaccineName" resultMap="MedVaccineNameResultMap" parameterType="com.lymsh.yimiao.main.data.model.MedVaccineNameQuery">
select vn_id,vn_name,vn_preventDisease,vn_monthAge,vn_position,vn_taboo,vn_description,vn_isValid,isDelete,vn_vaccineType
from med_vaccinename
<include refid="MedVaccineNameCondition" />
<include refid="orderAndLimit" />
</select>



<select id="queryMedVaccineNameCount" resultType="int" parameterType="com.lymsh.yimiao.main.data.model.MedVaccineNameQuery">
select count(1) from med_vaccinename
<include refid="MedVaccineNameCondition" />
</select>


<select id="queryVaccineNameList" resultMap="MedVaccineNameResultMap" >
SELECT VN_ID, VN_NAME, b.column_value AS MONTH_AGE,VN_VACCINETYPE,VN_MONTHAGE
FROM med_VaccineName , table(splitstr(VN_MONTHAGE, &apos;,&apos;)) b
WHERE VN_MONTHAGE IS NOT NULL
AND ISDELETE = 1
AND VN_ISINPLAN = 1
ORDER BY MONTH_AGE,VN_VACCINETYPE
</select>

</mapper>