ChildrenFather.xml 3.89 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
<?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.ChildrenFatherMapper">

<resultMap id="ChildrenFatherResultMap" type="com.lyms.platform.permission.model.ChildrenFather">
<result column="ID" property="id" jdbcType="VARCHAR" />
<result column="CHILD_ID" property="childId" jdbcType="VARCHAR" />
<result column="NAME" property="name" jdbcType="VARCHAR" />
<result column="CONTACT_WAY" property="contactWay" jdbcType="VARCHAR" />
<result column="BIRTHDAY" property="birthday" jdbcType="TIMESTAMP" />
<result column="EDUCATION_DEGREE" property="educationDegree" jdbcType="INTEGER" />
<result column="OCCUPATION" property="occupation" jdbcType="INTEGER" />
<result column="CREATE_TIME" property="createTime" jdbcType="TIMESTAMP" />
</resultMap>



<insert id="addChildrenFather" parameterType="com.lyms.platform.permission.model.ChildrenFather">
insert into CHILDREN_FATHER (ID,CHILD_ID,NAME,CONTACT_WAY,BIRTHDAY,EDUCATION_DEGREE,OCCUPATION,CREATE_TIME) values (#{id},#{childId},#{name},#{contactWay},#{birthday},#{educationDegree},#{occupation},#{createTime})
</insert>



<update id="updateChildrenFather" parameterType="com.lyms.platform.permission.model.ChildrenFather">
update CHILDREN_FATHER <set><if test="id != null and id != ''">
ID = #{id,jdbcType=VARCHAR},
</if>
<if test="childId != null and childId != ''">
CHILD_ID = #{childId,jdbcType=VARCHAR},
</if>
<if test="name != null and name != ''">
NAME = #{name,jdbcType=VARCHAR},
</if>
<if test="contactWay != null and contactWay != ''">
CONTACT_WAY = #{contactWay,jdbcType=VARCHAR},
</if>
<if test="birthday != null">
BIRTHDAY = #{birthday,jdbcType=TIMESTAMP},
</if>
<if test="educationDegree != null and educationDegree >= 0">
EDUCATION_DEGREE = #{educationDegree,jdbcType=INTEGER},
</if>
<if test="occupation != null and occupation >= 0">
OCCUPATION = #{occupation,jdbcType=INTEGER},
</if>
<if test="createTime != null">
CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
</update>


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



<select id="getChildrenFather" resultMap="ChildrenFatherResultMap" parameterType="java.lang.String">
select ID,CHILD_ID,NAME,CONTACT_WAY,BIRTHDAY,EDUCATION_DEGREE,OCCUPATION,CREATE_TIME
</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="ChildrenFatherCondition">
<where>
1 = 1
<if test="id != null and id != ''">
and ID = #{id,jdbcType=VARCHAR}
</if>
<if test="childId != null and childId != ''">
and CHILD_ID = #{childId,jdbcType=VARCHAR}
</if>
<if test="name != null and name != ''">
and NAME = #{name,jdbcType=VARCHAR}
</if>
<if test="contactWay != null and contactWay != ''">
and CONTACT_WAY = #{contactWay,jdbcType=VARCHAR}
</if>
<if test="birthday != null">
and BIRTHDAY = #{birthday,jdbcType=TIMESTAMP}
</if>
<if test="educationDegree != null and educationDegree >= 0">
and EDUCATION_DEGREE = #{educationDegree,jdbcType=INTEGER}
</if>
<if test="occupation != null and occupation >= 0">
and OCCUPATION = #{occupation,jdbcType=INTEGER}
</if>
<if test="createTime != null">
and CREATE_TIME = #{createTime,jdbcType=TIMESTAMP}
</if>
</where>
</sql>



<select id="queryChildrenFather" resultMap="ChildrenFatherResultMap" parameterType="com.lyms.platform.permission.model.ChildrenFatherQuery">
select ID,CHILD_ID,NAME,CONTACT_WAY,BIRTHDAY,EDUCATION_DEGREE,OCCUPATION,CREATE_TIME
from CHILDREN_FATHER
<include refid="ChildrenFatherCondition" />
<include refid="orderAndLimit" />
</select>



<select id="queryChildrenFatherCount" resultType="int" parameterType="com.lyms.platform.permission.model.ChildrenFatherQuery">
select count(1) from CHILDREN_FATHER
<include refid="ChildrenFatherCondition" />
</select>



</mapper>