默认接口目录
This commit is contained in:
@@ -45,10 +45,6 @@ public class ShopConfigDTO implements Serializable {
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 是否允许会员自定义金额 1-允许 0-不允许
|
||||
*/
|
||||
private Integer isCustomAmount;
|
||||
/**
|
||||
* 是否开启退款密码 1-启用 0-禁用
|
||||
*/
|
||||
|
||||
@@ -76,10 +76,6 @@ public class ShopInfoEditDTO {
|
||||
*/
|
||||
private Integer isReturnPwd;
|
||||
|
||||
/**
|
||||
* 是否允许会员自定义金额 1 允许 0 不允许
|
||||
*/
|
||||
private Integer isCustomAmount;
|
||||
|
||||
/**
|
||||
* 是否开启会员充值密码 1 启用 0 禁用
|
||||
|
||||
@@ -42,10 +42,10 @@ public class ShopUserAddDTO implements Serializable {
|
||||
*/
|
||||
private Integer sex;
|
||||
|
||||
/**
|
||||
* 账户积分
|
||||
*/
|
||||
private Integer accountPoints;
|
||||
// /**
|
||||
// * 账户积分
|
||||
// */
|
||||
// private Integer accountPoints;
|
||||
|
||||
/**
|
||||
* 钱包余额
|
||||
|
||||
@@ -65,10 +65,6 @@ public class ShopConfig implements Serializable {
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 是否允许会员自定义金额 1-允许 0-不允许
|
||||
*/
|
||||
private Integer isCustomAmount;
|
||||
/**
|
||||
* 是否开启退款密码 1-启用 0-禁用
|
||||
*/
|
||||
private Integer isReturnPwd;
|
||||
|
||||
@@ -283,11 +283,6 @@ public class ShopInfo implements Serializable {
|
||||
*/
|
||||
@Column(ignore = true)
|
||||
private Integer isAllowAccountLogin;
|
||||
/**
|
||||
* 是否允许会员自定义金额 1-允许 0-不允许
|
||||
*/
|
||||
@Column(ignore = true)
|
||||
private Integer isCustomAmount;
|
||||
/**
|
||||
* 是否开启退款密码 1-启用 0-禁用
|
||||
*/
|
||||
|
||||
@@ -83,11 +83,11 @@ public class ShopUser implements Serializable {
|
||||
* 用户Id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 账户积分
|
||||
*/
|
||||
private Integer accountPoints;
|
||||
//
|
||||
// /**
|
||||
// * 账户积分
|
||||
// */
|
||||
// private Integer accountPoints;
|
||||
|
||||
/**
|
||||
* 钱包余额
|
||||
@@ -122,15 +122,15 @@ public class ShopUser implements Serializable {
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 最近一次积分变动时间
|
||||
*/
|
||||
private LocalDateTime lastPointsChangeTime;
|
||||
|
||||
/**
|
||||
* 最近一次浮动积分
|
||||
*/
|
||||
private Integer lastFloatPoints;
|
||||
// /**
|
||||
// * 最近一次积分变动时间
|
||||
// */
|
||||
// private LocalDateTime lastPointsChangeTime;
|
||||
//
|
||||
// /**
|
||||
// * 最近一次浮动积分
|
||||
// */
|
||||
// private Integer lastFloatPoints;
|
||||
|
||||
/**
|
||||
* 成为会员的时间
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
@@ -87,24 +88,35 @@ public class LoadingRole implements CommandLineRunner {
|
||||
|
||||
Method parentNameMethod = annotationClass.getMethod("parentName");
|
||||
String parentName = (String) parentNameMethod.invoke(annotation);
|
||||
|
||||
|
||||
|
||||
String parentId;
|
||||
String parentMenuSql = "select * from sys_menu where title=?"; // 查询菜单是否存在
|
||||
Row parentMenu;
|
||||
// parentMenu = Db.selectOneBySql(parentMenuSql, "默认接口目录");
|
||||
// if (parentMenu == null) {
|
||||
// Db.insertBySql("INSERT INTO `sys_menu` (`type`, `title`) VALUES (?, ?);", 0, "默认接口目录");
|
||||
// }
|
||||
// parentMenu = Db.selectOneBySql(parentMenuSql, "默认接口目录");
|
||||
// if (StrUtil.isNotBlank(parentName)) {
|
||||
// parentMenu = Db.selectOneBySql(parentMenuSql, parentName);
|
||||
// if (parentMenu == null) {
|
||||
// throw new RuntimeException(StrUtil.format("上级菜单不存在, 方法名{}, 方法路径:{}", method.getName(), fullPath));
|
||||
// }
|
||||
// }
|
||||
// parentId = parentMenu.getString("menu_id");
|
||||
parentId = "1";
|
||||
|
||||
Row childMenu;
|
||||
if (StrUtil.isNotBlank(parentName)) {
|
||||
parentMenu = Db.selectOneBySql(parentMenuSql, parentName);
|
||||
if (parentMenu == null) {
|
||||
throw new RuntimeException(StrUtil.format("上级菜单不存在, 方法名{}, 方法路径:{}", method.getName(), fullPath));
|
||||
childMenu = Db.selectOneBySql(parentMenuSql, parentName);
|
||||
if (childMenu == null) {
|
||||
Db.insertBySql("INSERT INTO `sys_menu` (`type`, `pid`,`title`) VALUES (?,?, ?);", 0, parentId, parentName);
|
||||
childMenu = Db.selectOneBySql(parentMenuSql, parentName);
|
||||
}
|
||||
}else {
|
||||
parentMenu = Db.selectOneBySql(parentMenuSql, "默认接口目录");
|
||||
if (parentMenu == null) {
|
||||
Db.insertBySql("INSERT INTO `sys_menu` (`type`, `title`) VALUES (?, ?);", 0, "默认接口目录");
|
||||
}
|
||||
parentMenu = Db.selectOneBySql(parentMenuSql, "默认接口目录");
|
||||
parentId = childMenu.getString("menu_id");
|
||||
}
|
||||
parentId = parentMenu.getString("menu_id");
|
||||
|
||||
for (String s : permissions) {
|
||||
String sql = "select * from sys_menu where permission=?";
|
||||
|
||||
@@ -115,18 +127,18 @@ public class LoadingRole implements CommandLineRunner {
|
||||
String url = menu1.getString("url");
|
||||
String method1 = menu1.getString("method");
|
||||
String permission = menu1.getString("permission");
|
||||
String pid = menu1.getString("pid");
|
||||
String listSql = "select * from sys_roles_menus where menu_id=? and role_id=?";
|
||||
List<Row> count1 = Db.selectListBySql(listSql, menuId, 1L);
|
||||
|
||||
|
||||
|
||||
if (count1.isEmpty()) {
|
||||
sql = "INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES (?, ?);";
|
||||
Db.insertBySql(sql, menuId, 1L);
|
||||
log.info("接口菜单添加成功, 菜单名称: {}, 菜单权限: {}", title, permission);
|
||||
}
|
||||
|
||||
if (!title.equals(permissionName) || !fullPath.equals(url) || !httpMethod.equals(method1)) {
|
||||
if (!title.equals(permissionName) || !fullPath.equals(url) || !httpMethod.equals(method1) || !parentId.equals(pid)) {
|
||||
sql = "update sys_menu set title=?, url=?, method=?, pid=? where menu_id=?";
|
||||
Db.updateBySql(sql, permissionName, fullPath, httpMethod, parentId, menuId);
|
||||
log.info("接口菜单修改成功, 旧名称: {}, 新菜单名称: {}", title, permissionName);
|
||||
|
||||
Reference in New Issue
Block a user