diff --git a/ym-admin/src/main/java/com/cnbm/admin/basic/BaseParam.java b/ym-admin/src/main/java/com/cnbm/admin/basic/BaseParam.java new file mode 100644 index 0000000..81237d3 --- /dev/null +++ b/ym-admin/src/main/java/com/cnbm/admin/basic/BaseParam.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2018. + * http://www.ulabcare.com + */ + +package com.cnbm.admin.basic; + +import java.io.Serializable; + +/** + * 接口请求参数基类 + * + * @author jiff + * @date 2018/11/1 + * @since 1.0 + */ +public class BaseParam implements Serializable { +} diff --git a/ym-admin/src/main/java/com/cnbm/admin/config/SecurityConfig.java b/ym-admin/src/main/java/com/cnbm/admin/config/SecurityConfig.java index 2203625..2b39550 100644 --- a/ym-admin/src/main/java/com/cnbm/admin/config/SecurityConfig.java +++ b/ym-admin/src/main/java/com/cnbm/admin/config/SecurityConfig.java @@ -73,6 +73,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { "/webjars/**", "/websocket/**", "/influx/**", + "/basic/**", "/processInspection/**", "/captcha").anonymous() // .antMatchers("/testCors").hasAuthority("system:dept:list222") diff --git a/ym-admin/src/main/java/com/cnbm/admin/params/IdParam.java b/ym-admin/src/main/java/com/cnbm/admin/params/IdParam.java new file mode 100644 index 0000000..8bf2d6a --- /dev/null +++ b/ym-admin/src/main/java/com/cnbm/admin/params/IdParam.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2018. + * http://www.ulabcare.com + */ + +package com.cnbm.admin.params; + + +import com.cnbm.admin.basic.BaseParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + + +/** + * 主键请求参数对象 + * + * @author jiff + * @date 2018/11/9 + * @since 1.0 + */ +@Data +@ApiModel("主键参数对象") +public class IdParam implements Serializable { + private static final long serialVersionUID = 1L; + + @NotNull(message = "主键不能为空") + @ApiModelProperty(value = "主键", required = true, example = "1", notes = "根据实际接口传递不同对象的主键") + private Long id; + +} diff --git a/ym-baisc/src/main/java/com/cnbm/basic/controller/MachineController.java b/ym-baisc/src/main/java/com/cnbm/basic/controller/MachineController.java index e749ca8..b39272e 100644 --- a/ym-baisc/src/main/java/com/cnbm/basic/controller/MachineController.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/controller/MachineController.java @@ -119,7 +119,7 @@ public class MachineController { public Result changeStatus(@PathVariable("id") Long id){ machineService.changeStatus(id); - return new Result(); + return new Result().ok(true); } } \ No newline at end of file diff --git a/ym-baisc/src/main/java/com/cnbm/basic/controller/ProductController.java b/ym-baisc/src/main/java/com/cnbm/basic/controller/ProductController.java index eb5be8c..17b6d79 100644 --- a/ym-baisc/src/main/java/com/cnbm/basic/controller/ProductController.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/controller/ProductController.java @@ -1,6 +1,7 @@ package com.cnbm.basic.controller; import com.cnbm.admin.annotation.LogOperation; +import com.cnbm.admin.params.IdParam; import com.cnbm.common.constant.Constant; import com.cnbm.common.page.PageData; import com.cnbm.common.utils.ExcelUtils; @@ -34,7 +35,7 @@ import java.util.Map; * @since 2022-07-11 */ @RestController -@RequestMapping("/code/product") +@RequestMapping("/basic/product") @Api(tags="产品 表") public class ProductController { @Autowired @@ -113,11 +114,11 @@ public class ProductController { ExcelUtils.exportExcelToTarget(response, null, list, ProductExcel.class); } - @GetMapping("status") + @PostMapping("status") @ApiOperation("改变状态") @LogOperation("改变状态") - public Result changeStatus(@PathVariable("id") Long id){ - productService.changeStatus(id); + public Result changeStatus(@RequestBody IdParam id){ + productService.changeStatus(id.getId()); return new Result(); } diff --git a/ym-baisc/src/main/java/com/cnbm/basic/service/impl/MachineServiceImpl.java b/ym-baisc/src/main/java/com/cnbm/basic/service/impl/MachineServiceImpl.java index ddf9fc7..c36e011 100644 --- a/ym-baisc/src/main/java/com/cnbm/basic/service/impl/MachineServiceImpl.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/service/impl/MachineServiceImpl.java @@ -90,6 +90,8 @@ public class MachineServiceImpl extends CrudServiceImpl