1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <!--
3+ ~ Copyright 2019 WeBank
4+ ~
5+ ~ Licensed under the Apache License, Version 2.0 (the "License");
6+ ~ you may not use this file except in compliance with the License.
7+ ~ You may obtain a copy of the License at
8+ ~
9+ ~ http://www.apache.org/licenses/LICENSE-2.0
10+ ~
11+ ~ Unless required by applicable law or agreed to in writing, software
12+ ~ distributed under the License is distributed on an "AS IS" BASIS,
13+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ ~ See the License for the specific language governing permissions and
15+ ~ limitations under the License.
16+ ~
17+ -->
18+
19+ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
20+
21+ <mapper namespace =" com.webank.wedatasphere.dss.server.dao.WorkspaceMapper" >
22+
23+ <sql id =" workspace_main" >
24+ id,`name`,`label`,`description`,`department`,`product`,`source`,`create_by`,`create_time`,`last_update_user`,`last_update_time`
25+ </sql >
26+
27+ <sql id =" menu_appInstances_cn" >
28+ m.`id`,m.`title_cn` AS `title`, m.`desc_cn` AS `description`,m.`labels_cn` AS `labels`,
29+ m.`access_button_cn` AS `access_button`,m.`manual_button_cn` AS `manualButton`,m.`is_active`,
30+ m.`manual_button_url`,m.`icon`,m.`order`,app.`homepage_url` AS `access_button_url`,app.project_url, app.`name`
31+ </sql >
32+ <sql id =" menu_appInstances_en" >
33+ m.`id`,m.`title_en` AS `title`, m.`desc_en` AS `description`,m.`labels_en` AS `labels`,
34+ m.`access_button_en` AS `access_button`,m.`manual_button_en` AS `manualButton`,m.`is_active`
35+ m.`manual_button_url`,m.`icon`,m.`order`,app.`homepage_url` AS `access_button_url`,app.project_url, app.`name`
36+ </sql >
37+
38+
39+ <select id =" getWorkspaces" resultType =" com.webank.wedatasphere.dss.server.entity.DWSWorkspace" >
40+ SELECT *
41+ FROM dss_workspace
42+ ORDER BY dss_workspace.`create_time` DESC
43+ </select >
44+
45+ <select id =" getWorkspaceById" resultType =" com.webank.wedatasphere.dss.server.entity.DWSWorkspace" >
46+ SELECT *
47+ FROM dss_workspace
48+ WHERE id = #{workspaceId}
49+ </select >
50+
51+ <select id =" findByWorkspaceName" resultType =" com.webank.wedatasphere.dss.server.entity.DWSWorkspace" >
52+ SELECT *
53+ FROM dss_workspace
54+ <where >
55+ dss_workspace.`name` = #{name}
56+ </where >
57+ </select >
58+
59+ <insert id =" addWorkSpace" useGeneratedKeys =" true" keyProperty =" id" parameterType =" com.webank.wedatasphere.dss.server.entity.DWSWorkspace" >
60+ INSERT INTO dss_workspace (<include refid = " workspace_main" />)
61+ VALUES
62+ (#{id},#{name},#{label},#{description},#{department},#{product},#{source},#{createBy},#{createTime},#{lastUpdateUser},#{lastUpdateTime})
63+ </insert >
64+
65+ <select id =" getHomepageDemoMenusCn" resultType =" com.webank.wedatasphere.dss.server.dto.response.HomepageDemoMenuVo" >
66+ SELECT `id`,`name`,`title_cn` AS title,`description`,`icon`,`order`
67+ FROM dss_homepage_demo_menu
68+ <where >
69+ `is_active` = 1
70+ </where >
71+ </select >
72+ <select id =" getHomepageDemoMenusEn" resultType =" com.webank.wedatasphere.dss.server.dto.response.HomepageDemoMenuVo" >
73+ SELECT `id`,`name`,`title_en` AS `title`,`description`,`icon`,`order`
74+ FROM dss_homepage_demo_menu
75+ <where >
76+ `is_active` = 1
77+ </where >
78+ </select >
79+
80+ <select id =" getHomepageInstancesByMenuIdCn" resultType =" com.webank.wedatasphere.dss.server.dto.response.HomepageDemoInstanceVo" >
81+ SELECT `id`,`menu_id`,`name`,`url`,`title_cn` AS `title`,`description`,`icon`,`order`
82+ FROM dss_homepage_demo_instance
83+ <where >
84+ `is_active` = 1 AND `menu_id` = #{id}
85+ </where >
86+ </select >
87+ <select id =" getHomepageInstancesByMenuIdEn" resultType =" com.webank.wedatasphere.dss.server.dto.response.HomepageDemoInstanceVo" >
88+ SELECT `id`,`menu_id`,`name`,`url`,`title_en` AS `title`,`description`,`icon`,`order`
89+ FROM dss_homepage_demo_instance
90+ <where >
91+ `is_active` = 1 AND `menu_id` = #{id}
92+ </where >
93+ </select >
94+
95+ <select id =" getHomepageVideosCn" resultType =" com.webank.wedatasphere.dss.server.dto.response.HomepageVideoVo" >
96+ SELECT `id`,`name`,`title_cn` AS `title`,`url`,`description`,`order`
97+ FROM dss_homepage_video
98+ <where >
99+ `is_active` = 1
100+ </where >
101+ </select >
102+ <select id =" getHomepageVideosEn" resultType =" com.webank.wedatasphere.dss.server.dto.response.HomepageVideoVo" >
103+ SELECT `id`,`name`,`title_en` AS `title`,`url`,`description`,`order`
104+ FROM dss_homepage_video
105+ <where >
106+ `is_active` = 1
107+ </where >
108+ </select >
109+
110+ <select id =" getManagementMenuCn" resultType =" com.webank.wedatasphere.dss.server.dto.response.OnestopMenuVo" >
111+ SELECT `id`,`name`,`title_cn` AS `title`,`order`
112+ FROM dss_onestop_menu
113+ <where >
114+ `is_active` = 0
115+ </where >
116+ </select >
117+ <select id =" getManagementMenuEn" resultType =" com.webank.wedatasphere.dss.server.dto.response.OnestopMenuVo" >
118+ SELECT `id`,`name`,`title_en` AS `title`,`order`
119+ FROM dss_onestop_menu
120+ <where >
121+ `is_active` = 0
122+ </where >
123+ </select >
124+
125+ <select id =" getApplicationMenuCn" resultType =" com.webank.wedatasphere.dss.server.dto.response.OnestopMenuVo" >
126+ SELECT `id`,`name`,`title_cn` AS `title`,`order`
127+ FROM dss_onestop_menu
128+ <where >
129+ `is_active` = 1
130+ </where >
131+ </select >
132+ <select id =" getApplicationMenuEn" resultType =" com.webank.wedatasphere.dss.server.dto.response.OnestopMenuVo" >
133+ SELECT `id`,`name`,`title_en` AS `title`,`order`
134+ FROM dss_onestop_menu
135+ <where >
136+ `is_active` = 1
137+ </where >
138+ </select >
139+
140+ <select id =" getMenuAppInstancesCn" resultType =" com.webank.wedatasphere.dss.server.dto.response.OnestopMenuAppInstanceVo" >
141+ SELECT <include refid = " menu_appInstances_cn" />
142+ FROM dss_onestop_menu_application m
143+ LEFT JOIN dss_application app
144+ ON m.`application_id` = app.`id`
145+ <where >
146+ m.`onestop_menu_id` = #{id}
147+ </where >
148+ </select >
149+ <select id =" getMenuAppInstancesEn" resultType =" com.webank.wedatasphere.dss.server.dto.response.OnestopMenuAppInstanceVo" >
150+ SELECT <include refid = " menu_appInstances_en" />
151+ FROM dss_onestop_menu_application m
152+ LEFT JOIN dss_application app
153+ ON m.`application_id` = app.`id`
154+ <where >
155+ m.`onestop_menu_id` = #{id}
156+ </where >
157+ </select >
158+ </mapper >
0 commit comments