From 9b6be2e36d263b84213d0e9c790ab0a01112e0da Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Thu, 1 Jun 2023 10:44:05 +0800 Subject: [PATCH] build: add ui scenario follower domain --- .../ui/domain/UiScenarioFollower.java | 24 ++ .../ui/domain/UiScenarioFollowerExample.java | 340 ++++++++++++++++++ .../ui/mapper/UiScenarioFollowerMapper.java | 24 ++ .../ui/mapper/UiScenarioFollowerMapper.xml | 145 ++++++++ 4 files changed, 533 insertions(+) create mode 100644 backend/framework/domain/src/main/java/io/metersphere/ui/domain/UiScenarioFollower.java create mode 100644 backend/framework/domain/src/main/java/io/metersphere/ui/domain/UiScenarioFollowerExample.java create mode 100644 backend/framework/domain/src/main/java/io/metersphere/ui/mapper/UiScenarioFollowerMapper.java create mode 100644 backend/framework/domain/src/main/java/io/metersphere/ui/mapper/UiScenarioFollowerMapper.xml diff --git a/backend/framework/domain/src/main/java/io/metersphere/ui/domain/UiScenarioFollower.java b/backend/framework/domain/src/main/java/io/metersphere/ui/domain/UiScenarioFollower.java new file mode 100644 index 0000000000..9c618e58d8 --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/ui/domain/UiScenarioFollower.java @@ -0,0 +1,24 @@ +package io.metersphere.ui.domain; + +import io.metersphere.validation.groups.Created; +import io.metersphere.validation.groups.Updated; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Size; +import java.io.Serializable; +import lombok.Data; + +@Data +public class UiScenarioFollower implements Serializable { + @Schema(title = "场景ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{ui_scenario_follower.scenario_id.not_blank}", groups = {Updated.class}) + @Size(min = 1, max = 50, message = "{ui_scenario_follower.scenario_id.length_range}", groups = {Created.class, Updated.class}) + private String scenarioId; + + @Schema(title = "关注人ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{ui_scenario_follower.user_id.not_blank}", groups = {Updated.class}) + @Size(min = 1, max = 50, message = "{ui_scenario_follower.user_id.length_range}", groups = {Created.class, Updated.class}) + private String userId; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/backend/framework/domain/src/main/java/io/metersphere/ui/domain/UiScenarioFollowerExample.java b/backend/framework/domain/src/main/java/io/metersphere/ui/domain/UiScenarioFollowerExample.java new file mode 100644 index 0000000000..3816af6b0c --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/ui/domain/UiScenarioFollowerExample.java @@ -0,0 +1,340 @@ +package io.metersphere.ui.domain; + +import java.util.ArrayList; +import java.util.List; + +public class UiScenarioFollowerExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public UiScenarioFollowerExample() { + oredCriteria = new ArrayList(); + } + + 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 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; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List 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 andScenarioIdIsNull() { + addCriterion("scenario_id is null"); + return (Criteria) this; + } + + public Criteria andScenarioIdIsNotNull() { + addCriterion("scenario_id is not null"); + return (Criteria) this; + } + + public Criteria andScenarioIdEqualTo(String value) { + addCriterion("scenario_id =", value, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdNotEqualTo(String value) { + addCriterion("scenario_id <>", value, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdGreaterThan(String value) { + addCriterion("scenario_id >", value, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdGreaterThanOrEqualTo(String value) { + addCriterion("scenario_id >=", value, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdLessThan(String value) { + addCriterion("scenario_id <", value, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdLessThanOrEqualTo(String value) { + addCriterion("scenario_id <=", value, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdLike(String value) { + addCriterion("scenario_id like", value, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdNotLike(String value) { + addCriterion("scenario_id not like", value, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdIn(List values) { + addCriterion("scenario_id in", values, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdNotIn(List values) { + addCriterion("scenario_id not in", values, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdBetween(String value1, String value2) { + addCriterion("scenario_id between", value1, value2, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdNotBetween(String value1, String value2) { + addCriterion("scenario_id not between", value1, value2, "scenarioId"); + return (Criteria) this; + } + + public Criteria andUserIdIsNull() { + addCriterion("user_id is null"); + return (Criteria) this; + } + + public Criteria andUserIdIsNotNull() { + addCriterion("user_id is not null"); + return (Criteria) this; + } + + public Criteria andUserIdEqualTo(String value) { + addCriterion("user_id =", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotEqualTo(String value) { + addCriterion("user_id <>", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThan(String value) { + addCriterion("user_id >", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThanOrEqualTo(String value) { + addCriterion("user_id >=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThan(String value) { + addCriterion("user_id <", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThanOrEqualTo(String value) { + addCriterion("user_id <=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLike(String value) { + addCriterion("user_id like", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotLike(String value) { + addCriterion("user_id not like", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdIn(List values) { + addCriterion("user_id in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotIn(List values) { + addCriterion("user_id not in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdBetween(String value1, String value2) { + addCriterion("user_id between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotBetween(String value1, String value2) { + addCriterion("user_id not between", value1, value2, "userId"); + 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); + } + } +} \ No newline at end of file diff --git a/backend/framework/domain/src/main/java/io/metersphere/ui/mapper/UiScenarioFollowerMapper.java b/backend/framework/domain/src/main/java/io/metersphere/ui/mapper/UiScenarioFollowerMapper.java new file mode 100644 index 0000000000..54f92e256d --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/ui/mapper/UiScenarioFollowerMapper.java @@ -0,0 +1,24 @@ +package io.metersphere.ui.mapper; + +import io.metersphere.ui.domain.UiScenarioFollower; +import io.metersphere.ui.domain.UiScenarioFollowerExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface UiScenarioFollowerMapper { + long countByExample(UiScenarioFollowerExample example); + + int deleteByExample(UiScenarioFollowerExample example); + + int deleteByPrimaryKey(@Param("scenarioId") String scenarioId, @Param("userId") String userId); + + int insert(UiScenarioFollower record); + + int insertSelective(UiScenarioFollower record); + + List selectByExample(UiScenarioFollowerExample example); + + int updateByExampleSelective(@Param("record") UiScenarioFollower record, @Param("example") UiScenarioFollowerExample example); + + int updateByExample(@Param("record") UiScenarioFollower record, @Param("example") UiScenarioFollowerExample example); +} \ No newline at end of file diff --git a/backend/framework/domain/src/main/java/io/metersphere/ui/mapper/UiScenarioFollowerMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/ui/mapper/UiScenarioFollowerMapper.xml new file mode 100644 index 0000000000..02deae6d8c --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/ui/mapper/UiScenarioFollowerMapper.xml @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + scenario_id, user_id + + + + delete from ui_scenario_follower + where scenario_id = #{scenarioId,jdbcType=VARCHAR} + and user_id = #{userId,jdbcType=VARCHAR} + + + delete from ui_scenario_follower + + + + + + insert into ui_scenario_follower (scenario_id, user_id) + values (#{scenarioId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}) + + + insert into ui_scenario_follower + + + scenario_id, + + + user_id, + + + + + #{scenarioId,jdbcType=VARCHAR}, + + + #{userId,jdbcType=VARCHAR}, + + + + + + update ui_scenario_follower + + + scenario_id = #{record.scenarioId,jdbcType=VARCHAR}, + + + user_id = #{record.userId,jdbcType=VARCHAR}, + + + + + + + + update ui_scenario_follower + set scenario_id = #{record.scenarioId,jdbcType=VARCHAR}, + user_id = #{record.userId,jdbcType=VARCHAR} + + + + + \ No newline at end of file