shiyunteng
2 天以前 c6db287f6c987060d615fd7ef5126511e051d5c6
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
<?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="com.by4cloud.platformx.device.mapper.DeviceStocktakingPlanMapper">
 
  <resultMap id="deviceStocktakingPlanMap" type="com.by4cloud.platformx.device.entity.DeviceStocktakingPlan">
        <id property="id" column="id"/>
        <result property="compId" column="comp_id"/>
        <result property="endDate" column="end_date"/>
        <result property="planName" column="plan_name"/>
        <result property="planStatus" column="plan_status"/>
        <result property="startDate" column="start_date"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="delFlag" column="del_flag"/>
  </resultMap>
    <select id="selectVoById" resultType="com.by4cloud.platformx.device.entity.vo.DeviceStocktakingPlanVo">
 
        select
            dsp.id,
            dsp.plan_name,
            dsp.start_date,
            dsp.end_date,
            dsp.plan_status,
            (
                select
                    GROUP_CONCAT(name)
                from
                    platformxx_boot.sys_user su
                where
                    exists (
                            select
                                *
                            from
                                device_stocktaking_plan_user dspu
                            where
                                dspu.stocktaking_user_id = su.user_id
                              and dspu.plan_id = dsp.id)) users,
            (
                select
                    GROUP_CONCAT(name)
                from
                    device_class dc
                where
                    exists (
                            select
                                *
                            from
                                device_stocktaking_plan_scope dsps
                            where
                                dsps.class_id = dc.id
                              and dsps.plan_id = dsp.id)) scopes
        from
            device_stocktaking_plan dsp
        where
            dsp.id = #{id}
    </select>
</mapper>