refactor(generator):重构代码生成器配置与模板
- 重命名 ShopGenerator 为 ClinicGenerator - 更新数据库连接配置信息 - 修改模块名称为 clinic- 更新 Vue 和 UniApp 文件输出路径 - 移除未使用的 import 语句- 注释掉 Controller 模板中的用户 ID 设置逻辑 - 新增 OperationLog 注解类 - 删除无用的 TestMain 测试类
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package com.gxwebsoft.common.core.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 操作日志记录注解
|
||||
*
|
||||
* @author WebSoft
|
||||
* @since 2020-03-21 17:03:08
|
||||
*/
|
||||
@Documented
|
||||
@Target({ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface OperationLog {
|
||||
|
||||
/**
|
||||
* 操作功能
|
||||
*/
|
||||
String value() default "";
|
||||
|
||||
/**
|
||||
* 操作模块
|
||||
*/
|
||||
String module() default "";
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
String comments() default "";
|
||||
|
||||
/**
|
||||
* 是否记录请求参数
|
||||
*/
|
||||
boolean param() default true;
|
||||
|
||||
/**
|
||||
* 是否记录返回结果
|
||||
*/
|
||||
boolean result() default true;
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.gxwebsoft;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
/**
|
||||
* Created by WebSoft on 2020-03-23 23:37
|
||||
*/
|
||||
@SpringBootTest
|
||||
public class TestMain {
|
||||
/**
|
||||
* 测试
|
||||
*/
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
System.out.println("测试");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,7 +13,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -25,16 +24,16 @@ import java.util.regex.Matcher;
|
||||
* @author WebSoft
|
||||
* @since 2021-09-05 00:31:14
|
||||
*/
|
||||
public class ShopGenerator {
|
||||
public class ClinicGenerator {
|
||||
// 输出位置
|
||||
private static final String OUTPUT_LOCATION = System.getProperty("user.dir");
|
||||
//private static final String OUTPUT_LOCATION = "D:/codegen"; // 不想生成到项目中可以写磁盘路径
|
||||
// JAVA输出目录
|
||||
private static final String OUTPUT_DIR = "/src/main/java";
|
||||
// Vue文件输出位置
|
||||
private static final String OUTPUT_LOCATION_VUE = "/Users/gxwebsoft/VUE/mp-vue";
|
||||
private static final String OUTPUT_LOCATION_VUE = "/Users/gxwebsoft/VUE/generator-vue";
|
||||
// UniApp文件输出目录
|
||||
private static final String OUTPUT_LOCATION_UNIAPP = "/Users/gxwebsoft/VUE/template-10550";
|
||||
private static final String OUTPUT_LOCATION_UNIAPP = "/Users/gxwebsoft/APP/template-10001";
|
||||
// Vue文件输出目录
|
||||
private static final String OUTPUT_DIR_VUE = "/src";
|
||||
// 作者名称
|
||||
@@ -42,70 +41,30 @@ public class ShopGenerator {
|
||||
// 是否在xml中添加二级缓存配置
|
||||
private static final boolean ENABLE_CACHE = false;
|
||||
// 数据库连接配置
|
||||
private static final String DB_URL = "jdbc:mysql://8.134.169.209:13306/cms_demo?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8";
|
||||
private static final String DB_URL = "jdbc:mysql://8.134.169.209:13306/modules?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 = "cms_demo";
|
||||
private static final String DB_PASSWORD = "EtzJFr4A3c4THZjY";
|
||||
private static final String DB_USERNAME = "modules";
|
||||
private static final String DB_PASSWORD = "P7KsAyDXG8YdLnkA";
|
||||
// 包名
|
||||
private static final String PACKAGE_NAME = "com.gxwebsoft";
|
||||
// 模块名
|
||||
private static final String MODULE_NAME = "oa";
|
||||
private static final String MODULE_NAME = "clinic";
|
||||
// 需要生成的表
|
||||
private static final String[] TABLE_NAMES = new String[]{
|
||||
// "shop_spec",
|
||||
// "shop_spec_value",
|
||||
// "shop_goods",
|
||||
// "shop_category",
|
||||
// "shop_goods_spec",
|
||||
// "shop_goods_sku",
|
||||
// "shop_goods_category",
|
||||
// "shop_coupon",
|
||||
// "shop_goods_description",
|
||||
// "shop_goods_log",
|
||||
// "shop_goods_relation",
|
||||
// "shop_goods_comment",
|
||||
// "shop_goods_rule",
|
||||
// "shop_brand",
|
||||
// "shop_merchant",
|
||||
// "shop_merchant_type",
|
||||
// "shop_merchant_apply",
|
||||
// "shop_merchant_account",
|
||||
// "shop_chat_message",
|
||||
// "shop_chat_conversation",
|
||||
// "shop_user_collection",
|
||||
// "shop_goods_role_commission"
|
||||
// "shop_commission_role"
|
||||
// "shop_order",
|
||||
// "shop_order_info",
|
||||
// "shop_order_info_log",
|
||||
// "shop_order_goods",
|
||||
// "shop_wechat_deposit",
|
||||
// "shop_users",
|
||||
// "shop_user_address",
|
||||
// "shop_user_balance_log",
|
||||
// "shop_recharge_order",
|
||||
// 经销商表
|
||||
// "shop_dealer_apply",
|
||||
// "shop_dealer_capital",
|
||||
// "shop_dealer_order",
|
||||
// "shop_dealer_referee",
|
||||
// "shop_dealer_setting",
|
||||
// "shop_dealer_user",
|
||||
// "shop_user_referee",
|
||||
// "shop_dealer_withdraw",
|
||||
// "shop_user_coupon",
|
||||
// "shop_cart",
|
||||
// "shop_count",
|
||||
// "shop_order_delivery",
|
||||
// "shop_order_delivery_goods",
|
||||
// "shop_order_extract",
|
||||
// "shop_splash",
|
||||
// "shop_goods_income_config"
|
||||
// "shop_express",
|
||||
// "shop_express_template",
|
||||
// "shop_express_template_detail",
|
||||
// "shop_gift"
|
||||
"shop_article"
|
||||
"clinic_appointment",
|
||||
// "clinic_doctor_apply",
|
||||
// "clinic_doctor_medical_record",
|
||||
// "clinic_doctor_user",
|
||||
// "clinic_medical_history",
|
||||
// "clinic_medicine",
|
||||
// "clinic_medicine_inout",
|
||||
// "clinic_medicine_stock",
|
||||
// "clinic_order",
|
||||
// "clinic_patient_user",
|
||||
// "clinic_prescription",
|
||||
// "clinic_prescription_item",
|
||||
// "clinic_report",
|
||||
// "clinic_visit_record",
|
||||
};
|
||||
// 需要去除的表前缀
|
||||
private static final String[] TABLE_PREFIX = new String[]{
|
||||
@@ -22,7 +22,6 @@ import ${cfg.packageName!}.common.core.web.PageResult;
|
||||
import ${cfg.packageName!}.common.core.web.PageParam;
|
||||
import ${cfg.packageName!}.common.core.web.BatchParam;
|
||||
import ${cfg.packageName!}.common.core.annotation.OperationLog;
|
||||
import ${cfg.packageName!}.common.system.entity.User;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -139,10 +138,10 @@ public class ${table.controllerName} {
|
||||
<% } %>
|
||||
<% if(hasUserIdField){ %>
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
${table.entityPath}.setUserId(loginUser.getUserId());
|
||||
}
|
||||
// User loginUser = getLoginUser();
|
||||
// if (loginUser != null) {
|
||||
// ${table.entityPath}.setUserId(loginUser.getUserId());
|
||||
// }
|
||||
<% } %>
|
||||
if (${serviceIns}.save(${table.entityPath})) {
|
||||
return success("添加成功");
|
||||
|
||||
Reference in New Issue
Block a user