机构用户登录、用户详情、退出登录、自动登录
This commit is contained in:
parent
b30fddd5f0
commit
f6e9fb371a
@ -34,6 +34,11 @@ public class LoginUser implements Serializable
|
||||
*/
|
||||
private Integer userType;
|
||||
|
||||
/**
|
||||
* 登录用户的openID
|
||||
*/
|
||||
private String openId;
|
||||
|
||||
/**
|
||||
* 登录时间
|
||||
*/
|
||||
@ -161,4 +166,12 @@ public class LoginUser implements Serializable
|
||||
public void setUserType(Integer userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
|
||||
public String getOpenId() {
|
||||
return openId;
|
||||
}
|
||||
|
||||
public void setOpenId(String openId) {
|
||||
this.openId = openId;
|
||||
}
|
||||
}
|
||||
|
||||
18
sql/v2.1.sql
18
sql/v2.1.sql
@ -63,3 +63,21 @@ ALTER TABLE `xhpc_customers_personnel` ADD COLUMN `alipay_open_id` varchar(50)
|
||||
ALTER TABLE `xhpc_customers_personnel` ADD COLUMN `weixin_login` int(10) NULL DEFAULT 0 COMMENT '微信是否登录(0未登录 1已登录)' AFTER `alipay_open_id`;
|
||||
ALTER TABLE `xhpc_customers_personnel` ADD COLUMN `alipay_login` int(10) NULL DEFAULT 0 COMMENT '支付宝是否登录(0未登录 1已登录)' AFTER `weixin_login`;
|
||||
ALTER TABLE `xhpc_customers_personnel` ADD COLUMN `is_refund` int(4) NULL DEFAULT 0 COMMENT '是否退款 0 不退款 1 退款' AFTER `soc`;
|
||||
|
||||
CREATE TABLE `xhpc_user_login` (
|
||||
`user_login_id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`app_user_id` bigint(20) DEFAULT NULL COMMENT '用户id',
|
||||
`account` varchar(50) DEFAULT NULL COMMENT '账号',
|
||||
`user_type` int(4) NOT NULL COMMENT '用户类型 0 C端用户 1 流量方用户 2社区用户 3B端用户)',
|
||||
`open_id` varchar(50) DEFAULT NULL COMMENT 'openid',
|
||||
`type` int(4) DEFAULT '0' COMMENT '1 微信 2支付宝',
|
||||
`status` int(4) DEFAULT '1' COMMENT '0退出 1登录',
|
||||
`del_flag` int(1) DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)',
|
||||
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
PRIMARY KEY (`user_login_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='小程序用户最后一次登录记录';
|
||||
|
||||
|
||||
@ -40,12 +40,12 @@ public class XhpcSmsController extends BaseController {
|
||||
if(phone !=null || "".equals(phone)){
|
||||
if(!UserTypeUtil.COMMUNIT.equals(phone.substring(0,2)) && !UserTypeUtil.CUSTOMERS.equals(phone.substring(0,2))){
|
||||
//C端用户
|
||||
return xhpcSmsService.getLogonPhoneCode(phone, signatureName, templateId);
|
||||
return xhpcSmsService.getLogonPhoneCode(phone, signatureName, templateId,null);
|
||||
}else if (UserTypeUtil.COMMUNIT.equals(phone.substring(0,2)) || UserTypeUtil.CUSTOMERS.equals(phone.substring(0,2))){
|
||||
R user = userTypeService.getUser(phone, null, null);
|
||||
if(user !=null && user.getData() !=null){
|
||||
Map<String, Object> map = (Map<String, Object>)user.getData();
|
||||
return xhpcSmsService.getLogonPhoneCode(map.get("phone").toString(), signatureName, templateId);
|
||||
return xhpcSmsService.getLogonPhoneCode(map.get("phone").toString(), signatureName, templateId,map.get("account").toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ public interface IXhpcSmsService {
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getLogonPhoneCode(String phone, String signatureName, String templateId);
|
||||
AjaxResult getLogonPhoneCode(String phone, String signatureName, String templateId,String account);
|
||||
|
||||
List<Map<String, Object>> getList(Integer status,String phone);
|
||||
|
||||
@ -35,7 +35,7 @@ public interface IXhpcSmsService {
|
||||
* @param paramMap 模板中的参数
|
||||
* @return
|
||||
*/
|
||||
AjaxResult send(String phone, String content, String random, String signatureName, String templateId, Map<String, String> paramMap);
|
||||
AjaxResult send(String phone, String content, String random, String signatureName, String templateId, Map<String, String> paramMap,String account);
|
||||
|
||||
/**
|
||||
* 发送通知短信方法
|
||||
|
||||
@ -48,13 +48,13 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult getLogonPhoneCode(String phone, String signatureName, String templateId) {
|
||||
public AjaxResult getLogonPhoneCode(String phone, String signatureName, String templateId,String account) {
|
||||
|
||||
String random = getRandom();
|
||||
HashMap<String, String> paramMap = new HashMap<>();
|
||||
paramMap.put("code", random);
|
||||
String content = null;
|
||||
return send(phone, content, random, signatureName, templateId, paramMap);
|
||||
return send(phone, content, random, signatureName, templateId, paramMap,account);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -64,7 +64,7 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult send(String phone, String content, String random, String signatureName, String templateId, Map<String, String> paramMap) {
|
||||
public AjaxResult send(String phone, String content, String random, String signatureName, String templateId, Map<String, String> paramMap,String account) {
|
||||
//调用接口
|
||||
String pattern = "^([1][0-9]{10})";
|
||||
Pattern compile = Pattern.compile(pattern);
|
||||
@ -76,15 +76,27 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
|
||||
//添加短信记录
|
||||
XhpcSms xhpcSms =new XhpcSms();
|
||||
try {
|
||||
String pvToken ="";
|
||||
String token ="";
|
||||
if(account !=null){
|
||||
//用户使用的Key
|
||||
String pvToken = "pvToken:" + phone;
|
||||
pvToken = "pvToken:" + account;
|
||||
//用户频繁调用的判断的Key
|
||||
String token = "token:" + phone;
|
||||
token = "token:" + account;
|
||||
String cacheObject = REDIS.getCacheObject(token);
|
||||
System.out.println("过了redis");
|
||||
if (cacheObject != null) {
|
||||
return AjaxResult.error("1012", "操作过于频繁,请于1分钟后重试");
|
||||
}
|
||||
}else{
|
||||
//用户使用的Key
|
||||
pvToken = "pvToken:" + phone;
|
||||
//用户频繁调用的判断的Key
|
||||
token = "token:" + phone;
|
||||
String cacheObject = REDIS.getCacheObject(token);
|
||||
if (cacheObject != null) {
|
||||
return AjaxResult.error("1012", "操作过于频繁,请于1分钟后重试");
|
||||
}
|
||||
}
|
||||
//使用阿里云发送通知短信
|
||||
Map<String, String> neededParam = null;
|
||||
try {
|
||||
|
||||
@ -50,7 +50,9 @@ public class XhpcCommonController extends BaseController {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -76,4 +76,26 @@ public interface XhpcAppUserMapper {
|
||||
int updateUserIsRefund(@Param("userId")Long userId, @Param("isRefund")Integer isRefund);
|
||||
|
||||
int updateCommunityIsRefund(@Param("userId")Long userId, @Param("isRefund")Integer isRefund);
|
||||
|
||||
/**
|
||||
* 记录登录用户的最后一次数据
|
||||
*/
|
||||
int addUserLoginTime(@Param("appUserId")Long appUserId, @Param("account")String account, @Param("userType")Integer userType, @Param("openId")String openId,@Param("type")Integer type,@Param("status")Integer status);
|
||||
|
||||
/**
|
||||
* 修改社区用户信息
|
||||
*/
|
||||
int updateCommunityPersonnel(@Param("appUserId")Long appUserId,@Param("weixinOpenId")String weixinOpenId, @Param("alipayOpenId")String alipayOpenId,@Param("weixinLogin")Integer weixinLogin, @Param("alipayLogin")Integer alipayLogin);
|
||||
/**
|
||||
* 修改B端大客户信息
|
||||
*/
|
||||
int updateCustomersPersonnel(@Param("appUserId")Long appUserId,@Param("weixinOpenId")String weixinOpenId, @Param("alipayOpenId")String alipayOpenId,@Param("weixinLogin")Integer weixinLogin, @Param("alipayLogin")Integer alipayLogin);
|
||||
|
||||
/**
|
||||
* 查询用户最后一次登录信息
|
||||
* @param type
|
||||
* @param openid
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getUserLoginTime(@Param("type")Integer type,@Param("openid")String openid);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.xhpc.user.service;
|
||||
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.user.domain.XhpcAppUser;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -88,7 +89,7 @@ public interface IXhpcAppUserUserService {
|
||||
* @param
|
||||
* @return 结果
|
||||
*/
|
||||
public Map<String, Object> appInfo(HttpServletRequest request);
|
||||
public AjaxResult appInfo(HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 注销账号
|
||||
|
||||
@ -2,6 +2,7 @@ package com.xhpc.user.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.xhpc.common.api.UserTypeService;
|
||||
import com.xhpc.common.core.constant.HttpStatus;
|
||||
import com.xhpc.common.core.constant.StatusConstants;
|
||||
import com.xhpc.common.core.constant.UserConstants;
|
||||
@ -9,8 +10,10 @@ import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.enums.UserStatus;
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.redis.service.RedisService;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.common.util.UserTypeUtil;
|
||||
import com.xhpc.system.api.domain.SysUser;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import com.xhpc.user.aspect.LogUserUtils;
|
||||
@ -48,6 +51,9 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
@Autowired
|
||||
private LogUserUtils logUserUtils;
|
||||
|
||||
@Autowired
|
||||
private UserTypeService userTypeService;
|
||||
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(XhpcAppUserServiceImpl.class);
|
||||
/**
|
||||
@ -209,6 +215,49 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
|| username.length() > UserConstants.USERNAME_MAX_LENGTH) {
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "用户名不在指定范围");
|
||||
}
|
||||
|
||||
//判断账号
|
||||
String sub = username.substring(0, 2);
|
||||
if (UserTypeUtil.COMMUNIT.equals(sub) || UserTypeUtil.CUSTOMERS.equals(sub)){
|
||||
R user = userTypeService.getUser(username, null, null);
|
||||
if(user !=null && user.getData() !=null){
|
||||
Map<String, Object> map = (Map<String, Object>)user.getData();
|
||||
LoginUser userInfo = new LoginUser();
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setUserName(username);
|
||||
long appUserId = Long.parseLong(map.get("appUserId").toString());
|
||||
sysUser.setUserId(appUserId);
|
||||
userInfo.setSysUser(sysUser);
|
||||
userInfo.setUsername(username);
|
||||
userInfo.setOpenId(openid);
|
||||
if(UserTypeUtil.COMMUNIT.equals(username.substring(0,2))){
|
||||
userInfo.setUserType(UserTypeUtil.COMMUNIT_TYPE);
|
||||
}else{
|
||||
userInfo.setUserType(UserTypeUtil.CUSTOMERS_TYPE);
|
||||
}
|
||||
if(UserTypeUtil.COMMUNIT.equals(sub)){
|
||||
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
||||
xhpcAppUserMapper.updateCommunityPersonnel(appUserId,openid,null,UserConstants.LOGIN,null);
|
||||
} else {
|
||||
xhpcAppUserMapper.updateCommunityPersonnel(appUserId,null,openid,null,UserConstants.LOGIN);
|
||||
}
|
||||
}else{
|
||||
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
||||
xhpcAppUserMapper.updateCustomersPersonnel(appUserId,openid,null,UserConstants.LOGIN,null);
|
||||
} else {
|
||||
xhpcAppUserMapper.updateCustomersPersonnel(appUserId,null,openid,null,UserConstants.LOGIN);
|
||||
}
|
||||
}
|
||||
//添加最后一次登录数据
|
||||
xhpcAppUserMapper.addUserLoginTime(appUserId,username,userInfo.getUserType(),openid,Integer.valueOf(type),null);
|
||||
|
||||
redisService.deleteObject("pvToken:" + username);
|
||||
// 获取登录token
|
||||
return R.ok(tokenService.createToken(userInfo));
|
||||
}else{
|
||||
return R.fail(HttpStatus.DATA_ERROR, "账号不正确,请重新输入");
|
||||
}
|
||||
}
|
||||
// 查询用户信息
|
||||
XhpcAppUser user = xhpcAppUserMapper.getAppUserByPhone(username);
|
||||
if (StringUtils.isNull(user)) {
|
||||
@ -236,6 +285,10 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
sysUser.setUserName(user.getPhone());
|
||||
sysUser.setUserId(user.getAppUserId());
|
||||
userInfo.setSysUser(sysUser);
|
||||
userInfo.setUserType(UserTypeUtil.USER_TYPE);
|
||||
userInfo.setUsername(username);
|
||||
userInfo.setOpenId(openid);
|
||||
userInfo.setUserid(user.getAppUserId());
|
||||
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
|
||||
return R.fail(HttpStatus.DATA_ERROR, "对不起,您的账号:" + username + " 已被删除");
|
||||
}
|
||||
@ -255,6 +308,9 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
}
|
||||
xhpcAppUserMapper.update(user);
|
||||
redisService.deleteObject("pvToken:" + user.getPhone());
|
||||
|
||||
//添加最后一次登录数据
|
||||
xhpcAppUserMapper.addUserLoginTime(user.getAppUserId(),username,userInfo.getUserType(),openid,Integer.valueOf(type),UserConstants.LOGIN);
|
||||
// 获取登录token
|
||||
return R.ok(tokenService.createToken(userInfo));
|
||||
}
|
||||
@ -271,17 +327,43 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
if (StringUtils.isNotNull(loginUser)) {
|
||||
String username = loginUser.getUsername();
|
||||
Integer userType = loginUser.getUserType();
|
||||
Long userid = loginUser.getUserid();
|
||||
String openId = loginUser.getOpenId();
|
||||
R user = userTypeService.getUser(null, userid, userType);
|
||||
if(user !=null && user.getData() !=null){
|
||||
if(UserTypeUtil.USER_TYPE==userType){
|
||||
XhpcAppUser appUser = xhpcAppUserMapper.getAppUserByPhone(username);
|
||||
if (!StringUtils.isNull(appUser)) {
|
||||
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
||||
appUser.setWeixinLogin(UserConstants.NO_LOGIN);
|
||||
} else {
|
||||
appUser.setAlipayLogin(UserConstants.NO_LOGIN);
|
||||
}
|
||||
xhpcAppUserMapper.update(appUser);
|
||||
//添加最后一次登录数据
|
||||
xhpcAppUserMapper.addUserLoginTime(appUser.getAppUserId(),username,userType,openId,Integer.valueOf(type),UserConstants.NO_LOGIN);
|
||||
}
|
||||
}else if(UserTypeUtil.COMMUNIT_TYPE==userType){
|
||||
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
||||
xhpcAppUserMapper.updateCommunityPersonnel(userid,null,null,UserConstants.NO_LOGIN,null);
|
||||
} else {
|
||||
xhpcAppUserMapper.updateCommunityPersonnel(userid,null,null,null,UserConstants.NO_LOGIN);
|
||||
}
|
||||
//添加最后一次登录数据
|
||||
xhpcAppUserMapper.addUserLoginTime(userid,username,userType,openId,Integer.valueOf(type),UserConstants.NO_LOGIN);
|
||||
}else if(UserTypeUtil.CUSTOMERS_TYPE==userType){
|
||||
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
||||
xhpcAppUserMapper.updateCustomersPersonnel(userid,null,null,UserConstants.NO_LOGIN,null);
|
||||
} else {
|
||||
xhpcAppUserMapper.updateCustomersPersonnel(userid,null,null,null,UserConstants.NO_LOGIN);
|
||||
}
|
||||
//添加最后一次登录数据
|
||||
xhpcAppUserMapper.addUserLoginTime(userid,username,userType,openId,Integer.valueOf(type),UserConstants.NO_LOGIN);
|
||||
}
|
||||
}
|
||||
// 删除用户缓存记录
|
||||
tokenService.delLoginUser(loginUser.getToken());
|
||||
XhpcAppUser user = xhpcAppUserMapper.getAppUserByPhone(username);
|
||||
if (!StringUtils.isNull(user)) {
|
||||
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
||||
user.setWeixinLogin(UserConstants.NO_LOGIN);
|
||||
} else {
|
||||
user.setAlipayLogin(UserConstants.NO_LOGIN);
|
||||
}
|
||||
xhpcAppUserMapper.update(user);
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
@ -296,39 +378,55 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
public R<?> voluntaryLogin(Map<String, Object> map) {
|
||||
String type = StringUtils.valueOf(map.get("type"));
|
||||
String openid = StringUtils.valueOf(map.get("openid"));
|
||||
XhpcAppUser user = xhpcAppUserMapper.getAppUserByOpenid(openid);
|
||||
if (StringUtils.isNull(user)) {
|
||||
return R.fail(HttpStatus.DATA_ERROR, "用户不存在");
|
||||
Map<String, Object> userLoginTime = xhpcAppUserMapper.getUserLoginTime(Integer.valueOf(type), openid);
|
||||
if(userLoginTime ==null){
|
||||
return R.fail(HttpStatus.USER_LOGIN, "请重新登录");
|
||||
}
|
||||
if (StatusConstants.OPERATION_ALI_PAY_TYPE.equals(type)) {
|
||||
if (UserConstants.NO_LOGIN == user.getAlipayLogin()) {
|
||||
return R.fail(HttpStatus.USER_LOGIN, "用户未登录");
|
||||
if(UserConstants.NO_LOGIN.equals(userLoginTime.get("status").toString())){
|
||||
return R.fail(HttpStatus.USER_LOGIN, "请重新登录");
|
||||
}
|
||||
} else if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
||||
if (UserConstants.NO_LOGIN == user.getWeixinLogin()) {
|
||||
return R.fail(HttpStatus.USER_LOGIN, "用户未登录");
|
||||
}
|
||||
}
|
||||
return appLogin(user.getPhone(), type, openid);
|
||||
return appLogin(userLoginTime.get("account").toString(), type, openid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序用户详情
|
||||
*
|
||||
* @param
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> appInfo(HttpServletRequest request) {
|
||||
public AjaxResult appInfo(HttpServletRequest request) {
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
String userId = StringUtils.valueOf(loginUser.getUserid());
|
||||
Object version = redisService.getCacheObject("global:version");
|
||||
Object servicePhone = redisService.getCacheObject("global:phone");
|
||||
//根据不同的用户类型查询不同的信息
|
||||
Map<String,Object> result = xhpcAppUserMapper.info(Long.parseLong(userId));
|
||||
result.put("version",version);
|
||||
result.put("servicePhone",servicePhone);
|
||||
return result;
|
||||
Long userid = loginUser.getUserid();
|
||||
Integer userType = loginUser.getUserType();
|
||||
R user = userTypeService.getUser(null, loginUser.getUserid(), loginUser.getUserType());
|
||||
if(user !=null && user.getData() !=null){
|
||||
Map<String, Object> map = (Map<String, Object>)user.getData();
|
||||
//发票、留言板、版本、客服电话
|
||||
Object invoice =null;
|
||||
if(UserTypeUtil.USER_TYPE.equals(userType)){
|
||||
invoice = redisService.getCacheObject("global:invoice:" + UserTypeUtil.USER + userid);
|
||||
}else if(UserTypeUtil.INTERNET_TYPE.equals(userType)){
|
||||
invoice = redisService.getCacheObject("global:invoice:"+UserTypeUtil.INTERNET+userid);
|
||||
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(userType)){
|
||||
invoice = redisService.getCacheObject("global:invoice:"+UserTypeUtil.COMMUNIT+userid);
|
||||
}else{
|
||||
invoice = redisService.getCacheObject("global:invoice:"+UserTypeUtil.CUSTOMERS+userid);
|
||||
}
|
||||
if(invoice==null){
|
||||
map.put("invoiceNumber","0");
|
||||
}else{
|
||||
map.put("invoiceNumber",invoice);
|
||||
}
|
||||
map.put("guestbook","0");
|
||||
map.put("version",version);
|
||||
map.put("servicePhone",servicePhone);
|
||||
return AjaxResult.success(map);
|
||||
}else{
|
||||
return AjaxResult.error("请重新登录");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -228,4 +228,79 @@
|
||||
<update id="updateCommunityIsRefund">
|
||||
update xhpc_community_personnel set is_refund=#{isRefund} where community_personnel_id=#{userId}
|
||||
</update>
|
||||
|
||||
<insert id="addUserLoginTime">
|
||||
INSERT INTO xhpc_user_login
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="null != appUserId">
|
||||
app_user_id,
|
||||
</if>
|
||||
<if test="null != account and '' != account">
|
||||
account,
|
||||
</if>
|
||||
<if test="null != userType ">
|
||||
user_type,
|
||||
</if>
|
||||
<if test="null != openId and '' != openId">
|
||||
open_id,
|
||||
</if>
|
||||
<if test="null != type">
|
||||
type,
|
||||
</if>
|
||||
<if test="null != status">
|
||||
status,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="null != appUserId">
|
||||
#{appUserId},
|
||||
</if>
|
||||
<if test="null != account and '' != account">
|
||||
#{account},
|
||||
</if>
|
||||
<if test="null != userType">
|
||||
#{userType},
|
||||
</if>
|
||||
<if test="null != openId">
|
||||
#{openId},
|
||||
</if>
|
||||
<if test="null != type">
|
||||
#{type},
|
||||
</if>
|
||||
<if test="null != status">
|
||||
#{status},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateCommunityPersonnel">
|
||||
UPDATE xhpc_community_personnel
|
||||
<set>
|
||||
<if test="null != weixinOpenId and '' != weixinOpenId">weixin_open_id = #{weixinOpenId},</if>
|
||||
<if test="null != alipayOpenId and '' != alipayOpenId">alipay_open_id = #{alipayOpenId},</if>
|
||||
<if test="null != weixinLogin ">weixin_login = #{weixinLogin},</if>
|
||||
<if test="null != alipayLogin ">alipay_login = #{alipayLogin},</if>
|
||||
</set>
|
||||
WHERE community_personnel_id = #{appUserId}
|
||||
</update>
|
||||
<update id="updateCustomersPersonnel">
|
||||
UPDATE xhpc_customers_personnel
|
||||
<set>
|
||||
<if test="null != weixinOpenId and '' != weixinOpenId">weixin_open_id = #{weixinOpenId},</if>
|
||||
<if test="null != alipayOpenId and '' != alipayOpenId">alipay_open_id = #{alipayOpenId},</if>
|
||||
<if test="null != weixinLogin ">weixin_login = #{weixinLogin},</if>
|
||||
<if test="null != alipayLogin ">alipay_login = #{alipayLogin},</if>
|
||||
</set>
|
||||
WHERE customers_personnel_id = #{appUserId}
|
||||
</update>
|
||||
|
||||
<select id="getUserLoginTime" resultType="map">
|
||||
select
|
||||
app_user_id as appUserId,
|
||||
account as account,
|
||||
user_type as userType,
|
||||
open_id as openId,
|
||||
status as status
|
||||
from xhpc_user_login type=#{type} and open_id=#{openid}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user