feat: 增加活动的增删改查接口

dev
huangfeng 1 year ago
parent 23246c0a54
commit d7148673ed

@ -0,0 +1,61 @@
package com.shxy.xymanager_admin.controller;
import com.shxy.xymanager_common.base.BaseController;
import com.shxy.xymanager_common.base.ResponseReult;
import com.shxy.xymanager_common.entity.MntnActivities;
import com.shxy.xymanager_common.exception.ApiException;
import com.shxy.xymanager_service.service.ActivitiesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.util.List;
@RestController
@Api(tags = {"活动相关接口"})
@RequestMapping("activity")
@Slf4j
public class ActivityController extends BaseController {
@Resource
ActivitiesService service;
@GetMapping("listAll")
@ApiOperation("查询全部列表")
public ResponseReult<List<MntnActivities>> listAll() {
List<MntnActivities> result = service.listAll();
return ResponseReult.success(result);
}
@PostMapping("add")
@ApiOperation("新增")
public ResponseReult<String> add(@Validated @RequestBody MntnActivities item) throws Exception {
service.add(item);
return ResponseReult.success("OK");
}
@PostMapping("update")
@ApiOperation("更新")
public ResponseReult<String> update(@Validated @RequestBody MntnActivities item) throws Exception {
if (item.getId() == null) {
throw new ApiException("id不能为空!");
}
service.update(item);
return ResponseReult.success("OK");
}
@PostMapping("delete")
@ApiOperation("删除")
public ResponseReult<String> delete(@Validated @NotNull(message = "id不能为空!") Integer id) throws Exception {
if (id == null) {
throw new ApiException("id不能为空!");
}
service.delete(id);
return ResponseReult.success("OK");
}
}

