刘光辉
15 小时以前 34981c30a78e8bbd7791131059a9210f9928b62c
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="jnpf.limsMapper.LimsJianyanJinduMapper">
 
    <resultMap id="qingyandanMap" type="jnpf.limsEntity.LimsJianyanJinduQingyandanRow">
        <id property="id" column="id"/>
        <result property="chanpinMingcheng" column="chanpin_mingcheng"/>
        <result property="chanpinBianma" column="chanpin_bianma"/>
        <result property="pihao" column="pihao"/>
        <result property="guige" column="guige"/>
        <result property="qingyanRen" column="qingyan_ren"/>
        <result property="qingyanRiqi" column="qingyan_riqi"/>
        <result property="quyangren" column="quyangren"/>
        <result property="quyangRiqi" column="quyang_riqi"/>
        <result property="jieshouren" column="jieshouren"/>
        <result property="jieshouRiqi" column="jieshou_riqi"/>
        <result property="baogaoRen" column="baogao_ren"/>
        <result property="baogaoRiqi" column="baogao_riqi"/>
        <result property="baogaoShenheRen" column="baogao_shenhe_ren"/>
        <result property="baogaoShenheRiqi" column="baogao_shenhe_riqi"/>
        <result property="baogaoPizhunRen" column="baogao_pizhun_ren"/>
        <result property="baogaoPizhunRiqi" column="baogao_pizhun_riqi"/>
    </resultMap>
 
    <select id="selectQingyandan" resultMap="qingyandanMap">
        SELECT a.f_id AS id,
               a.chanpin_mingcheng,
               a.chanpin_bianma,
               a.pihao,
               a.guige,
               CASE WHEN a.qingyan_ren IS NULL OR a.qingyan_ren = ''
                    THEN '' ELSE CONCAT(b.f_account, '/', b.f_real_name) END AS qingyan_ren,
               a.qingyan_riqi,
               CASE WHEN a.quyangren IS NULL OR a.quyangren = ''
                    THEN '' ELSE CONCAT(c.f_account, '/', c.f_real_name) END AS quyangren,
               a.quyang_riqi,
               CASE WHEN a.jieshouren IS NULL OR a.jieshouren = ''
                    THEN '' ELSE CONCAT(d.f_account, '/', d.f_real_name) END AS jieshouren,
               a.jieshou_riqi,
               CASE WHEN a.baogao_ren IS NULL OR a.baogao_ren = ''
                    THEN '' ELSE CONCAT(e.f_account, '/', e.f_real_name) END AS baogao_ren,
               a.baogao_riqi,
               CASE WHEN a.baogao_shenhe_ren IS NULL OR a.baogao_shenhe_ren = ''
                    THEN '' ELSE CONCAT(f.f_account, '/', f.f_real_name) END AS baogao_shenhe_ren,
               a.baogao_shenhe_riqi,
               CASE WHEN a.baogao_pizhun_ren IS NULL OR a.baogao_pizhun_ren = ''
                    THEN '' ELSE CONCAT(g.f_account, '/', g.f_real_name) END AS baogao_pizhun_ren,
               a.baogao_pizhun_riqi
        FROM lims_qingyandan a
        LEFT JOIN base_user b ON a.qingyan_ren = b.f_id
        LEFT JOIN base_user c ON a.quyangren = c.f_id
        LEFT JOIN base_user d ON a.jieshouren = d.f_id
        LEFT JOIN base_user e ON a.baogao_ren = e.f_id
        LEFT JOIN base_user f ON a.baogao_shenhe_ren = f.f_id
        LEFT JOIN base_user g ON a.baogao_pizhun_ren = g.f_id
        WHERE a.f_id = #{qingyandanId}
    </select>
 
</mapper>