src/main/java/com/whyc/controller/DeviceManageController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/pojo/DeviceManage.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/DeviceManageService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/swagger/SwaggerConfig4Knife.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/config/authentication.properties | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/whyc/controller/DeviceManageController.java
@@ -1,5 +1,7 @@ package com.whyc.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.whyc.dto.Response; import com.whyc.pojo.DeviceManage; import com.whyc.service.DeviceManageService; @@ -19,13 +21,19 @@ @Autowired private DeviceManageService service; @GetMapping("all") @ApiOperation(value = "查询所有") public Response<IPage<DeviceManage>> getAll(@RequestParam int pageNum, @RequestParam int pageSize){ return service.getAll(pageNum,pageSize); } @PostMapping @ApiOperation(value="添加-入库") public Response add(@RequestBody DeviceManage deviceManage){ return service.add(deviceManage); } @PutMapping @PutMapping("delete") @ApiOperation(value="报废-出库") public Response delete(@RequestParam Integer deviceId){ return service.delete(deviceId); src/main/java/com/whyc/pojo/DeviceManage.java
@@ -14,7 +14,7 @@ @TableId private Integer num; private Integer deviceId; private Integer deviceName; private String deviceName; /**设备状态:新增时设备状态为1(入库),报废时设备状态为0(出库)*/ private Byte status; @@ -34,11 +34,11 @@ this.deviceId = deviceId; } public Integer getDeviceName() { public String getDeviceName() { return deviceName; } public void setDeviceName(Integer deviceName) { public void setDeviceName(String deviceName) { this.deviceName = deviceName; } src/main/java/com/whyc/service/DeviceManageService.java
@@ -1,13 +1,17 @@ package com.whyc.service; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.whyc.dto.Response; import com.whyc.mapper.DeviceManageMapper; import com.whyc.pojo.DeviceManage; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; @Service public class DeviceManageService { @@ -25,7 +29,7 @@ public Response delete(Integer deviceId) { //逻辑删除,更改状态为0 UpdateWrapper<DeviceManage> wrapper = Wrappers.update(); wrapper.apply("update set status = 0 where deviceId=?",deviceId); wrapper.set("status",0).eq("device_id",deviceId); int update = mapper.update(null, wrapper); return new Response().setMsg(1,"出库报废成功"); } @@ -34,4 +38,11 @@ mapper.updateById(deviceManage); return new Response().setMsg(1,"修改成功"); } public Response<IPage<DeviceManage>> getAll(int pageNum,int pageSize) { QueryWrapper<DeviceManage> wrapper = Wrappers.query(); wrapper.eq("status",1); IPage<DeviceManage> page1 = mapper.selectPage(new Page<>(pageNum,pageSize), wrapper); return new Response<IPage<DeviceManage>>().set(1,page1); } } src/main/java/com/whyc/swagger/SwaggerConfig4Knife.java
@@ -22,7 +22,7 @@ public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .groupName("通用框架平台") .groupName("半仿真试验系统") .select() .apis(RequestHandlerSelectors.any()) .apis(RequestHandlerSelectors.basePackage("com.whyc.controller")) @@ -31,9 +31,9 @@ private ApiInfo apiInfo() { return new ApiInfoBuilder() .title("通用框架平台") //大标题 title .title("半仿真试验系统") //大标题 title .contact(new Contact("PerryHsu","todo","todo")) .description("通用框架平台,请根据具体应用平台修改名称") //小标题 .description("半仿真试验系统") //小标题 .version("1.0") //版本 // .termsOfServiceUrl("http://xxx.xxx.com") //终端服务程序 // .license("LICENSE") //链接显示文字 src/main/resources/config/authentication.properties
@@ -1,5 +1,5 @@ #dev接口调试时使用 #/**=anon /**=anon #静态资源不拦截 /static/**=anon @@ -24,4 +24,4 @@ #/WaterComm/**=rolesOr["admin","dev"] #其他链接是需要登录的 /**=authc #/**=authc