diff --git a/jshERP-boot/docs/jsh_erp.sql b/jshERP-boot/docs/jsh_erp.sql index ad23905a..66894b36 100644 --- a/jshERP-boot/docs/jsh_erp.sql +++ b/jshERP-boot/docs/jsh_erp.sql @@ -10,7 +10,7 @@ Target Server Type : MYSQL Target Server Version : 50704 File Encoding : 65001 -Date: 2023-05-19 19:25:05 +Date: 2023-05-28 22:28:31 */ SET FOREIGN_KEY_CHECKS=0; @@ -716,6 +716,9 @@ INSERT INTO `jsh_platform_config` VALUES ('6', 'pay_fee_url', '租户续费地 INSERT INTO `jsh_platform_config` VALUES ('7', 'register_flag', '注册启用标记', '1'); INSERT INTO `jsh_platform_config` VALUES ('8', 'app_activation_code', '手机端激活码', ''); INSERT INTO `jsh_platform_config` VALUES ('9', 'send_workflow_url', '发起流程地址', ''); +INSERT INTO `jsh_platform_config` VALUES ('10', 'weixinUrl', '微信url', ''); +INSERT INTO `jsh_platform_config` VALUES ('11', 'weixinAppid', '微信appid', ''); +INSERT INTO `jsh_platform_config` VALUES ('12', 'weixinSecret', '微信secret', ''); -- ---------------------------- -- Table structure for jsh_role @@ -935,6 +938,7 @@ CREATE TABLE `jsh_user` ( `Status` tinyint(4) DEFAULT '0' COMMENT '状态,0:正常,1:删除,2封禁', `description` varchar(500) DEFAULT NULL COMMENT '用户描述信息', `remark` varchar(500) DEFAULT NULL COMMENT '备注', + `weixin_open_id` varchar(100) DEFAULT NULL COMMENT '微信绑定', `tenant_id` bigint(20) DEFAULT NULL COMMENT '租户id', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=146 DEFAULT CHARSET=utf8 COMMENT='用户表'; @@ -942,9 +946,9 @@ CREATE TABLE `jsh_user` ( -- ---------------------------- -- Records of jsh_user -- ---------------------------- -INSERT INTO `jsh_user` VALUES ('63', '测试用户', 'jsh', 'e10adc3949ba59abbe56e057f20f883e', '0', '主管', null, '666666@qq.com', '1123123123132', '1', '1', '0', '', null, '63'); -INSERT INTO `jsh_user` VALUES ('120', '管理员', 'admin', 'e10adc3949ba59abbe56e057f20f883e', '0', null, null, null, null, '1', '0', '0', null, null, '0'); -INSERT INTO `jsh_user` VALUES ('131', 'test123', 'test123', 'e10adc3949ba59abbe56e057f20f883e', '0', '总监', null, '7777777@qq.com', '', '1', '0', '0', '', null, '63'); +INSERT INTO `jsh_user` VALUES ('63', '测试用户', 'jsh', 'e10adc3949ba59abbe56e057f20f883e', '0', '主管', null, '666666@qq.com', '1123123123132', '1', '1', '0', '', null, null, '63'); +INSERT INTO `jsh_user` VALUES ('120', '管理员', 'admin', 'e10adc3949ba59abbe56e057f20f883e', '0', null, null, null, null, '1', '0', '0', null, null, null, '0'); +INSERT INTO `jsh_user` VALUES ('131', 'test123', 'test123', 'e10adc3949ba59abbe56e057f20f883e', '0', '总监', null, '7777777@qq.com', '', '1', '0', '0', '', null, null, '63'); -- ---------------------------- -- Table structure for jsh_user_business diff --git a/jshERP-boot/docs/数据库更新记录-首次安装请勿使用.txt b/jshERP-boot/docs/数据库更新记录-首次安装请勿使用.txt index 01c063d6..90b9f41b 100644 --- a/jshERP-boot/docs/数据库更新记录-首次安装请勿使用.txt +++ b/jshERP-boot/docs/数据库更新记录-首次安装请勿使用.txt @@ -1487,4 +1487,15 @@ alter table jsh_system_config add over_link_bill_flag varchar(1) DEFAULT '0' COM -- by jishenghua -- 给商品主表增加仓位货架 -- -------------------------------------------------------- -alter table jsh_material add position varchar(100) DEFAULT NULL COMMENT '仓位货架' after enable_batch_number; \ No newline at end of file +alter table jsh_material add position varchar(100) DEFAULT NULL COMMENT '仓位货架' after enable_batch_number; + +-- -------------------------------------------------------- +-- 时间 2023年05月28日 +-- by jishenghua +-- 给用户表增加微信绑定字段 +-- 给平台表增加微信登录的相关信息 +-- -------------------------------------------------------- +alter table jsh_user add weixin_open_id varchar(100) DEFAULT NULL COMMENT '微信绑定' after remark; +INSERT INTO `jsh_platform_config` (`platform_key`, `platform_key_info`, `platform_value`) VALUES ('weixinUrl', '微信url', ''); +INSERT INTO `jsh_platform_config` (`platform_key`, `platform_key_info`, `platform_value`) VALUES ('weixinAppid', '微信appid', ''); +INSERT INTO `jsh_platform_config` (`platform_key`, `platform_key_info`, `platform_value`) VALUES ('weixinSecret', '微信secret', ''); \ No newline at end of file diff --git a/jshERP-boot/src/main/java/com/jsh/erp/config/TenantConfig.java b/jshERP-boot/src/main/java/com/jsh/erp/config/TenantConfig.java index 3592d42c..6db85afd 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/config/TenantConfig.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/config/TenantConfig.java @@ -73,7 +73,11 @@ public class TenantConfig { public boolean doFilter(MetaObject metaObject) { MappedStatement ms = SqlParserHelper.getMappedStatement(metaObject); // 过滤自定义查询此时无租户信息约束出现 - if ("com.jsh.erp.datasource.mappers.UserMapperEx.getUserListByUserNameOrLoginName".equals(ms.getId())) { + if ("com.jsh.erp.datasource.mappers.UserMapperEx.getUserByWeixinOpenId".equals(ms.getId())) { + return true; + } else if ("com.jsh.erp.datasource.mappers.UserMapperEx.updateUserWithWeixinOpenId".equals(ms.getId())) { + return true; + } else if ("com.jsh.erp.datasource.mappers.UserMapperEx.getUserListByUserNameOrLoginName".equals(ms.getId())) { return true; } else if ("com.jsh.erp.datasource.mappers.UserMapperEx.disableUserByLimit".equals(ms.getId())) { return true; diff --git a/jshERP-boot/src/main/java/com/jsh/erp/controller/UserController.java b/jshERP-boot/src/main/java/com/jsh/erp/controller/UserController.java index 81c1d857..474bcbf6 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/controller/UserController.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/controller/UserController.java @@ -64,94 +64,18 @@ public class UserController { @Resource private RedisService redisService; - private static final String TEST_USER = "jsh"; private static String SUCCESS = "操作成功"; private static String ERROR = "操作失败"; - private static final String HTTP = "http://"; - private static final String CODE_OK = "200"; - private static final String BASE_CHECK_CODES = "qwertyuiplkjhgfdsazxcvbnmQWERTYUPLKJHGFDSAZXCVBNM1234567890"; @PostMapping(value = "/login") @ApiOperation(value = "登录") public BaseResponseInfo login(@RequestBody User userParam, HttpServletRequest request)throws Exception { - logger.info("============用户登录 login 方法调用开始=============="); - String msgTip = ""; - User user=null; BaseResponseInfo res = new BaseResponseInfo(); try { - - String loginName = userParam.getLoginName().trim(); - String password = userParam.getPassword().trim(); - //判断用户是否已经登录过,登录过不再处理 - Object userId = redisService.getObjectFromSessionByKey(request,"userId"); - if (userId != null) { - logger.info("====用户已经登录过, login 方法调用结束===="); - msgTip = "user already login"; - } - //获取用户状态 - int userStatus = -1; - try { - redisService.deleteObjectBySession(request,"userId"); - userStatus = userService.validateUser(loginName, password); - } catch (Exception e) { - e.printStackTrace(); - logger.error(">>>>>>>>>>>>>用户 " + loginName + " 登录 login 方法 访问服务层异常====", e); - msgTip = "access service exception"; - } - String token = UUID.randomUUID().toString().replaceAll("-", "") + ""; - switch (userStatus) { - case ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST: - msgTip = "user is not exist"; - break; - case ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR: - msgTip = "user password error"; - break; - case ExceptionCodeConstants.UserExceptionCode.BLACK_USER: - msgTip = "user is black"; - break; - case ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION: - msgTip = "access service error"; - break; - case ExceptionCodeConstants.UserExceptionCode.BLACK_TENANT: - msgTip = "tenant is black"; - break; - case ExceptionCodeConstants.UserExceptionCode.EXPIRE_TENANT: - msgTip = "tenant is expire"; - break; - case ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT: - msgTip = "user can login"; - //验证通过 ,可以登录,放入session,记录登录日志 - user = userService.getUserByLoginName(loginName); - if(user.getTenantId()!=null) { - token = token + "_" + user.getTenantId(); - } - redisService.storageObjectBySession(token,"userId",user.getId()); - break; - default: - break; - } - Map data = new HashMap(); - data.put("msgTip", msgTip); - if(user!=null){ - String roleType = userService.getRoleTypeByUserId(user.getId()).getType(); //角色类型 - redisService.storageObjectBySession(token,"roleType",roleType); - redisService.storageObjectBySession(token,"clientIp", Tools.getLocalIp(request)); - logService.insertLogWithUserId(user.getId(), user.getTenantId(), "用户", - new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_LOGIN).append(user.getLoginName()).toString(), - ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); - JSONArray btnStrArr = userService.getBtnStrArrById(user.getId()); - data.put("token", token); - data.put("user", user); - //用户的按钮权限 - if(!"admin".equals(user.getLoginName())){ - data.put("userBtn", btnStrArr); - } - data.put("roleType", roleType); - } + Map data = userService.login(userParam, request); res.code = 200; res.data = data; - logger.info("===============用户登录 login 方法调用结束==============="); } catch(Exception e){ e.printStackTrace(); logger.error(e.getMessage()); @@ -161,6 +85,47 @@ public class UserController { return res; } + @PostMapping(value = "/weixinLogin") + @ApiOperation(value = "微信登录") + public BaseResponseInfo weixinLogin(@RequestBody JSONObject jsonObject, + HttpServletRequest request)throws Exception { + BaseResponseInfo res = new BaseResponseInfo(); + try { + String weixinCode = jsonObject.getString("weixinCode"); + User user = userService.getUserByWeixinCode(weixinCode); + if(user == null) { + res.code = 501; + res.data = "微信未绑定"; + } else { + Map data = userService.login(user, request); + res.code = 200; + res.data = data; + } + } catch(Exception e){ + e.printStackTrace(); + logger.error(e.getMessage()); + res.code = 500; + res.data = "用户登录失败"; + } + return res; + } + + @PostMapping(value = "/weixinBind") + @ApiOperation(value = "绑定微信") + public String weixinBind(@RequestBody JSONObject jsonObject, + HttpServletRequest request)throws Exception { + Map objectMap = new HashMap<>(); + String loginName = jsonObject.getString("loginName"); + String password = jsonObject.getString("password"); + String weixinCode = jsonObject.getString("weixinCode"); + int res = userService.weixinBind(loginName, password, weixinCode); + if(res > 0) { + return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code); + } else { + return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code); + } + } + @GetMapping(value = "/getUserSession") @ApiOperation(value = "获取用户信息") public BaseResponseInfo getSessionUser(HttpServletRequest request)throws Exception { diff --git a/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/User.java b/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/User.java index bf2dceaf..13ce6a0e 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/User.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/User.java @@ -29,6 +29,8 @@ public class User { private String remark; + private String weixinOpenId; + private Long tenantId; public Long getId() { @@ -143,6 +145,14 @@ public class User { this.remark = remark == null ? null : remark.trim(); } + public String getWeixinOpenId() { + return weixinOpenId; + } + + public void setWeixinOpenId(String weixinOpenId) { + this.weixinOpenId = weixinOpenId == null ? null : weixinOpenId.trim(); + } + public Long getTenantId() { return tenantId; } diff --git a/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/UserExample.java b/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/UserExample.java index 71a1fbaf..a125d80f 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/UserExample.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/UserExample.java @@ -1044,6 +1044,76 @@ public class UserExample { return (Criteria) this; } + public Criteria andWeixinOpenIdIsNull() { + addCriterion("weixin_open_id is null"); + return (Criteria) this; + } + + public Criteria andWeixinOpenIdIsNotNull() { + addCriterion("weixin_open_id is not null"); + return (Criteria) this; + } + + public Criteria andWeixinOpenIdEqualTo(String value) { + addCriterion("weixin_open_id =", value, "weixinOpenId"); + return (Criteria) this; + } + + public Criteria andWeixinOpenIdNotEqualTo(String value) { + addCriterion("weixin_open_id <>", value, "weixinOpenId"); + return (Criteria) this; + } + + public Criteria andWeixinOpenIdGreaterThan(String value) { + addCriterion("weixin_open_id >", value, "weixinOpenId"); + return (Criteria) this; + } + + public Criteria andWeixinOpenIdGreaterThanOrEqualTo(String value) { + addCriterion("weixin_open_id >=", value, "weixinOpenId"); + return (Criteria) this; + } + + public Criteria andWeixinOpenIdLessThan(String value) { + addCriterion("weixin_open_id <", value, "weixinOpenId"); + return (Criteria) this; + } + + public Criteria andWeixinOpenIdLessThanOrEqualTo(String value) { + addCriterion("weixin_open_id <=", value, "weixinOpenId"); + return (Criteria) this; + } + + public Criteria andWeixinOpenIdLike(String value) { + addCriterion("weixin_open_id like", value, "weixinOpenId"); + return (Criteria) this; + } + + public Criteria andWeixinOpenIdNotLike(String value) { + addCriterion("weixin_open_id not like", value, "weixinOpenId"); + return (Criteria) this; + } + + public Criteria andWeixinOpenIdIn(List values) { + addCriterion("weixin_open_id in", values, "weixinOpenId"); + return (Criteria) this; + } + + public Criteria andWeixinOpenIdNotIn(List values) { + addCriterion("weixin_open_id not in", values, "weixinOpenId"); + return (Criteria) this; + } + + public Criteria andWeixinOpenIdBetween(String value1, String value2) { + addCriterion("weixin_open_id between", value1, value2, "weixinOpenId"); + return (Criteria) this; + } + + public Criteria andWeixinOpenIdNotBetween(String value1, String value2) { + addCriterion("weixin_open_id not between", value1, value2, "weixinOpenId"); + return (Criteria) this; + } + public Criteria andTenantIdIsNull() { addCriterion("tenant_id is null"); return (Criteria) this; diff --git a/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/UserMapperEx.java b/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/UserMapperEx.java index 800df836..9d9c5a46 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/UserMapperEx.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/UserMapperEx.java @@ -36,4 +36,12 @@ public interface UserMapperEx { List getListByOrgaId( @Param("id") Long id, @Param("orgaId") Long orgaId); + + User getUserByWeixinOpenId( + @Param("weixinOpenId") String weixinOpenId); + + int updateUserWithWeixinOpenId( + @Param("loginName") String loginName, + @Param("password") String password, + @Param("weixinOpenId") String weixinOpenId); } \ No newline at end of file diff --git a/jshERP-boot/src/main/java/com/jsh/erp/filter/LogCostFilter.java b/jshERP-boot/src/main/java/com/jsh/erp/filter/LogCostFilter.java index 71974166..aaef9801 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/filter/LogCostFilter.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/filter/LogCostFilter.java @@ -13,7 +13,7 @@ import java.io.IOException; @WebFilter(filterName = "LogCostFilter", urlPatterns = {"/*"}, initParams = {@WebInitParam(name = "filterPath", - value = "/jshERP-boot/user/login#/jshERP-boot/user/registerUser#/jshERP-boot/user/randomImage#" + + value = "/jshERP-boot/user/login#/jshERP-boot/user/weixinLogin#/jshERP-boot/user/registerUser#/jshERP-boot/user/randomImage#" + "/jshERP-boot/platformConfig/getPlatform#/jshERP-boot/v2/api-docs#/jshERP-boot/webjars#" + "/jshERP-boot/systemConfig/static#/jshERP-boot/api/plugin/wechat/weChat/share")}) public class LogCostFilter implements Filter { diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/user/UserService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/user/UserService.java index f1d2dc14..8dc0c9e6 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/user/UserService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/user/UserService.java @@ -3,8 +3,10 @@ package com.jsh.erp.service.user; import com.jsh.erp.datasource.entities.*; import com.jsh.erp.exception.BusinessParamCheckingException; import com.jsh.erp.service.functions.FunctionService; +import com.jsh.erp.service.platformConfig.PlatformConfigService; import com.jsh.erp.service.redis.RedisService; import com.jsh.erp.service.role.RoleService; +import com.jsh.erp.utils.HttpClient; import org.springframework.util.StringUtils; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -59,6 +61,8 @@ public class UserService { @Resource private FunctionService functionService; @Resource + private PlatformConfigService platformConfigService; + @Resource private RedisService redisService; public User getUser(long id)throws Exception { @@ -282,6 +286,87 @@ public class UserService { return result; } + /** + * 用户登录 + * @param userParam + * @param request + * @return + * @throws Exception + */ + public Map login(User userParam, HttpServletRequest request) throws Exception { + Map data = new HashMap<>(); + String msgTip = ""; + User user=null; + String loginName = userParam.getLoginName().trim(); + String password = userParam.getPassword().trim(); + //判断用户是否已经登录过,登录过不再处理 + Object userId = redisService.getObjectFromSessionByKey(request,"userId"); + if (userId != null) { + logger.info("====用户已经登录过, login 方法调用结束===="); + msgTip = "user already login"; + } + //获取用户状态 + int userStatus = -1; + try { + redisService.deleteObjectBySession(request,"userId"); + userStatus = validateUser(loginName, password); + } catch (Exception e) { + e.printStackTrace(); + logger.error(">>>>>>>>>>>>>用户 " + loginName + " 登录 login 方法 访问服务层异常====", e); + msgTip = "access service exception"; + } + String token = UUID.randomUUID().toString().replaceAll("-", "") + ""; + switch (userStatus) { + case ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST: + msgTip = "user is not exist"; + break; + case ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR: + msgTip = "user password error"; + break; + case ExceptionCodeConstants.UserExceptionCode.BLACK_USER: + msgTip = "user is black"; + break; + case ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION: + msgTip = "access service error"; + break; + case ExceptionCodeConstants.UserExceptionCode.BLACK_TENANT: + msgTip = "tenant is black"; + break; + case ExceptionCodeConstants.UserExceptionCode.EXPIRE_TENANT: + msgTip = "tenant is expire"; + break; + case ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT: + msgTip = "user can login"; + //验证通过 ,可以登录,放入session,记录登录日志 + user = getUserByLoginName(loginName); + if(user.getTenantId()!=null) { + token = token + "_" + user.getTenantId(); + } + redisService.storageObjectBySession(token,"userId",user.getId()); + break; + default: + break; + } + data.put("msgTip", msgTip); + if(user!=null){ + String roleType = getRoleTypeByUserId(user.getId()).getType(); //角色类型 + redisService.storageObjectBySession(token,"roleType",roleType); + redisService.storageObjectBySession(token,"clientIp", Tools.getLocalIp(request)); + logService.insertLogWithUserId(user.getId(), user.getTenantId(), "用户", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_LOGIN).append(user.getLoginName()).toString(), + ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); + JSONArray btnStrArr = getBtnStrArrById(user.getId()); + data.put("token", token); + data.put("user", user); + //用户的按钮权限 + if(!"admin".equals(user.getLoginName())){ + data.put("userBtn", btnStrArr); + } + data.put("roleType", roleType); + } + return data; + } + public int validateUser(String loginName, String password) throws Exception { /**默认是可以登录的*/ List list = null; @@ -803,4 +888,36 @@ public class UserService { } return result; } + + public User getUserByWeixinCode(String weixinCode) throws Exception { + String weixinUrl = platformConfigService.getPlatformConfigByKey("weixinUrl").getPlatformValue(); + String weixinAppid = platformConfigService.getPlatformConfigByKey("weixinAppid").getPlatformValue(); + String weixinSecret = platformConfigService.getPlatformConfigByKey("weixinSecret").getPlatformValue(); + String url = weixinUrl + "?appid=" + weixinAppid + "&secret=" + weixinSecret + "&js_code=" + weixinCode + + "&grant_type=authorization_code"; + JSONObject jsonObject = HttpClient.httpGet(url); + if(jsonObject!=null) { + String weixinOpenId = jsonObject.getString("openid"); + if(StringUtil.isNotEmpty(weixinOpenId)) { + return userMapperEx.getUserByWeixinOpenId(weixinOpenId); + } + } + return null; + } + + public int weixinBind(String loginName, String password, String weixinCode) throws Exception { + String weixinUrl = platformConfigService.getPlatformConfigByKey("weixinUrl").getPlatformValue(); + String weixinAppid = platformConfigService.getPlatformConfigByKey("weixinAppid").getPlatformValue(); + String weixinSecret = platformConfigService.getPlatformConfigByKey("weixinSecret").getPlatformValue(); + String url = weixinUrl + "?appid=" + weixinAppid + "&secret=" + weixinSecret + "&js_code=" + weixinCode + + "&grant_type=authorization_code"; + JSONObject jsonObject = HttpClient.httpGet(url); + if(jsonObject!=null) { + String weixinOpenId = jsonObject.getString("openid"); + if(StringUtil.isNotEmpty(weixinOpenId)) { + return userMapperEx.updateUserWithWeixinOpenId(loginName, password, weixinOpenId); + } + } + return 0; + } } diff --git a/jshERP-boot/src/main/resources/mapper_xml/UserMapper.xml b/jshERP-boot/src/main/resources/mapper_xml/UserMapper.xml index 3687f71c..4124b8c8 100644 --- a/jshERP-boot/src/main/resources/mapper_xml/UserMapper.xml +++ b/jshERP-boot/src/main/resources/mapper_xml/UserMapper.xml @@ -16,6 +16,7 @@ + @@ -78,7 +79,7 @@ id, username, login_name, password, leader_flag, position, department, email, phonenum, - ismanager, isystem, Status, description, remark, tenant_id + ismanager, isystem, Status, description, remark, weixin_open_id, tenant_id select tb.*, (select r.id from jsh_user_business ub @@ -144,4 +145,16 @@ and u.id != #{id} + + + + + update jsh_user u set u.weixin_open_id = #{weixinOpenId} + where u.login_name = #{loginName} and u.password = #{password} + and ifnull(u.status,'0') not in('1','2') + \ No newline at end of file