mirror of https://github.com/longtai-cn/hippo4j
parent
7c22923dff
commit
b1b82d9534
@ -0,0 +1,15 @@
|
|||||||
|
package com.github.dynamic.threadpool.config.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.github.dynamic.threadpool.logrecord.model.LogRecordInfo;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log record mapper.
|
||||||
|
*
|
||||||
|
* @author chen.ma
|
||||||
|
* @date 2021/10/24 21:01
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface LogRecordMapper extends BaseMapper<LogRecordInfo> {
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.github.dynamic.threadpool.config.service.biz.impl;
|
||||||
|
|
||||||
|
import com.github.dynamic.threadpool.config.mapper.LogRecordMapper;
|
||||||
|
import com.github.dynamic.threadpool.logrecord.model.LogRecordInfo;
|
||||||
|
import com.github.dynamic.threadpool.logrecord.service.LogRecordService;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作日志保存数据库.
|
||||||
|
*
|
||||||
|
* @author chen.ma
|
||||||
|
* @date 2021/10/24 20:57
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class LogRecordServiceImpl implements LogRecordService {
|
||||||
|
|
||||||
|
private LogRecordMapper logRecordMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void record(LogRecordInfo logRecordInfo) {
|
||||||
|
logRecordMapper.insert(logRecordInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.github.dynamic.threadpool.config.service.handler;
|
||||||
|
|
||||||
|
import com.github.dynamic.threadpool.config.model.biz.tenant.TenantRespDTO;
|
||||||
|
import com.github.dynamic.threadpool.config.service.biz.TenantService;
|
||||||
|
import com.github.dynamic.threadpool.logrecord.service.ParseFunction;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查找项目 Id 旧值.
|
||||||
|
*
|
||||||
|
* @author chen.ma
|
||||||
|
* @date 2021/10/24 22:07
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class TenantIdFunctionServiceImpl implements ParseFunction {
|
||||||
|
|
||||||
|
private final TenantService tenantService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String functionName() {
|
||||||
|
return "TENANT";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String apply(String tenantId) {
|
||||||
|
TenantRespDTO tenant = tenantService.getTenantById(tenantId);
|
||||||
|
return Optional.ofNullable(tenant).map(TenantRespDTO::getTenantName).orElse("");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in new issue