Browse Source

金句

master
nili 3 years ago
parent
commit
a492bb092f
  1. 9
      luigi-api/src/main/java/com/bzgame/server/luigi/api/rest/AuthorController.java
  2. 12
      luigi-api/src/main/java/com/bzgame/server/luigi/api/rest/PoemController.java
  3. 42
      luigi-api/src/main/java/com/bzgame/server/luigi/api/rest/VerseController.java
  4. 336
      luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/Verse.java
  5. 892
      luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/VerseExample.java
  6. 96
      luigi-dao/src/main/java/com/bzgame/server/luigi/dao/mapper/VerseMapper.java
  7. 342
      luigi-dao/src/main/resources/mapper/VerseMapper.xml
  8. 2
      luigi-dao/src/main/resources/mybatis-generator/generatorConfig.xml
  9. 2
      luigi-service/src/main/java/com/bzgame/server/luigi/service/AuthorService.java
  10. 13
      luigi-service/src/main/java/com/bzgame/server/luigi/service/PoemService.java
  11. 88
      luigi-service/src/main/java/com/bzgame/server/luigi/service/VerseService.java
  12. 32
      luigi-service/src/main/java/com/bzgame/server/luigi/service/constant/DetailTypeEnum.java

9
luigi-api/src/main/java/com/bzgame/server/luigi/api/rest/AuthorController.java