@ -0,0 +1,214 @@
package com.shxy.xymanager_common.entity;
import java.util.Date;
import java.util.List;
public class MntnActivities {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_activities.id
*
* @mbg.generated
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_activities.title
*
* @mbg.generated
*/
private String title;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_activities.term_count
*
* @mbg.generated
*/
private Integer termCount;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_activities.status
*
* @mbg.generated
*/
private Byte status;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_activities.create_time
*
* @mbg.generated
*/
private Date createTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_activities.update_time
*
* @mbg.generated
*/
private Date updateTime;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_activities.id
*
* @return the value of mntn_activities.id
*
* @mbg.generated
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_activities.id
*
* @param id the value for mntn_activities.id
*
* @mbg.generated
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_activities.title
*
* @return the value of mntn_activities.title
*
* @mbg.generated
*/
public String getTitle() {
return title;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_activities.title
*
* @param title the value for mntn_activities.title
*
* @mbg.generated
*/
public void setTitle(String title) {
this.title = title;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_activities.term_count
*
* @return the value of mntn_activities.term_count
*
* @mbg.generated
*/
public Integer getTermCount() {
return termCount;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_activities.term_count
*
* @param termCount the value for mntn_activities.term_count
*
* @mbg.generated
*/
public void setTermCount(Integer termCount) {
this.termCount = termCount;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_activities.status
*
* @return the value of mntn_activities.status
*
* @mbg.generated
*/
public Byte getStatus() {
return status;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_activities.status
*
* @param status the value for mntn_activities.status
*
* @mbg.generated
*/
public void setStatus(Byte status) {
this.status = status;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_activities.create_time
*
* @return the value of mntn_activities.create_time
*
* @mbg.generated
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_activities.create_time
*
* @param createTime the value for mntn_activities.create_time
*
* @mbg.generated
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_activities.update_time
*
* @return the value of mntn_activities.update_time
*
* @mbg.generated
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_activities.update_time
*
* @param updateTime the value for mntn_activities.update_time
*
* @mbg.generated
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
private List<Terminals> terms;
public List<Terminals> getTerms() {
return terms;
}
public void setTerms(List<Terminals> terms) {
this.terms = terms;
}
}

@ -0,0 +1,672 @@
package com.shxy.xymanager_common.entity;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class MntnActivitiesExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table mntn_activities
*
* @mbg.generated
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table mntn_activities
*
* @mbg.generated
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table mntn_activities
*
* @mbg.generated
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
public MntnActivitiesExample() {
oredCriteria = new ArrayList<>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table mntn_activities
*
* @mbg.generated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
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(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andTitleIsNull() {
addCriterion("title is null");
return (Criteria) this;
}
public Criteria andTitleIsNotNull() {
addCriterion("title is not null");
return (Criteria) this;
}
public Criteria andTitleEqualTo(String value) {
addCriterion("title =", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotEqualTo(String value) {
addCriterion("title <>", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThan(String value) {
addCriterion("title >", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThanOrEqualTo(String value) {
addCriterion("title >=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThan(String value) {
addCriterion("title <", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThanOrEqualTo(String value) {
addCriterion("title <=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLike(String value) {
addCriterion("title like", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotLike(String value) {
addCriterion("title not like", value, "title");
return (Criteria) this;
}
public Criteria andTitleIn(List<String> values) {
addCriterion("title in", values, "title");
return (Criteria) this;
}
public Criteria andTitleNotIn(List<String> values) {
addCriterion("title not in", values, "title");
return (Criteria) this;
}
public Criteria andTitleBetween(String value1, String value2) {
addCriterion("title between", value1, value2, "title");
return (Criteria) this;
}
public Criteria andTitleNotBetween(String value1, String value2) {
addCriterion("title not between", value1, value2, "title");
return (Criteria) this;
}
public Criteria andTermCountIsNull() {
addCriterion("term_count is null");
return (Criteria) this;
}
public Criteria andTermCountIsNotNull() {
addCriterion("term_count is not null");
return (Criteria) this;
}
public Criteria andTermCountEqualTo(Integer value) {
addCriterion("term_count =", value, "termCount");
return (Criteria) this;
}
public Criteria andTermCountNotEqualTo(Integer value) {
addCriterion("term_count <>", value, "termCount");
return (Criteria) this;
}
public Criteria andTermCountGreaterThan(Integer value) {
addCriterion("term_count >", value, "termCount");
return (Criteria) this;
}
public Criteria andTermCountGreaterThanOrEqualTo(Integer value) {
addCriterion("term_count >=", value, "termCount");
return (Criteria) this;
}
public Criteria andTermCountLessThan(Integer value) {
addCriterion("term_count <", value, "termCount");
return (Criteria) this;
}
public Criteria andTermCountLessThanOrEqualTo(Integer value) {
addCriterion("term_count <=", value, "termCount");
return (Criteria) this;
}
public Criteria andTermCountIn(List<Integer> values) {
addCriterion("term_count in", values, "termCount");
return (Criteria) this;
}
public Criteria andTermCountNotIn(List<Integer> values) {
addCriterion("term_count not in", values, "termCount");
return (Criteria) this;
}
public Criteria andTermCountBetween(Integer value1, Integer value2) {
addCriterion("term_count between", value1, value2, "termCount");
return (Criteria) this;
}
public Criteria andTermCountNotBetween(Integer value1, Integer value2) {
addCriterion("term_count not between", value1, value2, "termCount");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("`status` is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("`status` is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(Byte value) {
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Byte value) {
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Byte value) {
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Byte value) {
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(Byte value) {
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Byte value) {
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<Byte> values) {
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Byte> values) {
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Byte value1, Byte value2) {
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Byte value1, Byte value2) {
addCriterion("`status` not between", value1, value2, "status");
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(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
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(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table mntn_activities
*
* @mbg.generated do_not_delete_during_merge
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table mntn_activities
*
* @mbg.generated
*/
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);
}
}
}

@ -0,0 +1,38 @@
package com.shxy.xymanager_common.entity;
import java.util.Date;
public class MntnActivityTerminals extends MntnActivityTerminalsKey {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_activity_terminals.create_time
*
* @mbg.generated
*/
private Date createTime;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_activity_terminals.create_time
*
* @return the value of mntn_activity_terminals.create_time
*
* @mbg.generated
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_activity_terminals.create_time
*
* @param createTime the value for mntn_activity_terminals.create_time
*
* @mbg.generated
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

@ -0,0 +1,482 @@
package com.shxy.xymanager_common.entity;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class MntnActivityTerminalsExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
public MntnActivityTerminalsExample() {
oredCriteria = new ArrayList<>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
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 andActivityIdIsNull() {
addCriterion("activity_id is null");
return (Criteria) this;
}
public Criteria andActivityIdIsNotNull() {
addCriterion("activity_id is not null");
return (Criteria) this;
}
public Criteria andActivityIdEqualTo(Integer value) {
addCriterion("activity_id =", value, "activityId");
return (Criteria) this;
}
public Criteria andActivityIdNotEqualTo(Integer value) {
addCriterion("activity_id <>", value, "activityId");
return (Criteria) this;
}
public Criteria andActivityIdGreaterThan(Integer value) {
addCriterion("activity_id >", value, "activityId");
return (Criteria) this;
}
public Criteria andActivityIdGreaterThanOrEqualTo(Integer value) {
addCriterion("activity_id >=", value, "activityId");
return (Criteria) this;
}
public Criteria andActivityIdLessThan(Integer value) {
addCriterion("activity_id <", value, "activityId");
return (Criteria) this;
}
public Criteria andActivityIdLessThanOrEqualTo(Integer value) {
addCriterion("activity_id <=", value, "activityId");
return (Criteria) this;
}
public Criteria andActivityIdIn(List<Integer> values) {
addCriterion("activity_id in", values, "activityId");
return (Criteria) this;
}
public Criteria andActivityIdNotIn(List<Integer> values) {
addCriterion("activity_id not in", values, "activityId");
return (Criteria) this;
}
public Criteria andActivityIdBetween(Integer value1, Integer value2) {
addCriterion("activity_id between", value1, value2, "activityId");
return (Criteria) this;
}
public Criteria andActivityIdNotBetween(Integer value1, Integer value2) {
addCriterion("activity_id not between", value1, value2, "activityId");
return (Criteria) this;
}
public Criteria andTermIdIsNull() {
addCriterion("term_id is null");
return (Criteria) this;
}
public Criteria andTermIdIsNotNull() {
addCriterion("term_id is not null");
return (Criteria) this;
}
public Criteria andTermIdEqualTo(Integer value) {
addCriterion("term_id =", value, "termId");
return (Criteria) this;
}
public Criteria andTermIdNotEqualTo(Integer value) {
addCriterion("term_id <>", value, "termId");
return (Criteria) this;
}
public Criteria andTermIdGreaterThan(Integer value) {
addCriterion("term_id >", value, "termId");
return (Criteria) this;
}
public Criteria andTermIdGreaterThanOrEqualTo(Integer value) {
addCriterion("term_id >=", value, "termId");
return (Criteria) this;
}
public Criteria andTermIdLessThan(Integer value) {
addCriterion("term_id <", value, "termId");
return (Criteria) this;
}
public Criteria andTermIdLessThanOrEqualTo(Integer value) {
addCriterion("term_id <=", value, "termId");
return (Criteria) this;
}
public Criteria andTermIdIn(List<Integer> values) {
addCriterion("term_id in", values, "termId");
return (Criteria) this;
}
public Criteria andTermIdNotIn(List<Integer> values) {
addCriterion("term_id not in", values, "termId");
return (Criteria) this;
}
public Criteria andTermIdBetween(Integer value1, Integer value2) {
addCriterion("term_id between", value1, value2, "termId");
return (Criteria) this;
}
public Criteria andTermIdNotBetween(Integer value1, Integer value2) {
addCriterion("term_id not between", value1, value2, "termId");
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(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table mntn_activity_terminals
*
* @mbg.generated do_not_delete_during_merge
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
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);
}
}
}

@ -0,0 +1,69 @@
package com.shxy.xymanager_common.entity;
public class MntnActivityTerminalsKey {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_activity_terminals.activity_id
*
* @mbg.generated
*/
private Integer activityId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_activity_terminals.term_id
*
* @mbg.generated
*/
private Integer termId;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_activity_terminals.activity_id
*
* @return the value of mntn_activity_terminals.activity_id
*
* @mbg.generated
*/
public Integer getActivityId() {
return activityId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_activity_terminals.activity_id
*
* @param activityId the value for mntn_activity_terminals.activity_id
*
* @mbg.generated
*/
public void setActivityId(Integer activityId) {
this.activityId = activityId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_activity_terminals.term_id
*
* @return the value of mntn_activity_terminals.term_id
*
* @mbg.generated
*/
public Integer getTermId() {
return termId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_activity_terminals.term_id
*
* @param termId the value for mntn_activity_terminals.term_id
*
* @mbg.generated
*/
public void setTermId(Integer termId) {
this.termId = termId;
}
}

@ -0,0 +1,97 @@
package com.shxy.xymanager_dao.dao;
import com.shxy.xymanager_common.entity.MntnActivities;
import com.shxy.xymanager_common.entity.MntnActivitiesExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface MntnActivitiesMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
long countByExample(MntnActivitiesExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
int deleteByExample(MntnActivitiesExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
int insert(MntnActivities row);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
int insertSelective(MntnActivities row);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
List<MntnActivities> selectByExample(MntnActivitiesExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
MntnActivities selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("row") MntnActivities row, @Param("example") MntnActivitiesExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
int updateByExample(@Param("row") MntnActivities row, @Param("example") MntnActivitiesExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(MntnActivities row);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activities
*
* @mbg.generated
*/
int updateByPrimaryKey(MntnActivities row);
}

@ -0,0 +1,98 @@
package com.shxy.xymanager_dao.dao;
import com.shxy.xymanager_common.entity.MntnActivityTerminals;
import com.shxy.xymanager_common.entity.MntnActivityTerminalsExample;
import com.shxy.xymanager_common.entity.MntnActivityTerminalsKey;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface MntnActivityTerminalsMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
long countByExample(MntnActivityTerminalsExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
int deleteByExample(MntnActivityTerminalsExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
int deleteByPrimaryKey(MntnActivityTerminalsKey key);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
int insert(MntnActivityTerminals row);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
int insertSelective(MntnActivityTerminals row);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
List<MntnActivityTerminals> selectByExample(MntnActivityTerminalsExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
MntnActivityTerminals selectByPrimaryKey(MntnActivityTerminalsKey key);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("row") MntnActivityTerminals row, @Param("example") MntnActivityTerminalsExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
int updateByExample(@Param("row") MntnActivityTerminals row, @Param("example") MntnActivityTerminalsExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(MntnActivityTerminals row);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_activity_terminals
*
* @mbg.generated
*/
int updateByPrimaryKey(MntnActivityTerminals row);
}

@ -0,0 +1,286 @@
<?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="com.shxy.xymanager_dao.dao.MntnActivitiesMapper">
<resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.MntnActivities">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="term_count" jdbcType="INTEGER" property="termCount" />
<result column="status" jdbcType="TINYINT" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<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">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<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">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, title, term_count, `status`, create_time, update_time
</sql>
<select id="selectByExample" parameterType="com.shxy.xymanager_common.entity.MntnActivitiesExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from mntn_activities
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from mntn_activities
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from mntn_activities
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.shxy.xymanager_common.entity.MntnActivitiesExample">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from mntn_activities
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.shxy.xymanager_common.entity.MntnActivities">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into mntn_activities (title, term_count, `status`,
create_time, update_time)
values (#{title,jdbcType=VARCHAR}, #{termCount,jdbcType=INTEGER}, #{status,jdbcType=TINYINT},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.MntnActivities">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into mntn_activities
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null">
title,
</if>
<if test="termCount != null">
term_count,
</if>
<if test="status != null">
`status`,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="termCount != null">
#{termCount,jdbcType=INTEGER},
</if>
<if test="status != null">
#{status,jdbcType=TINYINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.shxy.xymanager_common.entity.MntnActivitiesExample" resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from mntn_activities
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update mntn_activities
<set>
<if test="row.id != null">
id = #{row.id,jdbcType=INTEGER},
</if>
<if test="row.title != null">
title = #{row.title,jdbcType=VARCHAR},
</if>
<if test="row.termCount != null">
term_count = #{row.termCount,jdbcType=INTEGER},
</if>
<if test="row.status != null">
`status` = #{row.status,jdbcType=TINYINT},
</if>
<if test="row.createTime != null">
create_time = #{row.createTime,jdbcType=TIMESTAMP},
</if>
<if test="row.updateTime != null">
update_time = #{row.updateTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="example != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update mntn_activities
set id = #{row.id,jdbcType=INTEGER},
title = #{row.title,jdbcType=VARCHAR},
term_count = #{row.termCount,jdbcType=INTEGER},
`status` = #{row.status,jdbcType=TINYINT},
create_time = #{row.createTime,jdbcType=TIMESTAMP},
update_time = #{row.updateTime,jdbcType=TIMESTAMP}
<if test="example != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.shxy.xymanager_common.entity.MntnActivities">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update mntn_activities
<set>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="termCount != null">
term_count = #{termCount,jdbcType=INTEGER},
</if>
<if test="status != null">
`status` = #{status,jdbcType=TINYINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.MntnActivities">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update mntn_activities
set title = #{title,jdbcType=VARCHAR},
term_count = #{termCount,jdbcType=INTEGER},
`status` = #{status,jdbcType=TINYINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

@ -0,0 +1,241 @@
<?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="com.shxy.xymanager_dao.dao.MntnActivityTerminalsMapper">
<resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.MntnActivityTerminals">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="activity_id" jdbcType="INTEGER" property="activityId" />
<id column="term_id" jdbcType="INTEGER" property="termId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<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">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<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">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
activity_id, term_id, create_time
</sql>
<select id="selectByExample" parameterType="com.shxy.xymanager_common.entity.MntnActivityTerminalsExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from mntn_activity_terminals
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.MntnActivityTerminalsKey" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from mntn_activity_terminals
where activity_id = #{activityId,jdbcType=INTEGER}
and term_id = #{termId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.MntnActivityTerminalsKey">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from mntn_activity_terminals
where activity_id = #{activityId,jdbcType=INTEGER}
and term_id = #{termId,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.shxy.xymanager_common.entity.MntnActivityTerminalsExample">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from mntn_activity_terminals
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.shxy.xymanager_common.entity.MntnActivityTerminals">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into mntn_activity_terminals (activity_id, term_id, create_time
)
values (#{activityId,jdbcType=INTEGER}, #{termId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.MntnActivityTerminals">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into mntn_activity_terminals
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="activityId != null">
activity_id,
</if>
<if test="termId != null">
term_id,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="activityId != null">
#{activityId,jdbcType=INTEGER},
</if>
<if test="termId != null">
#{termId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.shxy.xymanager_common.entity.MntnActivityTerminalsExample" resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from mntn_activity_terminals
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update mntn_activity_terminals
<set>
<if test="row.activityId != null">
activity_id = #{row.activityId,jdbcType=INTEGER},
</if>
<if test="row.termId != null">
term_id = #{row.termId,jdbcType=INTEGER},
</if>
<if test="row.createTime != null">
create_time = #{row.createTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="example != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update mntn_activity_terminals
set activity_id = #{row.activityId,jdbcType=INTEGER},
term_id = #{row.termId,jdbcType=INTEGER},
create_time = #{row.createTime,jdbcType=TIMESTAMP}
<if test="example != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.shxy.xymanager_common.entity.MntnActivityTerminals">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update mntn_activity_terminals
<set>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where activity_id = #{activityId,jdbcType=INTEGER}
and term_id = #{termId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.MntnActivityTerminals">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update mntn_activity_terminals
set create_time = #{createTime,jdbcType=TIMESTAMP}
where activity_id = #{activityId,jdbcType=INTEGER}
and term_id = #{termId,jdbcType=INTEGER}
</update>
</mapper>

@ -0,0 +1,144 @@
package com.shxy.xymanager_service.impl;
import com.shxy.xymanager_common.entity.*;
import com.shxy.xymanager_common.exception.ApiException;
import com.shxy.xymanager_dao.dao.MntnActivityTerminalsMapper;
import com.shxy.xymanager_dao.dao.MntnActivitiesMapper;
import com.shxy.xymanager_service.service.ActivitiesService;
import com.shxy.xymanager_service.service.TerminalExtService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service
@Slf4j
@Transactional(rollbackFor = Exception.class)
public class ActivitiesServiceImpl implements ActivitiesService {
@Resource
MntnActivitiesMapper mapper;
@Resource
MntnActivityTerminalsMapper terminalsMapper;
@Resource
TerminalExtService terminalExtService;
@Override
public List<MntnActivities> listAll() {
MntnActivitiesExample example = new MntnActivitiesExample();
MntnActivitiesExample.Criteria criteria = example.createCriteria();
List<MntnActivities> list = mapper.selectByExample(example);
for (MntnActivities item : list) {
this.fillItem(item);
}
return list;
}
@Override
public boolean add(MntnActivities item) throws Exception {
if (CollectionUtils.isEmpty(item.getTerms())) {
throw new ApiException("装置列表信息不能为空");
}
MntnActivitiesExample example = new MntnActivitiesExample();
MntnActivitiesExample.Criteria criteria = example.createCriteria();
criteria.andTitleEqualTo(item.getTitle());
List<MntnActivities> list = mapper.selectByExample(example);
if (list.size() > 0) {
throw new ApiException("名称已存在");
}
item.setCreateTime(new Date());
item.setUpdateTime(new Date());
int r = mapper.insertSelective(item);
for (Terminals term : item.getTerms()) {
MntnActivityTerminals record = new MntnActivityTerminals();
record.setActivityId(item.getId());
if (term.getId() != null) {
record.setTermId(term.getId());
} else if (StringUtils.isNotBlank(term.getCmdid())) {
Terminals t = terminalExtService.getByCmdid(term.getCmdid());
if (t != null) {
record.setTermId(t.getId());
}
} else {
throw new Exception("装置列表信息异常");
}
record.setCreateTime(new Date());
terminalsMapper.insert(record);
}
return r > 0;
}
@Override
public void update(MntnActivities item) throws Exception {
MntnActivitiesExample example = new MntnActivitiesExample();
MntnActivitiesExample.Criteria criteria = example.createCriteria();
criteria.andTitleEqualTo(item.getTitle());
criteria.andIdNotEqualTo(item.getId());
List<MntnActivities> list = mapper.selectByExample(example);
if (list.size() > 0) {
throw new ApiException("名称已存在");
}
item.setUpdateTime(new Date());
mapper.updateByPrimaryKey(item);
MntnActivityTerminalsExample terminalsExample = new MntnActivityTerminalsExample();
MntnActivityTerminalsExample.Criteria terminalsCriteria = terminalsExample.createCriteria();
terminalsCriteria.andActivityIdEqualTo(item.getId());
terminalsMapper.deleteByExample(terminalsExample);
for (Terminals term : item.getTerms()) {
MntnActivityTerminals record = new MntnActivityTerminals();
record.setActivityId(item.getId());
if (term.getId() != null) {
record.setTermId(term.getId());
} else if (StringUtils.isNotBlank(term.getCmdid())) {
Terminals t = terminalExtService.getByCmdid(term.getCmdid());
if (t != null) {
record.setTermId(t.getId());
}
} else {
throw new Exception("装置列表信息异常");
}
record.setCreateTime(new Date());
terminalsMapper.insert(record);
}
}
@Override
public void delete(Integer id) throws Exception {
mapper.deleteByPrimaryKey(id);
MntnActivityTerminalsExample example = new MntnActivityTerminalsExample();
MntnActivityTerminalsExample.Criteria criteria = example.createCriteria();
criteria.andActivityIdEqualTo(id);
terminalsMapper.deleteByExample(example);
}
@Override
public MntnActivities detail(Integer id) {
MntnActivities item = mapper.selectByPrimaryKey(id);
this.fillItem(item);
return item;
}
private void fillItem(MntnActivities item) {
MntnActivityTerminalsExample example = new MntnActivityTerminalsExample();
MntnActivityTerminalsExample.Criteria criteria = example.createCriteria();
criteria.andActivityIdEqualTo(item.getId());
List<MntnActivityTerminals> list = terminalsMapper.selectByExample(example);
List<Terminals> terms = new ArrayList<>();
for (MntnActivityTerminals r : list) {
Terminals t = terminalExtService.getById(r.getTermId());
terms.add(t);
}
item.setTerms(terms);
}
}

@ -0,0 +1,46 @@
package com.shxy.xymanager_service.impl;
import com.shxy.xymanager_common.entity.Terminals;
import com.shxy.xymanager_common.entity.TerminalsExample;
import com.shxy.xymanager_common.entity.View_Dy_Line_Tower_Terminals;
import com.shxy.xymanager_common.vo.TerminalSelectVo;
import com.shxy.xymanager_dao.dao.TerminalsDao;
import com.shxy.xymanager_service.service.TerminalExtService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
@Service
@Slf4j
@Transactional(rollbackFor = Exception.class)
public class TerminalExtServiceImpl implements TerminalExtService {
@Resource
TerminalsDao terminalsDao;
@Override
public List<View_Dy_Line_Tower_Terminals> getTerminalList(TerminalSelectVo vo) {
return null;
}
@Override
public Terminals getByCmdid(String cmdid) {
TerminalsExample example = new TerminalsExample();
TerminalsExample.Criteria criteria = example.createCriteria();
criteria.andCmdidEqualTo(cmdid);
List<Terminals> list = terminalsDao.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null;
}
@Override
public Terminals getById(Integer id) {
return terminalsDao.selectByPrimaryKey(id);
}
}

@ -0,0 +1,19 @@
package com.shxy.xymanager_service.service;
import com.shxy.xymanager_common.entity.MntnActivities;
import java.util.List;
public interface ActivitiesService {
List<MntnActivities> listAll();
boolean add(MntnActivities item) throws Exception;
void update(MntnActivities item) throws Exception;
void delete(Integer id) throws Exception;
MntnActivities detail(Integer id);
}

@ -0,0 +1,16 @@
package com.shxy.xymanager_service.service;
import com.shxy.xymanager_common.entity.*;
import com.shxy.xymanager_common.vo.*;
import java.util.List;
public interface TerminalExtService {
List<View_Dy_Line_Tower_Terminals> getTerminalList(TerminalSelectVo vo);
Terminals getByCmdid(String cmdid);
Terminals getById(Integer id);
}
Loading…
Cancel
Save