Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Give datasource a name #2140

Merged
merged 1 commit into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions server/src/main/java/edp/core/utils/SqlUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -391,21 +391,21 @@ private static void getFromItemName(Set<String> columnPrefixes, FromItem fromIte
}
}

public static String getColumnLabel(Set<String> columnPrefixs, String columnLable) {
if (!CollectionUtils.isEmpty(columnPrefixs)) {
for (String prefix : columnPrefixs) {
if (columnLable.startsWith(prefix)) {
return columnLable.replaceFirst(prefix, EMPTY);
public static String getColumnLabel(Set<String> columnPrefixes, String columnLabel) {
if (!CollectionUtils.isEmpty(columnPrefixes)) {
for (String prefix : columnPrefixes) {
if (columnLabel.startsWith(prefix)) {
return columnLabel.replaceFirst(prefix, EMPTY);
}
if (columnLable.startsWith(prefix.toLowerCase())) {
return columnLable.replaceFirst(prefix.toLowerCase(), EMPTY);
if (columnLabel.startsWith(prefix.toLowerCase())) {
return columnLabel.replaceFirst(prefix.toLowerCase(), EMPTY);
}
if (columnLable.startsWith(prefix.toUpperCase())) {
return columnLable.replaceFirst(prefix.toUpperCase(), EMPTY);
if (columnLabel.startsWith(prefix.toUpperCase())) {
return columnLabel.replaceFirst(prefix.toUpperCase(), EMPTY);
}
}
}
return columnLable;
return columnLabel;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ public List<String> getSqls(String sqlStr, boolean isQuery) {
String[] sqls = sqlStr.split(SEMICOLON);
if (sqls.length > 0) {
for (String sql : sqls) {
sql = sql.trim();
boolean select = isQuery(sql);
if (isQuery) {
if (select) {
Expand Down Expand Up @@ -532,7 +533,7 @@ private String replaceSysVarCondition(String sql, String condition, User user) {
* @return
*/
public static String filterAnnotate(String sql) {
String temp = PATTERN_SQL_ANNOTATE.matcher(sql).replaceAll("$1").replaceAll(NEW_LINE_CHAR, EMPTY).replaceAll("(;" +
String temp = PATTERN_SQL_ANNOTATE.matcher(sql).replaceAll("$1").replaceAll(NEW_LINE_CHAR, SPACE).replaceAll("(;" +
"+\\s*)+", SEMICOLON);
return temp;
}
Expand Down
3 changes: 0 additions & 3 deletions server/src/main/java/edp/davinci/dao/CronJobMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ public interface CronJobMapper {
@Delete({"delete from cron_job where id = #{id,jdbcType=BIGINT}"})
int deleteById(@Param("id") Long id);


@Select({"select * from cron_job where id = #{id}"})
CronJob getById(@Param("id") Long id);


@Select({"select * from cron_job where job_status in ('stopped','failed') and update_time > (NOW() - INTERVAL 3 MINUTE)"})
List<CronJob> getStoppedJob();

Expand Down Expand Up @@ -69,7 +67,6 @@ public interface CronJobMapper {
})
int updateExecLog(@Param("id") Long id, @Param("execLog") String execLog);


@Select({"select id from cron_job where project_id = #{projectId} and `name` = #{name}"})
Long getByNameWithProjectId(@Param("name") String name, @Param("projectId") Long projectId);

Expand Down
7 changes: 0 additions & 7 deletions server/src/main/java/edp/davinci/dao/DashboardMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;
import java.util.Set;

@Component
Expand All @@ -45,15 +44,12 @@ public interface DashboardMapper {
@Delete({"delete from dashboard where dashboard_portal_id = #{portalId}"})
int deleteByPortalId(@Param("portalId") Long portalId);


@Select({"select * from dashboard where id = #{id}"})
Dashboard getById(@Param("id") Long id);


@Select({"select id from dashboard where dashboard_portal_id = #{portalId} and `name` = #{name}"})
Long getByNameWithPortalId(@Param("name") String name, @Param("portalId") Long portalId);


@Update({
"update dashboard",
"set `name` = #{name,jdbcType=VARCHAR},",
Expand All @@ -68,10 +64,8 @@ public interface DashboardMapper {
})
int update(Dashboard record);


int updateBatch(List<Dashboard> list);


@Select({
"select * from dashboard where dashboard_portal_id = #{portalId} order by `index`"
})
Expand Down Expand Up @@ -115,7 +109,6 @@ public interface DashboardMapper {

Set<Long> getIdSetByIds(@Param("set") Set<Long> dashboardIds);


@Select({
"select * from dashboard where type = 1 and FIND_IN_SET(#{id},full_parent_Id)"
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,15 @@

@Component
public interface DashboardPortalMapper {

int insert(DashboardPortal dashboardPortal);

@Delete({"delete from dashboard_portal where id = #{id}"})
int deleteById(@Param("id") Long id);


@Select({"select * from dashboard_portal where id = #{id}"})
DashboardPortal getById(@Param("id") Long id);


@Update({
"update dashboard_portal",
"set `name` = #{name,jdbcType=VARCHAR},",
Expand All @@ -60,7 +59,6 @@ public interface DashboardPortalMapper {
@Select({"select * from dashboard_portal where project_id = #{projectId}"})
List<DashboardPortal> getByProject(@Param("projectId") Long projectId);


@Select({
"SELECT ",
" dp.*,",
Expand Down
3 changes: 0 additions & 3 deletions server/src/main/java/edp/davinci/dao/DisplayMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,9 @@ public interface DisplayMapper {
@Delete({"delete from display where project_id = #{projectId}"})
int deleteByProject(@Param("projectId") Long projectId);


@Select({"select * from display where id = #{id}"})
Display getById(@Param("id") Long id);


@Update({
"update display",
"set `name` = #{name,jdbcType=VARCHAR},",
Expand All @@ -59,7 +57,6 @@ public interface DisplayMapper {
})
int update(Display display);


@Select({
"SELECT ",
" d.*,",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,5 @@ public interface DisplaySlideMapper {

int copySlide(@Param("originDisplayId") Long originDisplayId, @Param("displayId") Long displayId, @Param("userId") Long userId);


List<DisplaySlide> queryByDisplayIds(@Param("displayIds") Set<Long> displayIds);
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface DownloadRecordMapper {

int insert(DownloadRecord downloadRecord);
Expand Down
1 change: 0 additions & 1 deletion server/src/main/java/edp/davinci/dao/FavoriteMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,5 @@ public interface FavoriteMapper {
})
Favorite selectById(Long id);


int deleteBatch(@Param("list") List<Long> list, @Param("userId") Long userId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@ public interface MemDashboardWidgetMapper {
@Delete({"delete from mem_dashboard_widget where id = #{id}"})
int deleteById(@Param("id") Long id);


@Select({
"select * from mem_dashboard_widget where id = #{id}"
})
MemDashboardWidget getById(@Param("id") Long id);


@Update({
"update mem_dashboard_widget",
"set alias = #{alias,jdbcType=VARCHAR},",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@

package edp.davinci.dao;

import java.util.List;

import edp.davinci.dto.displayDto.MemDisplaySlideWidgetWithSlide;
import edp.davinci.model.MemDisplaySlideWidget;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

import edp.davinci.dto.displayDto.MemDisplaySlideWidgetWithSlide;
import edp.davinci.model.MemDisplaySlideWidget;
import java.util.List;

@Component
public interface MemDisplaySlideWidgetMapper {
Expand Down Expand Up @@ -64,14 +63,12 @@ public interface MemDisplaySlideWidgetMapper {
})
int update(MemDisplaySlideWidget memDisplaySlideWidget);


@Select({"SELECT m.* FROM mem_display_slide_widget m WHERE m.display_slide_id = #{slideId}"})
List<MemDisplaySlideWidget> getMemDisplaySlideWidgetListBySlideId(@Param("slideId") Long slideId);

@Delete({"delete from mem_display_slide_widget where display_slide_id in (select id from display_slide where display_id = #{displayId})"})
int deleteByDisplayId(@Param("displayId") Long displayId);


@Delete({"delete from mem_display_slide_widget where display_slide_id = #{slideId}"})
int deleteBySlideId(@Param("slideId") Long slideId);

Expand Down
1 change: 0 additions & 1 deletion server/src/main/java/edp/davinci/dao/ProjectMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
@Component
public interface ProjectMapper {


List<ProjectWithCreateBy> getProjectsByUser(@Param("userId") Long userId);

List<ProjectWithCreateBy> getFavoriteProjects(@Param("userId") Long userId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface RelProjectAdminMapper {

int insert(RelProjectAdmin relProjectAdmin);


@Select({
"select * from rel_project_admin where project_id = #{projectId} and user_id = #{userId}"
})
Expand Down Expand Up @@ -68,7 +69,6 @@ public interface RelProjectAdminMapper {
})
List<RelProjectAdminDto> getByProject(Long projectId);


@Select({
"select r.user_id",
"from rel_project_admin r",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Set;

@Component
public interface RelRoleDashboardMapper {

int insert(RelRoleDashboard relRoleDashboard);
Expand All @@ -43,7 +45,6 @@ public interface RelRoleDashboardMapper {
})
List<RoleDisableViz> getDisableByUser(@Param("userId") Long userId, @Param("portalId") Long portalId);


@Select("select role_id from rel_role_dashboard where dashboard_id = #{dashboardId} and visible = 0")
List<Long> getExcludeRoles(@Param("dashboardId") Long dashboardId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Set;

@Component
public interface RelRoleDashboardWidgetMapper {

int insertBatch(List<RelRoleDashboardWidget> list);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface RelRoleDisplayMapper {
int insert(RelRoleDisplay record);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Set;

@Component
public interface RelRoleDisplaySlideWidgetMapper {

int insertBatch(List<RelRoleDisplaySlideWidget> list);
Expand Down Expand Up @@ -84,6 +86,5 @@ public interface RelRoleDisplaySlideWidgetMapper {
") "})
int deleteByRoleAndProject(Long roleId, Long projectId);


int copyRoleSlideWidgetRelation(@Param("relSlideCopies") List<RelModelCopy> memCopies, @Param("userId") Long userId);
}
2 changes: 2 additions & 0 deletions server/src/main/java/edp/davinci/dao/RelRolePortalMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface RelRolePortalMapper {

int insert(RelRolePortal record);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Set;

@Component
public interface RelRoleProjectMapper {

int insert(RelRoleProject record);
Expand All @@ -45,7 +47,6 @@ public interface RelRoleProjectMapper {
})
int deleteByProjectId(@Param("projectId") Long projectId);


@Select({
"select * from rel_role_project where id = #{id,jdbcType=BIGINT}"
})
Expand Down Expand Up @@ -84,7 +85,6 @@ public interface RelRoleProjectMapper {
})
int deleteByRoleId(Long roleId);


@Select({
"select r.id,",
" r.name,",
Expand Down
2 changes: 2 additions & 0 deletions server/src/main/java/edp/davinci/dao/RelRoleSlideMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface RelRoleSlideMapper {

int insert(RelRoleSlide relRoleSlide);
Expand Down
Loading