2024-05-13 10:07:53 +08:00
|
|
|
package com.whdc.controller;
|
|
|
|
|
|
|
|
|
|
|
2024-05-14 15:34:23 +08:00
|
|
|
import com.whdc.model.dto.CommDto;
|
2024-05-13 10:07:53 +08:00
|
|
|
import com.whdc.model.entity.Versions;
|
|
|
|
|
import com.whdc.service.IVersionsService;
|
|
|
|
|
import com.whdc.utils.ResultJson;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
2024-05-16 17:47:39 +08:00
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import java.util.Objects;
|
2024-05-13 10:07:53 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author xusan
|
|
|
|
|
* @date 2024-05-11
|
|
|
|
|
*/
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Api(tags = "通讯录日志 - Controller")
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/versions")
|
|
|
|
|
public class VersionsController {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IVersionsService service;
|
|
|
|
|
|
|
|
|
|
|
2024-05-21 10:46:45 +08:00
|
|
|
// @ApiOperation(value = "查询所有")
|
2024-05-14 15:34:23 +08:00
|
|
|
// @PostMapping(value = "find")
|
2024-05-13 10:07:53 +08:00
|
|
|
public ResultJson<Versions> find(@RequestBody Versions dto) {
|
|
|
|
|
|
|
|
|
|
return ResultJson.ok(service.find(dto));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "分页查询")
|
|
|
|
|
@PostMapping(value = "page")
|
2024-05-14 15:34:23 +08:00
|
|
|
public ResultJson<Versions> page(@RequestBody CommDto dto) {
|
2024-05-13 10:07:53 +08:00
|
|
|
|
|
|
|
|
return ResultJson.ok(service.page(dto));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-21 10:46:45 +08:00
|
|
|
@ApiOperation(value = "通过版本号查询")
|
|
|
|
|
@GetMapping(value = "getByV/{abId}/{version}")
|
|
|
|
|
public ResultJson<Versions> getByV(@PathVariable("abId") Integer abId, @PathVariable("version") Integer version) {
|
|
|
|
|
if (version < 0) {
|
|
|
|
|
return ResultJson.error("版本号不能小于0");
|
|
|
|
|
}
|
|
|
|
|
return ResultJson.ok(service.lambdaQuery().eq(Versions::getAbId, abId)
|
|
|
|
|
.eq(Versions::getVersion, version).one());
|
|
|
|
|
|
|
|
|
|
}
|
2024-05-16 17:47:39 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "删除")
|
|
|
|
|
@GetMapping(value = "del/{id}")
|
|
|
|
|
public ResultJson delete(@PathVariable("id") Integer id) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Objects.isNull(service.getById(id))) {
|
|
|
|
|
|
|
|
|
|
return ResultJson.error("当前数据不存在");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ResultJson.ok(service.removeById(id));
|
|
|
|
|
|
|
|
|
|
}
|
2024-05-13 10:07:53 +08:00
|
|
|
}
|