mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2026-04-24 03:18:35 +08:00
!15 合并 新功能/satoken 分支
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
package com.ruoyi.gen;
|
||||
|
||||
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 代码生成
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableDubbo
|
||||
@SpringBootApplication
|
||||
public class RuoYiGenApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(RuoYiGenApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 代码生成模块启动成功 ლ(´ڡ`ლ)゙ ");
|
||||
}
|
||||
}
|
||||
package com.ruoyi.gen;
|
||||
|
||||
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 代码生成
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableDubbo
|
||||
@SpringBootApplication
|
||||
public class RuoYiGenApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(RuoYiGenApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 代码生成模块启动成功 ლ(´ڡ`ლ)゙ ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.gen.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
@@ -8,7 +9,6 @@ import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.gen.domain.GenTable;
|
||||
import com.ruoyi.gen.domain.GenTableColumn;
|
||||
import com.ruoyi.gen.service.IGenTableColumnService;
|
||||
@@ -41,7 +41,7 @@ public class GenController extends BaseController {
|
||||
/**
|
||||
* 查询代码生成列表
|
||||
*/
|
||||
@RequiresPermissions("tool:gen:list")
|
||||
@SaCheckPermission("tool:gen:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<GenTable> genList(GenTable genTable, PageQuery pageQuery) {
|
||||
return genTableService.selectPageGenTableList(genTable, pageQuery);
|
||||
@@ -50,7 +50,7 @@ public class GenController extends BaseController {
|
||||
/**
|
||||
* 修改代码生成业务
|
||||
*/
|
||||
@RequiresPermissions("tool:gen:query")
|
||||
@SaCheckPermission("tool:gen:query")
|
||||
@GetMapping(value = "/{talbleId}")
|
||||
public AjaxResult getInfo(@PathVariable Long talbleId) {
|
||||
GenTable table = genTableService.selectGenTableById(talbleId);
|
||||
@@ -66,7 +66,7 @@ public class GenController extends BaseController {
|
||||
/**
|
||||
* 查询数据库列表
|
||||
*/
|
||||
@RequiresPermissions("tool:gen:list")
|
||||
@SaCheckPermission("tool:gen:list")
|
||||
@GetMapping("/db/list")
|
||||
public TableDataInfo<GenTable> dataList(GenTable genTable, PageQuery pageQuery) {
|
||||
return genTableService.selectPageDbTableList(genTable, pageQuery);
|
||||
@@ -87,7 +87,7 @@ public class GenController extends BaseController {
|
||||
/**
|
||||
* 导入表结构(保存)
|
||||
*/
|
||||
@RequiresPermissions("tool:gen:import")
|
||||
@SaCheckPermission("tool:gen:import")
|
||||
@Log(title = "代码生成", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importTable")
|
||||
public AjaxResult importTableSave(String tables) {
|
||||
@@ -101,7 +101,7 @@ public class GenController extends BaseController {
|
||||
/**
|
||||
* 修改保存代码生成业务
|
||||
*/
|
||||
@RequiresPermissions("tool:gen:edit")
|
||||
@SaCheckPermission("tool:gen:edit")
|
||||
@Log(title = "代码生成", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult editSave(@Validated @RequestBody GenTable genTable) {
|
||||
@@ -113,7 +113,7 @@ public class GenController extends BaseController {
|
||||
/**
|
||||
* 删除代码生成
|
||||
*/
|
||||
@RequiresPermissions("tool:gen:remove")
|
||||
@SaCheckPermission("tool:gen:remove")
|
||||
@Log(title = "代码生成", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{tableIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] tableIds) {
|
||||
@@ -124,7 +124,7 @@ public class GenController extends BaseController {
|
||||
/**
|
||||
* 预览代码
|
||||
*/
|
||||
@RequiresPermissions("tool:gen:preview")
|
||||
@SaCheckPermission("tool:gen:preview")
|
||||
@GetMapping("/preview/{tableId}")
|
||||
public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException {
|
||||
Map<String, String> dataMap = genTableService.previewCode(tableId);
|
||||
@@ -134,7 +134,7 @@ public class GenController extends BaseController {
|
||||
/**
|
||||
* 生成代码(下载方式)
|
||||
*/
|
||||
@RequiresPermissions("tool:gen:code")
|
||||
@SaCheckPermission("tool:gen:code")
|
||||
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
||||
@GetMapping("/download/{tableName}")
|
||||
public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException {
|
||||
@@ -145,7 +145,7 @@ public class GenController extends BaseController {
|
||||
/**
|
||||
* 生成代码(自定义路径)
|
||||
*/
|
||||
@RequiresPermissions("tool:gen:code")
|
||||
@SaCheckPermission("tool:gen:code")
|
||||
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
||||
@GetMapping("/genCode/{tableName}")
|
||||
public AjaxResult genCode(@PathVariable("tableName") String tableName) {
|
||||
@@ -156,7 +156,7 @@ public class GenController extends BaseController {
|
||||
/**
|
||||
* 同步数据库
|
||||
*/
|
||||
@RequiresPermissions("tool:gen:edit")
|
||||
@SaCheckPermission("tool:gen:edit")
|
||||
@Log(title = "代码生成", businessType = BusinessType.UPDATE)
|
||||
@GetMapping("/synchDb/{tableName}")
|
||||
public AjaxResult synchDb(@PathVariable("tableName") String tableName) {
|
||||
@@ -167,7 +167,7 @@ public class GenController extends BaseController {
|
||||
/**
|
||||
* 批量生成代码
|
||||
*/
|
||||
@RequiresPermissions("tool:gen:code")
|
||||
@SaCheckPermission("tool:gen:code")
|
||||
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
||||
@GetMapping("/batchGenCode")
|
||||
public void batchGenCode(HttpServletResponse response, String tables) throws IOException {
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.ruoyi.common.core.utils.JsonUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.common.satoken.utils.LoginHelper;
|
||||
import com.ruoyi.gen.domain.GenTable;
|
||||
import com.ruoyi.gen.domain.GenTableColumn;
|
||||
import com.ruoyi.gen.mapper.GenTableColumnMapper;
|
||||
@@ -163,7 +163,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importGenTable(List<GenTable> tableList) {
|
||||
String operName = SecurityUtils.getUsername();
|
||||
String operName = LoginHelper.getUsername();
|
||||
try {
|
||||
for (GenTable table : tableList) {
|
||||
String tableName = table.getTableName();
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ${ClassName}Controller extends BaseController
|
||||
/**
|
||||
* 查询${functionName}列表
|
||||
*/
|
||||
@RequiresPermissions("${permissionPrefix}:list")
|
||||
@SaCheckPermission("${permissionPrefix}:list")
|
||||
@GetMapping("/list")
|
||||
#if($table.crud || $table.sub)
|
||||
public TableDataInfo list(${ClassName} ${className})
|
||||
@@ -60,7 +60,7 @@ public class ${ClassName}Controller extends BaseController
|
||||
/**
|
||||
* 导出${functionName}列表
|
||||
*/
|
||||
@RequiresPermissions("${permissionPrefix}:export")
|
||||
@SaCheckPermission("${permissionPrefix}:export")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ${ClassName} ${className})
|
||||
@@ -73,7 +73,7 @@ public class ${ClassName}Controller extends BaseController
|
||||
/**
|
||||
* 获取${functionName}详细信息
|
||||
*/
|
||||
@RequiresPermissions("${permissionPrefix}:query")
|
||||
@SaCheckPermission("${permissionPrefix}:query")
|
||||
@GetMapping(value = "/{${pkColumn.javaField}}")
|
||||
public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField})
|
||||
{
|
||||
@@ -83,7 +83,7 @@ public class ${ClassName}Controller extends BaseController
|
||||
/**
|
||||
* 新增${functionName}
|
||||
*/
|
||||
@RequiresPermissions("${permissionPrefix}:add")
|
||||
@SaCheckPermission("${permissionPrefix}:add")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ${ClassName} ${className})
|
||||
@@ -94,7 +94,7 @@ public class ${ClassName}Controller extends BaseController
|
||||
/**
|
||||
* 修改${functionName}
|
||||
*/
|
||||
@RequiresPermissions("${permissionPrefix}:edit")
|
||||
@SaCheckPermission("${permissionPrefix}:edit")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ${ClassName} ${className})
|
||||
@@ -105,7 +105,7 @@ public class ${ClassName}Controller extends BaseController
|
||||
/**
|
||||
* 删除${functionName}
|
||||
*/
|
||||
@RequiresPermissions("${permissionPrefix}:remove")
|
||||
@SaCheckPermission("${permissionPrefix}:remove")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{${pkColumn.javaField}s}")
|
||||
public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s)
|
||||
|
||||
Reference in New Issue
Block a user