liusheng
5 天以前 cc479e6a056785103996cc7ea67dbd5faa3e800e
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
package com.ruoyi.inhospvisit.api;
 
import com.ruoyi.common.core.service.ArchiveReadApi;
import com.ruoyi.common.core.service.dto.VisitArchiveRow;
import com.ruoyi.inhospvisit.mapper.VisitArchiveMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
/**
 * {@link ArchiveReadApi} 的实现(<b>常驻 Bean</b>)。
 *
 * <h3>为什么实现在本模块</h3>
 * 出入院随访模块自第 6 步起就自带 {@link VisitArchiveMapper}
 * (只读 {@code pat_archive} 的 10 列,与 smartor 的
 * {@code PatArchiveMapper.selectPatArchiveByPatid} 等价)。
 * 本类只是把它包成 ruoyi-common 的契约,供其它随访模块经契约调用,
 * 避免每个模块各写一份同表只读 SQL。
 *
 * <h3>⚠️ 纯转发</h3>
 * 不加工条件、不补默认值。查询条件就是原实现的
 * {@code where id = #{patid} and del_flag = 0}。
 */
@Slf4j
@Component
public class DefaultArchiveReadApi implements ArchiveReadApi {
 
    @Autowired
    private VisitArchiveMapper visitArchiveMapper;
 
    @Override
    public VisitArchiveRow findByPatid(Long patid) {
        if (patid == null) {
            return null;
        }
        return visitArchiveMapper.selectByPatid(patid);
    }
}