heheng
2 天以前 338f2f5afc7762dabf2409f296d5d023462ed4b5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.gkhy.exam.system.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.gkhy.exam.common.api.CommonPage;
import com.gkhy.exam.common.api.CommonResult;
import com.gkhy.exam.common.constant.UserConstant;
import com.gkhy.exam.common.utils.PageUtils;
import com.gkhy.exam.common.utils.SecurityUtils;
import com.gkhy.exam.system.domain.InternalKnowledge;
import com.gkhy.exam.system.mapper.InternalKnowledgeMapper;
import com.gkhy.exam.system.service.InternalKnowledgeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.time.LocalDateTime;
import java.util.List;
 
/**
 * <p>
 * 内部知识 服务实现类
 * </p>
 *
 * @author hh
 * @since 2025-08-25 15:01:44
 */
@Service
public class InternalKnowledgeServiceImpl extends ServiceImpl<InternalKnowledgeMapper, InternalKnowledge> implements InternalKnowledgeService {
 
    @Autowired
    private InternalKnowledgeMapper internalKnowledgeMapper;
    @Override
    public CommonPage selectInternalKnowledgeList(InternalKnowledge internalKnowledge) {
        PageUtils.startPage();
        List<InternalKnowledge> internalKnowledge1 = internalKnowledgeMapper.getInternalKnowledge(internalKnowledge);
        return CommonPage.restPage(internalKnowledge1);
    }
 
    @Override
    public CommonResult saveInternalKnowledge(InternalKnowledge internalKnowledge) {
        int i = 0;
        if (internalKnowledge.getId() == null){
            internalKnowledge.setCreateBy(SecurityUtils.getUsername());
            internalKnowledge.setCreateTime(LocalDateTime.now());
            i = internalKnowledgeMapper.insert(internalKnowledge);
 
        }else {
            internalKnowledge.setUpdateBy(SecurityUtils.getUsername());
            internalKnowledge.setUpdateTime(LocalDateTime.now());
            i = internalKnowledgeMapper.updateById(internalKnowledge);
        }
        return CommonResult.success();
    }
 
    @Override
    public CommonResult deletedInternalKnowledge(Integer id) {
        internalKnowledgeMapper.update(new InternalKnowledge(),
                new LambdaUpdateWrapper<InternalKnowledge>().eq(InternalKnowledge::getId, id)
                        .set(InternalKnowledge::getDelFlag, UserConstant.DEPT_DISABLE)
                        .set(InternalKnowledge::getUpdateTime, LocalDateTime.now())
                        .set(InternalKnowledge::getUpdateBy, SecurityUtils.getUsername()));
        return CommonResult.success();
    }
}