my最新
parent
2c021232d7
commit
4c6d335912
|
@ -20,6 +20,7 @@ import java.util.List;
|
|||
@RequestMapping("/api-config")
|
||||
@AllArgsConstructor
|
||||
public class ApiConfigController {
|
||||
|
||||
private final ApiConfigService apiConfigService;
|
||||
|
||||
|
||||
|
@ -40,7 +41,7 @@ public class ApiConfigController {
|
|||
* @param query API配置查询对象
|
||||
* @return 分页结果
|
||||
*/
|
||||
@GetMapping("page")
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "分页")
|
||||
@PreAuthorize("hasAuthority('data-service:api-config:page')")
|
||||
public Result<PageResult<ApiConfig>> page(@Valid ApiConfigQuery query) {
|
||||
|
@ -54,7 +55,7 @@ public class ApiConfigController {
|
|||
*
|
||||
* @return 返回IP和端口信息
|
||||
*/
|
||||
@GetMapping("getIpPort")
|
||||
@GetMapping("/getIpPort")
|
||||
public Result<String> getIpPort() {
|
||||
return Result.ok(apiConfigService.getIpPort());
|
||||
}
|
||||
|
@ -109,8 +110,8 @@ public class ApiConfigController {
|
|||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@PreAuthorize("hasAuthority('data-service:api-config:delete')")
|
||||
public Result<ApiConfigEntity> delete(@PathVariable("id") Long id) {
|
||||
apiConfigService.removeByI(id);
|
||||
public Result<String> delete(@RequestBody List<Long> idList) {
|
||||
apiConfigService.removeByI(idList);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@ package net.srt.convert;
|
|||
|
||||
import net.srt.entity.ApiLogEntity;
|
||||
import net.srt.vo.ApiLog;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.srt.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
|
@ -50,6 +51,7 @@ public class ApiConfigEntity extends BaseEntity {
|
|||
private Long releaseUserId;
|
||||
// 自定义注解,日期格式化,格式为"yyyy-MM-dd HH:mm:ss"
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date releaseTime;
|
||||
// 私有属性,内容类型
|
||||
private String contentType;
|
||||
|
|
|
@ -9,6 +9,6 @@ import org.apache.ibatis.annotations.Param;
|
|||
public interface ApiConfigDao extends BaseDao<ApiConfigEntity> {
|
||||
void xia(@Param("id") Long id);
|
||||
|
||||
void shang(Long id);
|
||||
void shang(@Param("id") Long id);
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.srt.framework.common.query.Query;
|
|||
|
||||
@Data
|
||||
public class ApiConfigQuery extends Query {
|
||||
|
||||
private Long groupId;
|
||||
private Long resourceId;
|
||||
private Long appId;
|
||||
|
|
|
@ -29,9 +29,10 @@ public interface ApiConfigService extends BaseService<ApiConfigEntity> {
|
|||
|
||||
void shang(Long id);
|
||||
|
||||
void removeByI(Long id);
|
||||
|
||||
|
||||
void sav(ApiConfig vo);
|
||||
|
||||
void removeByI(List<Long> idList);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package net.srt.service;
|
||||
|
||||
import net.srt.entity.ApiGroupEntity;
|
||||
import net.srt.entity.ApiLogEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.BaseService;
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
|
@ -111,7 +112,7 @@ public class ApiConfigServiceImpl extends BaseServiceImpl<ApiConfigDao, ApiConfi
|
|||
// }
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
ApiConfigDao apiConfigDto;
|
||||
|
||||
@Override
|
||||
|
@ -126,18 +127,24 @@ public class ApiConfigServiceImpl extends BaseServiceImpl<ApiConfigDao, ApiConfi
|
|||
apiConfigDto.shang(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeByI(Long id) {
|
||||
baseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sav(ApiConfig vo) {
|
||||
|
||||
|
||||
ApiConfigEntity entity = ApiConfigConvert.INSTANCE.convert(vo);
|
||||
entity.setPath(recursionPath(entity, null));
|
||||
entity.setProjectId(getProjectId());
|
||||
baseMapper.insert(entity); // 使用 insertSelective() 方法进行插入操作
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void removeByI(List<Long> idList) {
|
||||
baseMapper.deleteBatchIds(idList);
|
||||
}
|
||||
|
||||
private String recursionPath(ApiConfigEntity groupEntity, String path) {
|
||||
if (StringUtil.isBlank(path)) {
|
||||
path = groupEntity.getName();
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.util.List;
|
|||
@Service
|
||||
@AllArgsConstructor
|
||||
public class ApiGroupServiceImpl extends BaseServiceImpl<ApiGroupDao, ApiGroupEntity> implements ApiGroupService{
|
||||
private final ApiConfigService apiConfigService;
|
||||
// private final ApiConfigService apiConfigService;
|
||||
@Override
|
||||
public List<TreeNodeVo> listTree() {
|
||||
List<TreeNodeVo> treeNodeVos = getTreeNodeVos();
|
||||
|
@ -81,13 +81,13 @@ public class ApiGroupServiceImpl extends BaseServiceImpl<ApiGroupDao, ApiGroupEn
|
|||
if (one != null) {
|
||||
throw new ServerException("存在子节点,不允许删除!");
|
||||
}
|
||||
//查询有没有api与之关联
|
||||
LambdaQueryWrapper<ApiConfigEntity> serviceApiConfigWrapper = new LambdaQueryWrapper<>();
|
||||
serviceApiConfigWrapper.eq(ApiConfigEntity::getParentId, id).last(" limit 1");
|
||||
ApiConfigEntity apiConfigEntity = apiConfigService.getOne(serviceApiConfigWrapper);
|
||||
if (apiConfigEntity != null) {
|
||||
throw new ServerException("节点下有 api 与之关联,不允许删除!");
|
||||
}
|
||||
removeById(id);
|
||||
// //查询有没有api与之关联
|
||||
// LambdaQueryWrapper<ApiConfigEntity> serviceApiConfigWrapper = new LambdaQueryWrapper<>();
|
||||
// serviceApiConfigWrapper.eq(ApiConfigEntity::getParentId, id).last(" limit 1");
|
||||
// ApiConfigEntity apiConfigEntity = apiConfigService.getOne(serviceApiConfigWrapper);
|
||||
// if (apiConfigEntity != null) {
|
||||
// throw new ServerException("节点下有 api 与之关联,不允许删除!");
|
||||
// }
|
||||
// removeById(id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ public class ApiLogServiceImpl extends BaseServiceImpl<ApiLogDao, ApiLogEntity>
|
|||
// 调用Mapper层方法,查询分页数据
|
||||
IPage<ApiLogEntity> page = baseMapper.selectPage(getPage(query), getWrapper(query));
|
||||
|
||||
|
||||
// 将查询结果转换为ApiConfig对象列表
|
||||
// 返回分页结果
|
||||
return new PageResult<>(ApiLogConvert.INSTANCE.convertList(page.getRecords()), page.getTotal());
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package net.srt.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
@ -14,38 +18,84 @@ import java.util.Date;
|
|||
@Data
|
||||
public class ApiConfig implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
private Long groupId;
|
||||
private String path;
|
||||
private String type;
|
||||
private Integer parentId;
|
||||
private Integer type;
|
||||
private String name;
|
||||
private String note;
|
||||
private String sqlText;
|
||||
private String sqlSeparator;
|
||||
private Integer sqlMaxRow;
|
||||
private String sqlParam;
|
||||
private String jsonParam;
|
||||
private String responseResult;
|
||||
private Integer contentType;
|
||||
private Integer status;
|
||||
private Date releaseTime;
|
||||
private Long releaseUserId;
|
||||
private Integer sqlDbType;
|
||||
private Long databaseId;
|
||||
private Integer previlege;
|
||||
private Integer openTrans;
|
||||
private Long projectId;
|
||||
private Integer orderNo;
|
||||
private String description;
|
||||
private String path;
|
||||
private Integer projectId;
|
||||
private Integer version;
|
||||
private Integer deleted;
|
||||
private Long creator;
|
||||
private Integer creator;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
private Long updater;
|
||||
private Integer updater;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTime;
|
||||
private Integer requestedTimes;
|
||||
private Integer requestedSuccessTimes;
|
||||
private Integer requestedFailedTimes;
|
||||
private Long authId;
|
||||
private String group;
|
||||
private String groupPath;
|
||||
private Integer status;
|
||||
private String contentType;
|
||||
private Integer releaseUserId;
|
||||
private Date releaseTime;
|
||||
private Integer previlege;
|
||||
private Integer openTrans;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// @TableId(value = "id", type = IdType.AUTO)
|
||||
// private Long id;
|
||||
// private Long groupId;
|
||||
// private String path;
|
||||
// private String type;
|
||||
// private String name;
|
||||
//// private String note;
|
||||
// private String sqlText;
|
||||
// private String sqlSeparator;
|
||||
// private Integer sqlMaxRow;
|
||||
// private String sqlParam;
|
||||
// private String jsonParam;
|
||||
// private String responseResult;
|
||||
// private Integer contentType;
|
||||
// private Integer status
|
||||
// private Date releaseTime;
|
||||
// private Long releaseUserId;
|
||||
// private Integer sqlDbType;
|
||||
// private Long databaseId;
|
||||
// private Integer previlege;
|
||||
// private Integer openTrans;
|
||||
// private Long projectId;
|
||||
// private Integer version;
|
||||
// private Integer deleted;
|
||||
// private Long creator;
|
||||
// @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
// private Date createTime;
|
||||
// private Long updater;
|
||||
// @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
// private Date updateTime;
|
||||
// private Integer requestedTimes;
|
||||
// private Integer requestedSuccessTimes;
|
||||
// private Integer requestedFailedTimes;
|
||||
// private Long authId;
|
||||
// private String group;
|
||||
// private String groupPath;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue