实体类和数据库表增加BZ前缀
parent
06cbf48e7c
commit
dcfa66b12e
|
|
@ -2,10 +2,10 @@ package com.gunshi.project.xyt.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.gunshi.core.result.R;
|
import com.gunshi.core.result.R;
|
||||||
import com.gunshi.project.xyt.model.ProtocolInfo;
|
import com.gunshi.project.xyt.model.BzProtocolInfo;
|
||||||
import com.gunshi.project.xyt.model.ProtocolInfoAutoDao;
|
import com.gunshi.project.xyt.model.BzProtocolInfoAutoDao;
|
||||||
import com.gunshi.project.xyt.service.ProtocolInfoService;
|
import com.gunshi.project.xyt.service.ProtocolInfoService;
|
||||||
import com.gunshi.project.xyt.so.ProtocolInfoSo;
|
import com.gunshi.project.xyt.so.BzProtocolInfoSo;
|
||||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||||
import com.gunshi.project.xyt.validate.markers.Update;
|
import com.gunshi.project.xyt.validate.markers.Update;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
|
@ -27,13 +27,13 @@ import java.util.Date;
|
||||||
@Tag(name = "协议信息")
|
@Tag(name = "协议信息")
|
||||||
public class ProtocolInfoController {
|
public class ProtocolInfoController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProtocolInfoAutoDao dao;
|
private BzProtocolInfoAutoDao dao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProtocolInfoService service;
|
private ProtocolInfoService service;
|
||||||
|
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
public R<Boolean> save(@Validated({Insert.class}) @RequestBody ProtocolInfo entity) {
|
public R<Boolean> save(@Validated({Insert.class}) @RequestBody BzProtocolInfo entity) {
|
||||||
// todo 无论是数据库设置默认值为GETDATE()还是使用注解fill = FieldFill.INSERT都不能自动插入当前时间
|
// todo 无论是数据库设置默认值为GETDATE()还是使用注解fill = FieldFill.INSERT都不能自动插入当前时间
|
||||||
entity.setCreateTm(new Date());
|
entity.setCreateTm(new Date());
|
||||||
entity.setEnable(1);
|
entity.setEnable(1);
|
||||||
|
|
@ -41,7 +41,7 @@ public class ProtocolInfoController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
public R<Boolean> update(@Validated({Update.class}) @RequestBody ProtocolInfo entity) {
|
public R<Boolean> update(@Validated({Update.class}) @RequestBody BzProtocolInfo entity) {
|
||||||
return R.ok(dao.updateById(entity));
|
return R.ok(dao.updateById(entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -51,12 +51,12 @@ public class ProtocolInfoController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get/{id}")
|
@GetMapping("/get/{id}")
|
||||||
public R<ProtocolInfo> getById(@PathVariable("id") String id) {
|
public R<BzProtocolInfo> getById(@PathVariable("id") String id) {
|
||||||
return R.ok(dao.getById(id));
|
return R.ok(dao.getById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/page")
|
@PostMapping("/page")
|
||||||
public R<Page<ProtocolInfo>> page(@Validated @RequestBody ProtocolInfoSo so) {
|
public R<Page<BzProtocolInfo>> page(@Validated @RequestBody BzProtocolInfoSo so) {
|
||||||
return R.ok(service.page(so));
|
return R.ok(service.page(so));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.gunshi.core.result.R;
|
import com.gunshi.core.result.R;
|
||||||
import com.gunshi.project.xyt.model.ServiceResource;
|
import com.gunshi.project.xyt.model.BzServiceResource;
|
||||||
import com.gunshi.project.xyt.model.ServiceResourceAutoDao;
|
import com.gunshi.project.xyt.model.BzServiceResourceAutoDao;
|
||||||
import com.gunshi.project.xyt.model.ServiceResourceType;
|
import com.gunshi.project.xyt.model.BzServiceResourceType;
|
||||||
import com.gunshi.project.xyt.model.ServiceResourceTypeAutoDao;
|
import com.gunshi.project.xyt.model.BzServiceResourceTypeAutoDao;
|
||||||
import com.gunshi.project.xyt.service.ServiceResourceMonitorRService;
|
import com.gunshi.project.xyt.service.BzServiceResourceMonitorRService;
|
||||||
import com.gunshi.project.xyt.so.ServiceResourceSo;
|
import com.gunshi.project.xyt.so.BzServiceResourceSo;
|
||||||
import com.gunshi.project.xyt.so.ServiceResourceTypeSo;
|
import com.gunshi.project.xyt.so.BzServiceResourceTypeSo;
|
||||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||||
import com.gunshi.project.xyt.validate.markers.QueryPage;
|
import com.gunshi.project.xyt.validate.markers.QueryPage;
|
||||||
import com.gunshi.project.xyt.validate.markers.QueryTimeRange;
|
import com.gunshi.project.xyt.validate.markers.QueryTimeRange;
|
||||||
|
|
@ -37,16 +37,16 @@ import java.util.Date;
|
||||||
public class ServiceResourceController {
|
public class ServiceResourceController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ServiceResourceAutoDao serviceResourceDao;
|
private BzServiceResourceAutoDao serviceResourceDao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ServiceResourceMonitorRService serviceMonitorService;
|
private BzServiceResourceMonitorRService serviceMonitorService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ServiceResourceTypeAutoDao serviceTypeDao;
|
private BzServiceResourceTypeAutoDao serviceTypeDao;
|
||||||
|
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
public R<Boolean> save(@Validated(Insert.class) @RequestBody ServiceResource entity) {
|
public R<Boolean> save(@Validated(Insert.class) @RequestBody BzServiceResource entity) {
|
||||||
entity.setId(IdWorker.getIdStr());
|
entity.setId(IdWorker.getIdStr());
|
||||||
entity.setRegisterDate(new Date());
|
entity.setRegisterDate(new Date());
|
||||||
entity.setEnable(1);
|
entity.setEnable(1);
|
||||||
|
|
@ -54,8 +54,8 @@ public class ServiceResourceController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
public R<Boolean> update(@Validated(Update.class) @RequestBody ServiceResource entity) {
|
public R<Boolean> update(@Validated(Update.class) @RequestBody BzServiceResource entity) {
|
||||||
ServiceResource byId = serviceResourceDao.getById(entity.getId());
|
BzServiceResource byId = serviceResourceDao.getById(entity.getId());
|
||||||
if (byId == null) {
|
if (byId == null) {
|
||||||
return R.error(400, "数据不存在", false);
|
return R.error(400, "数据不存在", false);
|
||||||
}
|
}
|
||||||
|
|
@ -70,38 +70,38 @@ public class ServiceResourceController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/page")
|
@PostMapping("/page")
|
||||||
public R<Page<ServiceResource>> page(
|
public R<Page<BzServiceResource>> page(
|
||||||
@Validated({QueryPage.class, QueryTimeRange.class}) @RequestBody ServiceResourceSo so
|
@Validated({QueryPage.class, QueryTimeRange.class}) @RequestBody BzServiceResourceSo so
|
||||||
) {
|
) {
|
||||||
LambdaQueryWrapper<ServiceResource> query = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<BzServiceResource> query = new LambdaQueryWrapper<>();
|
||||||
if (StringUtils.isNotEmpty(so.getName())) {
|
if (StringUtils.isNotEmpty(so.getName())) {
|
||||||
query.like(ServiceResource::getName, so.getName());
|
query.like(BzServiceResource::getName, so.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
query.le(ServiceResource::getRegisterDate, so.getTimeSo().getEnd());
|
query.le(BzServiceResource::getRegisterDate, so.getTimeSo().getEnd());
|
||||||
query.ge(ServiceResource::getRegisterDate, so.getTimeSo().getStart());
|
query.ge(BzServiceResource::getRegisterDate, so.getTimeSo().getStart());
|
||||||
query.orderByDesc(ServiceResource::getRegisterDate);
|
query.orderByDesc(BzServiceResource::getRegisterDate);
|
||||||
|
|
||||||
Page<ServiceResource> page = serviceResourceDao.page(so.getPageSo().toPage(), query);
|
Page<BzServiceResource> page = serviceResourceDao.page(so.getPageSo().toPage(), query);
|
||||||
return R.ok(page);
|
return R.ok(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/monitor/page")
|
@PostMapping("/monitor/page")
|
||||||
public R<Page<ServiceResourceMonitorVo>> pageMonitorR(
|
public R<Page<ServiceResourceMonitorVo>> pageMonitorR(
|
||||||
@Validated({QueryPage.class, QueryTimeRange.class}) @RequestBody ServiceResourceSo so
|
@Validated({QueryPage.class, QueryTimeRange.class}) @RequestBody BzServiceResourceSo so
|
||||||
) {
|
) {
|
||||||
Page<ServiceResourceMonitorVo> page = serviceMonitorService.page(so.getPageSo().toPage(), so);
|
Page<ServiceResourceMonitorVo> page = serviceMonitorService.page(so.getPageSo().toPage(), so);
|
||||||
return R.ok(page);
|
return R.ok(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/type/save")
|
@PostMapping("/type/save")
|
||||||
public R<Boolean> saveType(@Validated(Insert.class) @RequestBody ServiceResourceType entity) {
|
public R<Boolean> saveType(@Validated(Insert.class) @RequestBody BzServiceResourceType entity) {
|
||||||
entity.setId(IdWorker.getIdStr());
|
entity.setId(IdWorker.getIdStr());
|
||||||
return R.ok(serviceTypeDao.save(entity));
|
return R.ok(serviceTypeDao.save(entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/type/update")
|
@PostMapping("/type/update")
|
||||||
public R<Boolean> updateType(@Validated(Update.class) @RequestBody ServiceResourceType entity) {
|
public R<Boolean> updateType(@Validated(Update.class) @RequestBody BzServiceResourceType entity) {
|
||||||
return R.ok(serviceTypeDao.updateById(entity));
|
return R.ok(serviceTypeDao.updateById(entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -111,18 +111,18 @@ public class ServiceResourceController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/type/page")
|
@PostMapping("/type/page")
|
||||||
public R<Page<ServiceResourceType>> pageType(
|
public R<Page<BzServiceResourceType>> pageType(
|
||||||
@Validated({QueryPage.class}) @RequestBody ServiceResourceTypeSo so
|
@Validated({QueryPage.class}) @RequestBody BzServiceResourceTypeSo so
|
||||||
) {
|
) {
|
||||||
LambdaQueryWrapper<ServiceResourceType> query = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<BzServiceResourceType> query = new LambdaQueryWrapper<>();
|
||||||
if (StringUtils.isNotEmpty(so.getName())) {
|
if (StringUtils.isNotEmpty(so.getName())) {
|
||||||
query.like(ServiceResourceType::getName, so.getName());
|
query.like(BzServiceResourceType::getName, so.getName());
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotEmpty(so.getType())) {
|
if (StringUtils.isNotEmpty(so.getType())) {
|
||||||
query.like(ServiceResourceType::getType, so.getType());
|
query.like(BzServiceResourceType::getType, so.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
Page<ServiceResourceType> page = serviceTypeDao.page(so.getPageSo().toPage(), query);
|
Page<BzServiceResourceType> page = serviceTypeDao.page(so.getPageSo().toPage(), query);
|
||||||
return R.ok(page);
|
return R.ok(page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,25 @@
|
||||||
package com.gunshi.project.xyt.mapper;
|
package com.gunshi.project.xyt.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.gunshi.project.xyt.so.ServiceResourceSo;
|
import com.gunshi.project.xyt.so.BzServiceResourceSo;
|
||||||
import com.gunshi.project.xyt.vo.ServiceResourceMonitorVo;
|
import com.gunshi.project.xyt.vo.ServiceResourceMonitorVo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类描述
|
* 服务资源及监控联合查询Mapper
|
||||||
*
|
*
|
||||||
* @author lyf
|
* @author lyf
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2024-01-24
|
* @since 2024-01-24
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ServiceResourceMonitorRMapper {
|
public interface BzServiceResourceMonitorRMapper {
|
||||||
@Select("""
|
@Select("""
|
||||||
<script>
|
<script>
|
||||||
SELECT r.*,sr.name FROM SERVICE_RESOURCE_MONITOR_R r
|
SELECT r.*,sr.name FROM BZ_SERVICE_RESOURCE_MONITOR_R r
|
||||||
LEFT JOIN SERVICE_RESOURCE sr ON r.SR_ID=sr.ID
|
LEFT JOIN BZ_SERVICE_RESOURCE sr ON r.SR_ID=sr.ID
|
||||||
WHERE 1=1
|
WHERE 1=1
|
||||||
<if test="so.name != null and so.name != ''">
|
<if test="so.name != null and so.name != ''">
|
||||||
AND sr.NAME LIKE CONCAT('%',#{so.name},'%')
|
AND sr.NAME LIKE CONCAT('%',#{so.name},'%')
|
||||||
|
|
@ -32,5 +32,5 @@ public interface ServiceResourceMonitorRMapper {
|
||||||
</if>
|
</if>
|
||||||
</script>
|
</script>
|
||||||
""")
|
""")
|
||||||
Page<ServiceResourceMonitorVo> page(@Param("page") Page page,@Param("so") ServiceResourceSo so);
|
Page<ServiceResourceMonitorVo> page(@Param("page") Page page,@Param("so") BzServiceResourceSo so);
|
||||||
}
|
}
|
||||||
|
|
@ -25,8 +25,8 @@ import java.util.Date;
|
||||||
@Data
|
@Data
|
||||||
@ToString
|
@ToString
|
||||||
@Schema(description = "接收协议")
|
@Schema(description = "接收协议")
|
||||||
@TableName("PROTOCOL_INFO")
|
@TableName("BZ_PROTOCOL_INFO")
|
||||||
public class ProtocolInfo {
|
public class BzProtocolInfo {
|
||||||
|
|
||||||
@NotEmpty(message = "协议编码不能为空", groups = {Insert.class, Update.class})
|
@NotEmpty(message = "协议编码不能为空", groups = {Insert.class, Update.class})
|
||||||
@Schema(description = "协议编码")
|
@Schema(description = "协议编码")
|
||||||
|
|
@ -24,8 +24,8 @@ import java.util.Date;
|
||||||
@Data
|
@Data
|
||||||
@ToString
|
@ToString
|
||||||
@Schema(description = "服务资源")
|
@Schema(description = "服务资源")
|
||||||
@TableName("SERVICE_RESOURCE")
|
@TableName("BZ_SERVICE_RESOURCE")
|
||||||
public class ServiceResource {
|
public class BzServiceResource {
|
||||||
|
|
||||||
@Schema(description = "id")
|
@Schema(description = "id")
|
||||||
@TableId("ID")
|
@TableId("ID")
|
||||||
|
|
@ -21,8 +21,8 @@ import java.util.Date;
|
||||||
@Data
|
@Data
|
||||||
@ToString
|
@ToString
|
||||||
@Schema(description = "服务资源监控记录")
|
@Schema(description = "服务资源监控记录")
|
||||||
@TableName("SERVICE_RESOURCE_R")
|
@TableName("BZ_SERVICE_RESOURCE_R")
|
||||||
public class ServiceResourceMonitorR {
|
public class BzServiceResourceMonitorR {
|
||||||
|
|
||||||
@Schema(description = "id")
|
@Schema(description = "id")
|
||||||
@TableId("ID")
|
@TableId("ID")
|
||||||
|
|
@ -21,8 +21,8 @@ import lombok.ToString;
|
||||||
@Data
|
@Data
|
||||||
@ToString
|
@ToString
|
||||||
@Schema(description = "服务类型")
|
@Schema(description = "服务类型")
|
||||||
@TableName("SERVICE_RESOURCE_TYPE")
|
@TableName("BZ_SERVICE_RESOURCE_TYPE")
|
||||||
public class ServiceResourceType {
|
public class BzServiceResourceType {
|
||||||
@Schema(description = "id")
|
@Schema(description = "id")
|
||||||
@TableId("ID")
|
@TableId("ID")
|
||||||
private String id;
|
private String id;
|
||||||
|
|
@ -1,14 +1,13 @@
|
||||||
package com.gunshi.project.xyt.service;
|
package com.gunshi.project.xyt.service;
|
||||||
|
|
||||||
import cn.hutool.db.Db;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.gunshi.project.xyt.mapper.ServiceResourceMonitorRMapper;
|
import com.gunshi.project.xyt.mapper.BzServiceResourceMonitorRMapper;
|
||||||
import com.gunshi.project.xyt.model.ServiceResource;
|
import com.gunshi.project.xyt.model.BzServiceResource;
|
||||||
import com.gunshi.project.xyt.model.ServiceResourceAutoDao;
|
import com.gunshi.project.xyt.model.BzServiceResourceAutoDao;
|
||||||
import com.gunshi.project.xyt.model.ServiceResourceMonitorR;
|
import com.gunshi.project.xyt.model.BzServiceResourceMonitorR;
|
||||||
import com.gunshi.project.xyt.model.ServiceResourceMonitorRAutoDao;
|
import com.gunshi.project.xyt.model.BzServiceResourceMonitorRAutoDao;
|
||||||
import com.gunshi.project.xyt.so.ServiceResourceSo;
|
import com.gunshi.project.xyt.so.BzServiceResourceSo;
|
||||||
import com.gunshi.project.xyt.vo.ServiceResourceMonitorVo;
|
import com.gunshi.project.xyt.vo.ServiceResourceMonitorVo;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -25,37 +24,37 @@ import java.util.List;
|
||||||
* @since 2024-01-24
|
* @since 2024-01-24
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ServiceResourceMonitorRService {
|
public class BzServiceResourceMonitorRService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ServiceResourceAutoDao serviceResourceDao;
|
private BzServiceResourceAutoDao serviceResourceDao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ServiceResourceMonitorRAutoDao serviceMonitorDao;
|
private BzServiceResourceMonitorRAutoDao serviceMonitorDao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ServiceResourceMonitorRMapper serviceMonitorMapper;
|
private BzServiceResourceMonitorRMapper serviceMonitorMapper;
|
||||||
|
|
||||||
public Page<ServiceResourceMonitorVo> page(Page page, ServiceResourceSo so) {
|
public Page<ServiceResourceMonitorVo> page(Page page, BzServiceResourceSo so) {
|
||||||
return serviceMonitorMapper.page(page, so);
|
return serviceMonitorMapper.page(page, so);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public Boolean removeById(String id) {
|
public Boolean removeById(String id) {
|
||||||
ServiceResource byId = serviceResourceDao.getById(id);
|
BzServiceResource byId = serviceResourceDao.getById(id);
|
||||||
if (byId == null) {
|
if (byId == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return serviceResourceDao.removeById(id) &&
|
return serviceResourceDao.removeById(id) &&
|
||||||
serviceMonitorDao.remove(
|
serviceMonitorDao.remove(
|
||||||
new LambdaQueryWrapper<ServiceResourceMonitorR>()
|
new LambdaQueryWrapper<BzServiceResourceMonitorR>()
|
||||||
.eq(ServiceResourceMonitorR::getSrId, id)
|
.eq(BzServiceResourceMonitorR::getSrId, id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void scanByTm() {
|
public void scanByTm() {
|
||||||
List<ServiceResource> serviceResources = serviceResourceDao.list();
|
List<BzServiceResource> serviceResources = serviceResourceDao.list();
|
||||||
for (ServiceResource serviceResource : serviceResources) {
|
for (BzServiceResource serviceResource : serviceResources) {
|
||||||
if (StringUtils.isNotEmpty(serviceResource.getTargetTable()) &&
|
if (StringUtils.isNotEmpty(serviceResource.getTargetTable()) &&
|
||||||
StringUtils.isNotEmpty(serviceResource.getTargetTmField())) {
|
StringUtils.isNotEmpty(serviceResource.getTargetTmField())) {
|
||||||
// Db.getMap(new QueryWrapper<>().orderByDesc(serviceResource.getTargetTmField()).last("limit 1"), serviceResource.getTargetTable());
|
// Db.getMap(new QueryWrapper<>().orderByDesc(serviceResource.getTargetTmField()).last("limit 1"), serviceResource.getTargetTable());
|
||||||
|
|
@ -2,9 +2,9 @@ package com.gunshi.project.xyt.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.gunshi.project.xyt.so.ProtocolInfoSo;
|
import com.gunshi.project.xyt.model.BzProtocolInfo;
|
||||||
import com.gunshi.project.xyt.model.ProtocolInfo;
|
import com.gunshi.project.xyt.model.BzProtocolInfoAutoDao;
|
||||||
import com.gunshi.project.xyt.model.ProtocolInfoAutoDao;
|
import com.gunshi.project.xyt.so.BzProtocolInfoSo;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -21,39 +21,39 @@ import java.util.List;
|
||||||
@Service
|
@Service
|
||||||
public class ProtocolInfoService {
|
public class ProtocolInfoService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProtocolInfoAutoDao dao;
|
private BzProtocolInfoAutoDao dao;
|
||||||
|
|
||||||
|
|
||||||
public Page<ProtocolInfo> page(ProtocolInfoSo so) {
|
public Page<BzProtocolInfo> page(BzProtocolInfoSo so) {
|
||||||
if (StringUtils.isNotEmpty(so.getId())) {
|
if (StringUtils.isNotEmpty(so.getId())) {
|
||||||
ProtocolInfo entity = dao.getById(so.getId());
|
BzProtocolInfo entity = dao.getById(so.getId());
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
List<ProtocolInfo> records = List.of(entity);
|
List<BzProtocolInfo> records = List.of(entity);
|
||||||
return new Page<ProtocolInfo>(1, 1, 1).setRecords(records);
|
return new Page<BzProtocolInfo>(1, 1, 1).setRecords(records);
|
||||||
}
|
}
|
||||||
|
|
||||||
LambdaQueryWrapper<ProtocolInfo> query = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<BzProtocolInfo> query = new LambdaQueryWrapper<>();
|
||||||
if (StringUtils.isNotEmpty(so.getName())) {
|
if (StringUtils.isNotEmpty(so.getName())) {
|
||||||
query.like(StringUtils.isNotEmpty(so.getName()),ProtocolInfo::getName, so.getName());
|
query.like(StringUtils.isNotEmpty(so.getName()), BzProtocolInfo::getName, so.getName());
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotEmpty(so.getIp())) {
|
if (StringUtils.isNotEmpty(so.getIp())) {
|
||||||
query.like(ProtocolInfo::getIp, so.getIp());
|
query.like(BzProtocolInfo::getIp, so.getIp());
|
||||||
}
|
}
|
||||||
if (so.getPort() != null) {
|
if (so.getPort() != null) {
|
||||||
query.eq(ProtocolInfo::getPort, so.getPort());
|
query.eq(BzProtocolInfo::getPort, so.getPort());
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotEmpty(so.getStd())) {
|
if (StringUtils.isNotEmpty(so.getStd())) {
|
||||||
query.like(ProtocolInfo::getStd, so.getStd());
|
query.like(BzProtocolInfo::getStd, so.getStd());
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotEmpty(so.getTrans())) {
|
if (StringUtils.isNotEmpty(so.getTrans())) {
|
||||||
query.like(ProtocolInfo::getTrans, so.getTrans());
|
query.like(BzProtocolInfo::getTrans, so.getTrans());
|
||||||
}
|
}
|
||||||
if (so.getEnable() != null) {
|
if (so.getEnable() != null) {
|
||||||
query.eq(ProtocolInfo::getEnable, so.getEnable());
|
query.eq(BzProtocolInfo::getEnable, so.getEnable());
|
||||||
}
|
}
|
||||||
query.orderByDesc(ProtocolInfo::getCreateTm);
|
query.orderByDesc(BzProtocolInfo::getCreateTm);
|
||||||
|
|
||||||
return dao.page(so.getPageSo().toPage(), query);
|
return dao.page(so.getPageSo().toPage(), query);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import lombok.Data;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Schema(description = "协议信息查询参数")
|
@Schema(description = "协议信息查询参数")
|
||||||
public class ProtocolInfoSo {
|
public class BzProtocolInfoSo {
|
||||||
|
|
||||||
@NotNull(message = "分页参数不能为空")
|
@NotNull(message = "分页参数不能为空")
|
||||||
private PageSo pageSo;
|
private PageSo pageSo;
|
||||||
|
|
@ -17,7 +17,7 @@ import lombok.Data;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Schema(description = "服务资源查询参数")
|
@Schema(description = "服务资源查询参数")
|
||||||
public class ServiceResourceSo {
|
public class BzServiceResourceSo {
|
||||||
|
|
||||||
@NotNull(message = "分页参数不能为空", groups = {QueryPage.class})
|
@NotNull(message = "分页参数不能为空", groups = {QueryPage.class})
|
||||||
private PageSo pageSo;
|
private PageSo pageSo;
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
package com.gunshi.project.xyt.so;
|
package com.gunshi.project.xyt.so;
|
||||||
|
|
||||||
import com.gunshi.db.dto.DateTimeRangeSo;
|
|
||||||
import com.gunshi.db.dto.PageSo;
|
import com.gunshi.db.dto.PageSo;
|
||||||
import com.gunshi.project.xyt.validate.markers.QueryPage;
|
import com.gunshi.project.xyt.validate.markers.QueryPage;
|
||||||
import com.gunshi.project.xyt.validate.markers.QueryTimeRange;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -17,7 +15,7 @@ import lombok.Data;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Schema(description = "服务资源查询参数")
|
@Schema(description = "服务资源查询参数")
|
||||||
public class ServiceResourceTypeSo {
|
public class BzServiceResourceTypeSo {
|
||||||
|
|
||||||
@NotNull(message = "分页参数不能为空", groups = {QueryPage.class})
|
@NotNull(message = "分页参数不能为空", groups = {QueryPage.class})
|
||||||
private PageSo pageSo;
|
private PageSo pageSo;
|
||||||
|
|
@ -16,7 +16,7 @@ import java.util.Date;
|
||||||
* @since 2024-01-24
|
* @since 2024-01-24
|
||||||
*/
|
*/
|
||||||
public class ServiceResourceMonitorVo {
|
public class ServiceResourceMonitorVo {
|
||||||
//region ServiceResourceMonitorR
|
//region BzServiceResourceMonitorR
|
||||||
@Schema(description = "id")
|
@Schema(description = "id")
|
||||||
@TableId("ID")
|
@TableId("ID")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
@ -55,7 +55,7 @@ public class ServiceResourceMonitorVo {
|
||||||
private Long yearlyCount;
|
private Long yearlyCount;
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
//region ServiceResource
|
//region BzServiceResource
|
||||||
@Schema(description = "服务名称")
|
@Schema(description = "服务名称")
|
||||||
@TableField("NAME")
|
@TableField("NAME")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue