songhuangfeng123
2022-08-12 5703d0e9865df3ba05bb02bc382ce59fbf5f7da0
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package com.gkhy.safePlatform.targetDuty.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.safePlatform.targetDuty.entity.ExamineMng;
import com.gkhy.safePlatform.targetDuty.entity.ExamineTemplate;
import com.gkhy.safePlatform.targetDuty.entity.RewardPunishmentStandard;
import com.gkhy.safePlatform.targetDuty.model.dto.resp.ExamineMngDto;
import com.gkhy.safePlatform.targetDuty.repository.RewardPunishmentDetailRepository;
import com.gkhy.safePlatform.targetDuty.entity.RewardPunishmentDetail;
import com.gkhy.safePlatform.targetDuty.repository.RewardPunishmentStandardRepository;
import com.gkhy.safePlatform.targetDuty.service.RewardPunishmentDetailService;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.query.PageQuery;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.commons.vo.SearchResultVO;
import com.gkhy.safePlatform.targetDuty.model.dto.req.RewardPunishmentDetailQueryCriteria;
import com.gkhy.safePlatform.targetDuty.model.dto.resp.RewardPunishmentDetailDto;
import com.gkhy.safePlatform.targetDuty.utils.QueryHelpPlus;
import com.gkhy.safePlatform.commons.utils.BeanCopyUtils;
 
import java.io.Serializable;
import java.util.List;
 
/**
 * 奖惩记录(RewardPunishmentDetail)表服务实现类
 *
 * @author xurui
 * @since 2022-07-21 10:15:45
 */
@Service("rewardPunishmentDetailService")
public class RewardPunishmentDetailServiceImpl extends ServiceImpl<RewardPunishmentDetailRepository, RewardPunishmentDetail> implements RewardPunishmentDetailService {
 
    @Autowired
    private RewardPunishmentDetailRepository rewardPunishmentDetailRepository;
 
    @Autowired
    private RewardPunishmentStandardRepository rewardPunishmentStandardRepository;
    
    
    @Override
    public ResultVO queryAll(PageQuery<RewardPunishmentDetailQueryCriteria> pageQuery) {
        Long pageIndex = pageQuery.getPageIndex();
        Long pageSize = pageQuery.getPageSize();
        IPage<RewardPunishmentDetailDto> page = new Page<>(pageIndex, pageSize);
 
        page = baseMapper.queryAll(page,
                pageQuery.getSearchParams().getPersonId());
//        List<RewardPunishmentDetailDto> respList = BeanCopyUtils.copyBeanList(page.getRecords(), RewardPunishmentDetailDto.class);
 
        return new SearchResultVO<>(
                true,
                pageIndex,
                pageSize,page.getPages(),
                page.getTotal(),
                page.getRecords(),
                ResultCodes.OK
        );
    }
 
 
    @Override
    public List<RewardPunishmentDetail> queryAll(RewardPunishmentDetailQueryCriteria criteria) {
        return baseMapper.selectList(QueryHelpPlus.getPredicate(RewardPunishmentDetail.class, criteria));
    }
 
 
    @Override
    public List<RewardPunishmentDetail> queryAllRelation(RewardPunishmentDetailQueryCriteria criteria) {
        return baseMapper.queryAll(criteria.getPersonId());
    }
 
    @Override
    public RewardPunishmentDetailDto selectOne(Serializable id) {
        RewardPunishmentDetail info = this.getById(id);
        if(info == null){
            return null;
        }
 
        RewardPunishmentDetailDto dto = BeanCopyUtils.copyBean(info, RewardPunishmentDetailDto.class);
 
        RewardPunishmentStandard standard = rewardPunishmentStandardRepository.selectOne(new QueryWrapper<RewardPunishmentStandard>().eq("id",dto.getRewardPunishmentStandardId()));
        dto.setRewardPunishmentStandardName(standard.getqName());
        return dto;
    }
}