ChildrenPerson.xml 10.9 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
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
<?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.ChildrenPersonMapper">

<resultMap id="ChildrenPersonResultMap" type="com.lyms.platform.permission.model.ChildrenPerson">
<result column="ID" property="id" jdbcType="VARCHAR"/>
<result column="MOTHER_ID" property="motherId" jdbcType="VARCHAR"/>
<result column="NAME" property="name" jdbcType="VARCHAR"/>
<result column="GENDER" property="gender" jdbcType="INTEGER"/>
<result column="PAPERS_NUM" property="papersNum" jdbcType="VARCHAR"/>
<result column="BIRTHDAY" property="birthday" jdbcType="TIMESTAMP"/>
<result column="ADDRESS_PROVINCE" property="addressProvince" jdbcType="VARCHAR"/>
<result column="ADDRESS_CITY" property="addressCity" jdbcType="VARCHAR"/>
<result column="ADDRESS_AREA" property="addressArea" jdbcType="VARCHAR"/>
<result column="ADDRESS_STREET" property="addressStreet" jdbcType="VARCHAR"/>
<result column="ADDRESS_DETAIL" property="addressDetail" jdbcType="VARCHAR"/>
<result column="CREATE_TIME" property="createTime" jdbcType="TIMESTAMP"/>
<result column="DOCTOR_ID" property="doctorId" jdbcType="INTEGER"/>
<result column="IF_DEL" property="ifDel" jdbcType="INTEGER"/>
<result column="BASE_WOMAN_NAME" property="baseWomanName" jdbcType="VARCHAR"/>
<result column="BASE_PAPERS_TYPE" property="basePapersType" jdbcType="INTEGER"/>
<result column="BASE_PAPERS_NUMBER" property="basePapersNumber" jdbcType="VARCHAR"/>
<result column="BASE_WOMAN_BIRTH" property="baseWomanBirth" jdbcType="TIMESTAMP"/>
<result column="CONTACT_WOMAN_WAY" property="contactWomanWay" jdbcType="VARCHAR"/>
<result column="DEGREE" property="degree" jdbcType="INTEGER"/>
<result column="OCCUPATION" property="occupation" jdbcType="INTEGER"/>
</resultMap>


