forked from github/cool-admin-java
feat: 新增product商品模块 + agent代理模块(moduleKey:proxy)
- 后端:product模块CRUD(Entity/Mapper/Service/Controller) - 后端:agent模块CRUD(Entity/Mapper/Service/Controller) - AppOrgAuthFilter注册/app/product/和/app/agent/路径 - App:新增module-product和module-proxy页面 - pages.json/tabbar/router注册两个新模块 - tabbar移除Star tab,模块上限改为3个 - 修复product页面双标题栏(navigationStyle:custom)
This commit is contained in:
@@ -33,7 +33,9 @@ public class AppOrgAuthFilter extends OncePerRequestFilter {
|
||||
"/app/zoo/", "zoo",
|
||||
"/app/order/", "order",
|
||||
"/app/book/", "book",
|
||||
"/app/ticket/", "ticket"
|
||||
"/app/ticket/", "ticket",
|
||||
"/app/product/", "product",
|
||||
"/app/agent/", "proxy"
|
||||
);
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.cool.modules.agent.controller.admin;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.cool.core.annotation.CoolRestController;
|
||||
import com.cool.core.base.BaseController;
|
||||
import com.cool.modules.agent.entity.AgentInfoEntity;
|
||||
import com.cool.modules.agent.service.AgentInfoService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "代理管理", description = "代理信息管理")
|
||||
@CoolRestController(api = {"add", "delete", "update", "page", "info"})
|
||||
public class AdminAgentInfoController extends BaseController<AgentInfoService, AgentInfoEntity> {
|
||||
|
||||
@Override
|
||||
protected void init(HttpServletRequest request, JSONObject requestParams) {
|
||||
setPageOption(createOp());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.cool.modules.agent.controller.app;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.cool.core.annotation.CoolRestController;
|
||||
import com.cool.core.request.R;
|
||||
import com.cool.modules.agent.service.AgentInfoService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestAttribute;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "代理", description = "App端代理")
|
||||
@CoolRestController
|
||||
public class AppAgentInfoController {
|
||||
|
||||
private final AgentInfoService agentInfoService;
|
||||
|
||||
@Operation(summary = "代理列表")
|
||||
@GetMapping("/list")
|
||||
public R list(@RequestAttribute JSONObject requestParams) {
|
||||
return R.ok(agentInfoService.list(requestParams, null));
|
||||
}
|
||||
|
||||
@Operation(summary = "代理详情")
|
||||
@GetMapping("/detail")
|
||||
public R detail(@RequestAttribute JSONObject requestParams) {
|
||||
Long id = requestParams.getLong("id");
|
||||
return R.ok(agentInfoService.info(id));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.cool.modules.agent.entity;
|
||||
|
||||
import com.cool.core.base.TenantEntity;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import com.cool.core.annotation.ColumnDefine;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Table(value = "agent_info", comment = "代理信息表")
|
||||
public class AgentInfoEntity extends TenantEntity<AgentInfoEntity> {
|
||||
|
||||
@ColumnDefine(comment = "代理名称", notNull = true)
|
||||
private String name;
|
||||
|
||||
@ColumnDefine(comment = "联系电话")
|
||||
private String phone;
|
||||
|
||||
@ColumnDefine(comment = "地区")
|
||||
private String region;
|
||||
|
||||
@ColumnDefine(comment = "图片")
|
||||
private String image;
|
||||
|
||||
@ColumnDefine(comment = "描述", type = "text")
|
||||
private String description;
|
||||
|
||||
@ColumnDefine(comment = "状态 0:停用 1:启用", defaultValue = "1")
|
||||
private Integer status;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.cool.modules.agent.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.cool.modules.agent.entity.AgentInfoEntity;
|
||||
|
||||
public interface AgentInfoMapper extends BaseMapper<AgentInfoEntity> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.cool.modules.agent.service;
|
||||
|
||||
import com.cool.core.base.BaseService;
|
||||
import com.cool.modules.agent.entity.AgentInfoEntity;
|
||||
|
||||
public interface AgentInfoService extends BaseService<AgentInfoEntity> {
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.cool.modules.agent.service.impl;
|
||||
|
||||
import com.cool.core.base.BaseServiceImpl;
|
||||
import com.cool.modules.agent.entity.AgentInfoEntity;
|
||||
import com.cool.modules.agent.mapper.AgentInfoMapper;
|
||||
import com.cool.modules.agent.service.AgentInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class AgentInfoServiceImpl extends BaseServiceImpl<AgentInfoMapper, AgentInfoEntity> implements
|
||||
AgentInfoService {
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public class AppOrgController {
|
||||
private final AppOrgUserService appOrgUserService;
|
||||
|
||||
@Operation(summary = "获取已加入的组织列表")
|
||||
@GetMapping("/list")
|
||||
@GetMapping("/orgList")
|
||||
public R list() {
|
||||
Long userId = CoolSecurityUtil.getCurrentUserId();
|
||||
List<Map<String, Object>> orgList = appOrgUserService.getOrgListByUserId(userId);
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.cool.modules.product.controller.admin;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.cool.core.annotation.CoolRestController;
|
||||
import com.cool.core.base.BaseController;
|
||||
import com.cool.modules.product.entity.ProductGoodsEntity;
|
||||
import com.cool.modules.product.service.ProductGoodsService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "商品管理", description = "商品管理")
|
||||
@CoolRestController(api = {"add", "delete", "update", "page", "info"})
|
||||
public class AdminProductGoodsController extends BaseController<ProductGoodsService, ProductGoodsEntity> {
|
||||
|
||||
@Override
|
||||
protected void init(HttpServletRequest request, JSONObject requestParams) {
|
||||
setPageOption(createOp());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.cool.modules.product.controller.app;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.cool.core.annotation.CoolRestController;
|
||||
import com.cool.core.request.R;
|
||||
import com.cool.modules.product.entity.ProductGoodsEntity;
|
||||
import com.cool.modules.product.service.ProductGoodsService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestAttribute;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "商品", description = "App端商品")
|
||||
@CoolRestController
|
||||
public class AppProductGoodsController {
|
||||
|
||||
private final ProductGoodsService productGoodsService;
|
||||
|
||||
@Operation(summary = "商品列表")
|
||||
@GetMapping("/list")
|
||||
public R list(@RequestAttribute JSONObject requestParams) {
|
||||
return R.ok(productGoodsService.list(requestParams, null));
|
||||
}
|
||||
|
||||
@Operation(summary = "商品详情")
|
||||
@GetMapping("/detail")
|
||||
public R detail(@RequestAttribute JSONObject requestParams) {
|
||||
Long id = requestParams.getLong("id");
|
||||
return R.ok(productGoodsService.info(id));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.cool.modules.product.entity;
|
||||
|
||||
import com.cool.core.base.TenantEntity;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import com.cool.core.annotation.ColumnDefine;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Table(value = "product_goods", comment = "商品表")
|
||||
public class ProductGoodsEntity extends TenantEntity<ProductGoodsEntity> {
|
||||
|
||||
@ColumnDefine(comment = "商品名称", notNull = true)
|
||||
private String name;
|
||||
|
||||
@ColumnDefine(comment = "价格")
|
||||
private Double price;
|
||||
|
||||
@ColumnDefine(comment = "单位")
|
||||
private String unit;
|
||||
|
||||
@ColumnDefine(comment = "图片")
|
||||
private String image;
|
||||
|
||||
@ColumnDefine(comment = "描述", type = "text")
|
||||
private String description;
|
||||
|
||||
@ColumnDefine(comment = "分类ID", type = "bigint")
|
||||
private Long categoryId;
|
||||
|
||||
@ColumnDefine(comment = "状态 0:下架 1:上架", defaultValue = "1")
|
||||
private Integer status;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.cool.modules.product.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.cool.modules.product.entity.ProductGoodsEntity;
|
||||
|
||||
public interface ProductGoodsMapper extends BaseMapper<ProductGoodsEntity> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.cool.modules.product.service;
|
||||
|
||||
import com.cool.core.base.BaseService;
|
||||
import com.cool.modules.product.entity.ProductGoodsEntity;
|
||||
|
||||
public interface ProductGoodsService extends BaseService<ProductGoodsEntity> {
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.cool.modules.product.service.impl;
|
||||
|
||||
import com.cool.core.base.BaseServiceImpl;
|
||||
import com.cool.modules.product.entity.ProductGoodsEntity;
|
||||
import com.cool.modules.product.mapper.ProductGoodsMapper;
|
||||
import com.cool.modules.product.service.ProductGoodsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ProductGoodsServiceImpl extends BaseServiceImpl<ProductGoodsMapper, ProductGoodsEntity> implements
|
||||
ProductGoodsService {
|
||||
}
|
||||
Reference in New Issue
Block a user