luyie
2 months ago
8 changed files with 320 additions and 4 deletions
@ -0,0 +1,32 @@
|
||||
package com.hnac.gglm.bigmodel.maintenance.constants; |
||||
|
||||
import lombok.Getter; |
||||
|
||||
/** |
||||
* @Author: ypj |
||||
* @Date: 2024/9/23 14:18 |
||||
*/ |
||||
@Getter |
||||
public enum DataOperateType { |
||||
CREATE("CREATE", "新增"), |
||||
UPDATE("UPDATE", "更新"), |
||||
RESET("RESET", "重置"), |
||||
DELETE("DELETE", "删除"), |
||||
SYNCHRONIZATION("SYNCHRONIZATION", "同步"); |
||||
private final String code; |
||||
private final String msg; |
||||
|
||||
DataOperateType(String code, String msg) { |
||||
this.code = code; |
||||
this.msg = msg; |
||||
} |
||||
|
||||
public static DataOperateType getInstance(String code) { |
||||
for (DataOperateType dataOperateType : DataOperateType.values()) { |
||||
if (dataOperateType.getCode().equals(code)) { |
||||
return dataOperateType; |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,99 @@
|
||||
package com.hnac.gglm.bigmodel.maintenance.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import com.hnac.gglm.bigmodel.maintenance.entity.VectorParamLogEntity; |
||||
import com.hnac.gglm.bigmodel.maintenance.service.VectorParamLogService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.annotations.ApiParam; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
/** |
||||
* @Author: ypj |
||||
* @Date: 2024/9/23 13:50 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/vector/log") |
||||
@Api(value = "向量参数配置日志", tags = "向量参数配置日志") |
||||
@AllArgsConstructor |
||||
@Slf4j |
||||
public class VectorParamLogController { |
||||
private final VectorParamLogService vectorParamLogService; |
||||
|
||||
@GetMapping("/listPage") |
||||
@ApiOperation(value = "分页查询") |
||||
@ApiOperationSupport(order = 1) |
||||
public R<IPage<VectorParamLogEntity>> listPage(Query query, VectorParamLogEntity req) { |
||||
return R.data(vectorParamLogService.page(Condition.getPage(query), Condition.getQueryWrapper(new VectorParamLogEntity(), req))); |
||||
} |
||||
|
||||
@GetMapping("/detail") |
||||
@ApiOperation(value = "查看详情") |
||||
@ApiOperationSupport(order = 2) |
||||
public R<VectorParamLogEntity> detail(@RequestParam @ApiParam("主键ID") Long id) { |
||||
return R.data(vectorParamLogService.getById(id)); |
||||
} |
||||
|
||||
@GetMapping("/save") |
||||
@ApiOperation(value = "保存向量参数配置日志") |
||||
@ApiOperationSupport(order = 3) |
||||
public R save(@RequestBody VectorParamLogEntity req) { |
||||
return R.status(vectorParamLogService.save(req)); |
||||
} |
||||
|
||||
@GetMapping("/remove") |
||||
@ApiOperation(value = "删除向量参数配置日志") |
||||
@ApiOperationSupport(order = 4) |
||||
public R remove(@RequestParam @ApiParam("主键ID,按逗号分隔") String ids) { |
||||
return R.status(vectorParamLogService.removeByIds(Func.toLongList(",", ids))); |
||||
} |
||||
|
||||
@PutMapping("/update") |
||||
@ApiOperation(value = "编辑向量参数配置日志") |
||||
@ApiOperationSupport(order = 5) |
||||
public R update(@RequestBody VectorParamLogEntity req) { |
||||
return R.status(vectorParamLogService.updateById(req)); |
||||
} |
||||
|
||||
@PostMapping("/create") |
||||
@ApiOperation(value = "创建向量参数配置操作记录") |
||||
@ApiOperationSupport(order = 6) |
||||
public R create(@RequestBody VectorParamLogEntity req) { |
||||
return R.status(vectorParamLogService.create(req)); |
||||
} |
||||
|
||||
@PostMapping("/edit") |
||||
@ApiOperation(value = "编辑向量参数配置操作记录") |
||||
@ApiOperationSupport(order = 7) |
||||
public R edit(@RequestBody VectorParamLogEntity req) { |
||||
return R.status(vectorParamLogService.edit(req)); |
||||
} |
||||
|
||||
@PostMapping("/reset") |
||||
@ApiOperation(value = "重置向量参数配置操作记录") |
||||
@ApiOperationSupport(order = 8) |
||||
public R reset(@RequestBody VectorParamLogEntity req) { |
||||
return R.status(vectorParamLogService.reset(req)); |
||||
} |
||||
|
||||
@PostMapping("/delete") |
||||
@ApiOperation(value = "删除向量参数配置操作记录") |
||||
@ApiOperationSupport(order = 9) |
||||
public R delete(@RequestParam @ApiParam("主键ID,按逗号分隔") String ids) { |
||||
return R.status(vectorParamLogService.delete(Func.toLongList(",", ids))); |
||||
} |
||||
|
||||
@PostMapping("/synchronization") |
||||
@ApiOperation(value = "同步向量参数配置操作记录") |
||||
@ApiOperationSupport(order = 10) |
||||
public R synchronization(@RequestBody VectorParamLogEntity req) { |
||||
return R.status(vectorParamLogService.synchronization(req)); |
||||
} |
||||
} |
@ -0,0 +1,44 @@
|
||||
package com.hnac.gglm.bigmodel.maintenance.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Builder; |
||||
import lombok.Data; |
||||
import lombok.NoArgsConstructor; |
||||
import org.springblade.core.mp.support.QueryField; |
||||
import org.springblade.core.mp.support.SqlCondition; |
||||
import org.springblade.core.tenant.mp.TenantEntity; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* @Author: ypj |
||||
* @Date: 2024/9/23 12:07 |
||||
*/ |
||||
@ApiModel("向量参数配置日志") |
||||
@TableName("gglm_vector_param_log") |
||||
@Data |
||||
@AllArgsConstructor |
||||
@NoArgsConstructor |
||||
@Builder |
||||
public class VectorParamLogEntity extends TenantEntity implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@ApiModelProperty("参数id") |
||||
@TableField("VECTOR_PARAM_ID") |
||||
@QueryField(condition = SqlCondition.EQUAL) |
||||
private Long vectorParamId; |
||||
|
||||
@ApiModelProperty("日志内容") |
||||
@TableField("CONTENT") |
||||
@QueryField(condition = SqlCondition.LIKE) |
||||
private String content; |
||||
|
||||
@ApiModelProperty("日志类型,新增CREATE,更新UPDATE,重置RESET") |
||||
@TableField("TYPE") |
||||
@QueryField(condition = SqlCondition.EQUAL) |
||||
private String type; |
||||
} |
@ -0,0 +1,13 @@
|
||||
package com.hnac.gglm.bigmodel.maintenance.mapper; |
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.hnac.gglm.bigmodel.maintenance.entity.VectorParamLogEntity; |
||||
|
||||
/** |
||||
* @Author: ypj |
||||
* @Date: 2024/9/23 13:59 |
||||
*/ |
||||
@DS("hznlm") |
||||
public interface VectorParamLogMapper extends BaseMapper<VectorParamLogEntity> { |
||||
} |
@ -0,0 +1,22 @@
|
||||
package com.hnac.gglm.bigmodel.maintenance.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.hnac.gglm.bigmodel.maintenance.entity.VectorParamLogEntity; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @Author: ypj |
||||
* @Date: 2024/9/23 13:56 |
||||
*/ |
||||
public interface VectorParamLogService extends IService<VectorParamLogEntity> { |
||||
Boolean create(VectorParamLogEntity req); |
||||
|
||||
Boolean edit(VectorParamLogEntity req); |
||||
|
||||
Boolean reset(VectorParamLogEntity req); |
||||
|
||||
Boolean delete(List<Long> ids); |
||||
|
||||
Boolean synchronization(VectorParamLogEntity req); |
||||
} |
@ -0,0 +1,76 @@
|
||||
package com.hnac.gglm.bigmodel.maintenance.service.impl; |
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.hnac.gglm.bigmodel.maintenance.constants.DataOperateType; |
||||
import com.hnac.gglm.bigmodel.maintenance.entity.VectorParamLogEntity; |
||||
import com.hnac.gglm.bigmodel.maintenance.mapper.VectorParamLogMapper; |
||||
import com.hnac.gglm.bigmodel.maintenance.service.VectorParamLogService; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.tool.utils.ObjectUtil; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
import java.util.concurrent.LinkedBlockingQueue; |
||||
import java.util.concurrent.ThreadPoolExecutor; |
||||
import java.util.concurrent.TimeUnit; |
||||
|
||||
/** |
||||
* @Author: ypj |
||||
* @Date: 2024/9/23 13:57 |
||||
*/ |
||||
@Service |
||||
@Slf4j |
||||
@AllArgsConstructor |
||||
@DS("hznlm") |
||||
public class VectorParamLogServiceImpl extends ServiceImpl<VectorParamLogMapper, VectorParamLogEntity> implements VectorParamLogService { |
||||
@Override |
||||
public Boolean create(VectorParamLogEntity req) { |
||||
if (ObjectUtil.isEmpty(req.getVectorParamId())) { |
||||
return false; |
||||
} |
||||
req.setType(DataOperateType.CREATE.getCode()); |
||||
return save(req); |
||||
} |
||||
|
||||
@Override |
||||
public Boolean edit(VectorParamLogEntity req) { |
||||
if (ObjectUtil.isEmpty(req.getVectorParamId())) { |
||||
return false; |
||||
} |
||||
req.setType(DataOperateType.UPDATE.getCode()); |
||||
return save(req); |
||||
} |
||||
|
||||
@Override |
||||
public Boolean reset(VectorParamLogEntity req) { |
||||
if (ObjectUtil.isEmpty(req.getVectorParamId())) { |
||||
return false; |
||||
} |
||||
req.setType(DataOperateType.RESET.getCode()); |
||||
return save(req); |
||||
} |
||||
|
||||
@Override |
||||
public Boolean delete(List<Long> ids) { |
||||
ThreadPoolExecutor executor = new ThreadPoolExecutor(5, ids.size() > 5 ? ids.size() : 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); |
||||
ids.forEach(id -> { |
||||
executor.execute(() -> { |
||||
save(VectorParamLogEntity.builder() |
||||
.vectorParamId(id) |
||||
.type(DataOperateType.DELETE.getCode()).build()); |
||||
}); |
||||
}); |
||||
return Boolean.TRUE; |
||||
} |
||||
|
||||
@Override |
||||
public Boolean synchronization(VectorParamLogEntity req) { |
||||
if (ObjectUtil.isEmpty(req.getVectorParamId())) { |
||||
return false; |
||||
} |
||||
req.setType(DataOperateType.SYNCHRONIZATION.getCode()); |
||||
return save(req); |
||||
} |
||||
} |
Loading…
Reference in new issue