目前还缺少,套餐绑定关系的逻辑,请单独一张表,并且引导添加user\_id系统用户绑定套餐逻辑,并且在创建租赁订单,自动关联应用对应user\_id的套餐信息。 另外给我一个脚本,创建3个套餐的脚本。

This commit is contained in:
lu7213 committed 2026-10-25 11:20:45 -04:00
1 parent a83e1fef40
commit 0fd0450ddb
16 files changed
+299 -15

No files matched your search

@@ -34,6 +34,51 @@ public class RentalController {
@org.springframework.beans.factory.annotation.Autowired
private RentalReconciliation reconciliation;
@org.springframework.beans.factory.annotation.Autowired
private RentalPackageBindings packageBindings;
/** 同一套餐管理权限负责授权;普通租赁用户不能自行添加绑定。 */
@PostMapping("/package/bind")
@PreAuthorize("@ss.hasPermi('rent:package:edit')")
public AjaxResult bindPackage(@RequestBody Map<String, Object> body) {
require(body.get("enabled") instanceof Boolean && body.get("is_default") instanceof Boolean,
"必须明确绑定状态及是否默认");
packageBindings.bind(number(body, "user_id"), number(body, "package_id"),
Boolean.TRUE.equals(body.get("enabled")), Boolean.TRUE.equals(body.get("is_default")), user());
return AjaxResult.success();
}
@GetMapping("/package/bindings/{userId}")
@PreAuthorize("@ss.hasPermi('rent:package:edit')")
public AjaxResult userPackageBindings(@PathVariable long userId) {
return AjaxResult.success(packageBindings.list(userId));
}
@GetMapping("/package/bindings")
@PreAuthorize("@ss.hasPermi('rent:portal:view')")
public AjaxResult myPackageBindings() {
return AjaxResult.success(packageBindings.list(user()));
}
/** 用户选择器复用套餐管理权限,不额外开放系统用户管理权限。 */
@GetMapping("/package/users")
@PreAuthorize("@ss.hasPermi('rent:package:edit')")
public AjaxResult packageUsers(@RequestParam(defaultValue = "") String keyword) {
require(keyword.length() <= 100, "搜索内容过长");
return AjaxResult.success(store.rows("SELECT user_id,user_name,nick_name FROM sys_user"
+ " WHERE del_flag='0' AND status='0' AND (user_name LIKE ? OR nick_name LIKE ?)"
+ " ORDER BY user_id LIMIT 30", "%" + keyword + "%", "%" + keyword + "%"));
}
@GetMapping("/package/options")
@PreAuthorize("@ss.hasPermi('rent:package:edit')")
public AjaxResult packageOptions(@RequestParam(defaultValue = "") String keyword) {
require(keyword.length() <= 100, "搜索内容过长");
return AjaxResult.success(store.rows("SELECT id,name,network,resource_type,revision FROM rent_package"
+ " WHERE status='ACTIVE' AND (name LIKE ? OR package_code LIKE ?) ORDER BY id DESC LIMIT 30",
"%" + keyword + "%", "%" + keyword + "%"));
}
public RentalController(
RentalStore store,
RentalProvisioning provisioning,