提交 | 用户 | 时间
|
7fd198
|
1 |
package com.iailab.module.model.mcs.pre.service.impl; |
潘 |
2 |
|
|
3 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
4 |
import com.iailab.framework.common.pojo.PageResult; |
|
5 |
import com.iailab.framework.common.service.impl.BaseServiceImpl; |
|
6 |
import com.iailab.module.model.mcs.pre.dao.MmResultTableDao; |
|
7 |
import com.iailab.module.model.mcs.pre.entity.MmResultTableEntity; |
|
8 |
import com.iailab.module.model.mcs.pre.service.MmResultTableService;; |
|
9 |
import com.iailab.module.model.mcs.pre.vo.MmResultTablePageReqVO; |
|
10 |
import org.apache.commons.lang3.StringUtils; |
|
11 |
import org.springframework.stereotype.Service; |
|
12 |
import org.springframework.transaction.annotation.Transactional; |
|
13 |
|
|
14 |
import java.util.Arrays; |
|
15 |
import java.util.List; |
|
16 |
import java.util.Map; |
|
17 |
import java.util.UUID; |
|
18 |
|
|
19 |
/** |
|
20 |
* @author PanZhibao |
|
21 |
* @date 2021年04月23日 16:28 |
|
22 |
*/ |
|
23 |
@Service("mmResultTableService") |
|
24 |
public class MmResultTableServiceImpl extends BaseServiceImpl<MmResultTableDao, MmResultTableEntity> implements MmResultTableService { |
|
25 |
@Override |
|
26 |
public PageResult<MmResultTableEntity> page(MmResultTablePageReqVO reqVO) { |
|
27 |
return baseDao.selectPage(reqVO); |
|
28 |
} |
|
29 |
|
|
30 |
private QueryWrapper<MmResultTableEntity> getWrapper(Map<String, Object> params) { |
|
31 |
String tablename = (String)params.get("tablename"); |
|
32 |
|
|
33 |
QueryWrapper<MmResultTableEntity> wrapper = new QueryWrapper<>(); |
|
34 |
wrapper.like(StringUtils.isNotBlank(tablename),"tablename", tablename); |
|
35 |
|
|
36 |
return wrapper; |
|
37 |
} |
|
38 |
|
|
39 |
@Override |
|
40 |
@Transactional(rollbackFor = Exception.class) |
|
41 |
public void saveResultTable(MmResultTableEntity resultTable) { |
|
42 |
resultTable.setId(UUID.randomUUID().toString()); |
|
43 |
baseDao.insert(resultTable); |
|
44 |
} |
|
45 |
|
|
46 |
@Override |
|
47 |
@Transactional(rollbackFor = Exception.class) |
|
48 |
public void update(MmResultTableEntity resultTable) { |
|
49 |
baseDao.updateById(resultTable); |
|
50 |
} |
|
51 |
|
|
52 |
@Override |
|
53 |
@Transactional(rollbackFor = Exception.class) |
|
54 |
public void deleteBatch(String[] resultTableIds) { |
|
55 |
baseDao.deleteBatchIds(Arrays.asList(resultTableIds)); |
|
56 |
} |
|
57 |
|
|
58 |
@Override |
|
59 |
public int check(MmResultTableEntity resultTable) { |
|
60 |
String id = resultTable.getId(); |
|
61 |
String tablename = resultTable.getTablename(); |
|
62 |
QueryWrapper<MmResultTableEntity> queryWrapper = new QueryWrapper<>(); |
|
63 |
queryWrapper.ne(StringUtils.isNotBlank(id), "id", id); |
|
64 |
queryWrapper.and(wrapper -> wrapper.eq("tablename",tablename)); |
|
65 |
|
|
66 |
List<MmResultTableEntity> list = baseDao.selectList(queryWrapper); |
|
67 |
return list.size(); |
|
68 |
} |
|
69 |
} |