<insert id="addChildrenPerson" parameterType="com.lyms.platform.permission.model.ChildrenPerson">
insert into CHILDREN_PERSON (ID,MOTHER_ID,NAME,GENDER,PAPERS_NUM,BIRTHDAY,ADDRESS_PROVINCE,ADDRESS_CITY,ADDRESS_AREA,ADDRESS_STREET,ADDRESS_DETAIL,CREATE_TIME,DOCTOR_ID,IF_DEL,BASE_WOMAN_NAME,BASE_PAPERS_TYPE,BASE_PAPERS_NUMBER,BASE_WOMAN_BIRTH,CONTACT_WOMAN_WAY,DEGREE,OCCUPATION) values (#{id},#{motherId},#{name},#{gender},#{papersNum},#{birthday},#{addressProvince},#{addressCity},#{addressArea},#{addressStreet},#{addressDetail},#{createTime},#{doctorId},#{ifDel},#{baseWomanName},#{basePapersType},#{basePapersNumber},#{baseWomanBirth},#{contactWomanWay},#{degree},#{occupation})
</insert>


<update id="updateChildrenPerson" parameterType="com.lyms.platform.permission.model.ChildrenPerson">
update CHILDREN_PERSON
<set>
<if test="id != null and id != ''">
ID = #{id,jdbcType=VARCHAR},
</if>
<if test="motherId != null and motherId != ''">
MOTHER_ID = #{motherId,jdbcType=VARCHAR},
</if>
<if test="name != null and name != ''">
NAME = #{name,jdbcType=VARCHAR},
</if>
<if test="gender != null and gender >= 0">
GENDER = #{gender,jdbcType=INTEGER},
</if>
<if test="papersNum != null and papersNum != ''">
PAPERS_NUM = #{papersNum,jdbcType=VARCHAR},
</if>
<if test="birthday != null">
BIRTHDAY = #{birthday,jdbcType=TIMESTAMP},
</if>
<if test="addressProvince != null and addressProvince != ''">
ADDRESS_PROVINCE = #{addressProvince,jdbcType=VARCHAR},
</if>
<if test="addressCity != null and addressCity != ''">
ADDRESS_CITY = #{addressCity,jdbcType=VARCHAR},
</if>
<if test="addressArea != null and addressArea != ''">
ADDRESS_AREA = #{addressArea,jdbcType=VARCHAR},
</if>
<if test="addressStreet != null and addressStreet != ''">
ADDRESS_STREET = #{addressStreet,jdbcType=VARCHAR},
</if>
<if test="addressDetail != null and addressDetail != ''">
ADDRESS_DETAIL = #{addressDetail,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="doctorId != null and doctorId >= 0">
DOCTOR_ID = #{doctorId,jdbcType=INTEGER},
</if>
<if test="ifDel != null and ifDel >= 0">
IF_DEL = #{ifDel,jdbcType=INTEGER},
</if>
<if test="baseWomanName != null and baseWomanName != ''">
BASE_WOMAN_NAME = #{baseWomanName,jdbcType=VARCHAR},
</if>
<if test="basePapersType != null and basePapersType >= 0">
BASE_PAPERS_TYPE = #{basePapersType,jdbcType=INTEGER},
</if>
<if test="basePapersNumber != null and basePapersNumber != ''">
BASE_PAPERS_NUMBER = #{basePapersNumber,jdbcType=VARCHAR},
</if>
<if test="baseWomanBirth != null">
BASE_WOMAN_BIRTH = #{baseWomanBirth,jdbcType=TIMESTAMP},
</if>
<if test="contactWomanWay != null and contactWomanWay != ''">
CONTACT_WOMAN_WAY = #{contactWomanWay,jdbcType=VARCHAR},
</if>
<if test="degree != null and degree >= 0">
DEGREE = #{degree,jdbcType=INTEGER},
</if>
<if test="occupation != null and occupation >= 0">
OCCUPATION = #{occupation,jdbcType=INTEGER},
</if>
</set>
</update>


<delete id="deleteChildrenPerson" parameterType="java.lang.String">
</delete>


<select id="getChildrenPerson" resultMap="ChildrenPersonResultMap" parameterType="java.lang.String">
select ID,MOTHER_ID,NAME,GENDER,PAPERS_NUM,BIRTHDAY,ADDRESS_PROVINCE,ADDRESS_CITY,ADDRESS_AREA,ADDRESS_STREET,ADDRESS_DETAIL,CREATE_TIME,DOCTOR_ID,IF_DEL,BASE_WOMAN_NAME,BASE_PAPERS_TYPE,BASE_PAPERS_NUMBER,BASE_WOMAN_BIRTH,CONTACT_WOMAN_WAY,DEGREE,OCCUPATION
</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="ChildrenPersonCondition">
<where>
1 = 1
<if test="id != null and id != ''">
and ID = #{id,jdbcType=VARCHAR}
</if>
<if test="motherId != null and motherId != ''">
and MOTHER_ID = #{motherId,jdbcType=VARCHAR}
</if>
<if test="name != null and name != ''">
and NAME = #{name,jdbcType=VARCHAR}
</if>
<if test="gender != null and gender >= 0">
and GENDER = #{gender,jdbcType=INTEGER}
</if>
<if test="papersNum != null and papersNum != ''">
and PAPERS_NUM = #{papersNum,jdbcType=VARCHAR}
</if>
<if test="birthday != null">
and BIRTHDAY = #{birthday,jdbcType=TIMESTAMP}
</if>
<if test="startBirthday != null">
and
<![CDATA[
DATEDIFF(#{startBirthday},BIRTHDAY)<=0
]]>
</if>
<if test="endBirthday != null">
AND
<![CDATA[
DATEDIFF(#{endBirthday},BIRTHDAY) >=0
]]>
</if>
<if test="addressProvince != null and addressProvince != ''">
and ADDRESS_PROVINCE = #{addressProvince,jdbcType=VARCHAR}
</if>
<if test="addressCity != null and addressCity != ''">
and ADDRESS_CITY = #{addressCity,jdbcType=VARCHAR}
</if>
<if test="addressArea != null and addressArea != ''">
and ADDRESS_AREA = #{addressArea,jdbcType=VARCHAR}
</if>
<if test="addressStreet != null and addressStreet != ''">
and ADDRESS_STREET = #{addressStreet,jdbcType=VARCHAR}
</if>
<if test="addressDetail != null and addressDetail != ''">
and ADDRESS_DETAIL = #{addressDetail,jdbcType=VARCHAR}
</if>
<if test="createTime != null">
and CREATE_TIME = #{createTime,jdbcType=TIMESTAMP}
</if>
<if test="doctorId != null and doctorId >= 0">
and DOCTOR_ID = #{doctorId,jdbcType=INTEGER}
</if>
<if test="ifDel != null and ifDel >= 0">
and IF_DEL = #{ifDel,jdbcType=INTEGER}
</if>
<if test="baseWomanName != null and baseWomanName != ''">
and BASE_WOMAN_NAME = #{baseWomanName,jdbcType=VARCHAR}
</if>
<if test="basePapersType != null and basePapersType >= 0">
and BASE_PAPERS_TYPE = #{basePapersType,jdbcType=INTEGER}
</if>
<if test="basePapersNumber != null and basePapersNumber != ''">
and BASE_PAPERS_NUMBER = #{basePapersNumber,jdbcType=VARCHAR}
</if>
<if test="baseWomanBirth != null">
and BASE_WOMAN_BIRTH = #{baseWomanBirth,jdbcType=TIMESTAMP}
</if>
<if test="contactWomanWay != null and contactWomanWay != ''">
and CONTACT_WOMAN_WAY = #{contactWomanWay,jdbcType=VARCHAR}
</if>
<if test="degree != null and degree >= 0">
and DEGREE = #{degree,jdbcType=INTEGER}
</if>
<if test="occupation != null and occupation >= 0">
and OCCUPATION = #{occupation,jdbcType=INTEGER}
</if>
<if test="keyWord != null and keyWord >= 0">
and (
NAME like concat('%',#{name},'%')
or CONTACT_WOMAN_WAY LIKE concat('%',#{name},'%')
)
</if>
</where>
</sql>


<select id="queryChildrenPerson" resultMap="ChildrenPersonResultMap"
parameterType="com.lyms.platform.permission.model.ChildrenPersonQuery">
select
ID,MOTHER_ID,NAME,GENDER,PAPERS_NUM,BIRTHDAY,ADDRESS_PROVINCE,ADDRESS_CITY,ADDRESS_AREA,ADDRESS_STREET,ADDRESS_DETAIL,CREATE_TIME,DOCTOR_ID,IF_DEL,BASE_WOMAN_NAME,BASE_PAPERS_TYPE,BASE_PAPERS_NUMBER,BASE_WOMAN_BIRTH,CONTACT_WOMAN_WAY,DEGREE,OCCUPATION
from CHILDREN_PERSON
<include refid="ChildrenPersonCondition"/>
<include refid="orderAndLimit"/>
</select>


<select id="queryChildrenPersonCount" resultType="int"
parameterType="com.lyms.platform.permission.model.ChildrenPersonQuery">
select count(1) from CHILDREN_PERSON
<include refid="ChildrenPersonCondition"/>
</select>


</mapper>