MeasureInfoMapper.xml 6.17 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
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
<?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.lyms.platform.permission.dao.master.MeasureInfoMapper">

<resultMap type="com.lyms.platform.pojo.MeasureInfoModel" id="measureInfoModelMap">
<result column="id" property="id"/>
<result column="user_name" property="userName"/>
<result column="cert_type" property="certType"/>
<result column="cert_no" property="certNo"/>
<result column="age" property="age"/>
<result column="phone" property="phone"/>
<result column="sex" property="sex"/>
<result column="vc_card_no" property="vcCardNo"/>
<result column="value_one" property="valueOne"/>
<result column="value_two" property="valueTwo"/>
<result column="value_type" property="valueType"/>
<result column="record_time" property="recordTime"/>
<result column="wx_code" property="wxCode"/>
<result column="record_count" property="recordCount"/>
<result column="open_id" property="openId"/>
<result column="hospital_id" property="hospitalId"/>
<result column="created" property="created"/>
<result column="modified" property="modified"/>
</resultMap>
<insert id="addMeasureInfo" parameterType="com.lyms.platform.pojo.MeasureInfoModel" >
INSERT INTO measure_info(user_name,cert_type,
cert_no,age,phone,sex,vc_card_no,
value_one,value_two,value_type,record_time,wx_code
,record_count,open_id,created,modified)
VALUES (#{userName},#{certType},
#{certNo},#{age},#{phone},#{sex}
,#{vcCardNo},#{valueOne}
,#{valueTwo},#{valueType},#{recordTime},
#{wxCode},#{recordCount},#{openId},#{created},#{modified})
</insert>

<select id="queryMeasureInfoList" parameterType="com.lyms.platform.query.MeasureInfoQuery" resultMap="measureInfoModelMap">
SELECT id,user_name,cert_type,
cert_no,age,phone,sex,vc_card_no,
value_one,value_two,value_type,record_time,wx_code
,record_count,open_id,created,modified
FROM measure_info

<include refid="queryMeasureInfoCondition"/>
<include refid="orderAndLimit"/>
</select>

<select id="queryMeasureInfoListCount" parameterType="com.lyms.platform.query.MeasureInfoQuery" resultType="int">
SELECT count(id) FROM measure_info
<include refid="queryMeasureInfoCondition"/>
</select>


<update id="updateMeasureInfo" parameterType="com.lyms.platform.pojo.MeasureInfoModel" >
UPDATE
measure_info
<set>
<if test="id != null and id >= 0">
id = #{id,jdbcType=INTEGER},
</if>
<if test="userName != null">
user_name = #{userName,jdbcType=VARCHAR},
</if>
<if test="certType != null and certType != ''">
cert_type = #{certType,jdbcType=VARCHAR},
</if>
<if test="certNo != null and certNo != ''">
cert_no = #{certNo,jdbcType=VARCHAR},
</if>
<if test="age != null and age >= 0">
age = #{age,jdbcType=INTEGER},
</if>
<if test="phone != null and phone != ''">
phone = #{phone,jdbcType=VARCHAR},
</if>
<if test="sex != null">
sex = #{sex,jdbcType=INTEGER},
</if>
<if test="vcCardNo != null and vcCardNo != ''">
vc_card_no = #{vcCardNo,jdbcType=VARCHAR},
</if>
<if test="valueOne != null and valueOne != ''">
value_one = #{valueOne,jdbcType=VARCHAR},
</if>
<if test="valueTwo != null and valueTwo != ''">
value_two = #{valueTwo,jdbcType=VARCHAR},
</if>
<if test="valueType != null and valueType > 0">
value_type = #{valueType,jdbcType=INTEGER},
</if>
<if test="recordTime != null">
record_time = #{recordTime},
</if>
<if test="wxCode != null and wxCode != ''">
wx_code = #{wxCode,jdbcType=VARCHAR},
</if>
<if test="recordCount != null and recordCount >= 0">
record_count = #{recordCount,jdbcType=INTEGER},
</if>
<if test="openId != null and openId != ''">
open_id = #{openId,jdbcType=VARCHAR},
</if>
<if test="created != null">
created = #{created},
</if>
<if test="modified != null">
modified = #{modified},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>


<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="queryMeasureInfoCondition">
<where>
1 = 1
<if test="id != null and id >= 0">
and id = #{id,jdbcType=INTEGER}
</if>
<if test="userName != null">
and user_name = #{userName,jdbcType=VARCHAR}
</if>
<if test="certType != null and certType != ''">
and cert_type = #{certType,jdbcType=VARCHAR}
</if>
<if test="certNo != null and certNo != ''">
and cert_no = #{certNo,jdbcType=VARCHAR}
</if>
<if test="age != null and age >= 0">
and age = #{age,jdbcType=INTEGER}
</if>
<if test="phone != null and phone != ''">
and phone = #{phone,jdbcType=VARCHAR}
</if>
<if test="sex != null">
and sex = #{sex,jdbcType=INTEGER}
</if>
<if test="vcCardNo != null and vcCardNo != ''">
and vc_card_no = #{vcCardNo,jdbcType=VARCHAR}
</if>
<if test="valueOne != null and valueOne != ''">
and value_one = #{valueOne,jdbcType=VARCHAR}
</if>
<if test="valueTwo != null and valueTwo != ''">
and value_two = #{valueTwo,jdbcType=VARCHAR}
</if>
<if test="valueType != null and valueType > 0">
and value_type = #{valueType,jdbcType=INTEGER}
</if>
<if test="recordTime != null">
AND date_format(record_time,'%Y-%m-%d') = #{recordTime}
</if>
<if test="wxCode != null and wxCode != ''">
and wx_code = #{wxCode,jdbcType=VARCHAR}
</if>
<if test="recordCount != null and recordCount >= 0">
and record_count = #{recordCount,jdbcType=INTEGER}
</if>
<if test="openId != null and openId != ''">
and open_id = #{openId,jdbcType=VARCHAR}
</if>

<if test="recordTimeStart != null">
AND record_time >= date_format(#{recordTimeStart},'%Y-%m-%d')
</if>
<if test="recordTimeEnd != null">
AND <![CDATA[ record_time <= date_format(#{recordTimeEnd},'%Y-%m-%d') ]]>
</if>

<if test="queryNo != null and queryNo != ''">
and (phone = #{queryNo,jdbcType=VARCHAR} or cert_no = #{queryNo,jdbcType=VARCHAR} or user_name = #{queryNo,jdbcType=VARCHAR})
</if>

</where>
</sql>
</mapper>