change - 代码生成优化

main
yinq 7 months ago
parent aab5e83754
commit 6a53dc3f7b

@ -1,9 +1,9 @@
# 代码生成 # 代码生成
gen: gen:
# 作者 # 作者
author: ruoyi author: Yinq
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
packageName: com.os.system packageName: com.os.ems.base
# 自动去除表前缀默认是false # 自动去除表前缀默认是false
autoRemovePre: false autoRemovePre: false
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔) # 表前缀(生成类名不会包含表前缀,多个用逗号分隔)

@ -16,6 +16,7 @@ import com.os.common.annotation.Log;
import com.os.common.core.controller.BaseController; import com.os.common.core.controller.BaseController;
import com.os.common.core.domain.AjaxResult; import com.os.common.core.domain.AjaxResult;
import com.os.common.enums.BusinessType; import com.os.common.enums.BusinessType;
import com.os.common.utils.DateUtils;
import ${packageName}.domain.${ClassName}; import ${packageName}.domain.${ClassName};
import ${packageName}.service.I${ClassName}Service; import ${packageName}.service.I${ClassName}Service;
import com.os.common.utils.poi.ExcelUtil; import com.os.common.utils.poi.ExcelUtil;
@ -88,6 +89,8 @@ public class ${ClassName}Controller extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody ${ClassName} ${className}) public AjaxResult add(@RequestBody ${ClassName} ${className})
{ {
${className}.setCreatedBy(getUsername());
${className}.setCreatedTime(DateUtils.getNowDate());
return toAjax(${className}Service.insert${ClassName}(${className})); return toAjax(${className}Service.insert${ClassName}(${className}));
} }
@ -99,6 +102,8 @@ public class ${ClassName}Controller extends BaseController
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody ${ClassName} ${className}) public AjaxResult edit(@RequestBody ${ClassName} ${className})
{ {
${className}.setUpdatedBy(getUsername());
${className}.setUpdatedTime(DateUtils.getNowDate());
return toAjax(${className}Service.update${ClassName}(${className})); return toAjax(${className}Service.update${ClassName}(${className}));
} }

@ -40,8 +40,8 @@ public class ${ClassName} extends ${Entity}
#if($parentheseIndex != -1) #if($parentheseIndex != -1)
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
#elseif($column.javaType == 'Date') #elseif($column.javaType == 'Date')
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
#else #else
@Excel(name = "${comment}") @Excel(name = "${comment}")
#end #end

@ -3,7 +3,8 @@ insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame
values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', getdate(), '', null, '${functionName}菜单'); values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', getdate(), '', null, '${functionName}菜单');
-- 按钮父菜单ID -- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID(); DECLARE @parentId INT;
SET @parentId = SCOPE_IDENTITY();
-- 按钮 SQL -- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -58,11 +58,11 @@
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
<dependency> <!-- <dependency>-->
<groupId>org.ssssssss</groupId> <!-- <groupId>org.ssssssss</groupId>-->
<artifactId>magic-api-spring-boot-starter</artifactId> <!-- <artifactId>magic-api-spring-boot-starter</artifactId>-->
<version>${magic.version}</version> <!-- <version>${magic.version}</version>-->
</dependency> <!-- </dependency>-->
<!-- Minio文件存储 --> <!-- Minio文件存储 -->
<dependency> <dependency>

Loading…
Cancel
Save