提交 | 用户 | 时间
|
a6de49
|
1 |
package com.iailab.module.mcs.service.impl; |
H |
2 |
|
|
3 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
4 |
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
5 |
import com.iailab.framework.common.page.PageData; |
|
6 |
import com.iailab.framework.common.service.impl.BaseServiceImpl; |
|
7 |
import com.iailab.framework.common.util.object.ConvertUtils; |
|
8 |
import com.iailab.module.mcs.dao.StModelRequestLogDao; |
|
9 |
import com.iailab.module.mcs.dto.StModelRequestLogDTO; |
|
10 |
import com.iailab.module.mcs.entity.StModelRequestLogEntity; |
|
11 |
import com.iailab.module.mcs.service.StModelRequestLogService; |
|
12 |
import org.apache.commons.lang3.StringUtils; |
|
13 |
import org.springframework.stereotype.Service; |
|
14 |
|
|
15 |
import java.util.Map; |
|
16 |
import java.util.UUID; |
|
17 |
|
|
18 |
/** |
|
19 |
* @author PanZhibao |
|
20 |
* @Description |
|
21 |
* @createTime 2024年05月22日 |
|
22 |
*/ |
|
23 |
@Service |
|
24 |
public class StModelRequestLogServiceImpl extends BaseServiceImpl<StModelRequestLogDao, StModelRequestLogEntity> implements StModelRequestLogService { |
|
25 |
|
|
26 |
@Override |
|
27 |
public PageData<StModelRequestLogDTO> page(Map<String, Object> params) { |
|
28 |
IPage<StModelRequestLogEntity> page = baseDao.selectPage( |
|
29 |
getPage(params, "request_time", false), |
|
30 |
getWrapper(params) |
|
31 |
); |
|
32 |
return getPageData(page, StModelRequestLogDTO.class); |
|
33 |
} |
|
34 |
|
|
35 |
private QueryWrapper<StModelRequestLogEntity> getWrapper(Map<String, Object> params) { |
|
36 |
String modelId = (String) params.get("modelId"); |
|
37 |
String appKey = (String) params.get("appKey"); |
|
38 |
String startTime = (String) params.get("startTime"); |
|
39 |
String endTime = (String) params.get("endTime"); |
|
40 |
|
|
41 |
QueryWrapper<StModelRequestLogEntity> wrapper = new QueryWrapper<>(); |
|
42 |
wrapper.eq(StringUtils.isNotBlank(modelId), "model_id", modelId) |
|
43 |
.like(StringUtils.isNotBlank(appKey), "app_key", appKey) |
|
44 |
.ge(StringUtils.isNotBlank(startTime), "request_time", startTime) |
|
45 |
.le(StringUtils.isNotBlank(endTime), "request_time", endTime); |
|
46 |
return wrapper; |
|
47 |
} |
|
48 |
|
|
49 |
@Override |
|
50 |
public void save(StModelRequestLogDTO dto) { |
|
51 |
StModelRequestLogEntity entity = ConvertUtils.sourceToTarget(dto, StModelRequestLogEntity.class); |
|
52 |
entity.setId(UUID.randomUUID().toString()); |
|
53 |
insert(entity); |
|
54 |
} |
|
55 |
} |