拆分核心模块
This commit is contained in:
@@ -6,15 +6,12 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.hutool.http.useragent.UserAgent;
|
||||
import cn.hutool.http.useragent.UserAgentUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.annotation.OperationModule;
|
||||
import com.gxwebsoft.common.core.utils.JSONUtil;
|
||||
import com.gxwebsoft.common.system.entity.OperationRecord;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.service.OperationRecordService;
|
||||
import com.gxwebsoft.shop.entity.UserLook;
|
||||
import com.gxwebsoft.shop.service.UserLookService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
@@ -44,8 +41,6 @@ import java.util.Map;
|
||||
public class OperationLogAspect {
|
||||
@Resource
|
||||
private OperationRecordService operationRecordService;
|
||||
@Resource
|
||||
private UserLookService userLookService;
|
||||
|
||||
// 参数、返回结果、错误信息等最大保存长度
|
||||
private static final int MAX_LENGTH = 1000;
|
||||
@@ -128,19 +123,6 @@ public class OperationLogAspect {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 记录访客日志
|
||||
// System.out.println("record = " + record);
|
||||
// if (record.getMethod().equals("com.gxwebsoft.love.controller.UserProfileController.detail")) {
|
||||
// final Integer toUserId = Integer.valueOf(StrUtil.removeSuffix(record.getParams()," "));
|
||||
// if (userLookService.count(new LambdaQueryWrapper<UserLook>().eq(UserLook::getUserId,record.getUserId()).eq(UserLook::getToUserId,toUserId)) == 0) {
|
||||
// final UserLook userLook = new UserLook();
|
||||
// userLook.setUserId(record.getUserId());
|
||||
// userLook.setToUserId(toUserId);
|
||||
// userLookService.save(userLook);
|
||||
// }
|
||||
// }
|
||||
|
||||
operationRecordService.saveAsync(record);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import com.gxwebsoft.common.core.Constants;
|
||||
import com.gxwebsoft.common.core.utils.JSONUtil;
|
||||
import com.gxwebsoft.shop.entity.Payment;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.SignatureAlgorithm;
|
||||
@@ -108,16 +107,6 @@ public class JwtUtil {
|
||||
return JSONUtil.parseObject(claims.getSubject(), JwtSubject.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析支付方式里的json数据
|
||||
*
|
||||
* @param payment Payment
|
||||
* @return Payment
|
||||
*/
|
||||
public static Payment getPaymentConfig(Payment payment){
|
||||
return JSONUtil.parseObject(payment.getConfig(), Payment.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成Key
|
||||
*
|
||||
|
||||
@@ -1,149 +0,0 @@
|
||||
package com.gxwebsoft.common.core.utils;
|
||||
|
||||
import com.gxwebsoft.oa.entity.Assets;
|
||||
import com.gxwebsoft.oa.service.AssetsService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.math.BigInteger;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 宝塔工具类
|
||||
* @author 科技小王子
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class BtUtil {
|
||||
public static Integer tenantId;
|
||||
public static String server;
|
||||
public static String token;
|
||||
private static String timestamp;
|
||||
@Resource
|
||||
private AssetsService assetsService;
|
||||
|
||||
// 实例化客户端
|
||||
public BtUtil client(Integer id) {
|
||||
Assets assets = assetsService.getByIdRel(id);
|
||||
try {
|
||||
String btSign = assets.getBtSign();
|
||||
server = "http://".concat(assets.getCode()).concat(":9003");
|
||||
String url = "http://".concat(assets.getCode()) + ":9003/system?action=GetSystemTotal";
|
||||
timestamp = (new Date().getTime()+"");
|
||||
String md5Sign = getMd5(btSign);
|
||||
String temp = timestamp+md5Sign;
|
||||
token = getMd5(temp);
|
||||
|
||||
String json = "request_time="+timestamp+"&request_token="+token;
|
||||
String responseText = sendPost(url,json);
|
||||
System.out.println("responseText = " + responseText);
|
||||
System.out.println(responseText);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSystemTotal(){
|
||||
String url = server.concat("/system?action=GetSystemTotal");
|
||||
String json = "request_time="+timestamp+"&request_token="+token;
|
||||
String responseText = sendPost(url,json);
|
||||
System.out.println("responseText = " + responseText);
|
||||
return responseText;
|
||||
}
|
||||
|
||||
public String getDiskInfo(){
|
||||
String url = server.concat("/system?action=GetDiskInfo");
|
||||
String json = "request_time="+timestamp+"&request_token="+token;
|
||||
return sendPost(url,json);
|
||||
}
|
||||
|
||||
// public void config()
|
||||
// {
|
||||
// try {
|
||||
// System.out.println("tenantId = " + tenantId);
|
||||
// String btSign = "XXXXXXXXXXXXXXXXXXXXXXXX";
|
||||
// String url = "http://XXX.XXX.XXX.XXX:8888/system?action=GetSystemTotal";
|
||||
// String timestamp = (new Date().getTime()+"");
|
||||
// String md5Sign = getMd5(btSign);
|
||||
// String temp = timestamp+md5Sign;
|
||||
// String token = getMd5(temp);
|
||||
//
|
||||
// String json = "request_time="+timestamp+"&request_token="+token;
|
||||
// String responseText = sendPost(url,json);
|
||||
// System.out.println(responseText);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
|
||||
public static String getMd5(String str) throws Exception
|
||||
{
|
||||
try {
|
||||
// 生成一个MD5加密计算摘要
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
// 计算md5函数
|
||||
md.update(str.getBytes());
|
||||
// digest()最后确定返回md5 hash值,返回值为8为字符串。因为md5 hash值是16位的hex值,实际上就是8位的字符
|
||||
// BigInteger函数则将8位的字符串转换成16位hex值,用字符串来表示;得到字符串形式的hash值
|
||||
return new BigInteger(1, md.digest()).toString(16);
|
||||
} catch (Exception e) {
|
||||
throw new Exception("MD5加密出现错误,"+e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public static String sendPost(String url, String param) {
|
||||
PrintWriter out = null;
|
||||
BufferedReader in = null;
|
||||
StringBuffer result = new StringBuffer();
|
||||
try {
|
||||
URL realUrl = new URL(url);
|
||||
// 打开和URL之间的连接
|
||||
URLConnection conn = realUrl.openConnection();
|
||||
// 设置通用的请求属性
|
||||
conn.setRequestProperty("accept", "text/xml,text/javascript,text/html,application/json");
|
||||
conn.setRequestProperty("connection", "Keep-Alive");
|
||||
// 发送POST请求必须设置如下两行
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
// 获取URLConnection对象对应的输出流
|
||||
out = new PrintWriter(conn.getOutputStream());
|
||||
// 发送请求参数
|
||||
out.print(param);
|
||||
// flush输出流的缓冲
|
||||
out.flush();
|
||||
// 定义BufferedReader输入流来读取URL的响应
|
||||
in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
result.append(line);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("发送 POST 请求出现异常!"+e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
//使用finally块来关闭输出流、输入流
|
||||
finally{
|
||||
try{
|
||||
if(out!=null){
|
||||
out.close();
|
||||
}
|
||||
if(in!=null){
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
catch(IOException ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.gxwebsoft.common.core.utils;
|
||||
|
||||
import com.gxwebsoft.shop.service.OrderService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 自动执行计划
|
||||
*
|
||||
* @author WebSoft
|
||||
* @since 2018-12-14 08:38:19
|
||||
*/
|
||||
public class SchedulingUtil {
|
||||
@Resource
|
||||
private OrderService orderService;
|
||||
|
||||
// @Scheduled(cron="*/5 * * * * *")
|
||||
// public void reportCurrentTime() {
|
||||
// System.out.println("定时任务开始 = " + new Date());
|
||||
// int count = orderService.count(new LambdaQueryWrapper<Order>().eq(Order::getPayStatus, 20));
|
||||
//// orderService.removeOrderByTimeOut();
|
||||
// System.out.println("count = " + count);
|
||||
// }
|
||||
}
|
||||
@@ -5,13 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.common.core.Constants;
|
||||
import com.gxwebsoft.common.core.exception.BusinessException;
|
||||
import com.gxwebsoft.common.core.utils.CacheClient;
|
||||
import com.gxwebsoft.common.core.utils.SignCheckUtil;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.service.UserService;
|
||||
import com.gxwebsoft.shop.entity.Merchant;
|
||||
import com.gxwebsoft.shop.service.MerchantClerkService;
|
||||
import com.gxwebsoft.shop.service.MerchantService;
|
||||
import org.springframework.beans.propertyeditors.StringTrimmerEditor;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.security.core.Authentication;
|
||||
@@ -21,10 +16,7 @@ import org.springframework.web.bind.annotation.InitBinder;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Controller基类
|
||||
@@ -38,12 +30,6 @@ public class BaseController {
|
||||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
@Resource
|
||||
private MerchantService merchantService;
|
||||
@Resource
|
||||
private MerchantClerkService merchantClerkService;
|
||||
@Resource
|
||||
private CacheClient cacheClient;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
@@ -207,98 +193,10 @@ public class BaseController {
|
||||
return request.getHeader("Authorization");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录用户所属的商户编号
|
||||
*
|
||||
* @return merchantCode
|
||||
*/
|
||||
public String getMerchantCode() {
|
||||
// 按店员查询
|
||||
return merchantClerkService.getMerchantCodeByClerk(getLoginUserId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录的商户信息
|
||||
*
|
||||
* @return merchantCode
|
||||
*/
|
||||
public Merchant getMerchant() {
|
||||
return merchantService.getMerchantByCode(getMerchantCode());
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
// 兼容小写
|
||||
if(request.getHeader("appid") != null){
|
||||
return request.getHeader("appid");
|
||||
}
|
||||
return request.getHeader("AppId");
|
||||
}
|
||||
|
||||
public String getSign() {
|
||||
return request.getParameter("sign");
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否校验签名信息
|
||||
* 存在签名信息则需要验证
|
||||
*/
|
||||
public void isCheckSign() {
|
||||
if (StrUtil.isNotBlank(getSign())) {
|
||||
if(getTenantId() == null){
|
||||
throw new BusinessException("签名失败:TenantId不能为空");
|
||||
}
|
||||
|
||||
String timestamp1 = request.getParameter("timestamp");
|
||||
long timestamp2 = System.currentTimeMillis();
|
||||
long time = timestamp2 - Long.parseLong(timestamp1);
|
||||
if(time > 600000L){
|
||||
throw new BusinessException("签名失败:请求超时");
|
||||
}
|
||||
|
||||
Enumeration<String> names = request.getParameterNames();
|
||||
//2.遍历正文名称的枚举获得请求参数
|
||||
Map<String, String> params = new HashMap<>();
|
||||
while(names.hasMoreElements()){
|
||||
String name = names.nextElement();
|
||||
String value = request.getParameter(name);
|
||||
params.put(name,value);
|
||||
}
|
||||
String signString = SignCheckUtil.getSignString(params, getAppSecret());
|
||||
System.out.println("请求的参数 = " + params);
|
||||
System.out.println("正确的签名 = " + signString);
|
||||
System.out.println("签名是否正确 = " + SignCheckUtil.signCheck(params, getAppSecret()));
|
||||
|
||||
if (!SignCheckUtil.signCheck(params, getAppSecret())) {
|
||||
throw new BusinessException("签名失败");
|
||||
}
|
||||
}
|
||||
|
||||
// 模拟提交参数
|
||||
// String key = "FRbMx1FkG4Qz6GZxY";
|
||||
// Map<String, String> param0 = new HashMap<>();
|
||||
// param0.put("orderId", "D2018062976332656413");
|
||||
// param0.put("MainAccountID", "DC3NHPJ73S");
|
||||
// param0.put("MainAccountSN", "320");
|
||||
// param0.put("payStatus", "2");
|
||||
// param0.put("title","测试");
|
||||
// System.out.println("请求的参数 = " + param0);
|
||||
// String signString0 = SignCheckUtil.getSignString(param0, key);
|
||||
// System.out.println("signString0 = " + signString0);
|
||||
|
||||
// return SignCheckUtil.signCheck(params, getAppSecret());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前请求租户的AppSecret
|
||||
*
|
||||
* @return AppSecret
|
||||
*/
|
||||
public String getAppSecret() {
|
||||
String key = "cache5:AppSecret:" + Integer.valueOf(getAppId());
|
||||
System.out.println("key = " + key);
|
||||
return stringRedisTemplate.opsForValue().get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据账号|手机号码|邮箱查找用户ID
|
||||
* @return userId
|
||||
|
||||
@@ -71,7 +71,6 @@ public class FileController extends BaseController {
|
||||
result.setThumbnail(requestURL + "/thumbnail" + path);
|
||||
}
|
||||
result.setDownloadUrl(config.getFileServer() + "/download" + path);
|
||||
result.setMerchantCode(getMerchantCode());
|
||||
// 云存储配置
|
||||
final String s = redisUtil.get("setting:upload:" + getTenantId());
|
||||
final JSONObject jsonObject = JSONObject.parseObject(s);
|
||||
@@ -111,7 +110,6 @@ public class FileController extends BaseController {
|
||||
result.setPath(path);
|
||||
result.setUrl(requestURL + path);
|
||||
result.setThumbnail(FileServerUtil.isImage(upload) ? (requestURL + "/thumbnail" + path) : null);
|
||||
result.setMerchantCode(getMerchantCode());
|
||||
fileRecordService.save(result);
|
||||
return success(result);
|
||||
} catch (Exception e) {
|
||||
@@ -148,7 +146,6 @@ public class FileController extends BaseController {
|
||||
result.setThumbnail(requestURL + "/thumbnail" + path);
|
||||
}
|
||||
result.setDownloadUrl(requestURL + "/download" + path);
|
||||
result.setMerchantCode(getMerchantCode());
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("name",result.getName());
|
||||
map.put("status","done");
|
||||
@@ -245,10 +242,6 @@ public class FileController extends BaseController {
|
||||
@ApiOperation("分页查询文件")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<FileRecord>> page(FileRecordParam param, HttpServletRequest request) {
|
||||
// 搜索条件
|
||||
if (getMerchantCode() != null) {
|
||||
param.setMerchantCode(getMerchantCode());
|
||||
}
|
||||
PageResult<FileRecord> result = fileRecordService.pageRel(param);
|
||||
// String requestURL = StrUtil.removeSuffix(request.getRequestURL(), "/page");
|
||||
String requestURL = config.getFileServer();
|
||||
|
||||
@@ -1,242 +0,0 @@
|
||||
package com.gxwebsoft.common.system.controller;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||
import com.gxwebsoft.common.core.security.JwtSubject;
|
||||
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||
import com.gxwebsoft.common.core.utils.CommonUtil;
|
||||
import com.gxwebsoft.common.core.utils.FileServerUtil;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.system.entity.AccessKey;
|
||||
import com.gxwebsoft.common.system.entity.FileRecord;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.result.LoginResult;
|
||||
import com.gxwebsoft.common.system.service.*;
|
||||
import com.gxwebsoft.oa.service.AppService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.gxwebsoft.common.core.constants.RedisConstants.ACCESS_TOKEN_KEY;
|
||||
|
||||
/**
|
||||
* 文件上传下载控制器
|
||||
*
|
||||
* @author WebSoft
|
||||
* @since 2018-12-24 16:10:24
|
||||
*/
|
||||
@Api(tags = "文件服务器-文件预览")
|
||||
@RestController
|
||||
@RequestMapping("/api/file-preview")
|
||||
public class FilePreviewController extends BaseController {
|
||||
private final StringRedisTemplate redisTemplate;
|
||||
@Resource
|
||||
private SettingService settingService;
|
||||
@Resource
|
||||
private ConfigProperties configProperties;
|
||||
@Resource
|
||||
private ConfigProperties config;
|
||||
@Resource
|
||||
private FileRecordService fileRecordService;
|
||||
@Resource
|
||||
private AccessKeyService accessKeyService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private AppService appService;
|
||||
@Resource
|
||||
private CompanyService companyService;
|
||||
|
||||
public FilePreviewController(StringRedisTemplate redisTemplate) {
|
||||
this.redisTemplate = redisTemplate;
|
||||
}
|
||||
|
||||
@ApiOperation("查看原文件")
|
||||
@GetMapping("/{dir}/{name:.+}")
|
||||
public void preview(@PathVariable("dir") String dir, @PathVariable("name") String name,
|
||||
HttpServletResponse response, HttpServletRequest request) {
|
||||
File file = new File(getUploadDir(), dir + "/" + name);
|
||||
FileServerUtil.preview(file, getPdfOutDir(), config.getOpenOfficeHome(), response, request);
|
||||
}
|
||||
|
||||
@ApiOperation("下载原文件")
|
||||
@GetMapping("/download/{dir}/{name:.+}")
|
||||
public void download(@PathVariable("dir") String dir, @PathVariable("name") String name,
|
||||
HttpServletResponse response, HttpServletRequest request) {
|
||||
String path = dir + "/" + name;
|
||||
FileRecord record = fileRecordService.getByIdPath(path);
|
||||
File file = new File(getUploadDir(), path);
|
||||
String fileName = record == null ? file.getName() : record.getName();
|
||||
FileServerUtil.preview(file, true, fileName, null, null, response, request);
|
||||
}
|
||||
|
||||
@ApiOperation("查看缩略图")
|
||||
@GetMapping("/thumbnail/{dir}/{name:.+}")
|
||||
public void thumbnail(@PathVariable("dir") String dir, @PathVariable("name") String name,
|
||||
HttpServletResponse response, HttpServletRequest request) {
|
||||
File file = new File(getUploadDir(), dir + "/" + name);
|
||||
File thumbnail = new File(getUploadSmDir(), dir + "/" + name);
|
||||
FileServerUtil.previewThumbnail(file, thumbnail, config.getThumbnailSize(), response, request);
|
||||
}
|
||||
|
||||
@ApiOperation("查看缩略图")
|
||||
@GetMapping("/thumb/{dir}/{name:.+}")
|
||||
public void thumb(@PathVariable("dir") String dir, @PathVariable("name") String name,
|
||||
HttpServletResponse response, HttpServletRequest request) {
|
||||
File file = new File(getUploadDir(), dir + "/" + name);
|
||||
File thumbnail = new File(getUploadSmDir2(), dir + "/" + name);
|
||||
FileServerUtil.previewThumbnail(file, thumbnail, config.getThumbnailSize(), response, request);
|
||||
}
|
||||
|
||||
@ApiOperation("免密登录")
|
||||
@GetMapping("/token/{userId}/{accessKey}")
|
||||
public ApiResult<LoginResult> getToken(@PathVariable("userId") Integer userId, @PathVariable("accessKey") String accessKey) {
|
||||
// 免密登录 传指定的userId和AccessKey,请给指定的userId分配好角色和权限
|
||||
if (accessKeyService.count(new LambdaQueryWrapper<AccessKey>().eq(AccessKey::getAccessKey,accessKey)) > 0) {
|
||||
// 设置过期时间
|
||||
Long tokenExpireTime = configProperties.getTokenExpireTime();
|
||||
// 查询用户信息
|
||||
final User byId = userService.getById(userId);
|
||||
// 登录账号|手机号码|邮箱登录
|
||||
User user = userService.getByUsername(byId.getUsername(), byId.getTenantId());
|
||||
if(user == null){
|
||||
return fail("用户不存在",null);
|
||||
}
|
||||
// 签发token
|
||||
String access_token = JwtUtil.buildToken(new JwtSubject(user.getUsername(), user.getTenantId()),
|
||||
tokenExpireTime, configProperties.getTokenKey());
|
||||
return success("登录成功", new LoginResult(access_token, user));
|
||||
}
|
||||
return fail("请求失败: 40010",null);
|
||||
}
|
||||
|
||||
@ApiOperation("APP应用信息")
|
||||
@GetMapping("/app-info2/{appid}/{accessKey}")
|
||||
public ApiResult<?> appInfo(@PathVariable("appid") Integer appId, @PathVariable("accessKey") String accessKey) {
|
||||
// 免密登录
|
||||
if (accessKeyService.count(new LambdaQueryWrapper<AccessKey>().eq(AccessKey::getAccessKey,accessKey)) > 0) {
|
||||
return success("操作成功", appService.getById(appId));
|
||||
}
|
||||
return fail("请求失败: 40011");
|
||||
}
|
||||
|
||||
@ApiOperation("获取企业信息")
|
||||
@GetMapping("/company-info2/{companyId}/{accessKey}")
|
||||
public ApiResult<?> companyInfo(@PathVariable("companyId") Integer companyId, @PathVariable("accessKey") String accessKey) {
|
||||
// 免密登录
|
||||
if (accessKeyService.count(new LambdaQueryWrapper<AccessKey>().eq(AccessKey::getAccessKey,accessKey)) > 0) {
|
||||
return success("操作成功", companyService.getById(companyId));
|
||||
}
|
||||
return fail("请求失败: 40012");
|
||||
}
|
||||
|
||||
@ApiOperation("获取微信小程序码")
|
||||
@GetMapping("/getQRCode")
|
||||
public ApiResult<?> getQRCode() {
|
||||
String apiUrl = "https://api.weixin.qq.com/wxa/getwxacode?access_token=" + getAccessToken();
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("path","pages/flash/index?user_id="+getLoginUserId());
|
||||
map.put("env_version","release");
|
||||
// map.put("env_version","trial");
|
||||
System.out.println("获取微信小程序码 = " + map);
|
||||
// 获取图片 Buffer
|
||||
byte[] qrCode = HttpRequest.post(apiUrl)
|
||||
.body(JSON.toJSONString(map))
|
||||
.execute().bodyBytes();
|
||||
|
||||
// 保存的文件名称
|
||||
final String fileName = CommonUtil.randomUUID8().concat(".png");
|
||||
// 保存路径
|
||||
String filePath = getUploadDir().concat("qrcode/") + fileName;
|
||||
File file = FileUtil.writeBytes(qrCode, filePath);
|
||||
if(file != null){
|
||||
return success("".concat("/qrcode/").concat(fileName));
|
||||
}
|
||||
return fail("获取失败",null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取接口调用凭据AccessToken
|
||||
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/mp-access-token/getAccessToken.html
|
||||
*/
|
||||
private String getAccessToken() {
|
||||
String key = ACCESS_TOKEN_KEY.concat(":").concat(getTenantId().toString());
|
||||
// 获取微信小程序配置信息
|
||||
JSONObject setting = settingService.getBySettingKey("mp-weixin");
|
||||
// 从缓存获取access_token
|
||||
String value = redisTemplate.opsForValue().get(key);
|
||||
if (value != null) {
|
||||
// 解析access_token
|
||||
JSONObject response = JSON.parseObject(value);
|
||||
return response.getString("access_token");
|
||||
}
|
||||
// 微信获取凭证接口
|
||||
String apiUrl = "https://api.weixin.qq.com/cgi-bin/token";
|
||||
// 组装url参数
|
||||
String url = apiUrl.concat("?grant_type=client_credential").concat("&appid=").concat(setting.getString("appId")).concat("&secret=").concat(setting.getString("appSecret"));
|
||||
// 执行get请求
|
||||
String result = HttpUtil.get(url);
|
||||
// 解析access_token
|
||||
JSONObject response = JSON.parseObject(result);
|
||||
if (response.getString("access_token") != null) {
|
||||
// 存入缓存
|
||||
redisTemplate.opsForValue().set(key, result,7000L, TimeUnit.SECONDS);
|
||||
return response.getString("access_token");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传基目录
|
||||
*/
|
||||
private String getUploadBaseDir() {
|
||||
return config.getUploadPath() + "file/";
|
||||
}
|
||||
|
||||
/**
|
||||
* office转pdf输出位置
|
||||
*/
|
||||
private String getPdfOutDir() {
|
||||
return getUploadBaseDir() + "pdf/";
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传位置(服务器)
|
||||
*/
|
||||
private String getUploadDir() {
|
||||
return config.getUploadPath() + "file/";
|
||||
}
|
||||
|
||||
/**
|
||||
* 缩略图生成位置
|
||||
*/
|
||||
private String getUploadSmDir() {
|
||||
return getUploadBaseDir() + "thumbnail/";
|
||||
}
|
||||
|
||||
/**
|
||||
* 缩略图生成位置
|
||||
*/
|
||||
private String getUploadSmDir2() {
|
||||
return getUploadBaseDir() + "thumb/";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,10 +19,6 @@ import com.gxwebsoft.common.system.service.DictionaryDataService;
|
||||
import com.gxwebsoft.common.system.service.OrganizationService;
|
||||
import com.gxwebsoft.common.system.service.RoleService;
|
||||
import com.gxwebsoft.common.system.service.UserService;
|
||||
import com.gxwebsoft.love.entity.UserProfile;
|
||||
import com.gxwebsoft.love.service.UserProfileService;
|
||||
import com.gxwebsoft.shop.entity.UserOauth;
|
||||
import com.gxwebsoft.shop.service.UserOauthService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
@@ -58,10 +54,6 @@ public class UserController extends BaseController {
|
||||
private OrganizationService organizationService;
|
||||
@Resource
|
||||
private DictionaryDataService dictionaryDataService;
|
||||
@Resource
|
||||
private UserOauthService userOauthService;
|
||||
@Resource
|
||||
private UserProfileService userProfileService;
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:user:list')")
|
||||
@OperationLog
|
||||
@@ -108,14 +100,6 @@ public class UserController extends BaseController {
|
||||
user.setStatus(null);
|
||||
user.setUsername(null);
|
||||
user.setPassword(null);
|
||||
// 前端请求限制仅可以修改自己的用户信息
|
||||
if (getAppId() != null) {
|
||||
user.setUserId(getLoginUserId());
|
||||
}
|
||||
// 保存详细资料
|
||||
if(user.getUserProfile() != null){
|
||||
userProfileService.update(user.getUserProfile(),new LambdaUpdateWrapper<UserProfile>().eq(UserProfile::getUserId,user.getUserId()));
|
||||
}
|
||||
if (userService.updateUser(user)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
@@ -128,8 +112,6 @@ public class UserController extends BaseController {
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (userService.removeById(id)) {
|
||||
QueryWrapper<UserOauth> userOauthQueryWrapper = new QueryWrapper<>();
|
||||
userOauthService.remove(userOauthQueryWrapper.eq("user_id",id));
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
@@ -155,10 +137,6 @@ public class UserController extends BaseController {
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> deleteBatch(@RequestBody List<Integer> ids) {
|
||||
ids.forEach(userId -> {
|
||||
QueryWrapper<UserOauth> userOauthQueryWrapper = new QueryWrapper<>();
|
||||
userOauthService.remove(userOauthQueryWrapper.eq("user_id",userId));
|
||||
});
|
||||
if (userService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
@@ -193,8 +171,6 @@ public class UserController extends BaseController {
|
||||
User u = new User();
|
||||
u.setUserId(user.getUserId());
|
||||
u.setRecommend(user.getRecommend());
|
||||
// 同步修改资料表
|
||||
userProfileService.updateById(user.getUserProfile());
|
||||
if (userService.updateById(u)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.gxwebsoft.common.system.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.service.UserGradeService;
|
||||
import com.gxwebsoft.common.system.entity.UserGrade;
|
||||
import com.gxwebsoft.common.system.param.UserGradeParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户会员等级表控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-10-07 22:51:17
|
||||
*/
|
||||
@Api(tags = "用户会员等级表管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/common.system/user-grade")
|
||||
public class UserGradeController extends BaseController {
|
||||
@Resource
|
||||
private UserGradeService userGradeService;
|
||||
|
||||
@PreAuthorize("hasAuthority('common.system:userGrade:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("分页查询用户会员等级表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<UserGrade>> page(UserGradeParam param) {
|
||||
// 使用关联查询
|
||||
return success(userGradeService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('common.system:userGrade:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("查询全部用户会员等级表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<UserGrade>> list(UserGradeParam param) {
|
||||
// 使用关联查询
|
||||
return success(userGradeService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('common.system:userGrade:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("根据id查询用户会员等级表")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<UserGrade> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(userGradeService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('common.system:userGrade:save')")
|
||||
@OperationLog
|
||||
@ApiOperation("添加用户会员等级表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody UserGrade userGrade) {
|
||||
if (userGradeService.save(userGrade)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('common.system:userGrade:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("修改用户会员等级表")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody UserGrade userGrade) {
|
||||
if (userGradeService.updateById(userGrade)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('common.system:userGrade:remove')")
|
||||
@OperationLog
|
||||
@ApiOperation("删除用户会员等级表")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (userGradeService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('common.system:userGrade:save')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量添加用户会员等级表")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<UserGrade> list) {
|
||||
if (userGradeService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('common.system:userGrade:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改用户会员等级表")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<UserGrade> batchParam) {
|
||||
if (batchParam.update(userGradeService, "grade_id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('common.system:userGrade:remove')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除用户会员等级表")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (userGradeService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.gxwebsoft.common.system.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.service.UserOauthService;
|
||||
import com.gxwebsoft.common.system.entity.UserOauth;
|
||||
import com.gxwebsoft.common.system.param.UserOauthParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 第三方用户信息表控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-10-07 22:39:46
|
||||
*/
|
||||
@Api(tags = "第三方用户信息表管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/common.system/user-oauth")
|
||||
public class UserOauthController extends BaseController {
|
||||
@Resource
|
||||
private UserOauthService userOauthService;
|
||||
|
||||
@PreAuthorize("hasAuthority('common.system:userOauth:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("分页查询第三方用户信息表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<UserOauth>> page(UserOauthParam param) {
|
||||
// 使用关联查询
|
||||
return success(userOauthService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('common.system:userOauth:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("查询全部第三方用户信息表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<UserOauth>> list(UserOauthParam param) {
|
||||
// 使用关联查询
|
||||
return success(userOauthService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('common.system:userOauth:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("根据id查询第三方用户信息表")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<UserOauth> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(userOauthService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('common.system:userOauth:save')")
|
||||
@OperationLog
|
||||
@ApiOperation("添加第三方用户信息表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody UserOauth userOauth) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
userOauth.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (userOauthService.save(userOauth)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('common.system:userOauth:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("修改第三方用户信息表")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody UserOauth userOauth) {
|
||||
if (userOauthService.updateById(userOauth)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('common.system:userOauth:remove')")
|
||||
@OperationLog
|
||||
@ApiOperation("删除第三方用户信息表")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (userOauthService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('common.system:userOauth:save')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量添加第三方用户信息表")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<UserOauth> list) {
|
||||
if (userOauthService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('common.system:userOauth:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改第三方用户信息表")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<UserOauth> batchParam) {
|
||||
if (batchParam.update(userOauthService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('common.system:userOauth:remove')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除第三方用户信息表")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (userOauthService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||
import com.gxwebsoft.common.core.exception.BusinessException;
|
||||
@@ -24,27 +23,16 @@ import com.gxwebsoft.common.system.entity.UserRole;
|
||||
import com.gxwebsoft.common.system.param.UserParam;
|
||||
import com.gxwebsoft.common.system.result.LoginResult;
|
||||
import com.gxwebsoft.common.system.service.*;
|
||||
import com.gxwebsoft.love.entity.UserProfile;
|
||||
import com.gxwebsoft.love.service.UserProfileService;
|
||||
import com.gxwebsoft.shop.entity.Merchant;
|
||||
import com.gxwebsoft.shop.entity.UserOauth;
|
||||
import com.gxwebsoft.shop.entity.UserReferee;
|
||||
import com.gxwebsoft.shop.service.MerchantService;
|
||||
import com.gxwebsoft.shop.service.UserOauthService;
|
||||
import com.gxwebsoft.shop.service.UserRefereeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.gxwebsoft.common.core.constants.RedisConstants.ACCESS_TOKEN_KEY;
|
||||
@@ -63,19 +51,11 @@ public class WxLoginController extends BaseController {
|
||||
@Resource
|
||||
private UserRoleService userRoleService;
|
||||
@Resource
|
||||
private UserOauthService userOauthService;
|
||||
@Resource
|
||||
private LoginRecordService loginRecordService;
|
||||
@Resource
|
||||
private RoleService roleService;
|
||||
@Resource
|
||||
private ConfigProperties config;
|
||||
@Resource
|
||||
private UserRefereeService userRefereeService;
|
||||
@Resource
|
||||
private UserProfileService userProfileService;
|
||||
@Resource
|
||||
private MerchantService merchantService;
|
||||
|
||||
public WxLoginController(StringRedisTemplate redisTemplate) {
|
||||
this.redisTemplate = redisTemplate;
|
||||
@@ -97,14 +77,6 @@ public class WxLoginController extends BaseController {
|
||||
// 3.存在则签发token并返回登录成功,不存在则注册新用户
|
||||
if (user == null) {
|
||||
user = addUser(userParam);
|
||||
// 添加第三方用户信息
|
||||
UserOauth uo = new UserOauth();
|
||||
uo.setUserId(user.getUserId());
|
||||
uo.setTenantId(user.getTenantId());
|
||||
uo.setOauthType("MP-WEIXIN");
|
||||
uo.setOauthId(openid);
|
||||
uo.setUnionid(unionid);
|
||||
userOauthService.save(uo);
|
||||
}
|
||||
// 4.签发token
|
||||
loginRecordService.saveAsync(user.getUsername(), LoginRecord.TYPE_LOGIN, null, user.getTenantId(), request);
|
||||
@@ -180,42 +152,6 @@ public class WxLoginController extends BaseController {
|
||||
userRole.setTenantId(addUser.getTenantId());
|
||||
userRole.setRoleId(addUser.getRoleId());
|
||||
userRoleService.save(userRole);
|
||||
// 用户详细资料表
|
||||
final UserProfile profile = new UserProfile();
|
||||
profile.setUserId(addUser.getUserId());
|
||||
profile.setRecommend(1);
|
||||
profile.setWhenMarriedMate("想要二年内结婚");
|
||||
userProfileService.save(profile);
|
||||
// 添加门店
|
||||
final Merchant merchant = new Merchant();
|
||||
merchant.setUserId(addUser.getUserId());
|
||||
merchant.setMerchantOwner(addUser.getUserId());
|
||||
merchant.setMerchantCode(addUser.getUserId()+"");
|
||||
merchant.setMerchantName(addUser.getNickname());
|
||||
merchant.setLogo(addUser.getAvatar());
|
||||
merchant.setProvince(addUser.getProvince());
|
||||
merchant.setCity(addUser.getCity());
|
||||
merchant.setRegion(addUser.getRegion());
|
||||
merchant.setMerchantPhone(addUser.getPhone());
|
||||
merchant.setMerchantHours("8:30 - 22:30");
|
||||
merchant.setSortNumber(100);
|
||||
merchant.setStatus(0);
|
||||
merchant.setFirstRatio(new BigDecimal("0.1"));
|
||||
merchant.setSecondRatio(new BigDecimal("0.1"));
|
||||
merchant.setOnlineRatio(new BigDecimal("0.1"));
|
||||
merchant.setOfflineRatio(new BigDecimal("0"));
|
||||
merchant.setShopRatio(new BigDecimal("0"));
|
||||
merchant.setTenantId(addUser.getTenantId());
|
||||
merchantService.save(merchant);
|
||||
}
|
||||
// 绑定推荐关系
|
||||
if(userParam.getRefereeId() != null && userParam.getRefereeId() > 0){
|
||||
final Integer refereeId = userParam.getRefereeId();
|
||||
final UserReferee userReferee = new UserReferee();
|
||||
userReferee.setUserId(addUser.getUserId());
|
||||
userReferee.setDealerId(refereeId);
|
||||
userReferee.setLevel(1);
|
||||
userRefereeService.save(userReferee);
|
||||
}
|
||||
return addUser;
|
||||
}
|
||||
@@ -322,18 +258,6 @@ public class WxLoginController extends BaseController {
|
||||
final String response = HttpUtil.get(apiUrl,map);
|
||||
System.out.println("response = " + response);
|
||||
final JSONObject jsonObject = JSONObject.parseObject(response);
|
||||
|
||||
// 保存openid
|
||||
final List<UserOauth> list = userOauthService.list(new LambdaQueryWrapper<UserOauth>().eq(UserOauth::getUserId, loginUser.getUserId()).eq(UserOauth::getOauthType,"MP-WEIXIN"));
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
final UserOauth userOauth = new UserOauth();
|
||||
userOauth.setUserId(getLoginUserId());
|
||||
userOauth.setOauthId(jsonObject.getString("openid"));
|
||||
userOauth.setUnionid(jsonObject.getString("unionid"));
|
||||
userOauth.setOauthType("MP-WEIXIN");
|
||||
userOauthService.save(userOauth);
|
||||
return success("保存openid成功",jsonObject);
|
||||
}
|
||||
return fail("更新失败",null);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,6 @@ package com.gxwebsoft.common.system.entity;
|
||||
import cn.hutool.core.util.DesensitizedUtil;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.gxwebsoft.love.entity.UserPlanEquity;
|
||||
import com.gxwebsoft.love.entity.UserProfile;
|
||||
import com.gxwebsoft.oa.entity.App;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -219,10 +216,6 @@ public class User implements UserDetails {
|
||||
@TableField(exist = false)
|
||||
private List<Role> roles;
|
||||
|
||||
@ApiModelProperty("详细资料")
|
||||
@TableField(exist = false)
|
||||
private UserProfile userProfile;
|
||||
|
||||
@ApiModelProperty("权限列表")
|
||||
@TableField(exist = false)
|
||||
private List<Menu> authorities;
|
||||
@@ -267,18 +260,10 @@ public class User implements UserDetails {
|
||||
@TableField(exist = false)
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty("应用信息")
|
||||
@TableField(exist = false)
|
||||
private App appInfo;
|
||||
|
||||
@ApiModelProperty("企业信息")
|
||||
@TableField(exist = false)
|
||||
private Company companyInfo;
|
||||
|
||||
@ApiModelProperty("权益列表")
|
||||
@TableField(exist = false)
|
||||
private List<UserPlanEquity> userPlanEquityList;
|
||||
|
||||
@ApiModelProperty("系统配置信息")
|
||||
@TableField(exist = false)
|
||||
private Object system;
|
||||
@@ -302,14 +287,7 @@ public class User implements UserDetails {
|
||||
public boolean isEnabled() {
|
||||
return true;
|
||||
}
|
||||
//
|
||||
// public String getRealName(){
|
||||
// return DesensitizedUtil.chineseName(this.realName);
|
||||
// }
|
||||
//
|
||||
// public String getIdCard(){
|
||||
// return DesensitizedUtil.idCardNum(this.idCard,1,2);
|
||||
// }
|
||||
|
||||
public String getMobile(){
|
||||
return DesensitizedUtil.mobilePhone(this.phone);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.gxwebsoft.common.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 用户会员等级表
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-10-07 22:51:17
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "UserGrade对象", description = "用户会员等级表")
|
||||
@TableName("sys_user_grade")
|
||||
public class UserGrade implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "等级ID")
|
||||
@TableId(value = "grade_id", type = IdType.AUTO)
|
||||
private Integer gradeId;
|
||||
|
||||
@ApiModelProperty(value = "等级名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "等级权重(1-9999)")
|
||||
private Integer weight;
|
||||
|
||||
@ApiModelProperty(value = "升级条件")
|
||||
private String upgrade;
|
||||
|
||||
@ApiModelProperty(value = "等级权益(折扣率0-100)")
|
||||
private String equity;
|
||||
|
||||
@ApiModelProperty(value = "佣金比率")
|
||||
private String commission;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "商户编码")
|
||||
private String merchantCode;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "注册时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.gxwebsoft.common.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 第三方用户信息表
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-10-07 22:39:46
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "UserOauth对象", description = "第三方用户信息表")
|
||||
@TableName("sys_user_oauth")
|
||||
public class UserOauth implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "第三方登陆类型(MP-WEIXIN)")
|
||||
private String oauthType;
|
||||
|
||||
@ApiModelProperty(value = "第三方用户唯一标识 (uid openid)")
|
||||
private String oauthId;
|
||||
|
||||
@ApiModelProperty(value = "微信unionID")
|
||||
private String unionid;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "商户编码")
|
||||
private String merchantCode;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "注册时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.common.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.common.system.entity.UserGrade;
|
||||
import com.gxwebsoft.common.system.param.UserGradeParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户会员等级表Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-10-07 22:51:17
|
||||
*/
|
||||
public interface UserGradeMapper extends BaseMapper<UserGrade> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<UserGrade>
|
||||
*/
|
||||
List<UserGrade> selectPageRel(@Param("page") IPage<UserGrade> page,
|
||||
@Param("param") UserGradeParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<UserGrade> selectListRel(@Param("param") UserGradeParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.common.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.common.system.entity.UserOauth;
|
||||
import com.gxwebsoft.common.system.param.UserOauthParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 第三方用户信息表Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-10-07 22:39:46
|
||||
*/
|
||||
public interface UserOauthMapper extends BaseMapper<UserOauth> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<UserOauth>
|
||||
*/
|
||||
List<UserOauth> selectPageRel(@Param("page") IPage<UserOauth> page,
|
||||
@Param("param") UserOauthParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<UserOauth> selectListRel(@Param("param") UserOauthParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?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.gxwebsoft.common.system.mapper.UserGradeMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM sys_user_grade a
|
||||
<where>
|
||||
<if test="param.gradeId != null">
|
||||
AND a.grade_id = #{param.gradeId}
|
||||
</if>
|
||||
<if test="param.name != null">
|
||||
AND a.name LIKE CONCAT('%', #{param.name}, '%')
|
||||
</if>
|
||||
<if test="param.weight != null">
|
||||
AND a.weight = #{param.weight}
|
||||
</if>
|
||||
<if test="param.upgrade != null">
|
||||
AND a.upgrade LIKE CONCAT('%', #{param.upgrade}, '%')
|
||||
</if>
|
||||
<if test="param.equity != null">
|
||||
AND a.equity LIKE CONCAT('%', #{param.equity}, '%')
|
||||
</if>
|
||||
<if test="param.commission != null">
|
||||
AND a.commission LIKE CONCAT('%', #{param.commission}, '%')
|
||||
</if>
|
||||
<if test="param.sortNumber != null">
|
||||
AND a.sort_number = #{param.sortNumber}
|
||||
</if>
|
||||
<if test="param.comments != null">
|
||||
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
AND a.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.deleted != null">
|
||||
AND a.deleted = #{param.deleted}
|
||||
</if>
|
||||
<if test="param.deleted == null">
|
||||
AND a.deleted = 0
|
||||
</if>
|
||||
<if test="param.merchantCode != null">
|
||||
AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%')
|
||||
</if>
|
||||
<if test="param.createTimeStart != null">
|
||||
AND a.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.common.system.entity.UserGrade">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.common.system.entity.UserGrade">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -175,7 +175,7 @@
|
||||
LEFT JOIN (
|
||||
<include refid="selectSexDictSql"/>
|
||||
) c ON a.sex = c.dict_data_code
|
||||
LEFT JOIN shop_user_oauth f ON f.user_id = a.user_id and f.oauth_type = 'MP-WEIXIN'
|
||||
LEFT JOIN sys_user_oauth f ON f.user_id = a.user_id and f.oauth_type = 'MP-WEIXIN'
|
||||
<where>
|
||||
AND a.deleted = 0
|
||||
AND (a.username = #{username} OR a.phone = #{username} OR a.email = #{username})
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?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.gxwebsoft.common.system.mapper.UserOauthMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM sys_user_oauth a
|
||||
<where>
|
||||
<if test="param.id != null">
|
||||
AND a.id = #{param.id}
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.oauthType != null">
|
||||
AND a.oauth_type LIKE CONCAT('%', #{param.oauthType}, '%')
|
||||
</if>
|
||||
<if test="param.oauthId != null">
|
||||
AND a.oauth_id LIKE CONCAT('%', #{param.oauthId}, '%')
|
||||
</if>
|
||||
<if test="param.unionid != null">
|
||||
AND a.unionid LIKE CONCAT('%', #{param.unionid}, '%')
|
||||
</if>
|
||||
<if test="param.sortNumber != null">
|
||||
AND a.sort_number = #{param.sortNumber}
|
||||
</if>
|
||||
<if test="param.comments != null">
|
||||
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
AND a.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.deleted != null">
|
||||
AND a.deleted = #{param.deleted}
|
||||
</if>
|
||||
<if test="param.deleted == null">
|
||||
AND a.deleted = 0
|
||||
</if>
|
||||
<if test="param.merchantCode != null">
|
||||
AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%')
|
||||
</if>
|
||||
<if test="param.createTimeStart != null">
|
||||
AND a.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.common.system.entity.UserOauth">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.common.system.entity.UserOauth">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.gxwebsoft.common.system.param;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||
import com.gxwebsoft.common.core.web.BaseParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 用户会员等级表查询参数
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-10-07 22:51:17
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "UserGradeParam对象", description = "用户会员等级表查询参数")
|
||||
public class UserGradeParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "等级ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer gradeId;
|
||||
|
||||
@ApiModelProperty(value = "等级名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "等级权重(1-9999)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer weight;
|
||||
|
||||
@ApiModelProperty(value = "升级条件")
|
||||
private String upgrade;
|
||||
|
||||
@ApiModelProperty(value = "等级权益(折扣率0-100)")
|
||||
private String equity;
|
||||
|
||||
@ApiModelProperty(value = "佣金比率")
|
||||
private String commission;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "商户编码")
|
||||
private String merchantCode;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.gxwebsoft.common.system.param;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||
import com.gxwebsoft.common.core.web.BaseParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 第三方用户信息表查询参数
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-10-07 22:39:46
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "UserOauthParam对象", description = "第三方用户信息表查询参数")
|
||||
public class UserOauthParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "第三方登陆类型(MP-WEIXIN)")
|
||||
private String oauthType;
|
||||
|
||||
@ApiModelProperty(value = "第三方用户唯一标识 (uid openid)")
|
||||
private String oauthId;
|
||||
|
||||
@ApiModelProperty(value = "微信unionID")
|
||||
private String unionid;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "商户编码")
|
||||
private String merchantCode;
|
||||
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||
import com.gxwebsoft.common.core.web.BaseParam;
|
||||
import com.gxwebsoft.love.entity.UserProfile;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -191,10 +190,6 @@ public class UserParam extends BaseParam {
|
||||
@TableField(exist = false)
|
||||
private Set<Integer> userIds;
|
||||
|
||||
@ApiModelProperty("详细资料")
|
||||
@TableField(exist = false)
|
||||
private UserProfile userProfile;
|
||||
|
||||
@ApiModelProperty("是否查询用户详细资料表")
|
||||
@TableField(exist = false)
|
||||
private Boolean showProfile;
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.gxwebsoft.common.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.LoginRecord;
|
||||
import com.gxwebsoft.common.system.param.LoginRecordParam;
|
||||
import com.gxwebsoft.shop.entity.Payment;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 支付宝服务层
|
||||
*
|
||||
* @author WebSoft
|
||||
* @since 2018-12-24 16:10:41
|
||||
*/
|
||||
public interface AlipayService extends IService<Payment> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.gxwebsoft.common.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.UserGrade;
|
||||
import com.gxwebsoft.common.system.param.UserGradeParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户会员等级表Service
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-10-07 22:51:17
|
||||
*/
|
||||
public interface UserGradeService extends IService<UserGrade> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<UserGrade>
|
||||
*/
|
||||
PageResult<UserGrade> pageRel(UserGradeParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<UserGrade>
|
||||
*/
|
||||
List<UserGrade> listRel(UserGradeParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param gradeId 等级ID
|
||||
* @return UserGrade
|
||||
*/
|
||||
UserGrade getByIdRel(Integer gradeId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.gxwebsoft.common.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.UserOauth;
|
||||
import com.gxwebsoft.common.system.param.UserOauthParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 第三方用户信息表Service
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-10-07 22:39:46
|
||||
*/
|
||||
public interface UserOauthService extends IService<UserOauth> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<UserOauth>
|
||||
*/
|
||||
PageResult<UserOauth> pageRel(UserOauthParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<UserOauth>
|
||||
*/
|
||||
List<UserOauth> listRel(UserOauthParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param id 主键ID
|
||||
* @return UserOauth
|
||||
*/
|
||||
UserOauth getByIdRel(Integer id);
|
||||
|
||||
}
|
||||
@@ -31,7 +31,6 @@ public interface UserService extends IService<User>, UserDetailsService {
|
||||
* @return List<User>
|
||||
*/
|
||||
List<User> listRel(UserParam param);
|
||||
void listRanking(UserParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询用户
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.gxwebsoft.common.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.common.system.mapper.UserGradeMapper;
|
||||
import com.gxwebsoft.common.system.service.UserGradeService;
|
||||
import com.gxwebsoft.common.system.entity.UserGrade;
|
||||
import com.gxwebsoft.common.system.param.UserGradeParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户会员等级表Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-10-07 22:51:17
|
||||
*/
|
||||
@Service
|
||||
public class UserGradeServiceImpl extends ServiceImpl<UserGradeMapper, UserGrade> implements UserGradeService {
|
||||
|
||||
@Override
|
||||
public PageResult<UserGrade> pageRel(UserGradeParam param) {
|
||||
PageParam<UserGrade, UserGradeParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
List<UserGrade> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserGrade> listRel(UserGradeParam param) {
|
||||
List<UserGrade> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<UserGrade, UserGradeParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserGrade getByIdRel(Integer gradeId) {
|
||||
UserGradeParam param = new UserGradeParam();
|
||||
param.setGradeId(gradeId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.gxwebsoft.common.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.common.system.mapper.UserOauthMapper;
|
||||
import com.gxwebsoft.common.system.service.UserOauthService;
|
||||
import com.gxwebsoft.common.system.entity.UserOauth;
|
||||
import com.gxwebsoft.common.system.param.UserOauthParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 第三方用户信息表Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-10-07 22:39:46
|
||||
*/
|
||||
@Service
|
||||
public class UserOauthServiceImpl extends ServiceImpl<UserOauthMapper, UserOauth> implements UserOauthService {
|
||||
|
||||
@Override
|
||||
public PageResult<UserOauth> pageRel(UserOauthParam param) {
|
||||
PageParam<UserOauth, UserOauthParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
List<UserOauth> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserOauth> listRel(UserOauthParam param) {
|
||||
List<UserOauth> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<UserOauth, UserOauthParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserOauth getByIdRel(Integer id) {
|
||||
UserOauthParam param = new UserOauthParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,11 +3,9 @@ package com.gxwebsoft.common.system.service.impl;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.common.core.exception.BusinessException;
|
||||
import com.gxwebsoft.common.core.utils.CacheClient;
|
||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
@@ -17,37 +15,22 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.entity.UserRole;
|
||||
import com.gxwebsoft.common.system.mapper.UserMapper;
|
||||
import com.gxwebsoft.common.system.param.UserParam;
|
||||
import com.gxwebsoft.common.system.service.*;
|
||||
import com.gxwebsoft.love.entity.UserPlanEquity;
|
||||
import com.gxwebsoft.love.entity.UserProfile;
|
||||
import com.gxwebsoft.love.param.UserProfileParam;
|
||||
import com.gxwebsoft.love.service.UserPlanEquityService;
|
||||
import com.gxwebsoft.love.service.UserProfileService;
|
||||
import com.gxwebsoft.oa.entity.App;
|
||||
import com.gxwebsoft.oa.service.AppService;
|
||||
import com.gxwebsoft.shop.entity.Merchant;
|
||||
import com.gxwebsoft.shop.entity.MerchantClerk;
|
||||
import com.gxwebsoft.shop.service.MerchantClerkService;
|
||||
import com.gxwebsoft.shop.service.MerchantService;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import com.gxwebsoft.common.system.service.RoleMenuService;
|
||||
import com.gxwebsoft.common.system.service.UserRoleService;
|
||||
import com.gxwebsoft.common.system.service.UserService;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.gxwebsoft.common.core.constants.RedisConstants.USER_RANKING_BY_APPS;
|
||||
|
||||
/**
|
||||
* 用户Service实现
|
||||
*
|
||||
@@ -63,26 +46,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
||||
@Resource
|
||||
private BCryptPasswordEncoder bCryptPasswordEncoder;
|
||||
@Resource
|
||||
private MerchantService merchantService;
|
||||
@Resource
|
||||
private MerchantClerkService merchantClerkService;
|
||||
@Resource
|
||||
private CacheClient cacheClient;
|
||||
@Resource
|
||||
private AppService appService;
|
||||
@Resource
|
||||
private TenantService tenantService;
|
||||
@Resource
|
||||
private CompanyService companyService;
|
||||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
@Resource
|
||||
private UserProfileService userProfileService;
|
||||
|
||||
@Resource
|
||||
private UserPlanEquityService userPlanEquityService;
|
||||
|
||||
@Override
|
||||
public PageResult<User> pageRel(UserParam param) {
|
||||
@@ -91,10 +55,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
||||
List<User> list = baseMapper.selectPageRel(page, param);
|
||||
// 查询用户的角色
|
||||
selectUserRoles(list);
|
||||
// 查询用户详细资料
|
||||
if (param.getShowProfile() != null) {
|
||||
selectUserProfile(list);
|
||||
}
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@@ -109,18 +69,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void listRanking(UserParam param) {
|
||||
List<User> list = baseMapper.selectListRel(param);
|
||||
Map<String, String> map = new HashMap<>();
|
||||
list.forEach(d -> {
|
||||
int count = appService.count(new LambdaQueryWrapper<App>()
|
||||
.eq(App::getUserId, d.getUserId()));
|
||||
// 更新全部用户的插件数量
|
||||
cacheClient.zAdd(USER_RANKING_BY_APPS, d.getUserId(), (double) count);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getByIdRel(Integer userId) {
|
||||
UserParam param = new UserParam();
|
||||
@@ -163,24 +111,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
||||
final Company company = redisUtil.get(key2, Company.class);
|
||||
user.setCompanyInfo(company);
|
||||
user.setSystem(map);
|
||||
// 商户编号
|
||||
Merchant merchant = merchantService.getOne(new QueryWrapper<Merchant>()
|
||||
.eq("merchant_owner", user.getUserId()), false);
|
||||
if (merchant != null) {
|
||||
user.setMerchantCode(merchant.getMerchantCode());
|
||||
user.setMerchantName(merchant.getMerchantName());
|
||||
} else {
|
||||
MerchantClerk clerk = merchantClerkService.getOne(new QueryWrapper<MerchantClerk>().eq("user_id", user.getUserId()), false);
|
||||
if (clerk != null) {
|
||||
user.setMerchantCode(clerk.getMerchantCode());
|
||||
}
|
||||
}
|
||||
|
||||
// 我的权益
|
||||
List<UserPlanEquity> userPlanEquityList = userPlanEquityService.list(new LambdaQueryWrapper<UserPlanEquity>()
|
||||
.eq(UserPlanEquity::getUserId, userId)
|
||||
.gt(UserPlanEquity::getExpirationTime, LocalDateTime.now()));
|
||||
user.setUserPlanEquityList(userPlanEquityList);
|
||||
|
||||
}
|
||||
return user;
|
||||
@@ -320,27 +250,4 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询用户的详细资料
|
||||
*
|
||||
* @param users 用户集合
|
||||
*/
|
||||
private void selectUserProfile(List<User> users) {
|
||||
if (users != null && users.size() > 0) {
|
||||
Set<Integer> userIds = users.stream().map(User::getUserId).collect(Collectors.toSet());
|
||||
final UserProfileParam userProfileParam = new UserProfileParam();
|
||||
userProfileParam.setUserIds(userIds);
|
||||
final List<UserProfile> userProfiles = userProfileService.listRel(userProfileParam);
|
||||
final Map<Integer, List<UserProfile>> collect = userProfiles.stream().collect(Collectors.groupingBy(UserProfile::getUserId));
|
||||
for (User user: users){
|
||||
final List<UserProfile> list = collect.get(user.getUserId());
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
final UserProfile profile = collect.get(user.getUserId()).get(0);
|
||||
user.setUserProfile(profile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,283 +1,21 @@
|
||||
package com.gxwebsoft;
|
||||
|
||||
import com.gxwebsoft.apps.service.HualalaService;
|
||||
import com.gxwebsoft.apps.service.TestDataService;
|
||||
import com.gxwebsoft.common.system.mapper.RoleMapper;
|
||||
import com.gxwebsoft.common.system.mapper.UserMapper;
|
||||
import com.gxwebsoft.common.system.service.SettingService;
|
||||
import com.gxwebsoft.common.system.service.UserService;
|
||||
import com.gxwebsoft.love.service.CertificateService;
|
||||
import com.gxwebsoft.shop.mapper.OrderGoodsMapper;
|
||||
import com.gxwebsoft.shop.mapper.OrderMapper;
|
||||
import com.gxwebsoft.shop.service.OrderService;
|
||||
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
/**
|
||||
* Created by WebSoft on 2020-03-23 23:37
|
||||
*/
|
||||
@SpringBootTest
|
||||
public class TestMain {
|
||||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
@Resource
|
||||
private OrderService orderService;
|
||||
@Resource
|
||||
private OrderGoodsMapper orderGoodsMapper;
|
||||
@Resource
|
||||
private OrderMapper orderMapper;
|
||||
@Resource
|
||||
private TestDataService testDataService;
|
||||
@Resource
|
||||
private HualalaService hualalaService;
|
||||
@Resource
|
||||
private SettingService settingService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private UserMapper userMapper;
|
||||
@Resource
|
||||
private RoleMapper roleMapper;
|
||||
|
||||
@Resource
|
||||
private CertificateService certificateService;
|
||||
|
||||
/**
|
||||
* 生成唯一的key用于jwt工具类
|
||||
*/
|
||||
// @Test
|
||||
// public void testGenJwtKey() {
|
||||
// System.out.println(JwtUtil.encodeKey(JwtUtil.randomKey()));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 生成加密后的登录密码
|
||||
* @return
|
||||
*/
|
||||
@Test
|
||||
public void testEncodePassword() throws UnsupportedEncodingException {
|
||||
// DateTime date = DateUtil.date();
|
||||
// System.out.println("date = " + date);
|
||||
// final String today = DateUtil.today();
|
||||
// System.out.println("today = " + today);
|
||||
// final DateTime dateTime = DateUtil.beginOfDay(date);
|
||||
// System.out.println("dateTime = " + dateTime);
|
||||
// System.out.println(new BCryptPasswordEncoder().encode("admin"));
|
||||
String encodedReturnUrl = URLEncoder.encode("https://server.gxwebsoft.com/api/open/wx-work/saveAccessToken","UTF-8");
|
||||
// System.out.println("encodedReturnUrl = " + encodedReturnUrl);
|
||||
// System.out.println("encodedReturnUrl = " + encodedReturnUrl);
|
||||
// log.info("生成加密后的登录密码:" + encodedReturnUrl);
|
||||
public void testGenJwtKey() {
|
||||
System.out.println(JwtUtil.encodeKey(JwtUtil.randomKey()));
|
||||
}
|
||||
|
||||
// @Test
|
||||
// public void test3() {
|
||||
// String key = "test:user:10";
|
||||
// HashMap<String, Object> map = new HashMap<>();
|
||||
// map.put("name", "科技小王子");
|
||||
// map.put("sex", "男");
|
||||
// map.put("phone", "13737128880");
|
||||
// map.put("money", "238585.215");
|
||||
// stringRedisTemplate.opsForHash().putAll(key, map);
|
||||
// }
|
||||
|
||||
// OrderParam param = new OrderParam();
|
||||
// param.setPayStatus(30);
|
||||
// param.setOrderNo("202303118310602");
|
||||
// final List<Order> all = orderMapper.getAll(param);
|
||||
// System.out.println("all = " + all);
|
||||
// OrderParam param = new OrderParam();
|
||||
// param.setOrderNo("2023031181184283");
|
||||
// param.setPayStatus(20);
|
||||
// boolean b = orderMapper.updatePayStatus(param);
|
||||
// System.out.println("b = " + b);
|
||||
|
||||
// Order order = orderService.getByOutTradeNo("20230301761610059");
|
||||
// OrderParam orderParam = new OrderParam();
|
||||
// orderParam.setPayStatus(20);
|
||||
// orderParam.setOrderNo("20230301761610059");
|
||||
// orderMapper.updatePayStatus(orderParam);
|
||||
// System.out.println("order = " + order);
|
||||
// Order order = new Order();
|
||||
// order.setOrderId(400);
|
||||
// order.setComments("sdfsdfsdfs");
|
||||
//
|
||||
// boolean update = orderService.lambdaUpdate()
|
||||
// .eq(Order::getOrderId, order.getOrderId())
|
||||
// .update(order);
|
||||
// System.out.println("update = " + update);
|
||||
|
||||
// OrderParam param = new OrderParam();
|
||||
// param.setOrderNo("20230301761610059");
|
||||
// Order order = orderService.getByOutTradeNo("20230301761610059");
|
||||
// System.out.println("order = " + order);
|
||||
// final int i = orderMapper.updateById(order);
|
||||
// System.out.println("i = " + i);
|
||||
|
||||
|
||||
// final Order one = param.getOne(orderMapper.getOne(param));
|
||||
// one.setTotalPrice(new BigDecimal("2.22"));
|
||||
// one.setPayStatus(20);
|
||||
// orderMapper.updateById(one);
|
||||
// System.out.println("one = " + one);
|
||||
// Order order = orderService.getByOutTradeNo("20230301761610059");
|
||||
// order.setPayStatus(20);
|
||||
// order.setTotalPrice(new BigDecimal("1.11"));
|
||||
// if (orderService.updateById(order)) {
|
||||
// System.out.println("成功");
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// public void test() {
|
||||
// final TestData testData = new TestData();
|
||||
// testData.setTitle("测试");
|
||||
// testData.setContent("内容...");
|
||||
// testData.setTenantId(10);
|
||||
// testDataService.save(testData);
|
||||
|
||||
// final boolean b = testDataService.removeById(2496);
|
||||
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// public void query() {
|
||||
// HashMap<String, Object> params = new HashMap<>();
|
||||
// params.put("shopID", Long.valueOf("76230180"));
|
||||
// JSONObject response = hualalaService.doPost("/doc/getPaySubject", params);
|
||||
// System.out.println("response = " + response);
|
||||
// }
|
||||
|
||||
// 推送订单到哗啦啦
|
||||
// @Test
|
||||
// public void pushOrder(){
|
||||
// Order orderInfo = orderService.getByOutTradeNo("202303118345835");
|
||||
// final List<OrderGoods> goodsInfo = orderGoodsMapper.selectByOrderId(orderInfo.getOrderId());
|
||||
// System.out.println("orderInfo = " + orderInfo);
|
||||
// System.out.println("goodsInfo = " + goodsInfo);
|
||||
// // 菜品信息
|
||||
// ArrayList<Object> orderItem = new ArrayList<>();
|
||||
// JSONObject item = new JSONObject();
|
||||
// item.put("foodID",603798638);
|
||||
// item.put("foodName","肉汁煲霜打萝卜.");
|
||||
// item.put("foodUnit","份");
|
||||
// item.put("foodUnitID","1748099318");
|
||||
// item.put("isSetFood",0);
|
||||
// item.put("isBatching",0);
|
||||
// item.put("foodCount",1);
|
||||
// item.put("originPrice","100");
|
||||
// item.put("takeoutPackagingFee","1");
|
||||
// item.put("isDiscount",0);
|
||||
// item.put("duePrice","1");
|
||||
// orderItem.add(item);
|
||||
// // 支付信息
|
||||
// ArrayList<Object> payInfo = new ArrayList<>();
|
||||
// JSONObject payItem = new JSONObject();
|
||||
// payItem.put("paymentSubjectID",Long.valueOf("51010440"));
|
||||
// payItem.put("paymentSubjectName","微信小程序实收");
|
||||
// payItem.put("dueAmount","1");
|
||||
// payItem.put("paymentStatus",20);
|
||||
// payItem.put("payWay",70);
|
||||
// payInfo.add(payItem);
|
||||
//
|
||||
// // 订单信息
|
||||
// JSONObject order = new JSONObject();
|
||||
// order.put("orderSubType",20);
|
||||
// order.put("orderStatus",20);
|
||||
// order.put("discountTotalAmount","1");
|
||||
// order.put("dinners",1);
|
||||
// // 期望送达时间
|
||||
// SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMddHHmm");
|
||||
// order.put("orderTime",sdf1.format(orderInfo.getCreateTime()));
|
||||
// order.put("orderItem",orderItem);
|
||||
// order.put("takeoutAddress","外送地址:");
|
||||
// order.put("deliveryAmount","0");
|
||||
// order.put("serviceAmount","0");
|
||||
// order.put("channelKey","399_weixin");
|
||||
// order.put("isAlreadyPaid","1");
|
||||
// order.put("orderMode",1);
|
||||
// order.put("OrderRemark","");
|
||||
// order.put("payment",payInfo);
|
||||
//
|
||||
// HashMap<String,Object> params = new HashMap<>();
|
||||
// params.put("shopID",Long.valueOf("76230180"));
|
||||
// params.put("isCheackOut",0);
|
||||
// params.put("isThirdPay",2);
|
||||
// params.put("bankCode","weChat");
|
||||
// params.put("order",order);
|
||||
// params.put("isSentMsg",1);
|
||||
// params.put("msgType",120);
|
||||
// params.put("thirdOrderID",orderInfo.getOrderNo());
|
||||
//
|
||||
//// JSONObject response = hualalaService.doPost("/order/submitordernew", params);
|
||||
//// System.out.println("response = " + response);
|
||||
// }
|
||||
|
||||
|
||||
// @Test
|
||||
// public void chat() {
|
||||
//
|
||||
// String endpoint = "https://api.openai.com/v1/engines/davinci-codex/completions";
|
||||
// String apiKey = "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";
|
||||
//
|
||||
//
|
||||
// // 构建请求
|
||||
// HttpRequest request = HttpRequest.get("https://api.openai.com/v1/engines/davinci-codex/completions")
|
||||
// .header("Authorization", "Bearer ".concat(apiKey));
|
||||
//
|
||||
// // 发送请求并获取响应
|
||||
// HttpResponse response = request.execute();
|
||||
//
|
||||
// // 处理响应结果
|
||||
// int statusCode = response.getStatus();
|
||||
// String body = response.body();
|
||||
// System.out.println("body = " + body);
|
||||
// }
|
||||
|
||||
|
||||
// @Test
|
||||
// public void chatGPT() {
|
||||
// String abc = "{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"您好!有什么我能为您效劳的吗?\"}}";
|
||||
// final JSONObject jsonObject = JSONObject.parseObject(abc);
|
||||
// final String message = jsonObject.getString("message");
|
||||
// System.out.println("message = " + message);
|
||||
// final JSONObject jsonObject1 = JSONObject.parseObject(message);
|
||||
// final String content = jsonObject1.getString("content");
|
||||
// System.out.println("content = " + content);
|
||||
// }
|
||||
|
||||
|
||||
// 自定义参数,这部分是Hutool工具封装的
|
||||
// @Test
|
||||
// public void initQrConfig() {
|
||||
// // 生成指定url对应的二维码到文件,宽和高都是300像素
|
||||
// QrCodeUtil.generate("https://hutool.cn/", 300, 300, FileUtil.file("/Users/gxwebsoft/Documents/uploads/qrcode.jpg"));
|
||||
// }
|
||||
|
||||
|
||||
@Test
|
||||
public void allIdCard() {
|
||||
// List<User> users = userService.list(new QueryWrapper<>());
|
||||
// System.out.println(users.size());
|
||||
// List<Certificate> certificateList = new ArrayList<>();
|
||||
// for (User user : users) {
|
||||
// Certificate certificate = new Certificate();
|
||||
// certificate.setFullName("xxx");
|
||||
// certificate.setCertificateCode("XXX");
|
||||
// certificate.setCertificateType("idCard");
|
||||
// certificate.setExpirationTime(LocalDateTime.now());
|
||||
// certificate.setAuthentication(1);
|
||||
// certificate.setUserId(user.getUserId());
|
||||
// certificate.setTenantId(10053);
|
||||
// certificateService.save(certificate);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void setProfile(){
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,189 +0,0 @@
|
||||
package com.gxwebsoft.generator;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.generator.AutoGenerator;
|
||||
import com.baomidou.mybatisplus.generator.InjectionConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.*;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
||||
import com.gxwebsoft.generator.engine.BeetlTemplateEnginePlus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 代码生成工具
|
||||
*
|
||||
* @author WebSoft
|
||||
* @since 2021-09-05 00:31:14
|
||||
*/
|
||||
public class AppsGenerator {
|
||||
// 输出位置
|
||||
private static final String OUTPUT_LOCATION = System.getProperty("user.dir");
|
||||
//private static final String OUTPUT_LOCATION = "D:/codegen"; // 不想生成到项目中可以写磁盘路径
|
||||
// 输出目录
|
||||
private static final String OUTPUT_DIR = "/src/main/java";
|
||||
// 作者名称
|
||||
private static final String AUTHOR = "科技小王子";
|
||||
// 是否在xml中添加二级缓存配置
|
||||
private static final boolean ENABLE_CACHE = false;
|
||||
// 数据库连接配置
|
||||
private static final String DB_URL = "jdbc:mysql://47.119.165.234:3308/com_gxwebsoft_oa?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8";
|
||||
private static final String DB_DRIVER = "com.mysql.cj.jdbc.Driver";
|
||||
private static final String DB_USERNAME = "com_gxwebsoft_oa";
|
||||
private static final String DB_PASSWORD = "EZfW2R4YiWfbLHLw";
|
||||
// 包名
|
||||
private static final String PACKAGE_NAME = "com.gxwebsoft";
|
||||
// 模块名
|
||||
private static final String MODULE_NAME = "apps";
|
||||
// 需要生成的表
|
||||
private static final String[] TABLE_NAMES = new String[]{
|
||||
// "apps_equipment",
|
||||
// "apps_equipment_fault",
|
||||
// "apps_equipment_alarm",
|
||||
// "apps_equipment_record"
|
||||
// "apps_equipment_order"
|
||||
// "apps_cashier",
|
||||
// "apps_hualala_card",
|
||||
// "apps_hualala_card_benefits",
|
||||
// "apps_hualala_food",
|
||||
// "apps_hualala_shop",
|
||||
// "apps_hualala_cart_food",
|
||||
// "apps_hualala_food_category",
|
||||
// "apps_test_data",
|
||||
// "apps_link",
|
||||
// "apps_bc_agent",
|
||||
// "apps_bc_temporary",
|
||||
// "apps_link",
|
||||
// "apps_bc_plan",
|
||||
// "apps_bc_food",
|
||||
// "apps_bc_equipment",
|
||||
// "apps_bc_cookbook"
|
||||
"apps_bc_export"
|
||||
// "apps_equipment_order_goods"
|
||||
|
||||
};
|
||||
// 需要去除的表前缀
|
||||
private static final String[] TABLE_PREFIX = new String[]{
|
||||
"apps_",
|
||||
"tb_"
|
||||
};
|
||||
// 不需要作为查询参数的字段
|
||||
private static final String[] PARAM_EXCLUDE_FIELDS = new String[]{
|
||||
"tenant_id",
|
||||
"create_time",
|
||||
"update_time"
|
||||
};
|
||||
// 查询参数使用String的类型
|
||||
private static final String[] PARAM_TO_STRING_TYPE = new String[]{
|
||||
"Date",
|
||||
"LocalDate",
|
||||
"LocalTime",
|
||||
"LocalDateTime"
|
||||
};
|
||||
// 查询参数使用EQ的类型
|
||||
private static final String[] PARAM_EQ_TYPE = new String[]{
|
||||
"Integer",
|
||||
"Boolean",
|
||||
"BigDecimal"
|
||||
};
|
||||
// 是否添加权限注解
|
||||
private static final boolean AUTH_ANNOTATION = true;
|
||||
// 是否添加日志注解
|
||||
private static final boolean LOG_ANNOTATION = true;
|
||||
// controller的mapping前缀
|
||||
private static final String CONTROLLER_MAPPING_PREFIX = "/api";
|
||||
// 模板所在位置
|
||||
private static final String TEMPLATES_DIR = "/src/test/java/com/gxwebsoft/generator/templates";
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 代码生成器
|
||||
AutoGenerator mpg = new AutoGenerator();
|
||||
|
||||
// 全局配置
|
||||
GlobalConfig gc = new GlobalConfig();
|
||||
gc.setOutputDir(OUTPUT_LOCATION + OUTPUT_DIR);
|
||||
gc.setAuthor(AUTHOR);
|
||||
gc.setOpen(false);
|
||||
gc.setFileOverride(true);
|
||||
gc.setEnableCache(ENABLE_CACHE);
|
||||
gc.setSwagger2(true);
|
||||
gc.setIdType(IdType.AUTO);
|
||||
gc.setServiceName("%sService");
|
||||
mpg.setGlobalConfig(gc);
|
||||
|
||||
// 数据源配置
|
||||
DataSourceConfig dsc = new DataSourceConfig();
|
||||
dsc.setUrl(DB_URL);
|
||||
// dsc.setSchemaName("public");
|
||||
dsc.setDriverName(DB_DRIVER);
|
||||
dsc.setUsername(DB_USERNAME);
|
||||
dsc.setPassword(DB_PASSWORD);
|
||||
mpg.setDataSource(dsc);
|
||||
|
||||
// 包配置
|
||||
PackageConfig pc = new PackageConfig();
|
||||
pc.setModuleName(MODULE_NAME);
|
||||
pc.setParent(PACKAGE_NAME);
|
||||
mpg.setPackageInfo(pc);
|
||||
|
||||
// 策略配置
|
||||
StrategyConfig strategy = new StrategyConfig();
|
||||
strategy.setNaming(NamingStrategy.underline_to_camel);
|
||||
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
|
||||
strategy.setInclude(TABLE_NAMES);
|
||||
strategy.setTablePrefix(TABLE_PREFIX);
|
||||
strategy.setSuperControllerClass(PACKAGE_NAME + ".common.core.web.BaseController");
|
||||
strategy.setEntityLombokModel(true);
|
||||
strategy.setRestControllerStyle(true);
|
||||
strategy.setControllerMappingHyphenStyle(true);
|
||||
strategy.setLogicDeleteFieldName("deleted");
|
||||
mpg.setStrategy(strategy);
|
||||
|
||||
// 模板配置
|
||||
TemplateConfig templateConfig = new TemplateConfig();
|
||||
templateConfig.setController(TEMPLATES_DIR + "/controller.java");
|
||||
templateConfig.setEntity(TEMPLATES_DIR + "/entity.java");
|
||||
templateConfig.setMapper(TEMPLATES_DIR + "/mapper.java");
|
||||
templateConfig.setXml(TEMPLATES_DIR + "/mapper.xml");
|
||||
templateConfig.setService(TEMPLATES_DIR + "/service.java");
|
||||
templateConfig.setServiceImpl(TEMPLATES_DIR + "/serviceImpl.java");
|
||||
mpg.setTemplate(templateConfig);
|
||||
mpg.setTemplateEngine(new BeetlTemplateEnginePlus());
|
||||
|
||||
// 自定义模板配置
|
||||
InjectionConfig cfg = new InjectionConfig() {
|
||||
@Override
|
||||
public void initMap() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("packageName", PACKAGE_NAME);
|
||||
map.put("paramExcludeFields", PARAM_EXCLUDE_FIELDS);
|
||||
map.put("paramToStringType", PARAM_TO_STRING_TYPE);
|
||||
map.put("paramEqType", PARAM_EQ_TYPE);
|
||||
map.put("authAnnotation", AUTH_ANNOTATION);
|
||||
map.put("logAnnotation", LOG_ANNOTATION);
|
||||
map.put("controllerMappingPrefix", CONTROLLER_MAPPING_PREFIX);
|
||||
this.setMap(map);
|
||||
}
|
||||
};
|
||||
String templatePath = TEMPLATES_DIR + "/param.java.btl";
|
||||
List<FileOutConfig> focList = new ArrayList<>();
|
||||
focList.add(new FileOutConfig(templatePath) {
|
||||
@Override
|
||||
public String outputFile(TableInfo tableInfo) {
|
||||
return OUTPUT_LOCATION + OUTPUT_DIR + "/"
|
||||
+ PACKAGE_NAME.replace(".", "/")
|
||||
+ "/" + pc.getModuleName() + "/param/"
|
||||
+ tableInfo.getEntityName() + "Param" + StringPool.DOT_JAVA;
|
||||
}
|
||||
});
|
||||
cfg.setFileOutConfigList(focList);
|
||||
mpg.setCfg(cfg);
|
||||
|
||||
mpg.execute();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,178 +0,0 @@
|
||||
package com.gxwebsoft.generator;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.generator.AutoGenerator;
|
||||
import com.baomidou.mybatisplus.generator.InjectionConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.*;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
||||
import com.gxwebsoft.generator.engine.BeetlTemplateEnginePlus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 代码生成工具
|
||||
*
|
||||
* @author WebSoft
|
||||
* @since 2021-09-05 00:31:14
|
||||
*/
|
||||
public class CmsGenerator {
|
||||
// 输出位置
|
||||
private static final String OUTPUT_LOCATION = System.getProperty("user.dir");
|
||||
//private static final String OUTPUT_LOCATION = "D:/codegen"; // 不想生成到项目中可以写磁盘路径
|
||||
// 输出目录
|
||||
private static final String OUTPUT_DIR = "/src/main/java";
|
||||
// 作者名称
|
||||
private static final String AUTHOR = "科技小王子";
|
||||
// 是否在xml中添加二级缓存配置
|
||||
private static final boolean ENABLE_CACHE = false;
|
||||
// 数据库连接配置
|
||||
private static final String DB_URL = "jdbc:mysql://47.119.165.234:3308/com_gxwebsoft_oa?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8";
|
||||
private static final String DB_DRIVER = "com.mysql.cj.jdbc.Driver";
|
||||
private static final String DB_USERNAME = "com_gxwebsoft_oa";
|
||||
private static final String DB_PASSWORD = "EZfW2R4YiWfbLHLw";
|
||||
// 包名
|
||||
private static final String PACKAGE_NAME = "com.gxwebsoft";
|
||||
// 模块名
|
||||
private static final String MODULE_NAME = "cms";
|
||||
// 需要生成的表
|
||||
private static final String[] TABLE_NAMES = new String[]{
|
||||
// "cms_article",
|
||||
// "cms_article_category",
|
||||
// "cms_article_like",
|
||||
"cms_article_comment",
|
||||
// "cms_docs",
|
||||
// "cms_docs",
|
||||
// "cms_docs",
|
||||
// "cms_docs",
|
||||
// "cms_docs",
|
||||
// "cms_docs",
|
||||
// "cms_docs",
|
||||
// "cms_docs",
|
||||
// "cms_docs",
|
||||
};
|
||||
// 需要去除的表前缀
|
||||
private static final String[] TABLE_PREFIX = new String[]{
|
||||
"cms_",
|
||||
"tb_"
|
||||
};
|
||||
// 不需要作为查询参数的字段
|
||||
private static final String[] PARAM_EXCLUDE_FIELDS = new String[]{
|
||||
"tenant_id",
|
||||
"create_time",
|
||||
"update_time"
|
||||
};
|
||||
// 查询参数使用String的类型
|
||||
private static final String[] PARAM_TO_STRING_TYPE = new String[]{
|
||||
"Date",
|
||||
"LocalDate",
|
||||
"LocalTime",
|
||||
"LocalDateTime"
|
||||
};
|
||||
// 查询参数使用EQ的类型
|
||||
private static final String[] PARAM_EQ_TYPE = new String[]{
|
||||
"Integer",
|
||||
"Boolean",
|
||||
"BigDecimal"
|
||||
};
|
||||
// 是否添加权限注解
|
||||
private static final boolean AUTH_ANNOTATION = true;
|
||||
// 是否添加日志注解
|
||||
private static final boolean LOG_ANNOTATION = true;
|
||||
// controller的mapping前缀
|
||||
private static final String CONTROLLER_MAPPING_PREFIX = "/api";
|
||||
// 模板所在位置
|
||||
private static final String TEMPLATES_DIR = "/src/test/java/com/gxwebsoft/generator/templates";
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 代码生成器
|
||||
AutoGenerator mpg = new AutoGenerator();
|
||||
|
||||
// 全局配置
|
||||
GlobalConfig gc = new GlobalConfig();
|
||||
gc.setOutputDir(OUTPUT_LOCATION + OUTPUT_DIR);
|
||||
gc.setAuthor(AUTHOR);
|
||||
gc.setOpen(false);
|
||||
gc.setFileOverride(true);
|
||||
gc.setEnableCache(ENABLE_CACHE);
|
||||
gc.setSwagger2(true);
|
||||
gc.setIdType(IdType.AUTO);
|
||||
gc.setServiceName("%sService");
|
||||
mpg.setGlobalConfig(gc);
|
||||
|
||||
// 数据源配置
|
||||
DataSourceConfig dsc = new DataSourceConfig();
|
||||
dsc.setUrl(DB_URL);
|
||||
// dsc.setSchemaName("public");
|
||||
dsc.setDriverName(DB_DRIVER);
|
||||
dsc.setUsername(DB_USERNAME);
|
||||
dsc.setPassword(DB_PASSWORD);
|
||||
mpg.setDataSource(dsc);
|
||||
|
||||
// 包配置
|
||||
PackageConfig pc = new PackageConfig();
|
||||
pc.setModuleName(MODULE_NAME);
|
||||
pc.setParent(PACKAGE_NAME);
|
||||
mpg.setPackageInfo(pc);
|
||||
|
||||
// 策略配置
|
||||
StrategyConfig strategy = new StrategyConfig();
|
||||
strategy.setNaming(NamingStrategy.underline_to_camel);
|
||||
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
|
||||
strategy.setInclude(TABLE_NAMES);
|
||||
strategy.setTablePrefix(TABLE_PREFIX);
|
||||
strategy.setSuperControllerClass(PACKAGE_NAME + ".common.core.web.BaseController");
|
||||
strategy.setEntityLombokModel(true);
|
||||
strategy.setRestControllerStyle(true);
|
||||
strategy.setControllerMappingHyphenStyle(true);
|
||||
strategy.setLogicDeleteFieldName("deleted");
|
||||
mpg.setStrategy(strategy);
|
||||
|
||||
// 模板配置
|
||||
TemplateConfig templateConfig = new TemplateConfig();
|
||||
templateConfig.setController(TEMPLATES_DIR + "/controller.java");
|
||||
templateConfig.setEntity(TEMPLATES_DIR + "/entity.java");
|
||||
templateConfig.setMapper(TEMPLATES_DIR + "/mapper.java");
|
||||
templateConfig.setXml(TEMPLATES_DIR + "/mapper.xml");
|
||||
templateConfig.setService(TEMPLATES_DIR + "/service.java");
|
||||
templateConfig.setServiceImpl(TEMPLATES_DIR + "/serviceImpl.java");
|
||||
mpg.setTemplate(templateConfig);
|
||||
mpg.setTemplateEngine(new BeetlTemplateEnginePlus());
|
||||
|
||||
// 自定义模板配置
|
||||
InjectionConfig cfg = new InjectionConfig() {
|
||||
@Override
|
||||
public void initMap() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("packageName", PACKAGE_NAME);
|
||||
map.put("paramExcludeFields", PARAM_EXCLUDE_FIELDS);
|
||||
map.put("paramToStringType", PARAM_TO_STRING_TYPE);
|
||||
map.put("paramEqType", PARAM_EQ_TYPE);
|
||||
map.put("authAnnotation", AUTH_ANNOTATION);
|
||||
map.put("logAnnotation", LOG_ANNOTATION);
|
||||
map.put("controllerMappingPrefix", CONTROLLER_MAPPING_PREFIX);
|
||||
this.setMap(map);
|
||||
}
|
||||
};
|
||||
String templatePath = TEMPLATES_DIR + "/param.java.btl";
|
||||
List<FileOutConfig> focList = new ArrayList<>();
|
||||
focList.add(new FileOutConfig(templatePath) {
|
||||
@Override
|
||||
public String outputFile(TableInfo tableInfo) {
|
||||
return OUTPUT_LOCATION + OUTPUT_DIR + "/"
|
||||
+ PACKAGE_NAME.replace(".", "/")
|
||||
+ "/" + pc.getModuleName() + "/param/"
|
||||
+ tableInfo.getEntityName() + "Param" + StringPool.DOT_JAVA;
|
||||
}
|
||||
});
|
||||
cfg.setFileOutConfigList(focList);
|
||||
mpg.setCfg(cfg);
|
||||
|
||||
mpg.execute();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
package com.gxwebsoft.generator;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.generator.AutoGenerator;
|
||||
import com.baomidou.mybatisplus.generator.InjectionConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.*;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
||||
import com.gxwebsoft.generator.engine.BeetlTemplateEnginePlus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 代码生成工具
|
||||
*
|
||||
* @author WebSoft
|
||||
* @since 2021-09-05 00:31:14
|
||||
*/
|
||||
public class HouseGenerator {
|
||||
// 输出位置
|
||||
private static final String OUTPUT_LOCATION = System.getProperty("user.dir");
|
||||
//private static final String OUTPUT_LOCATION = "D:/codegen"; // 不想生成到项目中可以写磁盘路径
|
||||
// 输出目录
|
||||
private static final String OUTPUT_DIR = "/src/main/java";
|
||||
// 作者名称
|
||||
private static final String AUTHOR = "科技小王子";
|
||||
// 是否在xml中添加二级缓存配置
|
||||
private static final boolean ENABLE_CACHE = false;
|
||||
// 数据库连接配置
|
||||
private static final String DB_URL = "jdbc:mysql://47.119.165.234:3308/com_gxwebsoft_oa?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8";
|
||||
private static final String DB_DRIVER = "com.mysql.cj.jdbc.Driver";
|
||||
private static final String DB_USERNAME = "com_gxwebsoft_oa";
|
||||
private static final String DB_PASSWORD = "EZfW2R4YiWfbLHLw";
|
||||
// 包名
|
||||
private static final String PACKAGE_NAME = "com.gxwebsoft";
|
||||
// 模块名
|
||||
private static final String MODULE_NAME = "house";
|
||||
// 需要生成的表
|
||||
private static final String[] TABLE_NAMES = new String[]{
|
||||
"house_info"
|
||||
};
|
||||
// 需要去除的表前缀
|
||||
private static final String[] TABLE_PREFIX = new String[]{
|
||||
"house_",
|
||||
"tb_"
|
||||
};
|
||||
// 不需要作为查询参数的字段
|
||||
private static final String[] PARAM_EXCLUDE_FIELDS = new String[]{
|
||||
"tenant_id",
|
||||
"create_time",
|
||||
"update_time"
|
||||
};
|
||||
// 查询参数使用String的类型
|
||||
private static final String[] PARAM_TO_STRING_TYPE = new String[]{
|
||||
"Date",
|
||||
"LocalDate",
|
||||
"LocalTime",
|
||||
"LocalDateTime"
|
||||
};
|
||||
// 查询参数使用EQ的类型
|
||||
private static final String[] PARAM_EQ_TYPE = new String[]{
|
||||
"Integer",
|
||||
"Boolean",
|
||||
"BigDecimal"
|
||||
};
|
||||
// 是否添加权限注解
|
||||
private static final boolean AUTH_ANNOTATION = true;
|
||||
// 是否添加日志注解
|
||||
private static final boolean LOG_ANNOTATION = true;
|
||||
// controller的mapping前缀
|
||||
private static final String CONTROLLER_MAPPING_PREFIX = "/api";
|
||||
// 模板所在位置
|
||||
private static final String TEMPLATES_DIR = "/src/test/java/com/gxwebsoft/generator/templates";
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 代码生成器
|
||||
AutoGenerator mpg = new AutoGenerator();
|
||||
|
||||
// 全局配置
|
||||
GlobalConfig gc = new GlobalConfig();
|
||||
gc.setOutputDir(OUTPUT_LOCATION + OUTPUT_DIR);
|
||||
gc.setAuthor(AUTHOR);
|
||||
gc.setOpen(false);
|
||||
gc.setFileOverride(true);
|
||||
gc.setEnableCache(ENABLE_CACHE);
|
||||
gc.setSwagger2(true);
|
||||
gc.setIdType(IdType.AUTO);
|
||||
gc.setServiceName("%sService");
|
||||
mpg.setGlobalConfig(gc);
|
||||
|
||||
// 数据源配置
|
||||
DataSourceConfig dsc = new DataSourceConfig();
|
||||
dsc.setUrl(DB_URL);
|
||||
// dsc.setSchemaName("public");
|
||||
dsc.setDriverName(DB_DRIVER);
|
||||
dsc.setUsername(DB_USERNAME);
|
||||
dsc.setPassword(DB_PASSWORD);
|
||||
mpg.setDataSource(dsc);
|
||||
|
||||
// 包配置
|
||||
PackageConfig pc = new PackageConfig();
|
||||
pc.setModuleName(MODULE_NAME);
|
||||
pc.setParent(PACKAGE_NAME);
|
||||
mpg.setPackageInfo(pc);
|
||||
|
||||
// 策略配置
|
||||
StrategyConfig strategy = new StrategyConfig();
|
||||
strategy.setNaming(NamingStrategy.underline_to_camel);
|
||||
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
|
||||
strategy.setInclude(TABLE_NAMES);
|
||||
strategy.setTablePrefix(TABLE_PREFIX);
|
||||
strategy.setSuperControllerClass(PACKAGE_NAME + ".common.core.web.BaseController");
|
||||
strategy.setEntityLombokModel(true);
|
||||
strategy.setRestControllerStyle(true);
|
||||
strategy.setControllerMappingHyphenStyle(true);
|
||||
strategy.setLogicDeleteFieldName("deleted");
|
||||
mpg.setStrategy(strategy);
|
||||
|
||||
// 模板配置
|
||||
TemplateConfig templateConfig = new TemplateConfig();
|
||||
templateConfig.setController(TEMPLATES_DIR + "/controller.java");
|
||||
templateConfig.setEntity(TEMPLATES_DIR + "/entity.java");
|
||||
templateConfig.setMapper(TEMPLATES_DIR + "/mapper.java");
|
||||
templateConfig.setXml(TEMPLATES_DIR + "/mapper.xml");
|
||||
templateConfig.setService(TEMPLATES_DIR + "/service.java");
|
||||
templateConfig.setServiceImpl(TEMPLATES_DIR + "/serviceImpl.java");
|
||||
mpg.setTemplate(templateConfig);
|
||||
mpg.setTemplateEngine(new BeetlTemplateEnginePlus());
|
||||
|
||||
// 自定义模板配置
|
||||
InjectionConfig cfg = new InjectionConfig() {
|
||||
@Override
|
||||
public void initMap() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("packageName", PACKAGE_NAME);
|
||||
map.put("paramExcludeFields", PARAM_EXCLUDE_FIELDS);
|
||||
map.put("paramToStringType", PARAM_TO_STRING_TYPE);
|
||||
map.put("paramEqType", PARAM_EQ_TYPE);
|
||||
map.put("authAnnotation", AUTH_ANNOTATION);
|
||||
map.put("logAnnotation", LOG_ANNOTATION);
|
||||
map.put("controllerMappingPrefix", CONTROLLER_MAPPING_PREFIX);
|
||||
this.setMap(map);
|
||||
}
|
||||
};
|
||||
String templatePath = TEMPLATES_DIR + "/param.java.btl";
|
||||
List<FileOutConfig> focList = new ArrayList<>();
|
||||
focList.add(new FileOutConfig(templatePath) {
|
||||
@Override
|
||||
public String outputFile(TableInfo tableInfo) {
|
||||
return OUTPUT_LOCATION + OUTPUT_DIR + "/"
|
||||
+ PACKAGE_NAME.replace(".", "/")
|
||||
+ "/" + pc.getModuleName() + "/param/"
|
||||
+ tableInfo.getEntityName() + "Param" + StringPool.DOT_JAVA;
|
||||
}
|
||||
});
|
||||
cfg.setFileOutConfigList(focList);
|
||||
mpg.setCfg(cfg);
|
||||
|
||||
mpg.execute();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
package com.gxwebsoft.generator;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.generator.AutoGenerator;
|
||||
import com.baomidou.mybatisplus.generator.InjectionConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.*;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
||||
import com.gxwebsoft.generator.engine.BeetlTemplateEnginePlus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 代码生成工具
|
||||
*
|
||||
* @author WebSoft
|
||||
* @since 2021-09-05 00:31:14
|
||||
*/
|
||||
public class LoveGenerator {
|
||||
// 输出位置
|
||||
private static final String OUTPUT_LOCATION = System.getProperty("user.dir");
|
||||
//private static final String OUTPUT_LOCATION = "D:/codegen"; // 不想生成到项目中可以写磁盘路径
|
||||
// 输出目录
|
||||
private static final String OUTPUT_DIR = "/src/main/java";
|
||||
// 作者名称
|
||||
private static final String AUTHOR = "科技小王子";
|
||||
// 是否在xml中添加二级缓存配置
|
||||
private static final boolean ENABLE_CACHE = false;
|
||||
// 数据库连接配置
|
||||
private static final String DB_URL = "jdbc:mysql://47.119.165.234:3308/com_gxwebsoft_oa?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8";
|
||||
private static final String DB_DRIVER = "com.mysql.cj.jdbc.Driver";
|
||||
private static final String DB_USERNAME = "com_gxwebsoft_oa";
|
||||
private static final String DB_PASSWORD = "EZfW2R4YiWfbLHLw";
|
||||
// 包名
|
||||
private static final String PACKAGE_NAME = "com.gxwebsoft";
|
||||
// 模块名
|
||||
private static final String MODULE_NAME = "love";
|
||||
// 需要生成的表
|
||||
private static final String[] TABLE_NAMES = new String[]{
|
||||
// "love_user_profile",
|
||||
// "love_user_plan",
|
||||
// "love_user_plan_price",
|
||||
// "love_user_plan_log",
|
||||
// "love_user_plan_icon",
|
||||
// "love_user_plan_equity",
|
||||
// "love_certificate",
|
||||
"love_profit"
|
||||
};
|
||||
// 需要去除的表前缀
|
||||
private static final String[] TABLE_PREFIX = new String[]{
|
||||
"love_",
|
||||
"tb_"
|
||||
};
|
||||
// 不需要作为查询参数的字段
|
||||
private static final String[] PARAM_EXCLUDE_FIELDS = new String[]{
|
||||
"tenant_id",
|
||||
"create_time",
|
||||
"update_time"
|
||||
};
|
||||
// 查询参数使用String的类型
|
||||
private static final String[] PARAM_TO_STRING_TYPE = new String[]{
|
||||
"Date",
|
||||
"LocalDate",
|
||||
"LocalTime",
|
||||
"LocalDateTime"
|
||||
};
|
||||
// 查询参数使用EQ的类型
|
||||
private static final String[] PARAM_EQ_TYPE = new String[]{
|
||||
"Integer",
|
||||
"Boolean",
|
||||
"BigDecimal"
|
||||
};
|
||||
// 是否添加权限注解
|
||||
private static final boolean AUTH_ANNOTATION = true;
|
||||
// 是否添加日志注解
|
||||
private static final boolean LOG_ANNOTATION = true;
|
||||
// controller的mapping前缀
|
||||
private static final String CONTROLLER_MAPPING_PREFIX = "/api";
|
||||
// 模板所在位置
|
||||
private static final String TEMPLATES_DIR = "/src/test/java/com/gxwebsoft/generator/templates";
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 代码生成器
|
||||
AutoGenerator mpg = new AutoGenerator();
|
||||
|
||||
// 全局配置
|
||||
GlobalConfig gc = new GlobalConfig();
|
||||
gc.setOutputDir(OUTPUT_LOCATION + OUTPUT_DIR);
|
||||
gc.setAuthor(AUTHOR);
|
||||
gc.setOpen(false);
|
||||
gc.setFileOverride(true);
|
||||
gc.setEnableCache(ENABLE_CACHE);
|
||||
gc.setSwagger2(true);
|
||||
gc.setIdType(IdType.AUTO);
|
||||
gc.setServiceName("%sService");
|
||||
mpg.setGlobalConfig(gc);
|
||||
|
||||
// 数据源配置
|
||||
DataSourceConfig dsc = new DataSourceConfig();
|
||||
dsc.setUrl(DB_URL);
|
||||
// dsc.setSchemaName("public");
|
||||
dsc.setDriverName(DB_DRIVER);
|
||||
dsc.setUsername(DB_USERNAME);
|
||||
dsc.setPassword(DB_PASSWORD);
|
||||
mpg.setDataSource(dsc);
|
||||
|
||||
// 包配置
|
||||
PackageConfig pc = new PackageConfig();
|
||||
pc.setModuleName(MODULE_NAME);
|
||||
pc.setParent(PACKAGE_NAME);
|
||||
mpg.setPackageInfo(pc);
|
||||
|
||||
// 策略配置
|
||||
StrategyConfig strategy = new StrategyConfig();
|
||||
strategy.setNaming(NamingStrategy.underline_to_camel);
|
||||
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
|
||||
strategy.setInclude(TABLE_NAMES);
|
||||
strategy.setTablePrefix(TABLE_PREFIX);
|
||||
strategy.setSuperControllerClass(PACKAGE_NAME + ".common.core.web.BaseController");
|
||||
strategy.setEntityLombokModel(true);
|
||||
strategy.setRestControllerStyle(true);
|
||||
strategy.setControllerMappingHyphenStyle(true);
|
||||
strategy.setLogicDeleteFieldName("deleted");
|
||||
mpg.setStrategy(strategy);
|
||||
|
||||
// 模板配置
|
||||
TemplateConfig templateConfig = new TemplateConfig();
|
||||
templateConfig.setController(TEMPLATES_DIR + "/controller.java");
|
||||
templateConfig.setEntity(TEMPLATES_DIR + "/entity.java");
|
||||
templateConfig.setMapper(TEMPLATES_DIR + "/mapper.java");
|
||||
templateConfig.setXml(TEMPLATES_DIR + "/mapper.xml");
|
||||
templateConfig.setService(TEMPLATES_DIR + "/service.java");
|
||||
templateConfig.setServiceImpl(TEMPLATES_DIR + "/serviceImpl.java");
|
||||
mpg.setTemplate(templateConfig);
|
||||
mpg.setTemplateEngine(new BeetlTemplateEnginePlus());
|
||||
|
||||
// 自定义模板配置
|
||||
InjectionConfig cfg = new InjectionConfig() {
|
||||
@Override
|
||||
public void initMap() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("packageName", PACKAGE_NAME);
|
||||
map.put("paramExcludeFields", PARAM_EXCLUDE_FIELDS);
|
||||
map.put("paramToStringType", PARAM_TO_STRING_TYPE);
|
||||
map.put("paramEqType", PARAM_EQ_TYPE);
|
||||
map.put("authAnnotation", AUTH_ANNOTATION);
|
||||
map.put("logAnnotation", LOG_ANNOTATION);
|
||||
map.put("controllerMappingPrefix", CONTROLLER_MAPPING_PREFIX);
|
||||
this.setMap(map);
|
||||
}
|
||||
};
|
||||
String templatePath = TEMPLATES_DIR + "/param.java.btl";
|
||||
List<FileOutConfig> focList = new ArrayList<>();
|
||||
focList.add(new FileOutConfig(templatePath) {
|
||||
@Override
|
||||
public String outputFile(TableInfo tableInfo) {
|
||||
return OUTPUT_LOCATION + OUTPUT_DIR + "/"
|
||||
+ PACKAGE_NAME.replace(".", "/")
|
||||
+ "/" + pc.getModuleName() + "/param/"
|
||||
+ tableInfo.getEntityName() + "Param" + StringPool.DOT_JAVA;
|
||||
}
|
||||
});
|
||||
cfg.setFileOutConfigList(focList);
|
||||
mpg.setCfg(cfg);
|
||||
|
||||
mpg.execute();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,180 +0,0 @@
|
||||
package com.gxwebsoft.generator;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.generator.AutoGenerator;
|
||||
import com.baomidou.mybatisplus.generator.InjectionConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.*;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
||||
import com.gxwebsoft.generator.engine.BeetlTemplateEnginePlus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 代码生成工具
|
||||
*
|
||||
* @author WebSoft
|
||||
* @since 2021-09-05 00:31:14
|
||||
*/
|
||||
public class OaGenerator {
|
||||
// 输出位置
|
||||
private static final String OUTPUT_LOCATION = System.getProperty("user.dir");
|
||||
//private static final String OUTPUT_LOCATION = "D:/codegen"; // 不想生成到项目中可以写磁盘路径
|
||||
// 输出目录
|
||||
private static final String OUTPUT_DIR = "/src/main/java";
|
||||
// 作者名称
|
||||
private static final String AUTHOR = "科技小王子";
|
||||
// 是否在xml中添加二级缓存配置
|
||||
private static final boolean ENABLE_CACHE = false;
|
||||
// 数据库连接配置
|
||||
private static final String DB_URL = "jdbc:mysql://47.119.165.234:3308/com_gxwebsoft_oa?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8";
|
||||
private static final String DB_DRIVER = "com.mysql.cj.jdbc.Driver";
|
||||
private static final String DB_USERNAME = "com_gxwebsoft_oa";
|
||||
private static final String DB_PASSWORD = "EZfW2R4YiWfbLHLw";
|
||||
// 包名
|
||||
private static final String PACKAGE_NAME = "com.gxwebsoft";
|
||||
// 模块名
|
||||
private static final String MODULE_NAME = "oa";
|
||||
// 需要生成的表
|
||||
private static final String[] TABLE_NAMES = new String[]{
|
||||
// "oa_project",
|
||||
// "oa_link",
|
||||
// "oa_assets",
|
||||
// "oa_customer",
|
||||
// "oa_task",
|
||||
// "oa_task_record",
|
||||
// "oa_task_user",
|
||||
// "sys_tenant",
|
||||
// "oa_app",
|
||||
// "oa_setting",
|
||||
// "oa_assets",
|
||||
// "oa_app_user",
|
||||
// "oa_notice"
|
||||
"oa_assets_user",
|
||||
|
||||
};
|
||||
// 需要去除的表前缀
|
||||
private static final String[] TABLE_PREFIX = new String[]{
|
||||
"oa_",
|
||||
"tb_"
|
||||
};
|
||||
// 不需要作为查询参数的字段
|
||||
private static final String[] PARAM_EXCLUDE_FIELDS = new String[]{
|
||||
"tenant_id",
|
||||
"create_time",
|
||||
"update_time"
|
||||
};
|
||||
// 查询参数使用String的类型
|
||||
private static final String[] PARAM_TO_STRING_TYPE = new String[]{
|
||||
"Date",
|
||||
"LocalDate",
|
||||
"LocalTime",
|
||||
"LocalDateTime"
|
||||
};
|
||||
// 查询参数使用EQ的类型
|
||||
private static final String[] PARAM_EQ_TYPE = new String[]{
|
||||
"Integer",
|
||||
"Boolean",
|
||||
"BigDecimal"
|
||||
};
|
||||
// 是否添加权限注解
|
||||
private static final boolean AUTH_ANNOTATION = true;
|
||||
// 是否添加日志注解
|
||||
private static final boolean LOG_ANNOTATION = true;
|
||||
// controller的mapping前缀
|
||||
private static final String CONTROLLER_MAPPING_PREFIX = "/api";
|
||||
// 模板所在位置
|
||||
private static final String TEMPLATES_DIR = "/src/test/java/com/gxwebsoft/generator/templates";
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 代码生成器
|
||||
AutoGenerator mpg = new AutoGenerator();
|
||||
|
||||
// 全局配置
|
||||
GlobalConfig gc = new GlobalConfig();
|
||||
gc.setOutputDir(OUTPUT_LOCATION + OUTPUT_DIR);
|
||||
gc.setAuthor(AUTHOR);
|
||||
gc.setOpen(false);
|
||||
gc.setFileOverride(true);
|
||||
gc.setEnableCache(ENABLE_CACHE);
|
||||
gc.setSwagger2(true);
|
||||
gc.setIdType(IdType.AUTO);
|
||||
gc.setServiceName("%sService");
|
||||
mpg.setGlobalConfig(gc);
|
||||
|
||||
// 数据源配置
|
||||
DataSourceConfig dsc = new DataSourceConfig();
|
||||
dsc.setUrl(DB_URL);
|
||||
// dsc.setSchemaName("public");
|
||||
dsc.setDriverName(DB_DRIVER);
|
||||
dsc.setUsername(DB_USERNAME);
|
||||
dsc.setPassword(DB_PASSWORD);
|
||||
mpg.setDataSource(dsc);
|
||||
|
||||
// 包配置
|
||||
PackageConfig pc = new PackageConfig();
|
||||
pc.setModuleName(MODULE_NAME);
|
||||
pc.setParent(PACKAGE_NAME);
|
||||
mpg.setPackageInfo(pc);
|
||||
|
||||
// 策略配置
|
||||
StrategyConfig strategy = new StrategyConfig();
|
||||
strategy.setNaming(NamingStrategy.underline_to_camel);
|
||||
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
|
||||
strategy.setInclude(TABLE_NAMES);
|
||||
strategy.setTablePrefix(TABLE_PREFIX);
|
||||
strategy.setSuperControllerClass(PACKAGE_NAME + ".common.core.web.BaseController");
|
||||
strategy.setEntityLombokModel(true);
|
||||
strategy.setRestControllerStyle(true);
|
||||
strategy.setControllerMappingHyphenStyle(true);
|
||||
strategy.setLogicDeleteFieldName("deleted");
|
||||
mpg.setStrategy(strategy);
|
||||
|
||||
// 模板配置
|
||||
TemplateConfig templateConfig = new TemplateConfig();
|
||||
templateConfig.setController(TEMPLATES_DIR + "/controller.java");
|
||||
templateConfig.setEntity(TEMPLATES_DIR + "/entity.java");
|
||||
templateConfig.setMapper(TEMPLATES_DIR + "/mapper.java");
|
||||
templateConfig.setXml(TEMPLATES_DIR + "/mapper.xml");
|
||||
templateConfig.setService(TEMPLATES_DIR + "/service.java");
|
||||
templateConfig.setServiceImpl(TEMPLATES_DIR + "/serviceImpl.java");
|
||||
mpg.setTemplate(templateConfig);
|
||||
mpg.setTemplateEngine(new BeetlTemplateEnginePlus());
|
||||
|
||||
// 自定义模板配置
|
||||
InjectionConfig cfg = new InjectionConfig() {
|
||||
@Override
|
||||
public void initMap() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("packageName", PACKAGE_NAME);
|
||||
map.put("paramExcludeFields", PARAM_EXCLUDE_FIELDS);
|
||||
map.put("paramToStringType", PARAM_TO_STRING_TYPE);
|
||||
map.put("paramEqType", PARAM_EQ_TYPE);
|
||||
map.put("authAnnotation", AUTH_ANNOTATION);
|
||||
map.put("logAnnotation", LOG_ANNOTATION);
|
||||
map.put("controllerMappingPrefix", CONTROLLER_MAPPING_PREFIX);
|
||||
this.setMap(map);
|
||||
}
|
||||
};
|
||||
String templatePath = TEMPLATES_DIR + "/param.java.btl";
|
||||
List<FileOutConfig> focList = new ArrayList<>();
|
||||
focList.add(new FileOutConfig(templatePath) {
|
||||
@Override
|
||||
public String outputFile(TableInfo tableInfo) {
|
||||
return OUTPUT_LOCATION + OUTPUT_DIR + "/"
|
||||
+ PACKAGE_NAME.replace(".", "/")
|
||||
+ "/" + pc.getModuleName() + "/param/"
|
||||
+ tableInfo.getEntityName() + "Param" + StringPool.DOT_JAVA;
|
||||
}
|
||||
});
|
||||
cfg.setFileOutConfigList(focList);
|
||||
mpg.setCfg(cfg);
|
||||
|
||||
mpg.execute();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,209 +0,0 @@
|
||||
package com.gxwebsoft.generator;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.generator.AutoGenerator;
|
||||
import com.baomidou.mybatisplus.generator.InjectionConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.*;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
||||
import com.gxwebsoft.generator.engine.BeetlTemplateEnginePlus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 代码生成工具
|
||||
*
|
||||
* @author WebSoft
|
||||
* @since 2021-09-05 00:31:14
|
||||
*/
|
||||
public class ShopGenerator {
|
||||
// 输出位置
|
||||
private static final String OUTPUT_LOCATION = System.getProperty("user.dir");
|
||||
//private static final String OUTPUT_LOCATION = "D:/codegen"; // 不想生成到项目中可以写磁盘路径
|
||||
// 输出目录
|
||||
private static final String OUTPUT_DIR = "/src/main/java";
|
||||
// 作者名称
|
||||
private static final String AUTHOR = "科技小王子";
|
||||
// 是否在xml中添加二级缓存配置
|
||||
private static final boolean ENABLE_CACHE = false;
|
||||
// 数据库连接配置
|
||||
private static final String DB_URL = "jdbc:mysql://47.119.165.234:3308/com_gxwebsoft_oa?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8";
|
||||
private static final String DB_DRIVER = "com.mysql.cj.jdbc.Driver";
|
||||
private static final String DB_USERNAME = "com_gxwebsoft_oa";
|
||||
private static final String DB_PASSWORD = "EZfW2R4YiWfbLHLw";
|
||||
// 包名
|
||||
private static final String PACKAGE_NAME = "com.gxwebsoft";
|
||||
// 模块名
|
||||
private static final String MODULE_NAME = "shop";
|
||||
// 需要生成的表
|
||||
private static final String[] TABLE_NAMES = new String[]{
|
||||
// "shop_order",
|
||||
// "shop_goods",
|
||||
// "shop_store",
|
||||
// "shop_cart",
|
||||
// "shop_express",
|
||||
// "shop_category",
|
||||
// "shop_goods_image",
|
||||
// "shop_comment",
|
||||
// "shop_goods_service"
|
||||
// "shop_member"
|
||||
// "shop_user_balance_log",
|
||||
// "shop_user_address",
|
||||
// "shop_user_coupon",
|
||||
// "shop_user_follow",
|
||||
// "shop_user_oauth",
|
||||
// "shop_user_points_log",
|
||||
// "shop_cart"
|
||||
// "shop_info"
|
||||
// "shop_coupon"
|
||||
// "shop_clerk"
|
||||
// "shop_merchant",
|
||||
// "shop_merchant_clerk"
|
||||
// "shop_merchant_withdraw"
|
||||
// "shop_order_address"
|
||||
// "shop_payment",
|
||||
// "shop_payment_template",
|
||||
// "shop_payment_trade"
|
||||
// "shop_order_goods"
|
||||
// "shop_user_oauth"
|
||||
// "shop_order_renew"
|
||||
// "shop_recharge_order",
|
||||
// "shop_recharge_order_plan",
|
||||
// "shop_recharge_plan",
|
||||
// "shop_user_balance_log"
|
||||
// "shop_user_referee",
|
||||
// "shop_order_refund",
|
||||
// "shop_order_refund_address",
|
||||
// "shop_user_grade",
|
||||
// "shop_user_grade_log",
|
||||
// "shop_user_comment",
|
||||
// "shop_user_like",
|
||||
// "shop_user_look"
|
||||
"shop_user_feedback"
|
||||
|
||||
};
|
||||
// 需要去除的表前缀
|
||||
private static final String[] TABLE_PREFIX = new String[]{
|
||||
"shop_",
|
||||
"tb_"
|
||||
};
|
||||
// 不需要作为查询参数的字段
|
||||
private static final String[] PARAM_EXCLUDE_FIELDS = new String[]{
|
||||
"tenant_id",
|
||||
"create_time",
|
||||
"update_time"
|
||||
};
|
||||
// 查询参数使用String的类型
|
||||
private static final String[] PARAM_TO_STRING_TYPE = new String[]{
|
||||
"Date",
|
||||
"LocalDate",
|
||||
"LocalTime",
|
||||
"LocalDateTime"
|
||||
};
|
||||
// 查询参数使用EQ的类型
|
||||
private static final String[] PARAM_EQ_TYPE = new String[]{
|
||||
"Integer",
|
||||
"Boolean",
|
||||
"BigDecimal"
|
||||
};
|
||||
// 是否添加权限注解
|
||||
private static final boolean AUTH_ANNOTATION = true;
|
||||
// 是否添加日志注解
|
||||
private static final boolean LOG_ANNOTATION = true;
|
||||
// controller的mapping前缀
|
||||
private static final String CONTROLLER_MAPPING_PREFIX = "/api";
|
||||
// 模板所在位置
|
||||
private static final String TEMPLATES_DIR = "/src/test/java/com/gxwebsoft/generator/templates";
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 代码生成器
|
||||
AutoGenerator mpg = new AutoGenerator();
|
||||
|
||||
// 全局配置
|
||||
GlobalConfig gc = new GlobalConfig();
|
||||
gc.setOutputDir(OUTPUT_LOCATION + OUTPUT_DIR);
|
||||
gc.setAuthor(AUTHOR);
|
||||
gc.setOpen(false);
|
||||
gc.setFileOverride(true);
|
||||
gc.setEnableCache(ENABLE_CACHE);
|
||||
gc.setSwagger2(true);
|
||||
gc.setIdType(IdType.AUTO);
|
||||
gc.setServiceName("%sService");
|
||||
mpg.setGlobalConfig(gc);
|
||||
|
||||
// 数据源配置
|
||||
DataSourceConfig dsc = new DataSourceConfig();
|
||||
dsc.setUrl(DB_URL);
|
||||
// dsc.setSchemaName("public");
|
||||
dsc.setDriverName(DB_DRIVER);
|
||||
dsc.setUsername(DB_USERNAME);
|
||||
dsc.setPassword(DB_PASSWORD);
|
||||
mpg.setDataSource(dsc);
|
||||
|
||||
// 包配置
|
||||
PackageConfig pc = new PackageConfig();
|
||||
pc.setModuleName(MODULE_NAME);
|
||||
pc.setParent(PACKAGE_NAME);
|
||||
mpg.setPackageInfo(pc);
|
||||
|
||||
// 策略配置
|
||||
StrategyConfig strategy = new StrategyConfig();
|
||||
strategy.setNaming(NamingStrategy.underline_to_camel);
|
||||
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
|
||||
strategy.setInclude(TABLE_NAMES);
|
||||
strategy.setTablePrefix(TABLE_PREFIX);
|
||||
strategy.setSuperControllerClass(PACKAGE_NAME + ".common.core.web.BaseController");
|
||||
strategy.setEntityLombokModel(true);
|
||||
strategy.setRestControllerStyle(true);
|
||||
strategy.setControllerMappingHyphenStyle(true);
|
||||
strategy.setLogicDeleteFieldName("deleted");
|
||||
mpg.setStrategy(strategy);
|
||||
|
||||
// 模板配置
|
||||
TemplateConfig templateConfig = new TemplateConfig();
|
||||
templateConfig.setController(TEMPLATES_DIR + "/controller.java");
|
||||
templateConfig.setEntity(TEMPLATES_DIR + "/entity.java");
|
||||
templateConfig.setMapper(TEMPLATES_DIR + "/mapper.java");
|
||||
templateConfig.setXml(TEMPLATES_DIR + "/mapper.xml");
|
||||
templateConfig.setService(TEMPLATES_DIR + "/service.java");
|
||||
templateConfig.setServiceImpl(TEMPLATES_DIR + "/serviceImpl.java");
|
||||
mpg.setTemplate(templateConfig);
|
||||
mpg.setTemplateEngine(new BeetlTemplateEnginePlus());
|
||||
|
||||
// 自定义模板配置
|
||||
InjectionConfig cfg = new InjectionConfig() {
|
||||
@Override
|
||||
public void initMap() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("packageName", PACKAGE_NAME);
|
||||
map.put("paramExcludeFields", PARAM_EXCLUDE_FIELDS);
|
||||
map.put("paramToStringType", PARAM_TO_STRING_TYPE);
|
||||
map.put("paramEqType", PARAM_EQ_TYPE);
|
||||
map.put("authAnnotation", AUTH_ANNOTATION);
|
||||
map.put("logAnnotation", LOG_ANNOTATION);
|
||||
map.put("controllerMappingPrefix", CONTROLLER_MAPPING_PREFIX);
|
||||
this.setMap(map);
|
||||
}
|
||||
};
|
||||
String templatePath = TEMPLATES_DIR + "/param.java.btl";
|
||||
List<FileOutConfig> focList = new ArrayList<>();
|
||||
focList.add(new FileOutConfig(templatePath) {
|
||||
@Override
|
||||
public String outputFile(TableInfo tableInfo) {
|
||||
return OUTPUT_LOCATION + OUTPUT_DIR + "/"
|
||||
+ PACKAGE_NAME.replace(".", "/")
|
||||
+ "/" + pc.getModuleName() + "/param/"
|
||||
+ tableInfo.getEntityName() + "Param" + StringPool.DOT_JAVA;
|
||||
}
|
||||
});
|
||||
cfg.setFileOutConfigList(focList);
|
||||
mpg.setCfg(cfg);
|
||||
|
||||
mpg.execute();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,10 +31,10 @@ public class SysGenerator {
|
||||
// 是否在xml中添加二级缓存配置
|
||||
private static final boolean ENABLE_CACHE = false;
|
||||
// 数据库连接配置
|
||||
private static final String DB_URL = "jdbc:mysql://47.119.165.234:3308/com_gxwebsoft_oa?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8";
|
||||
private static final String DB_URL = "jdbc:mysql://47.119.165.234:3308/gxwebsoft_core?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8";
|
||||
private static final String DB_DRIVER = "com.mysql.cj.jdbc.Driver";
|
||||
private static final String DB_USERNAME = "com_gxwebsoft_oa";
|
||||
private static final String DB_PASSWORD = "EZfW2R4YiWfbLHLw";
|
||||
private static final String DB_USERNAME = "gxwebsoft_core";
|
||||
private static final String DB_PASSWORD = "jdj7HYEdYHnYEFBy";
|
||||
// 包名
|
||||
private static final String PACKAGE_NAME = "com.gxwebsoft";
|
||||
// 模块名
|
||||
@@ -43,13 +43,15 @@ public class SysGenerator {
|
||||
private static final String[] TABLE_NAMES = new String[]{
|
||||
|
||||
// "sys_user",
|
||||
"sys_tenant",
|
||||
// "sys_tenant",
|
||||
// "sys_setting"
|
||||
// "sys_access_key"
|
||||
// "sys_company",
|
||||
// "sys_industry"
|
||||
// "sys_plug",
|
||||
// "sys_company"
|
||||
// "sys_user_oauth"
|
||||
"sys_user_grade"
|
||||
|
||||
};
|
||||
// 需要去除的表前缀
|
||||
|
||||
@@ -1,176 +0,0 @@
|
||||
package com.gxwebsoft.generator;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.generator.AutoGenerator;
|
||||
import com.baomidou.mybatisplus.generator.InjectionConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.*;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
||||
import com.gxwebsoft.generator.engine.BeetlTemplateEnginePlus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 代码生成工具
|
||||
*
|
||||
* @author WebSoft
|
||||
* @since 2021-09-05 00:31:14
|
||||
*/
|
||||
public class TowerGenerator {
|
||||
// 输出位置
|
||||
private static final String OUTPUT_LOCATION = System.getProperty("user.dir");
|
||||
//private static final String OUTPUT_LOCATION = "D:/codegen"; // 不想生成到项目中可以写磁盘路径
|
||||
// 输出目录
|
||||
private static final String OUTPUT_DIR = "/src/main/java";
|
||||
// 作者名称
|
||||
private static final String AUTHOR = "科技小王子";
|
||||
// 是否在xml中添加二级缓存配置
|
||||
private static final boolean ENABLE_CACHE = false;
|
||||
// 数据库连接配置
|
||||
private static final String DB_URL = "jdbc:mysql://47.119.165.234:3308/com_gxwebsoft_oa?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8";
|
||||
private static final String DB_DRIVER = "com.mysql.cj.jdbc.Driver";
|
||||
private static final String DB_USERNAME = "com_gxwebsoft_oa";
|
||||
private static final String DB_PASSWORD = "EZfW2R4YiWfbLHLw";
|
||||
// 包名
|
||||
private static final String PACKAGE_NAME = "com.gxwebsoft";
|
||||
// 模块名
|
||||
private static final String MODULE_NAME = "tower";
|
||||
// 需要生成的表
|
||||
private static final String[] TABLE_NAMES = new String[]{
|
||||
// "tower_equipment",
|
||||
// "tower_warehouse",
|
||||
// "tower_accessory"
|
||||
// "tower_project",
|
||||
// "tower_model",
|
||||
// "tower_project_user",
|
||||
// "tower_project_order",
|
||||
// "tower_place",
|
||||
// "tower_place_safety",
|
||||
// "tower_place_standard",
|
||||
"tower_project_place"
|
||||
};
|
||||
// 需要去除的表前缀
|
||||
private static final String[] TABLE_PREFIX = new String[]{
|
||||
"sys_",
|
||||
"tb_"
|
||||
};
|
||||
// 不需要作为查询参数的字段
|
||||
private static final String[] PARAM_EXCLUDE_FIELDS = new String[]{
|
||||
"tenant_id",
|
||||
"create_time",
|
||||
"update_time"
|
||||
};
|
||||
// 查询参数使用String的类型
|
||||
private static final String[] PARAM_TO_STRING_TYPE = new String[]{
|
||||
"Date",
|
||||
"LocalDate",
|
||||
"LocalTime",
|
||||
"LocalDateTime"
|
||||
};
|
||||
// 查询参数使用EQ的类型
|
||||
private static final String[] PARAM_EQ_TYPE = new String[]{
|
||||
"Integer",
|
||||
"Boolean",
|
||||
"BigDecimal"
|
||||
};
|
||||
// 是否添加权限注解
|
||||
private static final boolean AUTH_ANNOTATION = true;
|
||||
// 是否添加日志注解
|
||||
private static final boolean LOG_ANNOTATION = true;
|
||||
// controller的mapping前缀
|
||||
private static final String CONTROLLER_MAPPING_PREFIX = "/api";
|
||||
// 模板所在位置
|
||||
private static final String TEMPLATES_DIR = "/src/test/java/com/gxwebsoft/generator/templates";
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 代码生成器
|
||||
AutoGenerator mpg = new AutoGenerator();
|
||||
|
||||
// 全局配置
|
||||
GlobalConfig gc = new GlobalConfig();
|
||||
gc.setOutputDir(OUTPUT_LOCATION + OUTPUT_DIR);
|
||||
gc.setAuthor(AUTHOR);
|
||||
gc.setOpen(false);
|
||||
gc.setFileOverride(true);
|
||||
gc.setEnableCache(ENABLE_CACHE);
|
||||
gc.setSwagger2(true);
|
||||
gc.setIdType(IdType.AUTO);
|
||||
gc.setServiceName("%sService");
|
||||
mpg.setGlobalConfig(gc);
|
||||
|
||||
// 数据源配置
|
||||
DataSourceConfig dsc = new DataSourceConfig();
|
||||
dsc.setUrl(DB_URL);
|
||||
// dsc.setSchemaName("public");
|
||||
dsc.setDriverName(DB_DRIVER);
|
||||
dsc.setUsername(DB_USERNAME);
|
||||
dsc.setPassword(DB_PASSWORD);
|
||||
mpg.setDataSource(dsc);
|
||||
|
||||
// 包配置
|
||||
PackageConfig pc = new PackageConfig();
|
||||
pc.setModuleName(MODULE_NAME);
|
||||
pc.setParent(PACKAGE_NAME);
|
||||
mpg.setPackageInfo(pc);
|
||||
|
||||
// 策略配置
|
||||
StrategyConfig strategy = new StrategyConfig();
|
||||
strategy.setNaming(NamingStrategy.underline_to_camel);
|
||||
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
|
||||
strategy.setInclude(TABLE_NAMES);
|
||||
strategy.setTablePrefix(TABLE_PREFIX);
|
||||
strategy.setSuperControllerClass(PACKAGE_NAME + ".common.core.web.BaseController");
|
||||
strategy.setEntityLombokModel(true);
|
||||
strategy.setRestControllerStyle(true);
|
||||
strategy.setControllerMappingHyphenStyle(true);
|
||||
strategy.setLogicDeleteFieldName("deleted");
|
||||
mpg.setStrategy(strategy);
|
||||
|
||||
// 模板配置
|
||||
TemplateConfig templateConfig = new TemplateConfig();
|
||||
templateConfig.setController(TEMPLATES_DIR + "/controller.java");
|
||||
templateConfig.setEntity(TEMPLATES_DIR + "/entity.java");
|
||||
templateConfig.setMapper(TEMPLATES_DIR + "/mapper.java");
|
||||
templateConfig.setXml(TEMPLATES_DIR + "/mapper.xml");
|
||||
templateConfig.setService(TEMPLATES_DIR + "/service.java");
|
||||
templateConfig.setServiceImpl(TEMPLATES_DIR + "/serviceImpl.java");
|
||||
mpg.setTemplate(templateConfig);
|
||||
mpg.setTemplateEngine(new BeetlTemplateEnginePlus());
|
||||
|
||||
// 自定义模板配置
|
||||
InjectionConfig cfg = new InjectionConfig() {
|
||||
@Override
|
||||
public void initMap() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("packageName", PACKAGE_NAME);
|
||||
map.put("paramExcludeFields", PARAM_EXCLUDE_FIELDS);
|
||||
map.put("paramToStringType", PARAM_TO_STRING_TYPE);
|
||||
map.put("paramEqType", PARAM_EQ_TYPE);
|
||||
map.put("authAnnotation", AUTH_ANNOTATION);
|
||||
map.put("logAnnotation", LOG_ANNOTATION);
|
||||
map.put("controllerMappingPrefix", CONTROLLER_MAPPING_PREFIX);
|
||||
this.setMap(map);
|
||||
}
|
||||
};
|
||||
String templatePath = TEMPLATES_DIR + "/param.java.btl";
|
||||
List<FileOutConfig> focList = new ArrayList<>();
|
||||
focList.add(new FileOutConfig(templatePath) {
|
||||
@Override
|
||||
public String outputFile(TableInfo tableInfo) {
|
||||
return OUTPUT_LOCATION + OUTPUT_DIR + "/"
|
||||
+ PACKAGE_NAME.replace(".", "/")
|
||||
+ "/" + pc.getModuleName() + "/param/"
|
||||
+ tableInfo.getEntityName() + "Param" + StringPool.DOT_JAVA;
|
||||
}
|
||||
});
|
||||
cfg.setFileOutConfigList(focList);
|
||||
mpg.setCfg(cfg);
|
||||
|
||||
mpg.execute();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user