package com.ckzp.jfinal.system.util;
import cn.hutool.core.util.IdUtil;
import com.ckzp.core.ConfigUtil;
import com.ckzp.core.Results;
import com.ckzp.core.file.FileControl;
import com.ckzp.core.util.DateUtil;
import com.ckzp.core.util.StringUtil;
import com.ckzp.jfinal.system.model.SysCode;
import com.ckzp.jfinal.system.model.SysCodeColumn;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* Created by 51594 on 2021/4/9.
*/
public class SysCodeUtil {
private boolean hasNumber = false;
private boolean hasUpload = false;
private boolean hasColor = false;
private boolean hasIcon = false;
private boolean hasDate = false;
private boolean hasSelect = false;
/**
* @return
*/
public static SysCodeUtil n() {
return new SysCodeUtil();
}
/**
* @param c_id
* @return
*/
public Results InitSysCodeColumn(String c_id) {
SysCode code = SysCode.dao.findById(c_id);
if (code != null) {
String tablename = code.mod.getStr("table_name");
String sql = "SELECT column_name,data_type,column_comment,column_type FROM information_schema.COLUMNS WHERE table_name = ?";
List<SysCodeColumn> lo = SysCodeColumn.dao.find(sql, tablename);
for (SysCodeColumn t : lo) {
String column_name = t.getStr("column_name");
String column_comment = t.getStr("column_comment");
String data_type = t.getStr("data_type");
if (column_name == null) {
column_name = t.getStr("COLUMN_NAME");
column_comment = t.getStr("COLUMN_COMMENT");
data_type = t.getStr("DATA_TYPE");
}
SysCodeColumn cnew = SysCodeColumn.dao.findFirst("select * from sys_code_column where c_id=? and cc_name=?", c_id, column_name);
if (cnew == null) {
SysCodeColumn cc = new SysCodeColumn()
.set("cc_id", IdUtil.fastSimpleUUID())
.set("cc_name", column_name)
.set("c_id", c_id)
.set("cc_name", column_name)
.set("cc_title", column_comment)
.set("cc_type", data_type);
if (column_name.indexOf("desc") > -1 || column_name.indexOf("test") > -1) {
cc.set("f_more", 1);//多行
}
if (column_name.indexOf("img") > -1) {
cc.set("f_img", 1);//图片
}
if (column_name.indexOf("date") > -1 || column_name.indexOf("time") > -1) {
cc.set("f_date", 1);//日期选择
}
cc.save();
}
}
return Results.n(0, "初始化成功");
} else {
return Results.n(9, "CID不存在[" + c_id + "]");
}
}
public String getCodeConfig(SysCode code) {
String tablename = code.mod.getStr("table_name");
String modelname = code.mod.getStr("model_name");
String modelkey = code.mod.getStr("model_key");
StringBuffer sb = new StringBuffer();
//sb.append("//Config.java 数据库映射\n");
sb.append("arp.addMapping(\"" + tablename + "\", \"" + modelkey + "\", " + modelname + ".class);\r\n");
return sb.toString();
}
public String getCodeRoute(SysCode code) {
String tablename = code.mod.getStr("table_name");
String modelname = code.mod.getStr("model_name");
String model_path = code.mod.getStr("model_path");
StringBuffer sb = new StringBuffer();
//sb.append("//Config.java 数据库映射\n");
sb.append("add(ADMIN_PATH + \"/" + model_path + "\", " + modelname + "Controller.class, \"/" + model_path + "\");\r\n");
return sb.toString();
}
/**
* 生成Model文件
*
* @param code
* @return
*/
public String getCodeModel(SysCode code) {
String tablename = code.mod.getStr("table_name");
String modelname = code.mod.getStr("model_name");
String packagename = code.mod.getStr("package_name");
String data = new StringBuffer(readDemoFile("Demo.java.temp")).toString();
data = StringUtil.replace(data, "[package]", packagename);
data = StringUtil.replace(data, "[model]", modelname);
data = StringUtil.replace(data, "[tablename]", tablename);
data = StringUtil.replace(data, "[date]", DateUtil.getDateTime());
return data;
}
/**
* 生成Model文件
*
* @param code
* @return
*/
public String getCodeController(SysCode code) {
String tablename = code.mod.getStr("table_name");
String table_title = code.mod.getStr("table_title");
String pagename = StringUtil.replace(table_title, "表", "");
String modelname = code.mod.getStr("model_name");
String packagename = code.mod.getStr("package_name");
String modelkey = code.mod.getStr("model_key");
String modelsname = code.mod.getStr("model_sname");
String table_role = code.mod.getStr("table_role");
String tree_key = code.mod.getStr("tree_key", "");
int list_tree = code.mod.getInt("list_tree", 0);
int form_v_api = code.mod.getInt("form_v_api");
String columns = "";
List<SysCodeColumn> columnlist = getCodeColumn(code);
String data = new StringBuffer(readDemoFile("DemoController.java.temp")).toString();
data = StringUtil.replace(data, "[pagename]", pagename);
data = StringUtil.replace(data, "[role]", table_role);
data = StringUtil.replace(data, "[package]", packagename);
data = StringUtil.replace(data, "[model]", modelname);
data = StringUtil.replace(data, "[modelkey]", modelkey);
data = StringUtil.replace(data, "[tablename]", tablename);
data = StringUtil.replace(data, "[date]", DateUtil.getDateTime());
data = StringUtil.replace(data, "[columns]", columns);
data = StringUtil.replace(data, "[editcolumn]", getCodeEditColumnCode(columnlist));
data = StringUtil.replace(data, "[setcolumns]", getCodeModifyColumnCode(code, columnlist));
data = StringUtil.replace(data, "[dotagmethod]", getControllerTagMethod(code, columnlist));
data = StringUtil.replace(data, "[sqlsearch]", getControllerSqlSearch(columnlist));
data = StringUtil.replace(data, "[listcolumnput]", getListColumnPut(columnlist));
data = StringUtil.replace(data, "[modelsname]", modelsname);
if (tree_key.length() > 0) {
data = StringUtil.replace(data, "[addfd]", "setAttr(\"" + modelsname + "\", new " + modelname + "().put(\"" + tree_key + "\",getPara(\"" + tree_key + "\")));");
data = StringUtil.replace(data, "[treekey]", "ps.search(\"" + tree_key + "\", getPara(\"" + tree_key + "\", \"0\"));");
} else {
data = StringUtil.replace(data, "[addfd]", "setAttr(\"" + modelsname + "\", new " + modelname + "());");
data = StringUtil.replace(data, "[treekey]", "");
}
if (list_tree == list_tree) {
data = StringUtil.replace(data, "[treelist]", getControllerTreeList());
} else {
data = StringUtil.replace(data, "[treelist]", "");
}
data = StringUtil.replace(data, "[addformdata]", getAddFormData(code, columnlist));
data = StringUtil.replace(data, "[editformdata]", getEditFormData(code, columnlist));
if (form_v_api == 1) {
data = StringUtil.replace(data, "[validator]", " @Before(" + modelname + "Validator.class)");
}
没有合适的资源?快使用搜索试试~ 我知道了~
layuijfinal-tomcat安装及配置教程
共897个文件
class:272个
java:253个
html:130个
需积分: 1 0 下载量 172 浏览量
2024-09-10
06:29:13
上传
评论
收藏 53.33MB ZIP 举报
温馨提示
LAYUI+JFINALJAVA tomcat安装及配置教程 tomcat安装及配置教程 tomcat安装及配置教程 tomcat安装及配置教程 tomcat安装及配置教程
资源推荐
资源详情
资源评论
收起资源包目录
layuijfinal-tomcat安装及配置教程 (897个子文件)
start.bat 1KB
SysCodeUtil.class 37KB
SysInfoUtil.class 23KB
BaseController.class 19KB
SysMenuController.class 17KB
SysUserController.class 17KB
SysMenuUtil.class 16KB
LoginUtil.class 15KB
UpImage.class 15KB
FileControl.class 14KB
Validator.class 14KB
PageSearch.class 14KB
UpDocument.class 14KB
FileUtil.class 14KB
DrawingUtils.class 13KB
MyModel.class 13KB
TestTableController.class 13KB
WXPay.class 13KB
SysRoleController.class 12KB
SysTaskController.class 11KB
SysActivityController.class 11KB
IpKit.class 11KB
WxTool.class 11KB
AuthInterceptor.class 11KB
WXPayUtil.class 10KB
SysCodeController.class 10KB
MyCron4jPlugin.class 10KB
TestDemoController.class 9KB
XmlUtil.class 9KB
SysAppController.class 9KB
AppTool.class 9KB
WXPayRequest.class 9KB
SysWorkLogController.class 8KB
WxFormUtil.class 8KB
SysPostController.class 8KB
SysTypeController.class 8KB
WxUserUtil.class 8KB
LoginController.class 8KB
DemoConfig.class 8KB
MyX509TrustManager.class 8KB
WxMessageController.class 7KB
WxMessageUtil.class 7KB
MediaTool.class 7KB
Datas.class 7KB
SysTypeCache.class 7KB
SysNoticeController.class 7KB
WXPayReport.class 7KB
SysFileController.class 7KB
ImageUtil.class 7KB
Results.class 7KB
WebSite.class 7KB
WxGameTool.class 7KB
SysDataController.class 7KB
WXBizMsgCrypt.class 6KB
SysMenuCache.class 6KB
SysConfigController.class 6KB
ESelect.class 6KB
DrawingModel.class 6KB
MyPayUtil.class 6KB
SysDeptController.class 6KB
DateUtil.class 6KB
StringUtil.class 6KB
FormSelect.class 6KB
Rsa.class 6KB
SysTaskUtil.class 6KB
MakePomFromJars.class 5KB
JwtUtil.class 5KB
ServiceRequest.class 5KB
SysPageController.class 5KB
SysNoticeUtil.class 5KB
SysDataCache.class 5KB
TestCodeController.class 5KB
JsApiObject.class 5KB
Active.class 5KB
Aes.class 5KB
CsrfTokenManager.class 5KB
Models.class 5KB
SysUserUtil.class 5KB
SysCacheUtil.class 5KB
CookieUtil.class 5KB
TreeNode.class 5KB
ConfigUtil.class 4KB
WxMemberController.class 4KB
WxDataAes.class 4KB
AccessTokenTool.class 4KB
SysAppCache.class 4KB
SysUserCache.class 4KB
WebUser.class 4KB
ClientUtil.class 4KB
SysOnlineController.class 4KB
JsApi.class 4KB
FormData.class 4KB
JsonResult.class 4KB
SysOnlineUtil.class 4KB
PageSite.class 4KB
PayReturn.class 4KB
Aes2.class 4KB
TuwenResponse.class 4KB
WxPayController.class 4KB
SysDeptCache.class 4KB
共 897 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
沐知全栈开发
- 粉丝: 5682
- 资源: 5215
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于C语言的多媒体框架chromium_third_party_ffmpeg设计源码
- COMSOL注浆 考虑裂隙倾角(可更改倾角度数),在注浆压力条件下或者注浆速率条件下,扩散距离情况和压力分布情况 可指定是注浆
- 基于博途1200PLC+HMI3x3立体车库~手动版~控制系统仿真 程序: 1、任务:PLC.人机界面横移式升降立体车库运行仿真
- 基于RabbitMQ的Java分布式事务设计源码解析
- 直接序列扩频Matlab仿真和FPGA实现
- 基于Python的频域空域双分支视频和谐化V4设计源码
- 基于COSTAS 环的残余频偏偏差补偿MATLAB仿真和FPGA实现
- 基于Java与多语言集成的bistoury设计源码探索
- 燃料电池电池超级电容复合能量管理策略simulink仿真模型,advisor仿真 燃料电池 电池 超级电容复合能量管理策略 1、
- 基于Java的兼容性设计——status-bar-color设置库源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功