Skip to content

Commit

Permalink
create model and mapper
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardShan committed Feb 25, 2019
1 parent a8748c4 commit 9c06a58
Show file tree
Hide file tree
Showing 32 changed files with 778 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ tempFiles/
userfiles/
.vscode
*yarn.lock
bin/upgrade.go
bin/upgrade.go
davinci-ui/
46 changes: 46 additions & 0 deletions server/src/main/java/edp/davinci/common/model/RecordInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* <<
* Davinci
* ==
* Copyright (C) 2016 - 2018 EDP
* ==
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* >>
*
*/

package edp.davinci.common.model;

import lombok.Data;

import java.util.Date;

@Data
public class RecordInfo {
Long createBy;

Date createTime;

Long updateBy;

Date updateTime;

public void createBy(Long userId) {
this.createBy = userId;
this.createTime = new Date();
}


public void updateBy(Long userId) {
this.updateBy = userId;
this.updateTime = new Date();
}
}
38 changes: 38 additions & 0 deletions server/src/main/java/edp/davinci/dao/DownloadRecordMapper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package edp.davinci.dao;

import edp.davinci.model.DownloadRecord;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface DownloadRecordMapper {

int insert(DownloadRecord downloadRecord);

@Delete({
"delete from download_record where id = #{id,jdbcType=BIGINT}"
})
int deleteById(Long id);

@Select({
"select * from download_record where id = #{id,jdbcType=BIGINT}"
})
DownloadRecord selectById(Long id);


@Select({
"select * from download_record where user_id = #{userId} order by create_time desc"
})
List<DownloadRecord> getDownloadRecordsByUser(Long userId);

@Update({
"update download_record",
"set path = #{path,jdbcType=VARCHAR},",
"status = #{status,jdbcType=SMALLINT},",
"last_download_time = #{lastDownloadTime,jdbcType=TIMESTAMP}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateById(DownloadRecord downloadRecord);
}
20 changes: 20 additions & 0 deletions server/src/main/java/edp/davinci/dao/RelProjectAdminMapper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package edp.davinci.dao;

import edp.davinci.model.RelProjectAdmin;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;

public interface RelProjectAdminMapper {

int insert(RelProjectAdmin relProjectAdmin);

@Delete({
"delete from rel_project_admin where id = #{id,jdbcType=BIGINT}"
})
int deleteById(Long id);

@Delete({
"delete from rel_project_admin where project_id = #{projectId} and user_id = #{userId}"
})
int delete(@Param("projectId") Long projectId, @Param("userId") Long userId);
}
34 changes: 34 additions & 0 deletions server/src/main/java/edp/davinci/dao/RelRoleDashboardMapper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package edp.davinci.dao;

import edp.davinci.model.RelRoleDashboard;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface RelRoleDashboardMapper {

int insert(RelRoleDashboard relRoleDashboard);

@Delete({
"delete from rel_role_dashboard where id = #{id,jdbcType=BIGINT}"
})
int deleteById(Long id);


@Select({
"select * from rel_role_dashboard where id = #{id,jdbcType=BIGINT}"
})
RelRoleDashboard selectById(Long id);


@Update({
"update rel_role_dashboard",
"set role_id = #{roleId,jdbcType=BIGINT},",
"dashboard_id = #{dashboardId,jdbcType=BIGINT},",
"permission = #{permission,jdbcType=SMALLINT},",
"update_by = #{updateBy,jdbcType=BIGINT},",
"update_time = #{updateTime,jdbcType=TIMESTAMP}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateById(RelRoleDashboard relRoleDashboard);
}
33 changes: 33 additions & 0 deletions server/src/main/java/edp/davinci/dao/RelRoleDisplayMapper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package edp.davinci.dao;

import edp.davinci.model.RelRoleDisplay;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface RelRoleDisplayMapper {
int insert(RelRoleDisplay record);

@Delete({
"delete from rel_role_display where id = #{id,jdbcType=BIGINT}"
})
int deleteById(Long id);


@Select({
"select * from rel_role_display where id = #{id,jdbcType=BIGINT}"
})
RelRoleDisplay selectById(Long id);


@Update({
"update rel_role_display",
"set role_id = #{roleId,jdbcType=BIGINT},",
"display_id = #{displayId,jdbcType=BIGINT},",
"permission = #{permission,jdbcType=SMALLINT},",
"update_by = #{updateBy,jdbcType=BIGINT},",
"update_time = #{updateTime,jdbcType=TIMESTAMP}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateById(RelRoleDisplay record);
}
35 changes: 35 additions & 0 deletions server/src/main/java/edp/davinci/dao/RelRolePortalMapper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package edp.davinci.dao;

import edp.davinci.model.RelRolePortal;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface RelRolePortalMapper {

int insert(RelRolePortal record);

@Delete({
"delete from rel_role_portal",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteById(Long id);


@Select({
"select * from rel_role_portal where id = #{id,jdbcType=BIGINT}"
})
RelRolePortal selectById(Long id);


@Update({
"update rel_role_portal",
"set role_id = #{roleId,jdbcType=BIGINT},",
"portal_id = #{portalId,jdbcType=BIGINT},",
"permission = #{permission,jdbcType=SMALLINT},",
"update_by = #{updateBy,jdbcType=BIGINT},",
"update_time = #{updateTime,jdbcType=TIMESTAMP}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateById(RelRolePortal record);
}
40 changes: 40 additions & 0 deletions server/src/main/java/edp/davinci/dao/RelRoleProjectMapper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package edp.davinci.dao;

import edp.davinci.model.RelRoleProject;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface RelRoleProjectMapper {

int insert(RelRoleProject record);

@Delete({
"delete from rel_role_project where project_id = #{iprojectIdd}"
})
int deleteByProjectId(@Param("projectId") Long projectId);


@Select({
"select * from rel_role_project where id = #{id,jdbcType=BIGINT}"
})
RelRoleProject selectById(Long id);

@Update({
"update rel_role_project",
"set project_id = #{projectId,jdbcType=BIGINT},",
"role_id = #{roleId,jdbcType=BIGINT},",
"source_permission = #{sourcePermission,jdbcType=SMALLINT},",
"view_permission = #{viewPermission,jdbcType=SMALLINT},",
"widget_permission = #{widgetPermission,jdbcType=SMALLINT},",
"viz_permission = #{vizPermission,jdbcType=SMALLINT},",
"schedule_permission = #{schedulePermission,jdbcType=SMALLINT},",
"share_permission = #{sharePermission,jdbcType=BIT},",
"download_permission = #{downloadPermission,jdbcType=BIT},",
"update_by = #{updateBy,jdbcType=BIGINT},",
"update_time = #{updateTime,jdbcType=TIMESTAMP}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateById(RelRoleProject record);
}
33 changes: 33 additions & 0 deletions server/src/main/java/edp/davinci/dao/RelRoleSlideMapper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package edp.davinci.dao;

import edp.davinci.model.RelRoleSlide;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface RelRoleSlideMapper {

int insert(RelRoleSlide relRoleSlide);

@Delete({
"delete from rel_role_slide where id = #{id,jdbcType=BIGINT}"
})
int deleteById(Long id);

@Select({
"select * from rel_role_slide where id = #{id,jdbcType=BIGINT}"
})
RelRoleSlide selectById(Long id);


@Update({
"update rel_role_slide",
"set role_id = #{roleId,jdbcType=BIGINT},",
"slide_id = #{slideId,jdbcType=BIGINT},",
"permission = #{permission,jdbcType=SMALLINT},",
"update_by = #{updateBy,jdbcType=BIGINT},",
"update_time = #{updateTime,jdbcType=TIMESTAMP}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateById(RelRoleSlide record);
}
38 changes: 38 additions & 0 deletions server/src/main/java/edp/davinci/dao/RelRoleUserMapper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package edp.davinci.dao;

import edp.davinci.model.RelRoleUser;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface RelRoleUserMapper {
int insert(RelRoleUser record);

@Delete({
"delete from rel_role_user where id = #{id,jdbcType=BIGINT}"
})
int deleteById(Long id);


@Select({
"select",
"id, user_id, role_id, create_by, create_time, update_by, update_time",
"from rel_role_user",
"where id = #{id,jdbcType=BIGINT}"
})
@ResultMap("BaseResultMap")
RelRoleUser selectById(Long id);

@Update({
"update rel_role_user",
"set user_id = #{userId,jdbcType=BIGINT},",
"role_id = #{roleId,jdbcType=BIGINT},",
"create_by = #{createBy,jdbcType=BIGINT},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_by = #{updateBy,jdbcType=BIGINT},",
"update_time = #{updateTime,jdbcType=TIMESTAMP}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateById(RelRoleUser record);
}
35 changes: 35 additions & 0 deletions server/src/main/java/edp/davinci/dao/RoleMapper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package edp.davinci.dao;

import edp.davinci.model.Role;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface RoleMapper {
int insert(Role record);

@Delete({
"delete from role where id = #{id,jdbcType=BIGINT}"
})
int deleteById(Long id);

@Select({
"select * from role where id = #{id,jdbcType=BIGINT}"
})
@ResultMap("BaseResultMap")
Role selectById(Long id);

@Update({
"update role",
"set org_id = #{orgId,jdbcType=BIGINT},",
"name = #{name,jdbcType=VARCHAR},",
"description = #{description,jdbcType=VARCHAR},",
"create_by = #{createBy,jdbcType=BIGINT},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_by = #{updateBy,jdbcType=BIGINT},",
"update_time = #{updateTime,jdbcType=TIMESTAMP}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(Role record);
}
Loading

0 comments on commit 9c06a58

Please sign in to comment.