heheng
2025-11-17 df77511b027636bd2202983d7ac4cdc636eac94b
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
package com.gkhy.exam.system.service.useSealApply.impl;
 
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.exam.common.api.CommonPage;
import com.gkhy.exam.common.api.CommonResult;
import com.gkhy.exam.common.exception.ApiException;
import com.gkhy.exam.common.utils.PageUtils;
import com.gkhy.exam.common.utils.SecurityUtils;
import com.gkhy.exam.system.domain.SealType;
import com.gkhy.exam.system.mapper.SealTypeMapper;
import com.gkhy.exam.system.service.useSealApply.SealTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.time.LocalDateTime;
import java.util.List;
 
@Service
public class SealTypeServiceImpl extends ServiceImpl<SealTypeMapper, SealType> implements SealTypeService {
 
    @Autowired
    private SealTypeMapper sealTypeMapper;
 
    @Override
    public CommonPage selectSealTypeList(SealType sealType) {
        if (!SecurityUtils.adminUser()){
            if (sealType.getCompanyId()==null){
                throw new ApiException("非管理员操作,查询条件不可为空");
            }
        }
        PageUtils.startPage();
        List<SealType> sealTypes = sealTypeMapper.selectSealTypeList(sealType);
        return CommonPage.restPage(sealTypes);
    }
 
    @Override
    public CommonResult insertSealType(SealType sealType) {
        sealType.setCreateTime(LocalDateTime.now());
        sealType.setCreateBy(SecurityUtils.getUsername());
        int insert = sealTypeMapper.insert(sealType);
        return CommonResult.success();
    }
 
    @Override
    public CommonResult updateSealType(SealType sealType) {
        sealType.setUpdateTime(LocalDateTime.now());
        sealType.setUpdateBy(SecurityUtils.getUsername());
        int update = sealTypeMapper.updateById(sealType);
        return CommonResult.success();
    }
 
    @Override
    public CommonResult deletedSealType(Integer sealTypeId) {
        SealType sealType = new SealType();
        sealType.setId(sealTypeId);
        sealType.setDelFlag(2);
        sealType.setUpdateTime(LocalDateTime.now());
        sealType.setUpdateBy(SecurityUtils.getUsername());
        sealTypeMapper.updateById(sealType);
        return CommonResult.success();
    }
}