@ -3,19 +3,14 @@ package com.bzgame.server.luigi.api.rest;
import com.bczgame.server.common.vo.Response;
import com.bzgame.server.luigi.api.aop.ApiFlag;
import com.bzgame.server.luigi.dao.domain.Author;
import com.bzgame.server.luigi.service.bo.AuthorService;
import com.bzgame.server.luigi.service.AuthorService;
import com.bzgame.server.luigi.service.bo.request.PaginationQuery;
import com.bzgame.server.luigi.service.bo.response.CommonList;
import com.bzgame.server.luigi.service.bo.response.PoemBo;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author nidaren
@ -29,7 +24,7 @@ public class AuthorController {
@GetMapping("/seek")
@ApiFlag
public Response<CommonList<Author>> seek(@RequestParam String name) {
public Response<CommonList<Author>> seekAuthor(@RequestParam String name) {
if (StringUtils.isEmpty(name)) {
return new Response<>(new CommonList<>(), "ok", Response.CODE_SUCCESS);
}

12
luigi-api/src/main/java/com/bzgame/server/luigi/api/rest/PoemController.java

@ -2,11 +2,12 @@ package com.bzgame.server.luigi.api.rest;
import com.bczgame.server.common.vo.Response;
import com.bzgame.server.luigi.api.aop.ApiFlag;
import com.bzgame.server.luigi.service.bo.PoemService;
import com.bzgame.server.luigi.service.PoemService;
import com.bzgame.server.luigi.service.bo.request.PaginationQuery;
import com.bzgame.server.luigi.service.bo.response.CommonList;
import com.bzgame.server.luigi.service.bo.response.PoemBo;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -27,6 +28,15 @@ public class PoemController {
return new Response<>(poemService.query(query), "ok", Response.CODE_SUCCESS);
}
@GetMapping("/seek")
@ApiFlag
public Response<CommonList<PoemBo>> seekPoem(@RequestParam String title) {
if (StringUtils.isEmpty(title)) {
return new Response<>(new CommonList<>(), "ok", Response.CODE_SUCCESS);
}
return new Response<>(poemService.seek(title), "ok", Response.CODE_SUCCESS);
}
@GetMapping("/detail")
@ApiFlag
public Response<PoemBo> poemDetail(@RequestParam Integer id) {

42
luigi-api/src/main/java/com/bzgame/server/luigi/api/rest/VerseController.java

@ -0,0 +1,42 @@
package com.bzgame.server.luigi.api.rest;
import com.bczgame.server.common.vo.Response;
import com.bzgame.server.luigi.api.aop.ApiFlag;
import com.bzgame.server.luigi.dao.domain.Verse;
import com.bzgame.server.luigi.service.VerseService;
import com.bzgame.server.luigi.service.bo.request.PaginationQuery;
import com.bzgame.server.luigi.service.bo.response.CommonList;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @author nidaren
*/
@RestController
@RequestMapping("/api/luigi/verse")
@Api(tags = "verse")
public class VerseController {
@Resource
private VerseService verseService;
@GetMapping("/get")
@ApiFlag
public Response<Verse> getVerseById(@RequestParam Integer id) {
return new Response<>(verseService.detail(id), "ok", Response.CODE_SUCCESS);
}
@PostMapping("/list")
@ApiFlag
public Response<CommonList<Verse>> verseList(@RequestBody PaginationQuery query) {
return new Response<>(verseService.list(query), "ok", Response.CODE_SUCCESS);
}
@PostMapping("/save")
@ApiFlag
public Response<Integer> saveVerse(@RequestBody Verse verse) {
return new Response<>(verseService.save(verse), "ok", 1);
}
}

336
luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/Verse.java

@ -0,0 +1,336 @@
package com.bzgame.server.luigi.dao.domain;
import java.io.Serializable;
public class Verse implements Serializable {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column verse.id
*
* @mbg.generated
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column verse.title
*
* @mbg.generated
*/
private String title;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column verse.content
*
* @mbg.generated
*/
private String content;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column verse.author_id
*
* @mbg.generated
*/
private Integer authorId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column verse.author_name
*
* @mbg.generated
*/
private String authorName;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column verse.type
*
* @mbg.generated
*/
private Byte type;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column verse.origin_id
*
* @mbg.generated
*/
private Integer originId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column verse.chapter_id
*
* @mbg.generated
*/
private Integer chapterId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column verse.status
*
* @mbg.generated
*/
private Integer status;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table verse
*
* @mbg.generated
*/
private static final long serialVersionUID = 1L;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column verse.id
*
* @return the value of verse.id
*
* @mbg.generated
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column verse.id
*
* @param id the value for verse.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 verse.title
*
* @return the value of verse.title
*
* @mbg.generated
*/
public String getTitle() {
return title;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column verse.title
*
* @param title the value for verse.title
*
* @mbg.generated
*/
public void setTitle(String title) {
this.title = title == null ? null : title.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column verse.content
*
* @return the value of verse.content
*
* @mbg.generated
*/
public String getContent() {
return content;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column verse.content
*
* @param content the value for verse.content
*
* @mbg.generated
*/
public void setContent(String content) {
this.content = content == null ? null : content.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column verse.author_id
*
* @return the value of verse.author_id
*
* @mbg.generated
*/
public Integer getAuthorId() {
return authorId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column verse.author_id
*
* @param authorId the value for verse.author_id
*
* @mbg.generated
*/
public void setAuthorId(Integer authorId) {
this.authorId = authorId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column verse.author_name
*
* @return the value of verse.author_name
*
* @mbg.generated
*/
public String getAuthorName() {
return authorName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column verse.author_name
*
* @param authorName the value for verse.author_name
*
* @mbg.generated
*/
public void setAuthorName(String authorName) {
this.authorName = authorName == null ? null : authorName.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column verse.type
*
* @return the value of verse.type
*
* @mbg.generated
*/
public Byte getType() {
return type;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column verse.type
*
* @param type the value for verse.type
*
* @mbg.generated
*/
public void setType(Byte type) {
this.type = type;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column verse.origin_id
*
* @return the value of verse.origin_id
*
* @mbg.generated
*/
public Integer getOriginId() {
return originId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column verse.origin_id
*
* @param originId the value for verse.origin_id
*
* @mbg.generated
*/
public void setOriginId(Integer originId) {
this.originId = originId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column verse.chapter_id
*
* @return the value of verse.chapter_id
*
* @mbg.generated
*/
public Integer getChapterId() {
return chapterId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column verse.chapter_id
*
* @param chapterId the value for verse.chapter_id
*
* @mbg.generated
*/
public void setChapterId(Integer chapterId) {
this.chapterId = chapterId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column verse.status
*
* @return the value of verse.status
*
* @mbg.generated
*/
public Integer getStatus() {
return status;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column verse.status
*
* @param status the value for verse.status
*
* @mbg.generated
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table verse
*
* @mbg.generated
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", title=").append(title);
sb.append(", content=").append(content);
sb.append(", authorId=").append(authorId);
sb.append(", authorName=").append(authorName);
sb.append(", type=").append(type);
sb.append(", originId=").append(originId);
sb.append(", chapterId=").append(chapterId);
sb.append(", status=").append(status);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

892
luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/VerseExample.java

@ -0,0 +1,892 @@
package com.bzgame.server.luigi.dao.domain;
import java.util.ArrayList;
import java.util.List;
public class VerseExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table verse
*
* @mbg.generated
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table verse
*
* @mbg.generated
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table verse
*
* @mbg.generated
*/
protected List<Criteria> oredCriteria;
private Integer limit;
private Integer offset;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table verse
*
* @mbg.generated
*/
public VerseExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table verse
*
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table verse
*
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table verse
*
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table verse
*
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table verse
*
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table verse
*
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table verse
*
* @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 verse
*
* @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 verse
*
* @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 verse
*
* @mbg.generated
*/
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(Integer offset) {
this.offset = offset;
}
public Integer getOffset() {
return offset;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table verse
*
* @mbg.generated
*/
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(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 andContentIsNull() {
addCriterion("content is null");
return (Criteria) this;
}
public Criteria andContentIsNotNull() {
addCriterion("content is not null");
return (Criteria) this;
}
public Criteria andContentEqualTo(String value) {
addCriterion("content =", value, "content");
return (Criteria) this;
}
public Criteria andContentNotEqualTo(String value) {
addCriterion("content <>", value, "content");
return (Criteria) this;
}
public Criteria andContentGreaterThan(String value) {
addCriterion("content >", value, "content");
return (Criteria) this;
}
public Criteria andContentGreaterThanOrEqualTo(String value) {
addCriterion("content >=", value, "content");
return (Criteria) this;
}
public Criteria andContentLessThan(String value) {
addCriterion("content <", value, "content");
return (Criteria) this;
}
public Criteria andContentLessThanOrEqualTo(String value) {
addCriterion("content <=", value, "content");
return (Criteria) this;
}
public Criteria andContentLike(String value) {
addCriterion("content like", value, "content");
return (Criteria) this;
}
public Criteria andContentNotLike(String value) {
addCriterion("content not like", value, "content");
return (Criteria) this;
}
public Criteria andContentIn(List<String> values) {
addCriterion("content in", values, "content");
return (Criteria) this;
}
public Criteria andContentNotIn(List<String> values) {
addCriterion("content not in", values, "content");
return (Criteria) this;
}
public Criteria andContentBetween(String value1, String value2) {
addCriterion("content between", value1, value2, "content");
return (Criteria) this;
}
public Criteria andContentNotBetween(String value1, String value2) {
addCriterion("content not between", value1, value2, "content");
return (Criteria) this;
}
public Criteria andAuthorIdIsNull() {
addCriterion("author_id is null");
return (Criteria) this;
}
public Criteria andAuthorIdIsNotNull() {
addCriterion("author_id is not null");
return (Criteria) this;
}
public Criteria andAuthorIdEqualTo(Integer value) {
addCriterion("author_id =", value, "authorId");
return (Criteria) this;
}
public Criteria andAuthorIdNotEqualTo(Integer value) {
addCriterion("author_id <>", value, "authorId");
return (Criteria) this;
}
public Criteria andAuthorIdGreaterThan(Integer value) {
addCriterion("author_id >", value, "authorId");
return (Criteria) this;
}
public Criteria andAuthorIdGreaterThanOrEqualTo(Integer value) {
addCriterion("author_id >=", value, "authorId");
return (Criteria) this;
}
public Criteria andAuthorIdLessThan(Integer value) {
addCriterion("author_id <", value, "authorId");
return (Criteria) this;
}
public Criteria andAuthorIdLessThanOrEqualTo(Integer value) {
addCriterion("author_id <=", value, "authorId");
return (Criteria) this;
}
public Criteria andAuthorIdIn(List<Integer> values) {
addCriterion("author_id in", values, "authorId");
return (Criteria) this;
}
public Criteria andAuthorIdNotIn(List<Integer> values) {
addCriterion("author_id not in", values, "authorId");
return (Criteria) this;
}
public Criteria andAuthorIdBetween(Integer value1, Integer value2) {
addCriterion("author_id between", value1, value2, "authorId");
return (Criteria) this;
}
public Criteria andAuthorIdNotBetween(Integer value1, Integer value2) {
addCriterion("author_id not between", value1, value2, "authorId");
return (Criteria) this;
}
public Criteria andAuthorNameIsNull() {
addCriterion("author_name is null");
return (Criteria) this;
}
public Criteria andAuthorNameIsNotNull() {
addCriterion("author_name is not null");
return (Criteria) this;
}
public Criteria andAuthorNameEqualTo(String value) {
addCriterion("author_name =", value, "authorName");
return (Criteria) this;
}
public Criteria andAuthorNameNotEqualTo(String value) {
addCriterion("author_name <>", value, "authorName");
return (Criteria) this;
}
public Criteria andAuthorNameGreaterThan(String value) {
addCriterion("author_name >", value, "authorName");
return (Criteria) this;
}
public Criteria andAuthorNameGreaterThanOrEqualTo(String value) {
addCriterion("author_name >=", value, "authorName");
return (Criteria) this;
}
public Criteria andAuthorNameLessThan(String value) {
addCriterion("author_name <", value, "authorName");
return (Criteria) this;
}
public Criteria andAuthorNameLessThanOrEqualTo(String value) {
addCriterion("author_name <=", value, "authorName");
return (Criteria) this;
}
public Criteria andAuthorNameLike(String value) {
addCriterion("author_name like", value, "authorName");
return (Criteria) this;
}
public Criteria andAuthorNameNotLike(String value) {
addCriterion("author_name not like", value, "authorName");
return (Criteria) this;
}
public Criteria andAuthorNameIn(List<String> values) {
addCriterion("author_name in", values, "authorName");
return (Criteria) this;
}
public Criteria andAuthorNameNotIn(List<String> values) {
addCriterion("author_name not in", values, "authorName");
return (Criteria) this;
}
public Criteria andAuthorNameBetween(String value1, String value2) {
addCriterion("author_name between", value1, value2, "authorName");
return (Criteria) this;
}
public Criteria andAuthorNameNotBetween(String value1, String value2) {
addCriterion("author_name not between", value1, value2, "authorName");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Byte value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Byte value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Byte value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Byte value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(Byte value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Byte value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<Byte> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Byte> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Byte value1, Byte value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Byte value1, Byte value2) {
addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andOriginIdIsNull() {
addCriterion("origin_id is null");
return (Criteria) this;
}
public Criteria andOriginIdIsNotNull() {
addCriterion("origin_id is not null");
return (Criteria) this;
}
public Criteria andOriginIdEqualTo(Integer value) {
addCriterion("origin_id =", value, "originId");
return (Criteria) this;
}
public Criteria andOriginIdNotEqualTo(Integer value) {
addCriterion("origin_id <>", value, "originId");
return (Criteria) this;
}
public Criteria andOriginIdGreaterThan(Integer value) {
addCriterion("origin_id >", value, "originId");
return (Criteria) this;
}
public Criteria andOriginIdGreaterThanOrEqualTo(Integer value) {
addCriterion("origin_id >=", value, "originId");
return (Criteria) this;
}
public Criteria andOriginIdLessThan(Integer value) {
addCriterion("origin_id <", value, "originId");
return (Criteria) this;
}
public Criteria andOriginIdLessThanOrEqualTo(Integer value) {
addCriterion("origin_id <=", value, "originId");
return (Criteria) this;
}
public Criteria andOriginIdIn(List<Integer> values) {
addCriterion("origin_id in", values, "originId");
return (Criteria) this;
}
public Criteria andOriginIdNotIn(List<Integer> values) {
addCriterion("origin_id not in", values, "originId");
return (Criteria) this;
}
public Criteria andOriginIdBetween(Integer value1, Integer value2) {
addCriterion("origin_id between", value1, value2, "originId");
return (Criteria) this;
}
public Criteria andOriginIdNotBetween(Integer value1, Integer value2) {
addCriterion("origin_id not between", value1, value2, "originId");
return (Criteria) this;
}
public Criteria andChapterIdIsNull() {
addCriterion("chapter_id is null");
return (Criteria) this;
}
public Criteria andChapterIdIsNotNull() {
addCriterion("chapter_id is not null");
return (Criteria) this;
}
public Criteria andChapterIdEqualTo(Integer value) {
addCriterion("chapter_id =", value, "chapterId");
return (Criteria) this;
}
public Criteria andChapterIdNotEqualTo(Integer value) {
addCriterion("chapter_id <>", value, "chapterId");
return (Criteria) this;
}
public Criteria andChapterIdGreaterThan(Integer value) {
addCriterion("chapter_id >", value, "chapterId");
return (Criteria) this;
}
public Criteria andChapterIdGreaterThanOrEqualTo(Integer value) {
addCriterion("chapter_id >=", value, "chapterId");
return (Criteria) this;
}
public Criteria andChapterIdLessThan(Integer value) {
addCriterion("chapter_id <", value, "chapterId");
return (Criteria) this;
}
public Criteria andChapterIdLessThanOrEqualTo(Integer value) {
addCriterion("chapter_id <=", value, "chapterId");
return (Criteria) this;
}
public Criteria andChapterIdIn(List<Integer> values) {
addCriterion("chapter_id in", values, "chapterId");
return (Criteria) this;
}
public Criteria andChapterIdNotIn(List<Integer> values) {
addCriterion("chapter_id not in", values, "chapterId");
return (Criteria) this;
}
public Criteria andChapterIdBetween(Integer value1, Integer value2) {
addCriterion("chapter_id between", value1, value2, "chapterId");
return (Criteria) this;
}
public Criteria andChapterIdNotBetween(Integer value1, Integer value2) {
addCriterion("chapter_id not between", value1, value2, "chapterId");
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(Integer value) {
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Integer value) {
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Integer value) {
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(Integer value) {
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Integer value) {
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<Integer> values) {
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Integer> values) {
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Integer value1, Integer value2) {
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Integer value1, Integer value2) {
addCriterion("`status` not between", value1, value2, "status");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table verse
*
* @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 verse
*
* @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);
}
}
}

96
luigi-dao/src/main/java/com/bzgame/server/luigi/dao/mapper/VerseMapper.java

@ -0,0 +1,96 @@
package com.bzgame.server.luigi.dao.mapper;
import com.bzgame.server.luigi.dao.domain.Verse;
import com.bzgame.server.luigi.dao.domain.VerseExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface VerseMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table verse
*
* @mbg.generated
*/
long countByExample(VerseExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table verse
*
* @mbg.generated
*/
int deleteByExample(VerseExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table verse
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table verse
*
* @mbg.generated
*/
int insert(Verse record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table verse
*
* @mbg.generated
*/
int insertSelective(Verse record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table verse
*
* @mbg.generated
*/
List<Verse> selectByExample(VerseExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table verse
*
* @mbg.generated
*/
Verse selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table verse
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") Verse record, @Param("example") VerseExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table verse
*
* @mbg.generated
*/
int updateByExample(@Param("record") Verse record, @Param("example") VerseExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table verse
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(Verse record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table verse
*
* @mbg.generated
*/
int updateByPrimaryKey(Verse record);
}

342
luigi-dao/src/main/resources/mapper/VerseMapper.xml

@ -0,0 +1,342 @@
<?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.bzgame.server.luigi.dao.mapper.VerseMapper">
<resultMap id="BaseResultMap" type="com.bzgame.server.luigi.dao.domain.Verse">
<!--
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="content" jdbcType="VARCHAR" property="content" />
<result column="author_id" jdbcType="INTEGER" property="authorId" />
<result column="author_name" jdbcType="VARCHAR" property="authorName" />
<result column="type" jdbcType="TINYINT" property="type" />
<result column="origin_id" jdbcType="INTEGER" property="originId" />
<result column="chapter_id" jdbcType="INTEGER" property="chapterId" />
<result column="status" jdbcType="INTEGER" property="status" />
</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, content, author_id, author_name, `type`, origin_id, chapter_id, `status`
</sql>
<select id="selectByExample" parameterType="com.bzgame.server.luigi.dao.domain.VerseExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
</if>
'true' as QUERYID,
<include refid="Base_Column_List" />
from verse
<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.Integer" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from verse
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 verse
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.bzgame.server.luigi.dao.domain.VerseExample">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from verse
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.bzgame.server.luigi.dao.domain.Verse">
<!--
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 verse (title, content, author_id,
author_name, `type`, origin_id,
chapter_id, `status`)
values (#{title,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{authorId,jdbcType=INTEGER},
#{authorName,jdbcType=VARCHAR}, #{type,jdbcType=TINYINT}, #{originId,jdbcType=INTEGER},
#{chapterId,jdbcType=INTEGER}, #{status,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.bzgame.server.luigi.dao.domain.Verse">
<!--
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 verse
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null">
title,
</if>
<if test="content != null">
content,
</if>
<if test="authorId != null">
author_id,
</if>
<if test="authorName != null">
author_name,
</if>
<if test="type != null">
`type`,
</if>
<if test="originId != null">
origin_id,
</if>
<if test="chapterId != null">
chapter_id,
</if>
<if test="status != null">
`status`,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="content != null">
#{content,jdbcType=VARCHAR},
</if>
<if test="authorId != null">
#{authorId,jdbcType=INTEGER},
</if>
<if test="authorName != null">
#{authorName,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=TINYINT},
</if>
<if test="originId != null">
#{originId,jdbcType=INTEGER},
</if>
<if test="chapterId != null">
#{chapterId,jdbcType=INTEGER},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.bzgame.server.luigi.dao.domain.VerseExample" resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from verse
<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 verse
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.title != null">
title = #{record.title,jdbcType=VARCHAR},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=VARCHAR},
</if>
<if test="record.authorId != null">
author_id = #{record.authorId,jdbcType=INTEGER},
</if>
<if test="record.authorName != null">
author_name = #{record.authorName,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=TINYINT},
</if>
<if test="record.originId != null">
origin_id = #{record.originId,jdbcType=INTEGER},
</if>
<if test="record.chapterId != null">
chapter_id = #{record.chapterId,jdbcType=INTEGER},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != 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 verse
set id = #{record.id,jdbcType=INTEGER},
title = #{record.title,jdbcType=VARCHAR},
content = #{record.content,jdbcType=VARCHAR},
author_id = #{record.authorId,jdbcType=INTEGER},
author_name = #{record.authorName,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=TINYINT},
origin_id = #{record.originId,jdbcType=INTEGER},
chapter_id = #{record.chapterId,jdbcType=INTEGER},
`status` = #{record.status,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.bzgame.server.luigi.dao.domain.Verse">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update verse
<set>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="content != null">
content = #{content,jdbcType=VARCHAR},
</if>
<if test="authorId != null">
author_id = #{authorId,jdbcType=INTEGER},
</if>
<if test="authorName != null">
author_name = #{authorName,jdbcType=VARCHAR},
</if>
<if test="type != null">
`type` = #{type,jdbcType=TINYINT},
</if>
<if test="originId != null">
origin_id = #{originId,jdbcType=INTEGER},
</if>
<if test="chapterId != null">
chapter_id = #{chapterId,jdbcType=INTEGER},
</if>
<if test="status != null">
`status` = #{status,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.bzgame.server.luigi.dao.domain.Verse">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update verse
set title = #{title,jdbcType=VARCHAR},
content = #{content,jdbcType=VARCHAR},
author_id = #{authorId,jdbcType=INTEGER},
author_name = #{authorName,jdbcType=VARCHAR},
`type` = #{type,jdbcType=TINYINT},
origin_id = #{originId,jdbcType=INTEGER},
chapter_id = #{chapterId,jdbcType=INTEGER},
`status` = #{status,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

2
luigi-dao/src/main/resources/mybatis-generator/generatorConfig.xml

@ -45,7 +45,7 @@
<property name="enableSubPackages" value="false"/>
</javaClientGenerator>
<table tableName="author" enableCountByExample="true" enableUpdateByExample="true"
<table tableName="verse" enableCountByExample="true" enableUpdateByExample="true"
enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<property name="useActualColumnNames" value="false"/>
<generatedKey column="id" sqlStatement="Mysql" identity="true"/>

2
luigi-service/src/main/java/com/bzgame/server/luigi/service/bo/AuthorService.java → luigi-service/src/main/java/com/bzgame/server/luigi/service/AuthorService.java

@ -1,4 +1,4 @@
package com.bzgame.server.luigi.service.bo;
package com.bzgame.server.luigi.service;
import com.bczgame.server.common.exception.BizException;
import com.bczgame.server.common.exception.ExceptionCode;

13
luigi-service/src/main/java/com/bzgame/server/luigi/service/bo/PoemService.java → luigi-service/src/main/java/com/bzgame/server/luigi/service/PoemService.java

@ -1,4 +1,4 @@
package com.bzgame.server.luigi.service.bo;
package com.bzgame.server.luigi.service;
import com.bczgame.server.common.exception.BizException;
import com.bczgame.server.common.exception.ExceptionCode;
@ -49,6 +49,17 @@ public class PoemService {
return res;
}
public CommonList<PoemBo> seek(String title) {
PoemExample example = new PoemExample();
example.createCriteria().andTitleLike(title + "%");
List<Poem> poems = poemMapper.selectByExample(example);
CommonList<PoemBo> res = new CommonList<>();
res.setTotal(poems.size());
res.setList(convert(poems));
return res;
}
public PoemBo detail(Integer id) {
Poem p = poemMapper.selectByPrimaryKey(id);
Author a = authorService.getById(p.getAuthorId());

88
luigi-service/src/main/java/com/bzgame/server/luigi/service/VerseService.java

@ -0,0 +1,88 @@
package com.bzgame.server.luigi.service;
import com.bczgame.server.common.exception.BizException;
import com.bczgame.server.common.exception.ExceptionCode;
import com.bzgame.server.luigi.dao.domain.*;
import com.bzgame.server.luigi.dao.mapper.VerseMapper;
import com.bzgame.server.luigi.service.bo.request.PaginationQuery;
import com.bzgame.server.luigi.service.bo.response.CommonList;
import com.bzgame.server.luigi.service.bo.response.PoemBo;
import com.bzgame.server.luigi.service.constant.DetailTypeEnum;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.List;
/**
* @author nidaren
*/
@Service
public class VerseService {
@Resource
private VerseMapper verseMapper;
@Resource
private PoemService poemService;
public CommonList<Verse> list(PaginationQuery query) {
VerseExample example = new VerseExample();
VerseExample.Criteria criteria = example.createCriteria();
setQuery(query, criteria);
example.setOffset((query.getCurrent() - 1) * query.getPageSize());
example.setLimit(query.getPageSize());
List<Verse> verses = verseMapper.selectByExample(example);
long total = verseMapper.countByExample(example);
CommonList<Verse> res = new CommonList<>();
res.setTotal((int) total);
res.setList(verses);
return res;
}
public Verse detail(Integer id) {
return verseMapper.selectByPrimaryKey(id);
}
public Integer save(Verse v) {
if (v.getOriginId() != null) {
PoemBo poemBo = poemService.detail(v.getOriginId());
v.setAuthorName(poemBo.getAuthorName());
v.setAuthorId(poemBo.getAuthorId());
v.setTitle(poemBo.getTitle());
v.setType(DetailTypeEnum.POEM.getType().byteValue());
}
if (v.getId() != null) {
verseMapper.updateByPrimaryKeySelective(v);
} else {
verseMapper.insertSelective(v);
}
return v.getId();
}
private void setQuery(PaginationQuery query, VerseExample.Criteria criteria) {
criteria.andStatusGreaterThanOrEqualTo(0);
if (CollectionUtils.isEmpty(query.getQuery())) {
return;
}
query.getQuery().forEach(x -> {
switch (x.getKey()) {
case "authorId":
criteria.andAuthorIdEqualTo(Integer.valueOf(x.getVal()));
break;
case "status":
criteria.andStatusEqualTo(Integer.valueOf(x.getVal()));
break;
case "id":
criteria.andIdEqualTo(Integer.valueOf(x.getVal()));
break;
case "originId":
criteria.andOriginIdEqualTo(Integer.valueOf(x.getVal()));
break;
default:
throw new BizException(ExceptionCode.PARAM_ILLEGAL_WARN, "参数非法");
}
});
}
}

32
luigi-service/src/main/java/com/bzgame/server/luigi/service/constant/DetailTypeEnum.java

@ -0,0 +1,32 @@
package com.bzgame.server.luigi.service.constant;
import com.bczgame.server.common.exception.BizException;
import com.bczgame.server.common.exception.ExceptionCode;
public enum DetailTypeEnum {
CREATION(1),
DIARY(2),
DISCUSS(3),
POEM(4),
BOOK(5);
private final Integer type;
DetailTypeEnum(Integer type) {
this.type = type;
}
public static DetailTypeEnum getByType(Integer type) {
for (DetailTypeEnum c : DetailTypeEnum.values()) {
if (c.type.equals(type)) {
return c;
}
}
throw new BizException(ExceptionCode.PARAM_ILLEGAL_WARN, "illegal type");
}
public Integer getType() {
return type;
}
}
Loading…
Cancel
Save