75 lines
2.4 KiB
XML
75 lines
2.4 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="ink.wgink.login.wechat.dao.user.IMiniAppUserDao">
|
|
|
|
<cache flushInterval="3600000"/>
|
|
|
|
<resultMap id="miniAppUserPO" type="ink.wgink.login.wechat.pojo.pos.user.MiniAppUserPO">
|
|
<result column="app_id" property="appId"/>
|
|
<result column="open_id" property="openId"/>
|
|
<result column="user_id" property="userId"/>
|
|
<result column="is_init_account" property="isInitAccount"/>
|
|
<result column="gmt_create" property="gmtCreate"/>
|
|
</resultMap>
|
|
|
|
<!-- 建表 -->
|
|
<update id="createTable">
|
|
CREATE TABLE IF NOT EXISTS `wechat_mini_app_user` (
|
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
|
`app_id` varchar(255) DEFAULT NULL COMMENT 'appid',
|
|
`open_id` varchar(255) DEFAULT NULL COMMENT 'openid',
|
|
`user_id` varchar(255) DEFAULT NULL COMMENT '用户ID',
|
|
`is_init_account` int(1) DEFAULT '0' COMMENT '是否初始化账户',
|
|
`gmt_create` datetime DEFAULT NULL,
|
|
PRIMARY KEY (`id`),
|
|
KEY `app_id` (`app_id`) USING BTREE,
|
|
KEY `open_id` (`open_id`) USING BTREE,
|
|
KEY `user_id` (`user_id`) USING BTREE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='小程序用户';
|
|
</update>
|
|
|
|
<!-- 保存 -->
|
|
<insert id="save" parameterType="map">
|
|
INSERT INTO wechat_mini_app_user(
|
|
app_id,
|
|
open_id,
|
|
user_id,
|
|
is_init_account,
|
|
gmt_create
|
|
) VALUES(
|
|
#{appId},
|
|
#{openId},
|
|
#{userId},
|
|
#{isInitAccount},
|
|
#{gmtCreate}
|
|
)
|
|
</insert>
|
|
|
|
<!-- 详情 -->
|
|
<select id="getPO" parameterType="map" resultMap="miniAppUserPO" useCache="true">
|
|
SELECT
|
|
app_id,
|
|
open_id,
|
|
user_id,
|
|
is_init_account,
|
|
gmt_create
|
|
FROM
|
|
wechat_mini_app_user
|
|
<where>
|
|
<if test="appId != null and appId != ''">
|
|
app_id = #{appId}
|
|
</if>
|
|
<if test="openId != '' and openId != ''">
|
|
AND
|
|
open_id = #{openId}
|
|
</if>
|
|
<if test="userId != null and userId != ''">
|
|
AND
|
|
user_id = #{userId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
|
|
</mapper> |