YmUserKidMaps.xml 2.59 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
<?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.YmUserKidMapsMapper">

<resultMap id="YmUserKidMapsResultMap" type="com.lymsh.yimiao.main.data.model.YmUserKidMaps">
<result column="user_id" property="userId" jdbcType="INTEGER" />
<result column="kid_id" property="kidId" jdbcType="VARCHAR" />
<result column="created" property="created" jdbcType="TIMESTAMP" />
<result column="yn" property="yn" jdbcType="INTEGER" />
</resultMap>



<insert id="addYmUserKidMaps" parameterType="com.lymsh.yimiao.main.data.model.YmUserKidMaps">
insert into ym_user_kid_maps (user_id,kid_id,created,yn) values (#{userId},#{kidId},#{created},#{yn})
</insert>



<update id="updateYmUserKidMaps" parameterType="com.lymsh.yimiao.main.data.model.YmUserKidMaps">
update ym_user_kid_maps <set><if test="userId != null and userId >= 0">
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="kidId != null and kidId != ''">
kid_id = #{kidId,jdbcType=VARCHAR},
</if>
<if test="created != null">
created = #{created,jdbcType=TIMESTAMP},
</if>
<if test="yn != null and yn >= 0">
yn = #{yn,jdbcType=INTEGER},
</if>
</set>
</update>


<delete id="deleteYmUserKidMaps" parameterType="java.lang.Integer">
</delete>



<select id="getYmUserKidMaps" resultMap="YmUserKidMapsResultMap" parameterType="java.lang.Integer">
select user_id,kid_id,created,yn
from ym_user_kid_maps
WHERE user_id = #{userId,jdbcType=INTEGER}
</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="YmUserKidMapsCondition">
<where>
1 = 1
<if test="userId != null and userId >= 0">
and user_id = #{userId,jdbcType=INTEGER}
</if>
<if test="kidId != null and kidId != ''">
and kid_id = #{kidId,jdbcType=VARCHAR}
</if>
<if test="created != null">
and created = #{created,jdbcType=TIMESTAMP}
</if>
<if test="yn != null and yn >= 0">
and yn = #{yn,jdbcType=INTEGER}
</if>
</where>
</sql>



<select id="queryYmUserKidMaps" resultMap="YmUserKidMapsResultMap" parameterType="com.lymsh.yimiao.main.data.model.YmUserKidMapsQuery">
select user_id,kid_id,created,yn
from ym_user_kid_maps
<include refid="YmUserKidMapsCondition" />
<include refid="orderAndLimit" />
</select>



<select id="queryYmUserKidMapsCount" resultType="int" parameterType="com.lymsh.yimiao.main.data.model.YmUserKidMapsQuery">
select count(1) from ym_user_kid_maps
<include refid="YmUserKidMapsCondition" />
</select>



</mapper>