| @@ -1,6 +1,8 @@ | |||
| package com.iformall.controller.sm; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.ApiVersion; | |||
| import com.iformall.common.R; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.constant.SwaggerConstant; | |||
| import com.iformall.domain.dto.sm.SaveApiGuideDTO; | |||
| @@ -23,23 +25,23 @@ public class ApiGuideController { | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("分页查询api指南") | |||
| @GetMapping("/page") | |||
| public ResultData pageApiGuide(ApiGuide apiGuide, Integer pageNum, Integer pageSize) { | |||
| return new ResultData(apiGuideService.pageApiGuide(apiGuide, pageNum, pageSize)); | |||
| public R<PageInfo<ApiGuide>> pageApiGuide(ApiGuide apiGuide, Integer pageNum, Integer pageSize) { | |||
| return R.ok(apiGuideService.pageApiGuide(apiGuide, pageNum, pageSize)); | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("新增api指南") | |||
| @PostMapping("/save") | |||
| public ResultData saveApiGuide(@RequestBody SaveApiGuideDTO dto) { | |||
| public R<Void> saveApiGuide(@RequestBody SaveApiGuideDTO dto) { | |||
| apiGuideService.saveApiGuide(dto); | |||
| return new ResultData(); | |||
| return R.ok(); | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("修改api指南") | |||
| @PostMapping("/update") | |||
| public ResultData updateApiGuide(@RequestBody UpdateApiGuideDTO dto) { | |||
| public R<Void> updateApiGuide(@RequestBody UpdateApiGuideDTO dto) { | |||
| apiGuideService.updateApiGuide(dto); | |||
| return new ResultData(); | |||
| return R.ok(); | |||
| } | |||
| } | |||
| @@ -1,12 +1,15 @@ | |||
| package com.iformall.controller.sm; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.ApiVersion; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.R; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.constant.SwaggerConstant; | |||
| import com.iformall.domain.dto.sm.SaveApiMenuDTO; | |||
| import com.iformall.domain.dto.sm.UpdateApiMenuDTO; | |||
| import com.iformall.domain.po.sm.ApiMenu; | |||
| import com.iformall.domain.vo.sm.ApiMenuVO; | |||
| import com.iformall.exception.BizException; | |||
| import com.iformall.service.sm.ApiMenuService; | |||
| import io.swagger.annotations.Api; | |||
| @@ -14,6 +17,8 @@ import io.swagger.annotations.ApiOperation; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.List; | |||
| @RestController | |||
| @RequestMapping("/apiMenu") | |||
| @Api(tags = "api菜单接口") | |||
| @@ -25,40 +30,40 @@ public class ApiMenuController { | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("分页查询api菜单") | |||
| @GetMapping("/page") | |||
| public ResultData pageApiMenu(ApiMenu ApiMenu, Integer pageNum, Integer pageSize) { | |||
| return new ResultData(apiMenuService.pageApiMenu(ApiMenu, pageNum, pageSize)); | |||
| public R<PageInfo<ApiMenuVO>> pageApiMenu(ApiMenu ApiMenu, Integer pageNum, Integer pageSize) { | |||
| return R.ok(apiMenuService.pageApiMenu(ApiMenu, pageNum, pageSize)); | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("单个查询api菜单") | |||
| @GetMapping("/get") | |||
| public ResultData getApiMenu(Long id) { | |||
| public R<ApiMenuVO> getApiMenu(Long id) { | |||
| if (id == null) { | |||
| throw new BizException(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| return new ResultData(apiMenuService.getApiMenu(id)); | |||
| return R.ok(apiMenuService.getApiMenu(id)); | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("新增api菜单") | |||
| @PostMapping("/save") | |||
| public ResultData saveApiMenu(@RequestBody SaveApiMenuDTO dto) { | |||
| public R<Void> saveApiMenu(@RequestBody SaveApiMenuDTO dto) { | |||
| apiMenuService.saveApiMenu(dto); | |||
| return new ResultData(); | |||
| return R.ok(); | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("修改api菜单") | |||
| @PostMapping("/update") | |||
| public ResultData updateApiMenu(@RequestBody UpdateApiMenuDTO dto) { | |||
| public R<Void> updateApiMenu(@RequestBody UpdateApiMenuDTO dto) { | |||
| apiMenuService.updateApiMenu(dto); | |||
| return new ResultData(); | |||
| return R.ok(); | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("全查询父级api菜单") | |||
| @GetMapping("/listParentMenu") | |||
| public ResultData listParentMenu() { | |||
| return new ResultData(apiMenuService.listParentMenu()); | |||
| public R<List<ApiMenu>> listParentMenu() { | |||
| return R.ok(apiMenuService.listParentMenu()); | |||
| } | |||
| } | |||
| @@ -1,6 +1,8 @@ | |||
| package com.iformall.controller.sm; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.ApiVersion; | |||
| import com.iformall.common.R; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.constant.SwaggerConstant; | |||
| import com.iformall.controller.base.BaseController; | |||
| @@ -25,31 +27,31 @@ public class ServiceInfoController extends BaseController { | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("分页查询合作商") | |||
| @GetMapping("/page") | |||
| public ResultData pageServiceInfo(ServiceInfo serviceInfo, Integer pageNum, Integer pageSize) { | |||
| return new ResultData(serviceInfoService.pageServiceInfo(serviceInfo, pageNum, pageSize)); | |||
| public R<PageInfo<ServiceInfo>> pageServiceInfo(ServiceInfo serviceInfo, Integer pageNum, Integer pageSize) { | |||
| return R.ok(serviceInfoService.pageServiceInfo(serviceInfo, pageNum, pageSize)); | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("新增合作商") | |||
| @PostMapping("/save") | |||
| public ResultData saveServiceInfo(@RequestBody SaveServiceInfoDTO dto) { | |||
| public R<Void> saveServiceInfo(@RequestBody SaveServiceInfoDTO dto) { | |||
| serviceInfoService.saveServiceInfo(dto); | |||
| return new ResultData(); | |||
| return R.ok(); | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("修改合作商") | |||
| @PostMapping("/update") | |||
| public ResultData updateServiceInfo(@RequestBody UpdateServiceInfoDTO dto) { | |||
| public R<Void> updateServiceInfo(@RequestBody UpdateServiceInfoDTO dto) { | |||
| serviceInfoService.updateServiceInfo(dto); | |||
| return new ResultData(); | |||
| return R.ok(); | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("修改合作商状态") | |||
| @PostMapping("/updateStatus") | |||
| public ResultData updateServiceInfoStatus(@RequestBody UpdateServiceInfoStatusDTO dto) { | |||
| public R<Void> updateServiceInfoStatus(@RequestBody UpdateServiceInfoStatusDTO dto) { | |||
| serviceInfoService.updateServiceInfoStatus(dto); | |||
| return new ResultData(); | |||
| return R.ok(); | |||
| } | |||
| } | |||
| @@ -1,7 +1,9 @@ | |||
| package com.iformall.controller.sm; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.ApiVersion; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.R; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.constant.SwaggerConstant; | |||
| import com.iformall.domain.dto.sm.UpdateThirdPartyApiStatusDTO; | |||
| @@ -24,25 +26,25 @@ public class ThirdPartyApiController { | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("分页查询秘钥") | |||
| @GetMapping("/page") | |||
| public ResultData pageThirdPartyApi(WxThirdPartyApi thirdPartyApi, Integer pageNum, Integer pageSize) { | |||
| return new ResultData(thirdPartyApiService.pageThirdPartyApi(thirdPartyApi, pageNum, pageSize)); | |||
| public R<PageInfo<WxThirdPartyApi>> pageThirdPartyApi(WxThirdPartyApi thirdPartyApi, Integer pageNum, Integer pageSize) { | |||
| return R.ok(thirdPartyApiService.pageThirdPartyApi(thirdPartyApi, pageNum, pageSize)); | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("单个查询秘钥") | |||
| @GetMapping("/get") | |||
| public ResultData getThirdPartyApi(Long id) { | |||
| public R<WxThirdPartyApi> getThirdPartyApi(Long id) { | |||
| if (id == null) { | |||
| throw new BizException(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| return new ResultData(thirdPartyApiService.getThirdPartyApi(id)); | |||
| return R.ok(thirdPartyApiService.getThirdPartyApi(id)); | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("修改秘钥状态") | |||
| @PostMapping("/updateStatus") | |||
| public ResultData updateThirdPartyApiStatus(@RequestBody UpdateThirdPartyApiStatusDTO dto) { | |||
| public R<Void> updateThirdPartyApiStatus(@RequestBody UpdateThirdPartyApiStatusDTO dto) { | |||
| thirdPartyApiService.updateThirdPartyApiStatus(dto); | |||
| return new ResultData(); | |||
| return R.ok(); | |||
| } | |||
| } | |||
| @@ -2,8 +2,10 @@ package com.iformall.controller; | |||
| import com.iformall.annotation.ApiVersion; | |||
| import com.iformall.annotation.AuthIgnore; | |||
| import com.iformall.common.R; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.constant.SwaggerConstant; | |||
| import com.iformall.domain.po.sm.ApiGuide; | |||
| import com.iformall.service.sm.ApiGuideService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| @@ -24,7 +26,7 @@ public class ApiGuideController { | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("单个查询api指南") | |||
| @GetMapping("/getAvailableApiGuide") | |||
| public ResultData getAvailableApiGuide() { | |||
| return new ResultData(apiGuideService.getAvailableApiGuide()); | |||
| public R<ApiGuide> getAvailableApiGuide() { | |||
| return R.ok(apiGuideService.getAvailableApiGuide()); | |||
| } | |||
| } | |||
| @@ -3,8 +3,12 @@ package com.iformall.controller; | |||
| import com.iformall.annotation.ApiVersion; | |||
| import com.iformall.annotation.AuthIgnore; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.R; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.constant.SwaggerConstant; | |||
| import com.iformall.domain.po.sm.ApiMenu; | |||
| import com.iformall.domain.vo.sm.ApiMenuVO; | |||
| import com.iformall.domain.vo.sm.ListApiSubmenuVO; | |||
| import com.iformall.exception.BizException; | |||
| import com.iformall.service.sm.ApiMenuService; | |||
| import io.swagger.annotations.Api; | |||
| @@ -12,6 +16,8 @@ import io.swagger.annotations.ApiOperation; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.List; | |||
| @RestController | |||
| @RequestMapping("/api/apiMenu") | |||
| @Api(tags = "api菜单接口") | |||
| @@ -24,29 +30,29 @@ public class ApiMenuController { | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("全查询api菜单") | |||
| @GetMapping("/list") | |||
| public ResultData listApiMenu() { | |||
| return new ResultData(apiMenuService.listMenu()); | |||
| public R<List<ApiMenu>> listApiMenu() { | |||
| return R.ok(apiMenuService.listMenu()); | |||
| } | |||
| @AuthIgnore | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("查询某个api菜单所有子菜单") | |||
| @GetMapping("/listSubmenu") | |||
| public ResultData listApiSubmenu(Long id) { | |||
| public R<List<ListApiSubmenuVO>> listApiSubmenu(Long id) { | |||
| if (id == null) { | |||
| throw new BizException(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| return new ResultData(apiMenuService.listApiSubmenu(id)); | |||
| return R.ok(apiMenuService.listApiSubmenu(id)); | |||
| } | |||
| @AuthIgnore | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("单个查询菜单详情") | |||
| @GetMapping("/get") | |||
| public ResultData getApiMenu(Long id) { | |||
| public R<ApiMenuVO> getApiMenu(Long id) { | |||
| if (id == null) { | |||
| throw new BizException(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| return new ResultData(apiMenuService.getApiMenu(id)); | |||
| return R.ok(apiMenuService.getApiMenu(id)); | |||
| } | |||
| } | |||
| @@ -1,6 +1,12 @@ | |||
| package com.iformall.common; | |||
| public interface CommonConstants { | |||
| /** | |||
| * 接口响应码:200:成功 500:失败 | |||
| */ | |||
| Integer SUCCESS = 200; | |||
| Integer FAILED = 500; | |||
| /** | |||
| * 状态(0:正常,1:锁定) | |||
| */ | |||
| @@ -0,0 +1,76 @@ | |||
| package com.iformall.common; | |||
| import io.swagger.annotations.ApiModel; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.Data; | |||
| import java.io.Serializable; | |||
| /** | |||
| * 响应信息主体 | |||
| * | |||
| * @author xmzhao71 | |||
| * @date 2023-10-26 | |||
| */ | |||
| @ApiModel(description = "响应信息主体") | |||
| @Data | |||
| public class R<T> implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @ApiModelProperty(value = "返回标记:成功=0,失败=1") | |||
| private int code; | |||
| @ApiModelProperty(value = "返回信息") | |||
| private String message; | |||
| @ApiModelProperty(value = "数据") | |||
| private T data; | |||
| public Boolean isOk() { | |||
| return code == 200; | |||
| } | |||
| public static <T> R<T> ok() { | |||
| return restResult(null, CommonConstants.SUCCESS, null); | |||
| } | |||
| public static <T> R<T> ok(T data) { | |||
| return restResult(data, CommonConstants.SUCCESS, null); | |||
| } | |||
| public static <T> R<T> ok(T data, String msg) { | |||
| return restResult(data, CommonConstants.SUCCESS, msg); | |||
| } | |||
| public static <T> R<T> failed() { | |||
| return restResult(null, CommonConstants.FAILED, null); | |||
| } | |||
| public static <T> R<T> failed(String msg) { | |||
| return restResult(null, CommonConstants.FAILED, msg); | |||
| } | |||
| public static <T> R<T> failed(T data) { | |||
| return restResult(data, CommonConstants.FAILED, null); | |||
| } | |||
| public static <T> R<T> failed(T data, String msg) { | |||
| return restResult(data, CommonConstants.FAILED, msg); | |||
| } | |||
| public static <T> R<T> failed(T data, int code, String msg) { | |||
| return restResult(data, code, msg); | |||
| } | |||
| public static <T> R<T> failed(int code, String msg) { | |||
| return restResult(null, code, msg); | |||
| } | |||
| private static <T> R<T> restResult(T data, int code, String msg) { | |||
| R<T> apiResult = new R<>(); | |||
| apiResult.setCode(code); | |||
| apiResult.setData(data); | |||
| apiResult.setMessage(msg); | |||
| return apiResult; | |||
| } | |||
| } | |||