项目域名接口开发

This commit is contained in:
walker-sheng 2021-03-15 16:53:39 +08:00
parent 5782b50944
commit e7ab43038a
10 changed files with 1188 additions and 0 deletions

View File

@ -58,6 +58,8 @@ public class WebConfig implements WebMvcConfigurer {
whiteList.add("/api/learn/cgy/updateMessageTime");
// 成都工业使用记录
whiteList.add("/api/cgy/**");
//项目域名查询
whiteList.add("/api/projectServer/project/{project}");
registry.addInterceptor(authenticateInterceptor).excludePathPatterns(whiteList);
}

View File

@ -0,0 +1,50 @@
package club.joylink.rtss.controller;
import club.joylink.rtss.constants.Project;
import club.joylink.rtss.constants.RoleEnum;
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
import club.joylink.rtss.controller.advice.Role;
import club.joylink.rtss.services.project.ServerService;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.project.ProjectServerQueryVO;
import club.joylink.rtss.vo.project.ProjectServerVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@Slf4j
@RestController
@RequestMapping("/api/projectServer")
public class ProjectServerController {
@Autowired
private ServerService serverService;
@GetMapping("/project/{project}")
public ProjectServerVO getByProject(@PathVariable Project project) {
return this.serverService.getByProject(project);
}
@Role(RoleEnum.SuperAdmin)
@GetMapping("/paging")
public PageVO<ProjectServerVO> pagingQuery(ProjectServerQueryVO queryVO) {
return this.serverService.pagingQuery(queryVO);
}
@Role(RoleEnum.SuperAdmin)
@PostMapping("")
public String create(@RequestBody ProjectServerVO vo,
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY) UserVO userVO) {
return this.serverService.create(vo, userVO);
}
@Role(RoleEnum.SuperAdmin)
@PutMapping("/{id}")
public void update(@PathVariable Long id,
@RequestBody ProjectServerVO vo,
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY) UserVO userVO) {
this.serverService.update(id, vo, userVO);
}
}

View File

@ -0,0 +1,14 @@
package club.joylink.rtss.dao;
import club.joylink.rtss.entity.ProjectServer;
import club.joylink.rtss.entity.ProjectServerExample;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
/**
* ProjectServerDAO继承基类
*/
@Mapper
@Repository
public interface ProjectServerDAO extends MyBatisBaseDao<ProjectServer, Long, ProjectServerExample> {
}

View File

