fix 代码生成器不兼容的bug

This commit is contained in:
damonyuan
2024-11-05 22:54:17 +08:00
parent 8a467f30b6
commit f6a804c00f
7 changed files with 76 additions and 7 deletions

View File

@@ -45,6 +45,16 @@ public class SystemAuthMenuController {
return AjaxResult.success(result);
}
@NotPower
@GetMapping("/systemMenuLists")
@ApiOperation(value="获取菜单列表")
public AjaxResult<Object> systemMenuLists() {
JSONArray result = iSystemAuthMenuService.systemMenuLists();
return AjaxResult.success(result);
}
@GetMapping("/all")
@ApiOperation(value="获取菜单列表")
public AjaxResult<JSONArray> all() {

View File

@@ -10,6 +10,7 @@ import com.mdd.admin.service.system.ISystemRoleMenuService;
import com.mdd.admin.validate.system.SystemMenuCreateValidate;
import com.mdd.admin.validate.system.SystemMenuUpdateValidate;
import com.mdd.admin.vo.system.SystemAuthMenuVo;
import com.mdd.admin.vo.system.SystemMenuListedVo;
import com.mdd.common.entity.system.SystemMenu;
import com.mdd.common.mapper.system.SystemMenuMapper;
import com.mdd.common.util.ListUtils;
@@ -86,6 +87,28 @@ public class SystemMenuServiceImpl implements ISystemMenuService {
}};
}
@Override
public JSONArray systemMenuLists() {
QueryWrapper<SystemMenu> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByDesc("sort");
queryWrapper.orderByAsc("id");
List<SystemMenu> systemAuthMenus = systemAuthMenuMapper.selectList(queryWrapper);
List<SystemMenuListedVo> lists = new ArrayList<>();
for (SystemMenu systemAuthMenu : systemAuthMenus) {
SystemMenuListedVo vo = new SystemMenuListedVo();
BeanUtils.copyProperties(systemAuthMenu, vo);
vo.setCreateTime(TimeUtils.timestampToDate(systemAuthMenu.getCreateTime()));
vo.setUpdateTime(TimeUtils.timestampToDate(systemAuthMenu.getUpdateTime()));
lists.add(vo);
}
JSONArray jsonArray = JSONArray.parseArray(JSONArray.toJSONString(lists));
return ListUtils.listToTree(jsonArray, "id", "pid", "children");
}
@Override
public JSONArray all() {
QueryWrapper<SystemMenu> queryWrapper = new QueryWrapper<>();

View File

@@ -29,6 +29,14 @@ public interface ISystemMenuService {
*/
JSONObject list();
/**
* 菜单列表
*
* @author fzr
* @return JSONArray
*/
JSONArray systemMenuLists();
/**
* 菜单列表
*

View File

@@ -95,7 +95,7 @@ public class GenController {
@GetMapping("/detail")
public AjaxResult<Map<String, Object>> detail(@Validated @IDMust() @RequestParam("id") Integer id) {
Map<String, Object> maps = iGenerateService.detail(id);
return AjaxResult.success(maps);
return AjaxResult.success(200, "成功", maps);
}
/**
@@ -109,7 +109,7 @@ public class GenController {
Assert.notNull(tables, "请选择要导入的表");
String[] tableNames = tables.split(",");
iGenerateService.importTable(tableNames);
return AjaxResult.success();
return AjaxResult.success("成功", 0);
}
/**
@@ -122,7 +122,7 @@ public class GenController {
@PostMapping("/editTable")
public AjaxResult<Object> editTable(@Validated() @RequestBody GenParam genParam) {
iGenerateService.editTable(genParam);
return AjaxResult.success();
return AjaxResult.success("成功", 0);
}
/**
@@ -135,7 +135,7 @@ public class GenController {
@PostMapping("/delTable")
public AjaxResult<Object> deleteTable(@Validated(value = GenParam.delete.class) @RequestBody GenParam genParam) {
iGenerateService.deleteTable(genParam.getIds());
return AjaxResult.success();
return AjaxResult.success("成功", 0);
}
/**
@@ -148,7 +148,7 @@ public class GenController {
@PostMapping("/syncTable")
public AjaxResult<Object> syncTable(@Validated @IDMust() @RequestParam("id") Integer id) {
iGenerateService.syncTable(id);
return AjaxResult.success();
return AjaxResult.success("成功", 0);
}
/**

View File

@@ -1,5 +1,6 @@
package com.mdd.generator.validate;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.mdd.common.validator.annotation.IDMust;
import com.mdd.common.validator.annotation.IntegerContains;
import com.mdd.common.validator.annotation.StringContains;
@@ -34,21 +35,25 @@ public class GenParam implements Serializable {
@NotNull(message = "tableName参数缺失")
@NotEmpty(message = "表名称不能为空")
@Length(min = 1, max = 200, message = "名称不能大于200个字符")
@JsonProperty("tableName")
private String tableName;
@NotNull(message = "entityName参数缺失")
@NotEmpty(message = "实体类名称不能为空")
@Length(min = 1, max = 200, message = "实体类名称不能大于200个字符")
@JsonProperty("entityName")
private String entityName;
@NotNull(message = "tableComment参数缺失")
@NotEmpty(message = "表描述不能为空")
@Length(min = 1, max = 200, message = "表描述不能大于200个字符")
@JsonProperty("tableComment")
private String tableComment;
@NotNull(message = "authorName参数缺失")
@NotEmpty(message = "作者名称不能为空")
@Length(min = 1, max = 100, message = "作者名称不能大于60个字符")
@JsonProperty("authorName")
private String authorName;
@Length(max = 60, message = "备注不能大于200个字符")
@@ -57,37 +62,53 @@ public class GenParam implements Serializable {
@NotNull(message = "genTpl参数缺失")
@NotEmpty(message = "请选择生成模板")
@StringContains(values = {"crud", "tree"}, message = "选择的生成模板不符合")
@JsonProperty("genTpl")
private String genTpl;
@NotNull(message = "moduleName参数缺失")
@NotEmpty(message = "生成模块名不能为空")
@Length(min = 1, max = 60, message = "生成模块名不能大于60个字符")
@JsonProperty("moduleName")
private String moduleName;
@NotNull(message = "functionName参数缺失")
@NotEmpty(message = "生成功能名不能为空")
@Length(min = 1, max = 60, message = "生成功能名不能大于60个字符")
@JsonProperty("functionName")
private String functionName;
@NotNull(message = "genType参数缺失")
@IntegerContains(values = {0, 1}, message = "选择的生成代码方式不符合")
@JsonProperty("genType")
private Integer genType;
@Length(max = 200, message = "生成代码路径不能大于200个字符")
@JsonProperty("genPath")
private String genPath = "/";
private List<Map<String, String>> column = new ArrayList<>();
@JsonProperty("treePrimary")
private String treePrimary = "";
@JsonProperty("treeParent")
private String treeParent = "";
@JsonProperty("treeName")
private String treeName = "";
@JsonProperty("subTableName")
private String subTableName = "";
@JsonProperty("subTableFk")
private String subTableFk = "";
@JsonProperty("subTableFr")
private String subTableFr = "";
@JsonProperty("menuStatus")
private Integer menuStatus = 2;
@JsonProperty("menuPid")
private Integer menuPid = 0;
@JsonProperty("menuName")
private String menuName = "";
}