main
黄海 10 months ago
parent 58fc2081ad
commit bc3db88265

@ -59,6 +59,7 @@
<artifactId>slf4j-nop</artifactId>
<version>1.7.30</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
<!--安装hutool-->
<dependency>

@ -1,6 +1,7 @@
package com.dsideal.Tools;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.RuntimeUtil;
import cn.hutool.json.JSONObject;
import com.dsideal.Utils.dsKit;
import com.jfinal.kit.PropKit;
@ -9,7 +10,6 @@ import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
import com.jfinal.plugin.hikaricp.HikariCpPlugin;
import javax.sql.DataSource;
import java.io.File;
import java.sql.*;
import java.util.*;
@ -17,8 +17,6 @@ public class GenerateCode {
// JavaBean保存的位置
public static String beanPath;
// JavaBean包名
public static String beanPackage;
// mysql与java的数据类型映射
public static Map<String, String> dataTypeMap = new HashMap<>();
@ -136,9 +134,7 @@ public class GenerateCode {
public static void main(String[] args) throws Exception {
//加载配置文件
PropKit.use("application.properties");
beanPackage = PropKit.get("beanPackage");
beanPath = PropKit.get("beanPath");
beanPath = beanPath + "/" + beanPackage.replace(".", "/");
if (!FileUtil.exist(beanPath)) {
FileUtil.mkdir(beanPath);
}
@ -222,7 +218,7 @@ public class GenerateCode {
String table = jo.getStr("table");
StringBuilder sb = new StringBuilder();
sb.append("-------------------下面是Controller部分-------------------\n");
//sb.append("//-------------------下面是Controller部分-------------------\n");
//1、增加
sb.append(" //增加" + comment + "\n");
sb.append(" @Before({POST.class})\n");
@ -281,7 +277,11 @@ public class GenerateCode {
sb.append(" }\n");
sb.append("\n");
sb.append("-------------------下面是Model部分-------------------\n");
FileUtil.writeUtf8String(sb.toString(), beanPath + "/" + beanNameWithoutT + "Controller.txt");
//sb.append("//-------------------下面是Model部分-------------------\n");
sb = new StringBuilder();
//1、增加
sb.append(" //增加" + comment + "\n");
sb.append(" public boolean add" + beanNameWithoutT + "(" + fullParameters + "){\n");
@ -332,8 +332,7 @@ public class GenerateCode {
sb.append(" return Db.paginate(pageNum, pageSize, sql," + key + ");\n");
sb.append(" }\n");
sb.append("\n");
FileUtil.writeUtf8String(sb.toString(), beanPath + "/"+ beanNameWithoutT + "Model.txt");
System.out.println(sb);
FileUtil.writeUtf8String(sb.toString(), beanPath + "/" + beanNameWithoutT + ".txt");
}
}

@ -1,92 +0,0 @@
-------------------下面是Controller部分-------------------
//增加维修记录表
@Before({POST.class})
//@JwtCheckInterface({})
//@EmptyInterface({""})
//@IsNumericInterface({})
public void addWxRecord(int station_id , String station_name , int equipmentId , String equipmentName , int connectorId , String connectorNo , String wx_openid , int status_id , int type_id , String type_name , String memo ,){
wm.addWxRecord(station_id , station_name , equipmentId , equipmentName , connectorId , connectorNo , wx_openid , status_id , type_id , type_name , memo ,)
renderJson(RetKit.renderSuccess("操作成功"));
}
//按ID删除维修记录表
@Before({POST.class})
//@JwtCheckInterface({})
//@EmptyInterface({""})
//@IsNumericInterface({"id"})
public void delWxRecordById(int id){
wm.delWxRecordById(id);
renderJson(RetKit.renderSuccess("操作成功"));
}
//按ID修改维修记录表
@Before({POST.class})
//@JwtCheckInterface({})
//@EmptyInterface({""})
//@IsNumericInterface({"id"})
public void updateWxRecordById(int id,int station_id , String station_name , int equipmentId , String equipmentName , int connectorId , String connectorNo , String wx_openid , int status_id , int type_id , String type_name , String memo ,){
wm.updateWxRecordById(station_id , station_name , equipmentId , equipmentName , connectorId , connectorNo , wx_openid , status_id , type_id , type_name , memo ,);
renderJson(RetKit.renderSuccess("操作成功"));
}
//按ID查询维修记录表
@Before({GET.class})
//@JwtCheckInterface({})
//@EmptyInterface({""})
//@IsNumericInterface({"id"})
public void getWxRecordById(int id){
renderJson(RetKit.renderSuccess(wm.getWxRecordById(id)));
}
//分页查询维修记录表
@Before({GET.class})
//@JwtCheckInterface({})
//@EmptyInterface({""})
public void getWxRecordList(int pageNum, int pageSize){
Page<Record> listPage = wm.getWxRecordList(stage_id, pageNum, pageSize);
renderJson(RetKit.renderSuccess(listPage));
}
-------------------下面是Model部分-------------------
//增加维修记录表
public boolean addWxRecord(int station_id , String station_name , int equipmentId , String equipmentName , int connectorId , String connectorNo , String wx_openid , int status_id , int type_id , String type_name , String memo ,){
Record record = new Record();
record.set("station_id",station_id);
record.set("station_name",station_name);
record.set("equipmentId",equipmentId);
record.set("equipmentName",equipmentName);
record.set("connectorId",connectorId);
record.set("connectorNo",connectorNo);
record.set("wx_openid",wx_openid);
record.set("status_id",status_id);
record.set("create_time",create_time);
record.set("type_id",type_id);
record.set("type_name",type_name);
record.set("memo",memo);
Db.save("t_wx_record","id",record);
}
//删除维修记录表
public void delWxRecordById(int id){
String sql="delete from t_wx_record where id=?";
Db.update(sql,id);
}
//修改维修记录表
public void updateWxRecordById(int id,int station_id , String station_name , int equipmentId , String equipmentName , int connectorId , String connectorNo , String wx_openid , int status_id , int type_id , String type_name , String memo ,){
String sql="update t_wx_record set station_id= ?,station_name= ?,equipmentId= ?,equipmentName= ?,connectorId= ?,connectorNo= ?,wx_openid= ?,status_id= ?,create_time= ?,type_id= ?,type_name= ?,memo= ? where id=?";
Db.update(sql,station_id , station_name , equipmentId , equipmentName , connectorId , connectorNo , wx_openid , status_id , create_time , type_id , type_name , memo , id);
}
//单条查询维修记录表
public Record getWxRecordById(int id){
String sql="select * from t_wx_record where id=?";
return Db.findFirst(sql,id);
}
//分页查询维修记录表
public Page<Record> getWxRecordList(int id,int pageNum, int pageSize){
String sql="select * from t_wx_record where id=?";
return Db.paginate(pageNum, pageSize, sql,id);
}

@ -0,0 +1,48 @@
//增加维修记录表
@Before({POST.class})
//@JwtCheckInterface({})
//@EmptyInterface({""})
//@IsNumericInterface({})
public void addWxRecord(int station_id , String station_name , int equipmentId , String equipmentName , int connectorId , String connectorNo , String wx_openid , int status_id , int type_id , String type_name , String memo ,){
wm.addWxRecord(station_id , station_name , equipmentId , equipmentName , connectorId , connectorNo , wx_openid , status_id , type_id , type_name , memo ,)
renderJson(RetKit.renderSuccess("操作成功"));
}
//按ID删除维修记录表
@Before({POST.class})
//@JwtCheckInterface({})
//@EmptyInterface({""})
//@IsNumericInterface({"id"})
public void delWxRecordById(int id){
wm.delWxRecordById(id);
renderJson(RetKit.renderSuccess("操作成功"));
}
//按ID修改维修记录表
@Before({POST.class})
//@JwtCheckInterface({})
//@EmptyInterface({""})
//@IsNumericInterface({"id"})
public void updateWxRecordById(int id,int station_id , String station_name , int equipmentId , String equipmentName , int connectorId , String connectorNo , String wx_openid , int status_id , int type_id , String type_name , String memo ,){
wm.updateWxRecordById(station_id , station_name , equipmentId , equipmentName , connectorId , connectorNo , wx_openid , status_id , type_id , type_name , memo ,);
renderJson(RetKit.renderSuccess("操作成功"));
}
//按ID查询维修记录表
@Before({GET.class})
//@JwtCheckInterface({})
//@EmptyInterface({""})
//@IsNumericInterface({"id"})
public void getWxRecordById(int id){
renderJson(RetKit.renderSuccess(wm.getWxRecordById(id)));
}
//分页查询维修记录表
@Before({GET.class})
//@JwtCheckInterface({})
//@EmptyInterface({""})
public void getWxRecordList(int pageNum, int pageSize){
Page<Record> listPage = wm.getWxRecordList(stage_id, pageNum, pageSize);
renderJson(RetKit.renderSuccess(listPage));
}

@ -0,0 +1,42 @@
//增加维修记录表
public boolean addWxRecord(int station_id , String station_name , int equipmentId , String equipmentName , int connectorId , String connectorNo , String wx_openid , int status_id , int type_id , String type_name , String memo ,){
Record record = new Record();
record.set("station_id",station_id);
record.set("station_name",station_name);
record.set("equipmentId",equipmentId);
record.set("equipmentName",equipmentName);
record.set("connectorId",connectorId);
record.set("connectorNo",connectorNo);
record.set("wx_openid",wx_openid);
record.set("status_id",status_id);
record.set("create_time",create_time);
record.set("type_id",type_id);
record.set("type_name",type_name);
record.set("memo",memo);
Db.save("t_wx_record","id",record);
}
//删除维修记录表
public void delWxRecordById(int id){
String sql="delete from t_wx_record where id=?";
Db.update(sql,id);
}
//修改维修记录表
public void updateWxRecordById(int id,int station_id , String station_name , int equipmentId , String equipmentName , int connectorId , String connectorNo , String wx_openid , int status_id , int type_id , String type_name , String memo ,){
String sql="update t_wx_record set station_id= ?,station_name= ?,equipmentId= ?,equipmentName= ?,connectorId= ?,connectorNo= ?,wx_openid= ?,status_id= ?,create_time= ?,type_id= ?,type_name= ?,memo= ? where id=?";
Db.update(sql,station_id , station_name , equipmentId , equipmentName , connectorId , connectorNo , wx_openid , status_id , create_time , type_id , type_name , memo , id);
}
//单条查询维修记录表
public Record getWxRecordById(int id){
String sql="select * from t_wx_record where id=?";
return Db.findFirst(sql,id);
}
//分页查询维修记录表
public Page<Record> getWxRecordList(int id,int pageNum, int pageSize){
String sql="select * from t_wx_record where id=?";
return Db.paginate(pageNum, pageSize, sql,id);
}

@ -0,0 +1,48 @@
//增加维修记录表
@Before({POST.class})
//@JwtCheckInterface({})
//@EmptyInterface({""})
//@IsNumericInterface({})
public void addWxRecord(int station_id , String station_name , int equipmentId , String equipmentName , int connectorId , String connectorNo , String wx_openid , int status_id , int type_id , String type_name , String memo ,){
wm.addWxRecord(station_id , station_name , equipmentId , equipmentName , connectorId , connectorNo , wx_openid , status_id , type_id , type_name , memo ,)
renderJson(RetKit.renderSuccess("操作成功"));
}
//按ID删除维修记录表
@Before({POST.class})
//@JwtCheckInterface({})
//@EmptyInterface({""})
//@IsNumericInterface({"id"})
public void delWxRecordById(int id){
wm.delWxRecordById(id);
renderJson(RetKit.renderSuccess("操作成功"));
}
//按ID修改维修记录表
@Before({POST.class})
//@JwtCheckInterface({})
//@EmptyInterface({""})
//@IsNumericInterface({"id"})
public void updateWxRecordById(int id,int station_id , String station_name , int equipmentId , String equipmentName , int connectorId , String connectorNo , String wx_openid , int status_id , int type_id , String type_name , String memo ,){
wm.updateWxRecordById(station_id , station_name , equipmentId , equipmentName , connectorId , connectorNo , wx_openid , status_id , type_id , type_name , memo ,);
renderJson(RetKit.renderSuccess("操作成功"));
}
//按ID查询维修记录表
@Before({GET.class})
//@JwtCheckInterface({})
//@EmptyInterface({""})
//@IsNumericInterface({"id"})
public void getWxRecordById(int id){
renderJson(RetKit.renderSuccess(wm.getWxRecordById(id)));
}
//分页查询维修记录表
@Before({GET.class})
//@JwtCheckInterface({})
//@EmptyInterface({""})
public void getWxRecordList(int pageNum, int pageSize){
Page<Record> listPage = wm.getWxRecordList(stage_id, pageNum, pageSize);
renderJson(RetKit.renderSuccess(listPage));
}

@ -0,0 +1,42 @@
//增加维修记录表
public boolean addWxRecord(int station_id , String station_name , int equipmentId , String equipmentName , int connectorId , String connectorNo , String wx_openid , int status_id , int type_id , String type_name , String memo ,){
Record record = new Record();
record.set("station_id",station_id);
record.set("station_name",station_name);
record.set("equipmentId",equipmentId);
record.set("equipmentName",equipmentName);
record.set("connectorId",connectorId);
record.set("connectorNo",connectorNo);
record.set("wx_openid",wx_openid);
record.set("status_id",status_id);
record.set("create_time",create_time);
record.set("type_id",type_id);
record.set("type_name",type_name);
record.set("memo",memo);
Db.save("t_wx_record","id",record);
}
//删除维修记录表
public void delWxRecordById(int id){
String sql="delete from t_wx_record where id=?";
Db.update(sql,id);
}
//修改维修记录表
public void updateWxRecordById(int id,int station_id , String station_name , int equipmentId , String equipmentName , int connectorId , String connectorNo , String wx_openid , int status_id , int type_id , String type_name , String memo ,){
String sql="update t_wx_record set station_id= ?,station_name= ?,equipmentId= ?,equipmentName= ?,connectorId= ?,connectorNo= ?,wx_openid= ?,status_id= ?,create_time= ?,type_id= ?,type_name= ?,memo= ? where id=?";
Db.update(sql,station_id , station_name , equipmentId , equipmentName , connectorId , connectorNo , wx_openid , status_id , create_time , type_id , type_name , memo , id);
}
//单条查询维修记录表
public Record getWxRecordById(int id){
String sql="select * from t_wx_record where id=?";
return Db.findFirst(sql,id);
}
//分页查询维修记录表
public Page<Record> getWxRecordList(int id,int pageNum, int pageSize){
String sql="select * from t_wx_record where id=?";
return Db.paginate(pageNum, pageSize, sql,id);
}

@ -1,15 +1,15 @@
# ?????
# 数据库驱动
driverClassName=com.mysql.cj.jdbc.Driver
user=root
password=DsideaL147258369
jdbcUrl=jdbc:mysql://10.10.14.210:22066/ds_db?useUnicode=true&characterEncoding=UTF-8&useSSL=false
# ????
beanPath=D:/dsWork/dsProject/dsUtils/src/main/java
# ??bean???
beanPackage=com.dsideal.ZhuQue.Bean
# ???????
# 生成的bean存放路径
beanPath=D:/dsWork/dsProject/dsUtils/src/main/java/com/dsideal/ZhuQue
# 表
tableName=t_wx_record
# dao???
# dao的名称
daoName=wm
formatJar=D:/dsWork/dsProject/dsUtils/lib/google-java-format-1.24.0-all-deps.jar

@ -1,15 +1,15 @@
# ?????
# 数据库驱动
driverClassName=com.mysql.cj.jdbc.Driver
user=root
password=DsideaL147258369
jdbcUrl=jdbc:mysql://10.10.14.210:22066/ds_db?useUnicode=true&characterEncoding=UTF-8&useSSL=false
# ????
beanPath=D:/dsWork/dsProject/dsUtils/src/main/java
# ??bean???
beanPackage=com.dsideal.ZhuQue.Bean
# ???????
# 生成的bean存放路径
beanPath=D:/dsWork/dsProject/dsUtils/src/main/java/com/dsideal/ZhuQue
# 表
tableName=t_wx_record
# dao???
# dao的名称
daoName=wm
formatJar=D:/dsWork/dsProject/dsUtils/lib/google-java-format-1.24.0-all-deps.jar

Loading…
Cancel
Save