@ -0,0 +1,35 @@
package club.joylink.rtss.entity;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @author
* 项目服务器域名表
*/
@Data
public class ProjectServer implements Serializable {
private Long id;
/**
* 项目编码
*/
private String project;
/**
* 域名
*/
private String domainName;
private Long createUserId;
private LocalDateTime createTime;
private Long updateUserId;
private LocalDateTime updateTime;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,663 @@
package club.joylink.rtss.entity;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
public class ProjectServerExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public ProjectServerExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
public Integer getLimit() {
return limit;
}
public void setOffset(Long offset) {
this.offset = offset;
}
public Long getOffset() {
return offset;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andProjectIsNull() {
addCriterion("project is null");
return (Criteria) this;
}
public Criteria andProjectIsNotNull() {
addCriterion("project is not null");
return (Criteria) this;
}
public Criteria andProjectEqualTo(String value) {
addCriterion("project =", value, "project");
return (Criteria) this;
}
public Criteria andProjectNotEqualTo(String value) {
addCriterion("project <>", value, "project");
return (Criteria) this;
}
public Criteria andProjectGreaterThan(String value) {
addCriterion("project >", value, "project");
return (Criteria) this;
}
public Criteria andProjectGreaterThanOrEqualTo(String value) {
addCriterion("project >=", value, "project");
return (Criteria) this;
}
public Criteria andProjectLessThan(String value) {
addCriterion("project <", value, "project");
return (Criteria) this;
}
public Criteria andProjectLessThanOrEqualTo(String value) {
addCriterion("project <=", value, "project");
return (Criteria) this;
}
public Criteria andProjectLike(String value) {
addCriterion("project like", value, "project");
return (Criteria) this;
}
public Criteria andProjectNotLike(String value) {
addCriterion("project not like", value, "project");
return (Criteria) this;
}
public Criteria andProjectIn(List<String> values) {
addCriterion("project in", values, "project");
return (Criteria) this;
}
public Criteria andProjectNotIn(List<String> values) {
addCriterion("project not in", values, "project");
return (Criteria) this;
}
public Criteria andProjectBetween(String value1, String value2) {
addCriterion("project between", value1, value2, "project");
return (Criteria) this;
}
public Criteria andProjectNotBetween(String value1, String value2) {
addCriterion("project not between", value1, value2, "project");
return (Criteria) this;
}
public Criteria andDomainNameIsNull() {
addCriterion("domain_name is null");
return (Criteria) this;
}
public Criteria andDomainNameIsNotNull() {
addCriterion("domain_name is not null");
return (Criteria) this;
}
public Criteria andDomainNameEqualTo(String value) {
addCriterion("domain_name =", value, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameNotEqualTo(String value) {
addCriterion("domain_name <>", value, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameGreaterThan(String value) {
addCriterion("domain_name >", value, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameGreaterThanOrEqualTo(String value) {
addCriterion("domain_name >=", value, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameLessThan(String value) {
addCriterion("domain_name <", value, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameLessThanOrEqualTo(String value) {
addCriterion("domain_name <=", value, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameLike(String value) {
addCriterion("domain_name like", value, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameNotLike(String value) {
addCriterion("domain_name not like", value, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameIn(List<String> values) {
addCriterion("domain_name in", values, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameNotIn(List<String> values) {
addCriterion("domain_name not in", values, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameBetween(String value1, String value2) {
addCriterion("domain_name between", value1, value2, "domainName");
return (Criteria) this;
}
public Criteria andDomainNameNotBetween(String value1, String value2) {
addCriterion("domain_name not between", value1, value2, "domainName");
return (Criteria) this;
}
public Criteria andCreateUserIdIsNull() {
addCriterion("create_user_id is null");
return (Criteria) this;
}
public Criteria andCreateUserIdIsNotNull() {
addCriterion("create_user_id is not null");
return (Criteria) this;
}
public Criteria andCreateUserIdEqualTo(Long value) {
addCriterion("create_user_id =", value, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdNotEqualTo(Long value) {
addCriterion("create_user_id <>", value, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdGreaterThan(Long value) {
addCriterion("create_user_id >", value, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdGreaterThanOrEqualTo(Long value) {
addCriterion("create_user_id >=", value, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdLessThan(Long value) {
addCriterion("create_user_id <", value, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdLessThanOrEqualTo(Long value) {
addCriterion("create_user_id <=", value, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdIn(List<Long> values) {
addCriterion("create_user_id in", values, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdNotIn(List<Long> values) {
addCriterion("create_user_id not in", values, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdBetween(Long value1, Long value2) {
addCriterion("create_user_id between", value1, value2, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdNotBetween(Long value1, Long value2) {
addCriterion("create_user_id not between", value1, value2, "createUserId");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(LocalDateTime value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(LocalDateTime value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(LocalDateTime value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(LocalDateTime value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(LocalDateTime value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(LocalDateTime value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<LocalDateTime> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<LocalDateTime> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdateUserIdIsNull() {
addCriterion("update_user_id is null");
return (Criteria) this;
}
public Criteria andUpdateUserIdIsNotNull() {
addCriterion("update_user_id is not null");
return (Criteria) this;
}
public Criteria andUpdateUserIdEqualTo(Long value) {
addCriterion("update_user_id =", value, "updateUserId");
return (Criteria) this;
}
public Criteria andUpdateUserIdNotEqualTo(Long value) {
addCriterion("update_user_id <>", value, "updateUserId");
return (Criteria) this;
}
public Criteria andUpdateUserIdGreaterThan(Long value) {
addCriterion("update_user_id >", value, "updateUserId");
return (Criteria) this;
}
public Criteria andUpdateUserIdGreaterThanOrEqualTo(Long value) {
addCriterion("update_user_id >=", value, "updateUserId");
return (Criteria) this;
}
public Criteria andUpdateUserIdLessThan(Long value) {
addCriterion("update_user_id <", value, "updateUserId");
return (Criteria) this;
}
public Criteria andUpdateUserIdLessThanOrEqualTo(Long value) {
addCriterion("update_user_id <=", value, "updateUserId");
return (Criteria) this;
}
public Criteria andUpdateUserIdIn(List<Long> values) {
addCriterion("update_user_id in", values, "updateUserId");
return (Criteria) this;
}
public Criteria andUpdateUserIdNotIn(List<Long> values) {
addCriterion("update_user_id not in", values, "updateUserId");
return (Criteria) this;
}
public Criteria andUpdateUserIdBetween(Long value1, Long value2) {
addCriterion("update_user_id between", value1, value2, "updateUserId");
return (Criteria) this;
}
public Criteria andUpdateUserIdNotBetween(Long value1, Long value2) {
addCriterion("update_user_id not between", value1, value2, "updateUserId");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(LocalDateTime value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(LocalDateTime value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(LocalDateTime value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(LocalDateTime value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(LocalDateTime value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(LocalDateTime value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<LocalDateTime> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<LocalDateTime> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
}
/**
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,17 @@
package club.joylink.rtss.services.project;
import club.joylink.rtss.constants.Project;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.project.ProjectServerQueryVO;
import club.joylink.rtss.vo.project.ProjectServerVO;
public interface ServerService {
public ProjectServerVO getByProject(Project project);
PageVO<ProjectServerVO> pagingQuery(ProjectServerQueryVO queryVO);
String create(ProjectServerVO vo, UserVO userVO);
void update(Long id, ProjectServerVO vo, UserVO userVO);
}

View File

@ -0,0 +1,81 @@
package club.joylink.rtss.services.project;
import club.joylink.rtss.constants.Project;
import club.joylink.rtss.dao.ProjectServerDAO;
import club.joylink.rtss.entity.ProjectServer;
import club.joylink.rtss.entity.ProjectServerExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.project.ProjectServerQueryVO;
import club.joylink.rtss.vo.project.ProjectServerVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
@Slf4j
@Service
public class ServerServiceImpl implements ServerService {
@Autowired
private ProjectServerDAO projectServerDAO;
@Override
public ProjectServerVO getByProject(Project project) {
ProjectServerExample example = new ProjectServerExample();
example.createCriteria()
.andProjectEqualTo(project.name());
List<ProjectServer> projectServerList = this.projectServerDAO.selectByExample(example);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(projectServerList);
return new ProjectServerVO(projectServerList.get(0));
}
@Override
public PageVO<ProjectServerVO> pagingQuery(ProjectServerQueryVO queryVO) {
ProjectServerExample example = new ProjectServerExample();
if (queryVO.getProject() != null) {
example.createCriteria()
.andProjectEqualTo(queryVO.getProject().name());
}
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
Page<ProjectServer> projectServerList = (Page<ProjectServer>) this.projectServerDAO.selectByExample(example);
List<ProjectServerVO> voList = ProjectServerVO.convert2VOList(projectServerList.getResult());
return PageVO.convert(projectServerList, voList);
}
@Override
public String create(ProjectServerVO vo, UserVO userVO) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(vo.getProject(),"项目不能为null");
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertNotTrue(this.isProjectDataExist(vo.getProject()),
String.format("项目[%s]的域名数据已经存在", vo.getProject()));
ProjectServer db = vo.toDB();
db.setCreateUserId(userVO.getId());
db.setCreateTime(LocalDateTime.now());
this.projectServerDAO.insert(db);
return db.getId().toString();
}
private boolean isProjectDataExist(Project project) {
ProjectServerExample example = new ProjectServerExample();
example.createCriteria()
.andProjectEqualTo(project.name());
return this.projectServerDAO.countByExample(example) > 0;
}
@Override
public void update(Long id, ProjectServerVO vo, UserVO userVO) {
ProjectServer projectServer = this.projectServerDAO.selectByPrimaryKey(id);
if (!Objects.equals(vo.getDomainName(), projectServer.getDomainName())) {
projectServer.setDomainName(vo.getDomainName());
projectServer.setUpdateUserId(userVO.getId());
projectServer.setUpdateTime(LocalDateTime.now());
this.projectServerDAO.updateByPrimaryKey(projectServer);
}
}
}

View File

@ -0,0 +1,15 @@
package club.joylink.rtss.vo.project;
import club.joylink.rtss.constants.Project;
import club.joylink.rtss.vo.client.PageQueryVO;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class ProjectServerQueryVO extends PageQueryVO {
private Project project;
}

View File

@ -0,0 +1,66 @@
package club.joylink.rtss.vo.project;
import club.joylink.rtss.constants.Project;
import club.joylink.rtss.entity.ProjectServer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@Getter
@Setter
@NoArgsConstructor
public class ProjectServerVO {
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
private Project project;
/**
* 域名
*/
private String domainName;
@JsonSerialize(using = ToStringSerializer.class)
private Long createUserId;
private LocalDateTime createTime;
@JsonSerialize(using = ToStringSerializer.class)
private Long updateUserId;
private LocalDateTime updateTime;
public ProjectServerVO(ProjectServer projectServer) {
this.id = projectServer.getId();
this.project = Project.valueOf(projectServer.getProject());
this.domainName = projectServer.getDomainName();
this.createUserId = projectServer.getCreateUserId();
this.createTime = projectServer.getCreateTime();
this.updateUserId = projectServer.getUpdateUserId();
this.updateTime = projectServer.getUpdateTime();
}
public static List<ProjectServerVO> convert2VOList(List<ProjectServer> projectServerList) {
List<ProjectServerVO> voList = new ArrayList<>();
if (!CollectionUtils.isEmpty(projectServerList)) {
for (ProjectServer projectServer : projectServerList) {
voList.add(new ProjectServerVO(projectServer));
}
}
return voList;
}
public ProjectServer toDB() {
ProjectServer db = new ProjectServer();
db.setProject(this.project.name());
db.setDomainName(this.domainName);
return db;
}
}

View File

@ -0,0 +1,245 @@
<?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="club.joylink.rtss.dao.ProjectServerDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.ProjectServer">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="project" jdbcType="VARCHAR" property="project" />
<result column="domain_name" jdbcType="VARCHAR" property="domainName" />
<result column="create_user_id" jdbcType="BIGINT" property="createUserId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_user_id" jdbcType="BIGINT" property="updateUserId" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, project, domain_name, create_user_id, create_time, update_user_id, update_time
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.ProjectServerExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from project_server
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from project_server
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from project_server
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.ProjectServerExample">
delete from project_server
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.ProjectServer" useGeneratedKeys="true">
insert into project_server (project, domain_name, create_user_id,
create_time, update_user_id, update_time
)
values (#{project,jdbcType=VARCHAR}, #{domainName,jdbcType=VARCHAR}, #{createUserId,jdbcType=BIGINT},
#{createTime,jdbcType=TIMESTAMP}, #{updateUserId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.ProjectServer" useGeneratedKeys="true">
insert into project_server
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="project != null">
project,
</if>
<if test="domainName != null">
domain_name,
</if>
<if test="createUserId != null">
create_user_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateUserId != null">
update_user_id,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="project != null">
#{project,jdbcType=VARCHAR},
</if>
<if test="domainName != null">
#{domainName,jdbcType=VARCHAR},
</if>
<if test="createUserId != null">
#{createUserId,jdbcType=BIGINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateUserId != null">
#{updateUserId,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.ProjectServerExample" resultType="java.lang.Long">
select count(*) from project_server
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update project_server
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.project != null">
project = #{record.project,jdbcType=VARCHAR},
</if>
<if test="record.domainName != null">
domain_name = #{record.domainName,jdbcType=VARCHAR},
</if>
<if test="record.createUserId != null">
create_user_id = #{record.createUserId,jdbcType=BIGINT},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updateUserId != null">
update_user_id = #{record.updateUserId,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update project_server
set id = #{record.id,jdbcType=BIGINT},
project = #{record.project,jdbcType=VARCHAR},
domain_name = #{record.domainName,jdbcType=VARCHAR},
create_user_id = #{record.createUserId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_user_id = #{record.updateUserId,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.ProjectServer">
update project_server
<set>
<if test="project != null">
project = #{project,jdbcType=VARCHAR},
</if>
<if test="domainName != null">
domain_name = #{domainName,jdbcType=VARCHAR},
</if>
<if test="createUserId != null">
create_user_id = #{createUserId,jdbcType=BIGINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateUserId != null">
update_user_id = #{updateUserId,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.ProjectServer">
update project_server
set project = #{project,jdbcType=VARCHAR},
domain_name = #{domainName,jdbcType=VARCHAR},
create_user_id = #{createUserId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_user_id = #{updateUserId,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>