diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml
index 1d1d687b4..72fe7535e 100644
--- a/ruoyi-admin/pom.xml
+++ b/ruoyi-admin/pom.xml
@@ -61,6 +61,19 @@
ruoyi-generator
+
+
+ com.github.binarywang
+ weixin-java-miniapp
+ 3.8.0
+
+
+ com.ruoyi
+ ruoyi-wxapi
+ 3.7.0
+ compile
+
+
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java
index 7b1d8966a..8aa523b02 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java
@@ -2,6 +2,8 @@ package com.ruoyi.common.core.domain.model;
import java.util.Collection;
import java.util.Set;
+
+import com.ruoyi.common.core.domain.entity.WxUser;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import com.fasterxml.jackson.annotation.JsonIgnore;
@@ -71,6 +73,11 @@ public class LoginUser implements UserDetails
*/
private SysUser user;
+ /**
+ * 微信用户信息
+ */
+ private WxUser wxUser;
+
public Long getUserId()
{
return userId;
@@ -119,17 +126,21 @@ public class LoginUser implements UserDetails
this.permissions = permissions;
}
+ public LoginUser(WxUser wxUser){
+ this.wxUser = wxUser;
+ }
+
@JsonIgnore
@Override
public String getPassword()
{
- return user.getPassword();
+ return user!=null ? user.getPassword() : wxUser.getPassword();
}
@Override
public String getUsername()
{
- return user.getUserName();
+ return user!=null ? user.getUserName() : wxUser.getOpenId();
}
/**
@@ -258,6 +269,14 @@ public class LoginUser implements UserDetails
this.user = user;
}
+ public WxUser getWxUser() {
+ return wxUser;
+ }
+
+ public void setWxUser(WxUser wxUser) {
+ this.wxUser = wxUser;
+ }
+
@Override
public Collection extends GrantedAuthority> getAuthorities()
{
diff --git a/ruoyi-framework/pom.xml b/ruoyi-framework/pom.xml
index 0eea3ce11..c70ae3566 100644
--- a/ruoyi-framework/pom.xml
+++ b/ruoyi-framework/pom.xml
@@ -58,6 +58,12 @@
com.ruoyi
ruoyi-system
+
+ com.ruoyi
+ ruoyi-wxapi
+ 3.7.0
+ compile
+
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
index bd3622901..9563b3ed8 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
@@ -97,7 +97,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 过滤请求
.authorizeRequests()
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
- .antMatchers("/login", "/register", "/captchaImage").anonymous()
+ .antMatchers("/login", "/register", "/captchaImage", "/api/wx/login").anonymous()
.antMatchers(
HttpMethod.GET,
"/",
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java
index 575bd8d80..93f2dab43 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java
@@ -1,5 +1,8 @@
package com.ruoyi.framework.web.service;
+import com.ruoyi.common.core.domain.entity.WxUser;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.wxapi.service.IWxUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -30,9 +33,31 @@ public class UserDetailsServiceImpl implements UserDetailsService
@Autowired
private SysPermissionService permissionService;
+ @Autowired
+ private IWxUserService wxUserService;
+
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException
{
+ if (StringUtils.isNotEmpty(username) && username.startsWith("wx_openid_")){
+ String openId = username.replace("wx_openid_", "");
+ WxUser wxUser = wxUserService.selectWxUserByOpenId(openId);
+ wxUser.setPassword(SecurityUtils.encryptPassword(wxUser.getOpenId()));
+ if (StringUtils.isNull(wxUser))
+ {
+ log.info("登录用户:{} 不存在.", openId);
+ throw new ServiceException("登录用户不存在");
+ }
+ else if ("3".equals(wxUser.getStatus()))
+ {
+ log.info("登录用户:{} 已被停用.", openId);
+ throw new ServiceException("对不起,您的账号已停用");
+ }
+
+ return new LoginUser(wxUser);
+ }
+
+
SysUser user = userService.selectUserByUserName(username);
if (StringUtils.isNull(user))
{
diff --git a/ruoyi-wxapi/pom.xml b/ruoyi-wxapi/pom.xml
new file mode 100644
index 000000000..307c7c990
--- /dev/null
+++ b/ruoyi-wxapi/pom.xml
@@ -0,0 +1,33 @@
+
+
+
+ ruoyi
+ com.ruoyi
+ 3.7.0
+
+ 4.0.0
+
+ ruoyi-wxapi
+
+
+ wxapi系统模块
+
+
+
+ org.springframework.boot
+ spring-boot
+
+
+ com.github.binarywang
+ weixin-java-miniapp
+ 3.8.0
+
+
+ com.ruoyi
+ ruoyi-common
+
+
+
+
\ No newline at end of file
diff --git a/ruoyi-wxapi/src/main/java/com/ruoyi/wxapi/domain/WxApp.java b/ruoyi-wxapi/src/main/java/com/ruoyi/wxapi/domain/WxApp.java
new file mode 100644
index 000000000..37c43da31
--- /dev/null
+++ b/ruoyi-wxapi/src/main/java/com/ruoyi/wxapi/domain/WxApp.java
@@ -0,0 +1,124 @@
+package com.ruoyi.wxapi.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 小程序设置对象 wx_app
+ *
+ * @author tgq
+ * @date 2021-09-01
+ */
+public class WxApp extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** id */
+ private Long id;
+
+ /** 小程序代号 */
+ @Excel(name = "小程序代号")
+ private String appCode;
+
+ /** 小程序名称 */
+ @Excel(name = "小程序名称")
+ private String appName;
+
+ /** 小程序id */
+ @Excel(name = "小程序id")
+ private String appId;
+
+ /** 小程序secret */
+ private String secret;
+
+ /** 服务器域名 */
+ @Excel(name = "服务器域名")
+ private String apiDomain;
+
+ /** 状态(1:正常,2:停用) */
+ @Excel(name = "状态(1:正常,2:停用)")
+ private String status;
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+ public void setAppCode(String appCode)
+ {
+ this.appCode = appCode;
+ }
+
+ public String getAppCode()
+ {
+ return appCode;
+ }
+ public void setAppName(String appName)
+ {
+ this.appName = appName;
+ }
+
+ public String getAppName()
+ {
+ return appName;
+ }
+ public void setAppId(String appId)
+ {
+ this.appId = appId;
+ }
+
+ public String getAppId()
+ {
+ return appId;
+ }
+ public void setSecret(String secret)
+ {
+ this.secret = secret;
+ }
+
+ public String getSecret()
+ {
+ return secret;
+ }
+ public void setApiDomain(String apiDomain)
+ {
+ this.apiDomain = apiDomain;
+ }
+
+ public String getApiDomain()
+ {
+ return apiDomain;
+ }
+ public void setStatus(String status)
+ {
+ this.status = status;
+ }
+
+ public String getStatus()
+ {
+ return status;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("appCode", getAppCode())
+ .append("appName", getAppName())
+ .append("appId", getAppId())
+ .append("secret", getSecret())
+ .append("apiDomain", getApiDomain())
+ .append("status", getStatus())
+ .append("createBy", getCreateBy())
+ .append("createTime", getCreateTime())
+ .append("updateBy", getUpdateBy())
+ .append("updateTime", getUpdateTime())
+ .toString();
+ }
+}
diff --git a/ruoyi-wxapi/src/main/java/com/ruoyi/wxapi/mapper/WxAppMapper.java b/ruoyi-wxapi/src/main/java/com/ruoyi/wxapi/mapper/WxAppMapper.java
new file mode 100644
index 000000000..345410616
--- /dev/null
+++ b/ruoyi-wxapi/src/main/java/com/ruoyi/wxapi/mapper/WxAppMapper.java
@@ -0,0 +1,69 @@
+package com.ruoyi.wxapi.mapper;
+
+import java.util.List;
+import com.ruoyi.wxapi.domain.WxApp;
+
+/**
+ * 小程序设置Mapper接口
+ *
+ * @author tgq
+ * @date 2021-09-01
+ */
+public interface WxAppMapper
+{
+ /**
+ * 查询小程序设置
+ *
+ * @param id 小程序设置主键
+ * @return 小程序设置
+ */
+ public WxApp selectWxAppById(Long id);
+
+ /**
+ * 查询小程序设置
+ *
+ * @param code 小程序code
+ * @return 小程序设置
+ */
+ public WxApp selectWxAppByCode(String code);
+
+ /**
+ * 查询小程序设置列表
+ *
+ * @param wxApp 小程序设置
+ * @return 小程序设置集合
+ */
+ public List selectWxAppList(WxApp wxApp);
+
+ /**
+ * 新增小程序设置
+ *
+ * @param wxApp 小程序设置
+ * @return 结果
+ */
+ public int insertWxApp(WxApp wxApp);
+
+ /**
+ * 修改小程序设置
+ *
+ * @param wxApp 小程序设置
+ * @return 结果
+ */
+ public int updateWxApp(WxApp wxApp);
+
+ /**
+ * 删除小程序设置
+ *
+ * @param id 小程序设置主键
+ * @return 结果
+ */
+ public int deleteWxAppById(Long id);
+
+ /**
+ * 批量删除小程序设置
+ *
+ * @param ids 需要删除的数据主键集合
+ * @return 结果
+ */
+ public int deleteWxAppByIds(Long[] ids);
+}
diff --git a/ruoyi-wxapi/src/main/java/com/ruoyi/wxapi/mapper/WxUserMapper.java b/ruoyi-wxapi/src/main/java/com/ruoyi/wxapi/mapper/WxUserMapper.java
new file mode 100644
index 000000000..d2457f24f
--- /dev/null
+++ b/ruoyi-wxapi/src/main/java/com/ruoyi/wxapi/mapper/WxUserMapper.java
@@ -0,0 +1,69 @@
+package com.ruoyi.wxapi.mapper;
+
+import java.util.List;
+import com.ruoyi.common.core.domain.entity.WxUser;
+
+/**
+ * 小程序用户Mapper接口
+ *
+ * @author tgq
+ * @date 2021-09-01
+ */
+public interface WxUserMapper
+{
+ /**
+ * 查询小程序用户
+ *
+ * @param id 小程序用户主键
+ * @return 小程序用户
+ */
+ public WxUser selectWxUserById(Long id);
+
+ /**
+ * 查询小程序用户
+ *
+ * @param openId 小程序用户openId
+ * @return 小程序用户
+ */
+ public WxUser selectWxUserByOpenId(String openId);
+
+ /**
+ * 查询小程序用户列表
+ *
+ * @param wxUser 小程序用户
+ * @return 小程序用户集合
+ */
+ public List selectWxUserList(WxUser wxUser);
+
+ /**
+ * 新增小程序用户
+ *
+ * @param wxUser 小程序用户
+ * @return 结果
+ */
+ public int insertWxUser(WxUser wxUser);
+
+ /**
+ * 修改小程序用户
+ *
+ * @param wxUser 小程序用户
+ * @return 结果
+ */
+ public int updateWxUser(WxUser wxUser);
+
+ /**
+ * 删除小程序用户
+ *
+ * @param id 小程序用户主键
+ * @return 结果
+ */
+ public int deleteWxUserById(Long id);
+
+ /**
+ * 批量删除小程序用户
+ *
+ * @param ids 需要删除的数据主键集合
+ * @return 结果
+ */
+ public int deleteWxUserByIds(Long[] ids);
+}
diff --git a/ruoyi-wxapi/src/main/java/com/ruoyi/wxapi/service/IWxAppService.java b/ruoyi-wxapi/src/main/java/com/ruoyi/wxapi/service/IWxAppService.java
new file mode 100644
index 000000000..f82cff611
--- /dev/null
+++ b/ruoyi-wxapi/src/main/java/com/ruoyi/wxapi/service/IWxAppService.java
@@ -0,0 +1,71 @@
+package com.ruoyi.wxapi.service;
+
+import java.util.List;
+
+import cn.binarywang.wx.miniapp.api.WxMaService;
+import com.ruoyi.wxapi.domain.WxApp;
+
+/**
+ * 小程序设置Service接口
+ *
+ * @author tgq
+ * @date 2021-09-01
+ */
+public interface IWxAppService
+{
+ /**
+ * 查询小程序设置
+ *
+ * @param id 小程序设置主键
+ * @return 小程序设置
+ */
+ public WxApp selectWxAppById(Long id);
+
+ /**
+ * 查询小程序设置列表
+ *
+ * @param wxApp 小程序设置
+ * @return 小程序设置集合
+ */
+ public List selectWxAppList(WxApp wxApp);
+
+ /**
+ * 新增小程序设置
+ *
+ * @param wxApp 小程序设置
+ * @return 结果
+ */
+ public int insertWxApp(WxApp wxApp);
+
+ /**
+ * 修改小程序设置
+ *
+ * @param wxApp 小程序设置
+ * @return 结果
+ */
+ public int updateWxApp(WxApp wxApp);
+
+ /**
+ * 批量删除小程序设置
+ *
+ * @param ids 需要删除的小程序设置主键集合
+ * @return 结果
+ */
+ public int deleteWxAppByIds(Long[] ids);
+
+ /**
+ * 删除小程序设置信息
+ *
+ * @param id 小程序设置主键
+ * @return 结果
+ */
+ public int deleteWxAppById(Long id);
+
+ /**
+ * 获取微信小程序服务
+ *
+ * @param code 小程序code
+ * @return 结果
+ */
+ public WxMaService getMaService(String code);
+}
diff --git a/ruoyi-wxapi/src/main/java/com/ruoyi/wxapi/service/IWxUserService.java b/ruoyi-wxapi/src/main/java/com/ruoyi/wxapi/service/IWxUserService.java
new file mode 100644
index 000000000..0586eeaf4
--- /dev/null
+++ b/ruoyi-wxapi/src/main/java/com/ruoyi/wxapi/service/IWxUserService.java
@@ -0,0 +1,69 @@
+package com.ruoyi.wxapi.service;
+
+import java.util.List;
+import com.ruoyi.common.core.domain.entity.WxUser;
+
+/**
+ * 小程序用户Service接口
+ *
+ * @author tgq
+ * @date 2021-09-01
+ */
+public interface IWxUserService
+{
+ /**
+ * 查询小程序用户
+ *
+ * @param id 小程序用户主键
+ * @return 小程序用户
+ */
+ public WxUser selectWxUserById(Long id);
+
+ /**
+ * 查询小程序用户
+ *
+ * @param openId 小程序用户openId
+ * @return 小程序用户
+ */
+ public WxUser selectWxUserByOpenId(String openId);
+
+ /**
+ * 查询小程序用户列表
+ *
+ * @param wxUser 小程序用户
+ * @return 小程序用户集合
+ */
+ public List selectWxUserList(WxUser wxUser);
+
+ /**
+ * 新增小程序用户
+ *
+ * @param wxUser 小程序用户
+ * @return 结果
+ */
+ public int insertWxUser(WxUser wxUser);
+
+ /**
+ * 修改小程序用户
+ *
+ * @param wxUser 小程序用户
+ * @return 结果
+ */
+ public int updateWxUser(WxUser wxUser);
+
+ /**
+ * 批量删除小程序用户
+ *
+ * @param ids 需要删除的小程序用户主键集合
+ * @return 结果
+ */
+ public int deleteWxUserByIds(Long[] ids);
+
+ /**
+ * 删除小程序用户信息
+ *
+ * @param id 小程序用户主键
+ * @return 结果
+ */
+ public int deleteWxUserById(Long id);
+}
diff --git a/ruoyi-wxapi/src/main/java/com/ruoyi/wxapi/service/impl/WxAppServiceImpl.java b/ruoyi-wxapi/src/main/java/com/ruoyi/wxapi/service/impl/WxAppServiceImpl.java
new file mode 100644
index 000000000..4dcb988c8
--- /dev/null
+++ b/ruoyi-wxapi/src/main/java/com/ruoyi/wxapi/service/impl/WxAppServiceImpl.java
@@ -0,0 +1,125 @@
+package com.ruoyi.wxapi.service.impl;
+
+import java.util.List;
+
+import cn.binarywang.wx.miniapp.api.WxMaService;
+import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
+import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.wxapi.mapper.WxAppMapper;
+import com.ruoyi.wxapi.domain.WxApp;
+import com.ruoyi.wxapi.service.IWxAppService;
+
+/**
+ * 小程序设置Service业务层处理
+ *
+ * @author tgq
+ * @date 2021-09-01
+ */
+@Service
+public class WxAppServiceImpl implements IWxAppService
+{
+ @Autowired
+ private WxAppMapper wxAppMapper;
+
+ /**
+ * 查询小程序设置
+ *
+ * @param id 小程序设置主键
+ * @return 小程序设置
+ */
+ @Override
+ public WxApp selectWxAppById(Long id)
+ {
+ return wxAppMapper.selectWxAppById(id);
+ }
+
+ /**
+ * 查询小程序设置列表
+ *
+ * @param wxApp 小程序设置
+ * @return 小程序设置
+ */
+ @Override
+ public List selectWxAppList(WxApp wxApp)
+ {
+ return wxAppMapper.selectWxAppList(wxApp);
+ }
+
+ /**
+ * 新增小程序设置
+ *
+ * @param wxApp 小程序设置
+ * @return 结果
+ */
+ @Override
+ public int insertWxApp(WxApp wxApp)
+ {
+ wxApp.setCreateTime(DateUtils.getNowDate());
+ return wxAppMapper.insertWxApp(wxApp);
+ }
+
+ /**
+ * 修改小程序设置
+ *
+ * @param wxApp 小程序设置
+ * @return 结果
+ */
+ @Override
+ public int updateWxApp(WxApp wxApp)
+ {
+ wxApp.setUpdateTime(DateUtils.getNowDate());
+ return wxAppMapper.updateWxApp(wxApp);
+ }
+
+ /**
+ * 批量删除小程序设置
+ *
+ * @param ids 需要删除的小程序设置主键
+ * @return 结果
+ */
+ @Override
+ public int deleteWxAppByIds(Long[] ids)
+ {
+ return wxAppMapper.deleteWxAppByIds(ids);
+ }
+
+ /**
+ * 删除小程序设置信息
+ *
+ * @param id 小程序设置主键
+ * @return 结果
+ */
+ @Override
+ public int deleteWxAppById(Long id)
+ {
+ return wxAppMapper.deleteWxAppById(id);
+ }
+
+
+ /**
+ * 获取微信小程序服务
+ *
+ * @param code 小程序code
+ * @return 结果
+ */
+ @Override
+ public WxMaService getMaService(String code) {
+ WxApp wxApp = wxAppMapper.selectWxAppByCode(code);
+ if (wxApp == null) {
+ throw new IllegalArgumentException(String.format("未找到对应appcode=[%s]的配置,请核实!", code));
+ }
+ WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
+ config.setAppid(wxApp.getAppId());
+ config.setSecret(wxApp.getSecret());
+// config.setToken(null);
+// config.setAesKey(null);
+// config.setMsgDataFormat(null);
+
+ WxMaService service = new WxMaServiceImpl();
+ service.setWxMaConfig(config);
+ return service;
+ }
+}
diff --git a/ruoyi-wxapi/src/main/java/com/ruoyi/wxapi/service/impl/WxUserServiceImpl.java b/ruoyi-wxapi/src/main/java/com/ruoyi/wxapi/service/impl/WxUserServiceImpl.java
new file mode 100644
index 000000000..dd3eb1afa
--- /dev/null
+++ b/ruoyi-wxapi/src/main/java/com/ruoyi/wxapi/service/impl/WxUserServiceImpl.java
@@ -0,0 +1,107 @@
+package com.ruoyi.wxapi.service.impl;
+
+import java.util.List;
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.wxapi.mapper.WxUserMapper;
+import com.ruoyi.common.core.domain.entity.WxUser;
+import com.ruoyi.wxapi.service.IWxUserService;
+
+/**
+ * 小程序用户Service业务层处理
+ *
+ * @author tgq
+ * @date 2021-09-01
+ */
+@Service
+public class WxUserServiceImpl implements IWxUserService
+{
+ @Autowired
+ private WxUserMapper wxUserMapper;
+
+ /**
+ * 查询小程序用户
+ *
+ * @param id 小程序用户主键
+ * @return 小程序用户
+ */
+ @Override
+ public WxUser selectWxUserById(Long id)
+ {
+ return wxUserMapper.selectWxUserById(id);
+ }
+
+ /**
+ * 查询小程序用户
+ *
+ * @param openId 小程序用户openId
+ * @return 小程序用户
+ */
+ @Override
+ public WxUser selectWxUserByOpenId(String openId) {
+ return wxUserMapper.selectWxUserByOpenId(openId);
+ }
+
+ /**
+ * 查询小程序用户列表
+ *
+ * @param wxUser 小程序用户
+ * @return 小程序用户
+ */
+ @Override
+ public List selectWxUserList(WxUser wxUser)
+ {
+ return wxUserMapper.selectWxUserList(wxUser);
+ }
+
+ /**
+ * 新增小程序用户
+ *
+ * @param wxUser 小程序用户
+ * @return 结果
+ */
+ @Override
+ public int insertWxUser(WxUser wxUser)
+ {
+ wxUser.setCreateTime(DateUtils.getNowDate());
+ return wxUserMapper.insertWxUser(wxUser);
+ }
+
+ /**
+ * 修改小程序用户
+ *
+ * @param wxUser 小程序用户
+ * @return 结果
+ */
+ @Override
+ public int updateWxUser(WxUser wxUser)
+ {
+ wxUser.setUpdateTime(DateUtils.getNowDate());
+ return wxUserMapper.updateWxUser(wxUser);
+ }
+
+ /**
+ * 批量删除小程序用户
+ *
+ * @param ids 需要删除的小程序用户主键
+ * @return 结果
+ */
+ @Override
+ public int deleteWxUserByIds(Long[] ids)
+ {
+ return wxUserMapper.deleteWxUserByIds(ids);
+ }
+
+ /**
+ * 删除小程序用户信息
+ *
+ * @param id 小程序用户主键
+ * @return 结果
+ */
+ @Override
+ public int deleteWxUserById(Long id)
+ {
+ return wxUserMapper.deleteWxUserById(id);
+ }
+}
diff --git a/ruoyi-wxapi/src/main/resources/mapper/wxapi/WxAppMapper.xml b/ruoyi-wxapi/src/main/resources/mapper/wxapi/WxAppMapper.xml
new file mode 100644
index 000000000..309f0ca9b
--- /dev/null
+++ b/ruoyi-wxapi/src/main/resources/mapper/wxapi/WxAppMapper.xml
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select id, app_code, app_name, app_id, secret, api_domain, status, create_by, create_time, update_by, update_time from wx_app
+
+
+
+
+
+
+
+
+
+ insert into wx_app
+
+ id,
+ app_code,
+ app_name,
+ app_id,
+ secret,
+ api_domain,
+ status,
+ create_by,
+ create_time,
+ update_by,
+ update_time,
+
+
+ #{id},
+ #{appCode},
+ #{appName},
+ #{appId},
+ #{secret},
+ #{apiDomain},
+ #{status},
+ #{createBy},
+ #{createTime},
+ #{updateBy},
+ #{updateTime},
+
+
+
+
+ update wx_app
+
+ app_code = #{appCode},
+ app_name = #{appName},
+ app_id = #{appId},
+ secret = #{secret},
+ api_domain = #{apiDomain},
+ status = #{status},
+ create_by = #{createBy},
+ create_time = #{createTime},
+ update_by = #{updateBy},
+ update_time = #{updateTime},
+
+ where id = #{id}
+
+
+
+ delete from wx_app where id = #{id}
+
+
+
+ delete from wx_app where id in
+
+ #{id}
+
+
+
\ No newline at end of file
diff --git a/ruoyi-wxapi/src/main/resources/mapper/wxapi/WxUserMapper.xml b/ruoyi-wxapi/src/main/resources/mapper/wxapi/WxUserMapper.xml
new file mode 100644
index 000000000..91569c902
--- /dev/null
+++ b/ruoyi-wxapi/src/main/resources/mapper/wxapi/WxUserMapper.xml
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select id, union_id, open_id, nick_name, name, status, avatar_url, gender, country, province, city, mobile, app_id, create_by, create_time, update_by, update_time from wx_user
+
+
+
+
+
+
+
+
+
+ insert into wx_user
+
+ union_id,
+ open_id,
+ nick_name,
+ name,
+ status,
+ avatar_url,
+ gender,
+ country,
+ province,
+ city,
+ mobile,
+ app_id,
+ create_by,
+ create_time,
+ update_by,
+ update_time,
+
+
+ #{unionId},
+ #{openId},
+ #{nickName},
+ #{name},
+ #{status},
+ #{avatarUrl},
+ #{gender},
+ #{country},
+ #{province},
+ #{city},
+ #{mobile},
+ #{appId},
+ #{createBy},
+ #{createTime},
+ #{updateBy},
+ #{updateTime},
+
+
+
+
+ update wx_user
+
+ union_id = #{unionId},
+ open_id = #{openId},
+ nick_name = #{nickName},
+ name = #{name},
+ status = #{status},
+ avatar_url = #{avatarUrl},
+ gender = #{gender},
+ country = #{country},
+ province = #{province},
+ city = #{city},
+ mobile = #{mobile},
+ app_id = #{appId},
+ create_by = #{createBy},
+ create_time = #{createTime},
+ update_by = #{updateBy},
+ update_time = #{updateTime},
+
+ where id = #{id}
+
+
+
+ delete from wx_user where id = #{id}
+
+
+
+ delete from wx_user where id in
+
+ #{id}
+
+
+
\ No newline at end of file