文档接口

This commit is contained in:
Jade 2021-05-12 13:44:50 +08:00
parent 5de44e7263
commit 105e824236
16 changed files with 1954 additions and 0 deletions

19
sql/20210512-yuan.sql Normal file
View File

@ -0,0 +1,19 @@
CREATE TABLE `docu_document_draft` (
`id` bigint NOT NULL AUTO_INCREMENT,
`title` varchar(50) NOT NULL COMMENT '标题',
`content` longtext NOT NULL COMMENT '内容',
`create_user_id` bigint NOT NULL COMMENT '创建用户',
`create_time` datetime NOT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `docu_document` (
`id` bigint NOT NULL AUTO_INCREMENT,
`title` varchar(50) NOT NULL COMMENT '标题',
`content` longtext NOT NULL COMMENT '内容',
`publish_user_id` bigint NOT NULL COMMENT '发布用户',
`publish_time` datetime NOT NULL COMMENT '发布时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -0,0 +1,32 @@
package club.joylink.rtss.controller.doc;
import club.joylink.rtss.services.doc.DocumentService;
import club.joylink.rtss.vo.doc.DocumentVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping(path = "/api/doc")
public class DocumentController {
@Autowired
private DocumentService documentService;
@ApiOperation(value = "查询文档列表")
@GetMapping(path = "")
public List<DocumentVO> listDocuments() {
return documentService.listDocuments();
}
@ApiOperation(value = "获取文档详情")
@GetMapping(path = "/{id}")
public DocumentVO getDetail(@PathVariable Long id) {
return documentService.getDetail(id);
}
}

View File

@ -0,0 +1,70 @@
package club.joylink.rtss.controller.doc;
import club.joylink.rtss.services.doc.DocumentDraftService;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.doc.DocumentVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
@RestController
@RequestMapping(path = "/api/doc/draft")
public class DocumentDraftController {
@Autowired
private DocumentDraftService documentDraftService;
@ApiOperation(value = "查询草稿文档列表")
@GetMapping(path = "")
public List<DocumentVO> listMyDocuments(@ApiIgnore @RequestAttribute UserVO user) {
return documentDraftService.listMyDocuments(user);
}
@ApiOperation(value = "创建新的草稿文档")
@PostMapping(path = "")
public void create(@RequestBody @Validated DocumentVO documentVO, @ApiIgnore @RequestAttribute UserVO user) {
documentDraftService.create(documentVO, user);
}
@ApiOperation(value = "更新标题")
@PutMapping(path = "/{id}")
public void updateTitle(@PathVariable Long id, @RequestBody @Validated DocumentVO documentVO) {
documentDraftService.updateTitle(id, documentVO);
}
@ApiOperation(value = "获取文档详情")
@GetMapping(path = "/{id}")
public DocumentVO getDetail(@PathVariable Long id) {
return documentDraftService.getDetail(id);
}
@ApiOperation(value = "保存数据")
@PutMapping(path = "/{id}/data")
public void save(@PathVariable Long id, @RequestBody DocumentVO documentVO) {
documentDraftService.save(id, documentVO.getContent());
}
@ApiOperation(value = "发布文档")
@PutMapping(path = "/{id}/publish")
public void publish(@PathVariable Long id, @ApiIgnore @RequestAttribute UserVO user) {
documentDraftService.publish(id, user);
}
@ApiOperation(value = "删除文档")
@DeleteMapping(path = "/{id}")
public void delete(@PathVariable Long id) {
documentDraftService.delete(id);
}
}

View File

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

View File

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

View File

@ -0,0 +1,36 @@
package club.joylink.rtss.entity;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;
/**
* @author
*
*/
@Data
public class DocuDocument implements Serializable {
private Long id;
/**
* 标题
*/
private String title;
/**
* 发布用户
*/
private Long publishUserId;
/**
* 发布时间
*/
private LocalDateTime publishTime;
/**
* 内容
*/
private String content;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,36 @@
package club.joylink.rtss.entity;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;
/**
* @author
*
*/
@Data
public class DocuDocumentDraft implements Serializable {
private Long id;
/**
* 标题
*/
private String title;
/**
* 创建用户
*/
private Long createUserId;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 内容
*/
private String content;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,473 @@
package club.joylink.rtss.entity;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
public class DocuDocumentDraftExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public DocuDocumentDraftExample() {
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 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 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 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,473 @@
package club.joylink.rtss.entity;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
public class DocuDocumentExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public DocuDocumentExample() {
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 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 andPublishUserIdIsNull() {
addCriterion("publish_user_id is null");
return (Criteria) this;
}
public Criteria andPublishUserIdIsNotNull() {
addCriterion("publish_user_id is not null");
return (Criteria) this;
}
public Criteria andPublishUserIdEqualTo(Long value) {
addCriterion("publish_user_id =", value, "publishUserId");
return (Criteria) this;
}
public Criteria andPublishUserIdNotEqualTo(Long value) {
addCriterion("publish_user_id <>", value, "publishUserId");
return (Criteria) this;
}
public Criteria andPublishUserIdGreaterThan(Long value) {
addCriterion("publish_user_id >", value, "publishUserId");
return (Criteria) this;
}
public Criteria andPublishUserIdGreaterThanOrEqualTo(Long value) {
addCriterion("publish_user_id >=", value, "publishUserId");
return (Criteria) this;
}
public Criteria andPublishUserIdLessThan(Long value) {
addCriterion("publish_user_id <", value, "publishUserId");
return (Criteria) this;
}
public Criteria andPublishUserIdLessThanOrEqualTo(Long value) {
addCriterion("publish_user_id <=", value, "publishUserId");
return (Criteria) this;
}
public Criteria andPublishUserIdIn(List<Long> values) {
addCriterion("publish_user_id in", values, "publishUserId");
return (Criteria) this;
}
public Criteria andPublishUserIdNotIn(List<Long> values) {
addCriterion("publish_user_id not in", values, "publishUserId");
return (Criteria) this;
}
public Criteria andPublishUserIdBetween(Long value1, Long value2) {
addCriterion("publish_user_id between", value1, value2, "publishUserId");
return (Criteria) this;
}
public Criteria andPublishUserIdNotBetween(Long value1, Long value2) {
addCriterion("publish_user_id not between", value1, value2, "publishUserId");
return (Criteria) this;
}
public Criteria andPublishTimeIsNull() {
addCriterion("publish_time is null");
return (Criteria) this;
}
public Criteria andPublishTimeIsNotNull() {
addCriterion("publish_time is not null");
return (Criteria) this;
}
public Criteria andPublishTimeEqualTo(LocalDateTime value) {
addCriterion("publish_time =", value, "publishTime");
return (Criteria) this;
}
public Criteria andPublishTimeNotEqualTo(LocalDateTime value) {
addCriterion("publish_time <>", value, "publishTime");
return (Criteria) this;
}
public Criteria andPublishTimeGreaterThan(LocalDateTime value) {
addCriterion("publish_time >", value, "publishTime");
return (Criteria) this;
}
public Criteria andPublishTimeGreaterThanOrEqualTo(LocalDateTime value) {
addCriterion("publish_time >=", value, "publishTime");
return (Criteria) this;
}
public Criteria andPublishTimeLessThan(LocalDateTime value) {
addCriterion("publish_time <", value, "publishTime");
return (Criteria) this;
}
public Criteria andPublishTimeLessThanOrEqualTo(LocalDateTime value) {
addCriterion("publish_time <=", value, "publishTime");
return (Criteria) this;
}
public Criteria andPublishTimeIn(List<LocalDateTime> values) {
addCriterion("publish_time in", values, "publishTime");
return (Criteria) this;
}
public Criteria andPublishTimeNotIn(List<LocalDateTime> values) {
addCriterion("publish_time not in", values, "publishTime");
return (Criteria) this;
}
public Criteria andPublishTimeBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("publish_time between", value1, value2, "publishTime");
return (Criteria) this;
}
public Criteria andPublishTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("publish_time not between", value1, value2, "publishTime");
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,57 @@
package club.joylink.rtss.services.doc;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.doc.DocumentVO;
import java.util.List;
public interface DocumentDraftService {
/**
* 查询草稿文档列表
* @param userVO
* @return
*/
List<DocumentVO> listMyDocuments(UserVO userVO);
/**
* 创建新的草稿文档
* @param documentVO
* @param userVO
*/
void create(DocumentVO documentVO, UserVO userVO);
/**
* 更新标题
* @param id
* @param documentVO
*/
void updateTitle(Long id, DocumentVO documentVO);
/**
* 获取文档详情
* @param id
* @return
*/
DocumentVO getDetail(Long id);
/**
* 保存数据
* @param id
* @param content
*/
void save(Long id, String content);
/**
* 发布文档
* @param id
* @param userVO
*/
void publish(Long id, UserVO userVO);
/**
* 删除文档
* @param id
*/
void delete(Long id);
}

View File

@ -0,0 +1,84 @@
package club.joylink.rtss.services.doc;
import club.joylink.rtss.dao.DocuDocumentDraftDAO;
import club.joylink.rtss.entity.DocuDocumentDraft;
import club.joylink.rtss.entity.DocuDocumentDraftExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.doc.DocumentVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class DocumentDraftServiceImpl implements DocumentDraftService {
@Autowired
private DocuDocumentDraftDAO docuDocumentDraftDAO;
@Autowired
private DocumentService documentService;
@Override
public List<DocumentVO> listMyDocuments(UserVO userVO) {
DocuDocumentDraftExample example = new DocuDocumentDraftExample();
example.createCriteria().andCreateUserIdEqualTo(userVO.getId());
List<DocuDocumentDraft> list = docuDocumentDraftDAO.selectByExample(example);
return list.stream().map(DocumentVO::new).collect(Collectors.toList());
}
@Override
public void create(DocumentVO documentVO, UserVO userVO) {
// 校验名称
DocuDocumentDraftExample example = new DocuDocumentDraftExample();
example.createCriteria().andTitleEqualTo(documentVO.getTitle());
BusinessExceptionAssertEnum.NAME_REPEAT
.assertTrue(docuDocumentDraftDAO.countByExample(example) == 0, "name already exist");
// 添加
DocuDocumentDraft documentDraft = new DocuDocumentDraft();
documentDraft.setTitle(documentDraft.getTitle());
documentDraft.setCreateUserId(userVO.getId());
documentDraft.setCreateTime(LocalDateTime.now());
docuDocumentDraftDAO.insertSelective(documentDraft);
}
@Override
public void updateTitle(Long id, DocumentVO documentVO) {
DocuDocumentDraftExample example = new DocuDocumentDraftExample();
example.createCriteria().andTitleEqualTo(documentVO.getTitle()).andIdNotEqualTo(id);
BusinessExceptionAssertEnum.NAME_REPEAT
.assertTrue(docuDocumentDraftDAO.countByExample(example) == 0, "name already exist");
DocuDocumentDraft documentDraft = docuDocumentDraftDAO.selectByPrimaryKey(id);
documentDraft.setTitle(documentVO.getTitle());
docuDocumentDraftDAO.updateByPrimaryKey(documentDraft);
}
@Override
public DocumentVO getDetail(Long id) {
DocuDocumentDraft documentDraft = docuDocumentDraftDAO.selectByPrimaryKey(id);
DocumentVO documentVO = new DocumentVO(documentDraft);
documentVO.setContent(documentDraft.getContent());
return documentVO;
}
@Override
public void save(Long id, String content) {
DocuDocumentDraft documentDraft = docuDocumentDraftDAO.selectByPrimaryKey(id);
documentDraft.setContent(content);
docuDocumentDraftDAO.updateByPrimaryKey(documentDraft);
}
@Override
public void publish(Long id, UserVO userVO) {
DocumentVO documentVO = getDetail(id);
documentService.publish(documentVO, userVO);
}
@Override
public void delete(Long id) {
docuDocumentDraftDAO.deleteByPrimaryKey(id);
}
}

View File

@ -0,0 +1,29 @@
package club.joylink.rtss.services.doc;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.doc.DocumentVO;
import java.util.List;
public interface DocumentService {
/**
* 查询文档列表
* @return
*/
List<DocumentVO> listDocuments();
/**
* 获取文档详情
* @param id
* @return
*/
DocumentVO getDetail(Long id);
/**
* 发布文档
* @param documentVO
* @param userVO
*/
void publish(DocumentVO documentVO, UserVO userVO);
}

View File

@ -0,0 +1,56 @@
package club.joylink.rtss.services.doc;
import club.joylink.rtss.dao.DocuDocumentDAO;
import club.joylink.rtss.entity.DocuDocument;
import club.joylink.rtss.entity.DocuDocumentExample;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.doc.DocumentVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class DocumentServiceImpl implements DocumentService {
@Autowired
private DocuDocumentDAO docuDocumentDAO;
@Override
public List<DocumentVO> listDocuments() {
List<DocuDocument> list = docuDocumentDAO.selectByExample(null);
return list.stream().map(DocumentVO::new).collect(Collectors.toList());
}
@Override
public DocumentVO getDetail(Long id) {
DocuDocument document = docuDocumentDAO.selectByPrimaryKey(id);
DocumentVO documentVO = new DocumentVO(document);
documentVO.setContent(document.getContent());
return documentVO;
}
@Override
public void publish(DocumentVO documentVO, UserVO userVO) {
DocuDocumentExample example = new DocuDocumentExample();
example.createCriteria().andTitleEqualTo(documentVO.getTitle());
List<DocuDocument> documentList = docuDocumentDAO.selectByExample(example);
if (CollectionUtils.isEmpty(documentList)) {
DocuDocument document = new DocuDocument();
document.setTitle(documentVO.getTitle());
document.setContent(documentVO.getContent());
document.setPublishUserId(userVO.getId());
document.setPublishTime(LocalDateTime.now());
docuDocumentDAO.insert(document);
} else {
DocuDocument document = documentList.get(0);
document.setContent(documentVO.getContent());
document.setPublishUserId(userVO.getId());
document.setPublishTime(LocalDateTime.now());
docuDocumentDAO.updateByPrimaryKey(document);
}
}
}

View File

@ -0,0 +1,39 @@
package club.joylink.rtss.vo.doc;
import club.joylink.rtss.entity.DocuDocument;
import club.joylink.rtss.entity.DocuDocumentDraft;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotBlank;
@ApiModel(value = "文档对象")
@Getter
@Setter
@NoArgsConstructor
public class DocumentVO {
private Long id;
@ApiModelProperty(value = "标题")
@NotBlank(message = "标题不能为空")
@Max(50)
private String title;
@ApiModelProperty(value = "内容")
private String content;
public DocumentVO(DocuDocumentDraft documentDraft) {
this.id = documentDraft.getId();
this.title = documentDraft.getTitle();
}
public DocumentVO(DocuDocument document) {
this.id = document.getId();
this.title = document.getTitle();
}
}

View File

@ -0,0 +1,261 @@
<?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.DocuDocumentDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.DocuDocument">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="publish_user_id" jdbcType="BIGINT" property="publishUserId" />
<result column="publish_time" jdbcType="TIMESTAMP" property="publishTime" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.DocuDocument">
<result column="content" jdbcType="LONGVARCHAR" property="content" />
</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, title, publish_user_id, publish_time
</sql>
<sql id="Blob_Column_List">
content
</sql>
<select id="selectByExampleWithBLOBs" parameterType="club.joylink.rtss.entity.DocuDocumentExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from docu_document
<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="selectByExample" parameterType="club.joylink.rtss.entity.DocuDocumentExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from docu_document
<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="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from docu_document
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from docu_document
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.DocuDocumentExample">
delete from docu_document
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.DocuDocument" useGeneratedKeys="true">
insert into docu_document (title, publish_user_id, publish_time,
content)
values (#{title,jdbcType=VARCHAR}, #{publishUserId,jdbcType=BIGINT}, #{publishTime,jdbcType=TIMESTAMP},
#{content,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.DocuDocument" useGeneratedKeys="true">
insert into docu_document
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null">
title,
</if>
<if test="publishUserId != null">
publish_user_id,
</if>
<if test="publishTime != null">
publish_time,
</if>
<if test="content != null">
content,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="publishUserId != null">
#{publishUserId,jdbcType=BIGINT},
</if>
<if test="publishTime != null">
#{publishTime,jdbcType=TIMESTAMP},
</if>
<if test="content != null">
#{content,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.DocuDocumentExample" resultType="java.lang.Long">
select count(*) from docu_document
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update docu_document
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.title != null">
title = #{record.title,jdbcType=VARCHAR},
</if>
<if test="record.publishUserId != null">
publish_user_id = #{record.publishUserId,jdbcType=BIGINT},
</if>
<if test="record.publishTime != null">
publish_time = #{record.publishTime,jdbcType=TIMESTAMP},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update docu_document
set id = #{record.id,jdbcType=BIGINT},
title = #{record.title,jdbcType=VARCHAR},
publish_user_id = #{record.publishUserId,jdbcType=BIGINT},
publish_time = #{record.publishTime,jdbcType=TIMESTAMP},
content = #{record.content,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update docu_document
set id = #{record.id,jdbcType=BIGINT},
title = #{record.title,jdbcType=VARCHAR},
publish_user_id = #{record.publishUserId,jdbcType=BIGINT},
publish_time = #{record.publishTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.DocuDocument">
update docu_document
<set>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="publishUserId != null">
publish_user_id = #{publishUserId,jdbcType=BIGINT},
</if>
<if test="publishTime != null">
publish_time = #{publishTime,jdbcType=TIMESTAMP},
</if>
<if test="content != null">
content = #{content,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.DocuDocument">
update docu_document
set title = #{title,jdbcType=VARCHAR},
publish_user_id = #{publishUserId,jdbcType=BIGINT},
publish_time = #{publishTime,jdbcType=TIMESTAMP},
content = #{content,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.DocuDocument">
update docu_document
set title = #{title,jdbcType=VARCHAR},
publish_user_id = #{publishUserId,jdbcType=BIGINT},
publish_time = #{publishTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -0,0 +1,261 @@
<?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.DocuDocumentDraftDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.DocuDocumentDraft">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="create_user_id" jdbcType="BIGINT" property="createUserId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.DocuDocumentDraft">
<result column="content" jdbcType="LONGVARCHAR" property="content" />
</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, title, create_user_id, create_time
</sql>
<sql id="Blob_Column_List">
content
</sql>
<select id="selectByExampleWithBLOBs" parameterType="club.joylink.rtss.entity.DocuDocumentDraftExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from docu_document_draft
<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="selectByExample" parameterType="club.joylink.rtss.entity.DocuDocumentDraftExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from docu_document_draft
<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="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from docu_document_draft
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from docu_document_draft
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.DocuDocumentDraftExample">
delete from docu_document_draft
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.DocuDocumentDraft" useGeneratedKeys="true">
insert into docu_document_draft (title, create_user_id, create_time,
content)
values (#{title,jdbcType=VARCHAR}, #{createUserId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},
#{content,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.DocuDocumentDraft" useGeneratedKeys="true">
insert into docu_document_draft
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null">
title,
</if>
<if test="createUserId != null">
create_user_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="content != null">
content,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="createUserId != null">
#{createUserId,jdbcType=BIGINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="content != null">
#{content,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.DocuDocumentDraftExample" resultType="java.lang.Long">
select count(*) from docu_document_draft
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update docu_document_draft
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.title != null">
title = #{record.title,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.content != null">
content = #{record.content,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update docu_document_draft
set id = #{record.id,jdbcType=BIGINT},
title = #{record.title,jdbcType=VARCHAR},
create_user_id = #{record.createUserId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
content = #{record.content,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update docu_document_draft
set id = #{record.id,jdbcType=BIGINT},
title = #{record.title,jdbcType=VARCHAR},
create_user_id = #{record.createUserId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.DocuDocumentDraft">
update docu_document_draft
<set>
<if test="title != null">
title = #{title,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="content != null">
content = #{content,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.DocuDocumentDraft">
update docu_document_draft
set title = #{title,jdbcType=VARCHAR},
create_user_id = #{createUserId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
content = #{content,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.DocuDocumentDraft">
update docu_document_draft
set title = #{title,jdbcType=VARCHAR},
create_user_id = #{createUserId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>