Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
pan.wl.2 2024-11-06 22:47:45 +08:00
commit b8548c9ed1
8 changed files with 144 additions and 7 deletions

View File

@ -28,3 +28,9 @@ export function menuDelete(params: Record<string, any>) {
export function menuDetail(params: Record<string, any>) { export function menuDetail(params: Record<string, any>) {
return request.get({ url: '/auth.menu/detail', params }) return request.get({ url: '/auth.menu/detail', params })
} }
// 菜单列表
export function systemMenuLists(params: Record<string, any>) {
return request.get({ url: '/auth.menu/systemMenuLists', params })
}

View File

@ -368,7 +368,7 @@ import { dataTableAll, generateEdit, tableDetail, dataTableToColumn } from '@/ap
import { dictTypeAll } from '@/api/setting/dict' import { dictTypeAll } from '@/api/setting/dict'
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import feedback from '@/utils/feedback' import feedback from '@/utils/feedback'
import { menuLists } from '@/api/perms/menu' import { systemMenuLists } from '@/api/perms/menu'
import { useDictOptions } from '@/hooks/useDictOptions' import { useDictOptions } from '@/hooks/useDictOptions'
import useMultipleTabs from '@/hooks/useMultipleTabs' import useMultipleTabs from '@/hooks/useMultipleTabs'
enum GenTpl { enum GenTpl {
@ -447,8 +447,9 @@ const { optionsData } = useDictOptions<{
api: dictTypeAll api: dictTypeAll
}, },
menu: { menu: {
api: menuLists, api: systemMenuLists,
transformData(data: any) { transformData(data: any) {
console.log(data, "datadatadata")
const menu = { id: 0, menuName: '顶级', children: [] } const menu = { id: 0, menuName: '顶级', children: [] }
menu.children = data menu.children = data
return [menu] return [menu]

View File

@ -45,6 +45,16 @@ public class SystemAuthMenuController {
return AjaxResult.success(result); return AjaxResult.success(result);
} }
@NotPower
@GetMapping("/systemMenuLists")
@ApiOperation(value="获取菜单列表")
public AjaxResult<Object> systemMenuLists() {
JSONArray result = iSystemAuthMenuService.systemMenuLists();
return AjaxResult.success(result);
}
@GetMapping("/all") @GetMapping("/all")
@ApiOperation(value="获取菜单列表") @ApiOperation(value="获取菜单列表")
public AjaxResult<JSONArray> all() { 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.SystemMenuCreateValidate;
import com.mdd.admin.validate.system.SystemMenuUpdateValidate; import com.mdd.admin.validate.system.SystemMenuUpdateValidate;
import com.mdd.admin.vo.system.SystemAuthMenuVo; 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.entity.system.SystemMenu;
import com.mdd.common.mapper.system.SystemMenuMapper; import com.mdd.common.mapper.system.SystemMenuMapper;
import com.mdd.common.util.ListUtils; 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 @Override
public JSONArray all() { public JSONArray all() {
QueryWrapper<SystemMenu> queryWrapper = new QueryWrapper<>(); QueryWrapper<SystemMenu> queryWrapper = new QueryWrapper<>();

View File

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

View File

@ -0,0 +1,68 @@
package com.mdd.admin.vo.system;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel("系统菜单Vo")
public class SystemMenuListedVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Integer id;
@ApiModelProperty(value = "上级菜单")
private Integer pid;
@ApiModelProperty(value = "权限类型: [M=目录, C=菜单, A=按钮]")
@JsonProperty("menuType")
private String type;
@ApiModelProperty(value = "菜单名称")
@JsonProperty("menuName")
private String name;
@ApiModelProperty(value = "菜单图标")
@JsonProperty("menuIcon")
private String icon;
@ApiModelProperty(value = "菜单排序")
@JsonProperty("menuSort")
private Integer sort;
@ApiModelProperty(value = "权限标识")
private String perms;
@ApiModelProperty(value = "路由地址")
private String paths;
@ApiModelProperty(value = "前端组件")
private String component;
@ApiModelProperty(value = "选中路径")
private String selected;
@ApiModelProperty(value = "路由参数")
private String params;
@ApiModelProperty(value = "是否缓存: [0=否, 1=是]")
private Integer isCache;
@ApiModelProperty(value = "是否显示: [0=否, 1=是]")
private Integer isShow;
@ApiModelProperty(value = "是否禁用: [0=否, 1=是]")
private Integer isDisable;
@ApiModelProperty(value = "创建时间")
private String createTime;
@ApiModelProperty(value = "更新时间")
private String updateTime;
}

View File

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

View File

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