YmUsers.xml 4.48 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
<?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.YmUsersMapper">

<resultMap id="YmUsersResultMap" type="com.lymsh.yimiao.main.data.model.YmUsers">
<id column="id" property="id" jdbcType="INTEGER" />
<result column="phone" property="phone" jdbcType="VARCHAR" />
<result column="avatar" property="avatar" jdbcType="VARCHAR" />
<result column="nickname" property="nickname" jdbcType="VARCHAR" />
<result column="yn" property="yn" jdbcType="INTEGER" />
<result column="created" property="created" jdbcType="TIMESTAMP" />
<result column="modified" property="modified" jdbcType="TIMESTAMP" />
<result column="last_login_time" property="lastLoginTime" jdbcType="TIMESTAMP" />
<result column="login_center_id" property="loginCenterId" jdbcType="INTEGER" />
</resultMap>



<insert id="addYmUsers" keyProperty="id" useGeneratedKeys="false" parameterType="com.lymsh.yimiao.main.data.model.YmUsers">
<selectKey resultType="int" keyProperty="id" order="BEFORE">
SELECT WXYL_SEQ.nextval AS id
FROM dual
</selectKey>
insert into ym_users (id,phone,avatar,nickname,yn,created,modified,last_login_time,login_center_id) values (#{id,jdbcType=INTEGER},#{phone,jdbcType=VARCHAR},#{avatar,jdbcType=VARCHAR}
,#{nickname,jdbcType=VARCHAR},#{yn,jdbcType=INTEGER},#{created,jdbcType=TIMESTAMP},#{modified,jdbcType=TIMESTAMP},#{lastLoginTime,jdbcType=TIMESTAMP},#{loginCenterId,jdbcType=INTEGER})
</insert>



<update id="updateYmUsers" parameterType="com.lymsh.yimiao.main.data.model.YmUsers">
update ym_users <set><if test="phone != null and phone != ''">
phone = #{phone,jdbcType=VARCHAR},
</if>
<if test="loginCenterId != null and loginCenterId != ''">
login_center_id = #{loginCenterId,jdbcType=INTEGER},
</if>
<if test="avatar != null and avatar != ''">
avatar = #{avatar,jdbcType=VARCHAR},
</if>
<if test="nickname != null and nickname != ''">
nickname = #{nickname,jdbcType=VARCHAR},
</if>
<if test="yn != null and yn >= 0">
yn = #{yn,jdbcType=INTEGER},
</if>
<if test="created != null">
created = #{created,jdbcType=TIMESTAMP},
</if>
<if test="modified != null">
modified = #{modified,jdbcType=TIMESTAMP},
</if>
<if test="lastLoginTime != null">
last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>


<delete id="deleteYmUsers" parameterType="java.lang.Integer">
delete from ym_users where id = #{id,jdbcType=INTEGER}
</delete>



<select id="getYmUsers" resultMap="YmUsersResultMap" parameterType="java.lang.Integer">
select id,phone,avatar,nickname,yn,created,modified,last_login_time,login_center_id
from ym_users where id = #{id,jdbcType=INTEGER}
</select>

<select id="getUsersByLoginCenterId" resultMap="YmUsersResultMap" parameterType="java.lang.Integer">
SELECT id,phone,avatar,nickname,yn,created,modified,last_login_time,login_center_id
FROM ym_users
WHERE login_center_id = #{loginCenterId,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="YmUsersCondition">
<where>
1 = 1
<if test="id != null and id >= 0">
and id = #{id,jdbcType=INTEGER}
</if>
<if test="phone != null and phone != ''">
and phone = #{phone,jdbcType=VARCHAR}
</if>
<if test="avatar != null and avatar != ''">
and avatar = #{avatar,jdbcType=VARCHAR}
</if>
<if test="nickname != null and nickname != ''">
and nickname = #{nickname,jdbcType=VARCHAR}
</if>
<if test="yn != null and yn >= 0">
and yn = #{yn,jdbcType=INTEGER}
</if>
<if test="created != null">
and created = #{created,jdbcType=TIMESTAMP}
</if>
<if test="modified != null">
and modified = #{modified,jdbcType=TIMESTAMP}
</if>
<if test="lastLoginTime != null">
and last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP}
</if>
<if test="loginCenterId != null">
and login_center_id = #{loginCenterId,jdbcType=INTEGER}
</if>
</where>
</sql>



<select id="queryYmUsers" resultMap="YmUsersResultMap" parameterType="com.lymsh.yimiao.main.data.model.YmUsersQuery">
select id,phone,avatar,nickname,yn,created,modified,last_login_time,login_center_id
from ym_users
<include refid="YmUsersCondition" />
<include refid="orderAndLimit" />
</select>



<select id="queryYmUsersCount" resultType="int" parameterType="com.lymsh.yimiao.main.data.model.YmUsersQuery">
select count(1) from ym_users
<include refid="YmUsersCondition" />
</select>



</mapper>