2020-07-24 18:47

https://jfinal.com/share/1350

2019-12-16 10:43

https://my.oschina.net/giegie/blog/909865

2018-12-21 11:09

model namespace的命名为model首字母小写, 方法名与sql语句名一致

2018-12-21 11:08

加一个BaseModel, 通过堆栈获取信息

/**
* 获取sql模板语句
* @param data
* @return
*/
public SqlPara getSqlPara(Map data) {
StackTraceElement[] stacks = (new Throwable()).getStackTrace();
SqlPara sqlPara = _getConfig().getSqlKit().getSqlPara(getSqlParaKey(stacks), data);
if (sqlPara == null) {
sqlPara = _getConfig().getSqlKit().getSqlPara(getSqlParaKeyTwo(stacks), data);
}

return sqlPara;
}

private String getSqlParaKey(StackTraceElement[] stacks) {
/*Parameter[] parameters = null;*/
String[] classNames = stacks[1].getClassName().split("\\.");
String className = StrUtil.removeAll(classNames[classNames.length - 1], "Dao");
String methodName = stacks[1].getMethodName();
if (StrUtil.containsIgnoreCase(methodName, "ByModel")) {
methodName = "queryByModel";
}
/* for (Method method: ClassLoaderUtil.loadClass(stacks[1].getClassName()).getMethods()) {
if (method.getName().equals(methodName)) {
parameters = method.getParameters();
break;
}
}*/
String key = StrKit.firstCharToLowerCase(className) + "." + methodName;

return key;
}

private String getSqlParaKeyTwo(StackTraceElement[] stacks) {
String[] classNames = stacks[1].getClassName().split("\\.");
String className = StrUtil.removeAll(classNames[classNames.length - 1], "ServiceImpl");
String methodName = stacks[1].getMethodName();
if (StrUtil.containsIgnoreCase(methodName, "ByModel")) {
methodName = "queryByModel";
}

String key = StrKit.firstCharToLowerCase(className) + "." + methodName;

return key;
}

2017-12-22 11:18

如果需要单独推送消息, 就需要对session做绑定操作并缓存.

2017-12-22 11:17

@OnOpen
public void onOpen(@PathParam("userId") int userId, Session session) {
webSocketService.onOpen(userId, session);
}

2017-12-22 11:16

@ServerEndpoint(value ="/websocket/{userId}")

2017-12-21 10:50

逻辑写在service层, 其他类调用就用Duang.duang()

2017-12-21 10:42

session.getBasicRemote().sendText();

2017-11-20 10:18

BaseController extends Controller.....