178 lines
5.0 KiB
XML
178 lines
5.0 KiB
XML
<?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.haitongauto.mapper.base.UsersMapper">
|
||
<!--添加数据,返回id-->
|
||
<select id="insert" parameterType="com.haitongauto.models.pojo.Users" resultType="String">
|
||
insert into applet_users
|
||
(
|
||
id,
|
||
access_token,
|
||
access_token_rtos,
|
||
users_name,
|
||
wx_openid,
|
||
wx_unionid,
|
||
wx_nick,
|
||
wx_sex,
|
||
wx_head_sculpture,
|
||
tel_number,
|
||
id_code,
|
||
users_state,
|
||
create_time,
|
||
update_time,
|
||
is_del
|
||
)
|
||
values
|
||
(
|
||
#{id},
|
||
#{access_token},
|
||
#{access_token_rtos},
|
||
#{users_name},
|
||
#{wx_openid},
|
||
#{wx_unionid},
|
||
#{wx_nick},
|
||
#{wx_sex},
|
||
#{wx_head_sculpture},
|
||
#{tel_number},
|
||
#{id_code},
|
||
#{users_state},
|
||
current_timestamp,
|
||
current_timestamp,
|
||
0
|
||
)
|
||
returning id
|
||
</select>
|
||
<!--软删除-->
|
||
<update id="logicDel" parameterType="String">
|
||
update applet_users set is_del=1 where id=#{id}
|
||
</update>
|
||
<!--硬删除-->
|
||
<delete id="delete" parameterType="String">
|
||
delete from applet_users where id=#{id}
|
||
</delete>
|
||
<!--数据更新-->
|
||
<update id="update" parameterType="com.haitongauto.models.pojo.Users">
|
||
update applet_users
|
||
<set>
|
||
<if test="id != null and id != ''">
|
||
id = #{id},
|
||
</if>
|
||
<if test="access_token != null and access_token != ''">
|
||
access_token = #{access_token},
|
||
</if>
|
||
<if test="access_token_rtos != null and access_token_rtos != ''">
|
||
access_token_rtos = #{access_token_rtos},
|
||
</if>
|
||
<if test="users_name != null and users_name != ''">
|
||
users_name = #{users_name},
|
||
</if>
|
||
<if test="wx_openid != null and wx_openid != ''">
|
||
wx_openid = #{wx_openid},
|
||
</if>
|
||
<if test="wx_unionid != null and wx_unionid != ''">
|
||
wx_unionid = #{wx_unionid},
|
||
</if>
|
||
<if test="wx_nick != null and wx_nick != ''">
|
||
wx_nick = #{wx_nick},
|
||
</if>
|
||
<if test="wx_sex != null and wx_sex != ''">
|
||
wx_sex = #{wx_sex},
|
||
</if>
|
||
<if test="wx_head_sculpture != null and wx_head_sculpture != ''">
|
||
wx_head_sculpture = #{wx_head_sculpture},
|
||
</if>
|
||
<if test="tel_number != null and tel_number != ''">
|
||
tel_number = #{tel_number},
|
||
</if>
|
||
<if test="id_code != null and id_code != ''">
|
||
id_code = #{id_code},
|
||
</if>
|
||
<if test="users_state != null">
|
||
users_state = #{users_state},
|
||
</if>
|
||
<if test="create_time != null and create_time != ''">
|
||
create_time = #{create_time}::timestamp,
|
||
</if>
|
||
<if test="is_del != null">
|
||
is_del = #{is_del},
|
||
</if>
|
||
update_time = current_timestamp
|
||
</set>
|
||
where id = #{id}
|
||
</update>
|
||
|
||
|
||
<!--指定Id的记录-->
|
||
<select id="getById" parameterType="String" resultType="com.haitongauto.models.pojo.Users">
|
||
select
|
||
id,
|
||
access_token,
|
||
access_token_rtos,
|
||
users_name,
|
||
wx_openid,
|
||
wx_unionid,
|
||
wx_nick,
|
||
wx_sex,
|
||
wx_head_sculpture,
|
||
tel_number,
|
||
id_code,
|
||
users_state,
|
||
create_time,
|
||
update_time,
|
||
is_del
|
||
from applet_users
|
||
where id=#{id} and is_del=0
|
||
</select>
|
||
|
||
<!--指定openId的记录-->
|
||
<select id="getByWxOpenid" parameterType="String" resultType="com.haitongauto.models.pojo.Users">
|
||
select
|
||
id,
|
||
access_token,
|
||
access_token_rtos,
|
||
users_name,
|
||
wx_openid,
|
||
wx_unionid,
|
||
wx_nick,
|
||
wx_sex,
|
||
wx_head_sculpture,
|
||
tel_number,
|
||
id_code,
|
||
users_state,
|
||
create_time,
|
||
update_time,
|
||
is_del
|
||
from applet_users
|
||
where wx_openid=#{wx_openid} and is_del=0
|
||
</select>
|
||
<select id="getByIdCode" resultType="com.haitongauto.models.pojo.Users">
|
||
select *
|
||
from applet_users
|
||
where id_code=#{id_code}
|
||
and is_del=0
|
||
</select>
|
||
<!--数据列表-->
|
||
<select id="getList" resultType="com.haitongauto.models.pojo.Users">
|
||
select
|
||
id,
|
||
access_token,
|
||
access_token_rtos,
|
||
users_name,
|
||
wx_openid,
|
||
wx_unionid,
|
||
wx_nick,
|
||
wx_sex,
|
||
wx_head_sculpture,
|
||
tel_number,
|
||
id_code,
|
||
users_state,
|
||
create_time,
|
||
update_time,
|
||
is_del
|
||
from applet_users
|
||
where is_del=0
|
||
order by create_time desc
|
||
</select>
|
||
|
||
</mapper> |