Browse Source

主题

master
nili 3 years ago
parent
commit
e0ad5f0cbe
  1. 55
      luigi-api/src/main/java/com/bzgame/server/luigi/api/rest/CategoryController.java
  2. 42
      luigi-api/src/main/java/com/bzgame/server/luigi/api/rest/TopicController.java
  3. 302
      luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/Category.java
  4. 782
      luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/CategoryExample.java
  5. 166
      luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/Topic.java
  6. 512
      luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/TopicExample.java
  7. 120
      luigi-dao/src/main/java/com/bzgame/server/luigi/dao/mapper/CategoryMapper.java
  8. 120
      luigi-dao/src/main/java/com/bzgame/server/luigi/dao/mapper/TopicMapper.java
  9. 402
      luigi-dao/src/main/resources/mapper/CategoryMapper.xml
  10. 332
      luigi-dao/src/main/resources/mapper/TopicMapper.xml
  11. 2
      luigi-dao/src/main/resources/mybatis-generator/generatorConfig.xml
  12. 95
      luigi-service/src/main/java/com/bzgame/server/luigi/service/CategoryService.java
  13. 18
      luigi-service/src/main/java/com/bzgame/server/luigi/service/PoemService.java
  14. 83
      luigi-service/src/main/java/com/bzgame/server/luigi/service/TopicService.java
  15. 30
      luigi-service/src/main/java/com/bzgame/server/luigi/service/bo/response/CategoryDetail.java
  16. 7
      luigi-service/src/main/java/com/bzgame/server/luigi/service/bo/response/CommonList.java
  17. 29
      luigi-service/src/main/java/com/bzgame/server/luigi/service/bo/response/TopicDetail.java

55
luigi-api/src/main/java/com/bzgame/server/luigi/api/rest/CategoryController.java

@ -0,0 +1,55 @@
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.dao.domain.Category;
import com.bzgame.server.luigi.service.CategoryService;
import com.bzgame.server.luigi.service.bo.request.PaginationQuery;
import com.bzgame.server.luigi.service.bo.response.CategoryDetail;
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;
/**
* @author nidaren
*/
@RestController
@RequestMapping("/api/luigi/category")
@Api(tags = "category")
public class CategoryController {
@Resource
private CategoryService categoryService;
@GetMapping("/seek")
@ApiFlag
public Response<CommonList<Category>> seekCategory(@RequestParam String title) {
if (StringUtils.isEmpty(title)) {
return new Response<>(new CommonList<>(), "ok", Response.CODE_SUCCESS);
}
return new Response<>(categoryService.seek(title), "ok", Response.CODE_SUCCESS);
}
@PostMapping("/list")
@ApiFlag
public Response<CommonList<Category>> categoryList(@RequestBody PaginationQuery query) {
return new Response<>(categoryService.query(query), "ok", Response.CODE_SUCCESS);
}
@GetMapping("/detail")
@ApiFlag
public Response<CategoryDetail> categoryDetail(@RequestParam Integer id) {
return new Response<>(categoryService.detail(id), "ok", Response.CODE_SUCCESS);
}
@PostMapping("/save")
@ApiFlag
public Response<Integer> saveCategory(@RequestBody Category category) {
return new Response<>(categoryService.save(category), "ok", 1);
}
}

42
luigi-api/src/main/java/com/bzgame/server/luigi/api/rest/TopicController.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.Topic;
import com.bzgame.server.luigi.service.TopicService;
import com.bzgame.server.luigi.service.bo.response.CommonList;
import com.bzgame.server.luigi.service.bo.response.TopicDetail;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @author nidaren
*/
@RestController
@RequestMapping("/api/luigi/topic")
@Api(tags = "topic")
public class TopicController {
@Resource
private TopicService topicService;
@GetMapping("/list")
@ApiFlag
public Response<CommonList<Topic>> getTopicList() {
return new Response<>(topicService.allTopic(), "ok", Response.CODE_SUCCESS);
}
@GetMapping("/detail")
@ApiFlag
public Response<TopicDetail> getTopicDetail(@RequestParam Integer id) {
return new Response<>(topicService.topicDetail(id), "ok", Response.CODE_SUCCESS);
}
@PostMapping("/save")
@ApiFlag
public Response<Integer> saveTopic(@RequestBody TopicDetail detail) {
return new Response<>(topicService.saveTopicDetail(detail), "ok", Response.CODE_SUCCESS);
}
}

302
luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/Category.java

@ -0,0 +1,302 @@
package com.bzgame.server.luigi.dao.domain;
import java.io.Serializable;
public class Category implements Serializable {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column category.id
*
* @mbg.generated
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column category.title
*
* @mbg.generated
*/
private String title;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column category.sub_title
*
* @mbg.generated
*/
private String subTitle;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column category.desc
*
* @mbg.generated
*/
private String desc;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column category.image
*
* @mbg.generated
*/
private String image;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column category.type
*
* @mbg.generated
*/
private Byte type;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column category.status
*
* @mbg.generated
*/
private Integer status;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column category.poem_ids
*
* @mbg.generated
*/
private String poemIds;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table category
*
* @mbg.generated
*/
private static final long serialVersionUID = 1L;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column category.id
*
* @return the value of category.id
*
* @mbg.generated
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column category.id
*
* @param id the value for category.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 category.title
*
* @return the value of category.title
*
* @mbg.generated
*/
public String getTitle() {
return title;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column category.title
*
* @param title the value for category.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 category.sub_title
*
* @return the value of category.sub_title
*
* @mbg.generated
*/
public String getSubTitle() {
return subTitle;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column category.sub_title
*
* @param subTitle the value for category.sub_title
*
* @mbg.generated
*/
public void setSubTitle(String subTitle) {
this.subTitle = subTitle == null ? null : subTitle.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column category.desc
*
* @return the value of category.desc
*
* @mbg.generated
*/
public String getDesc() {
return desc;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column category.desc
*
* @param desc the value for category.desc
*
* @mbg.generated
*/
public void setDesc(String desc) {
this.desc = desc == null ? null : desc.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column category.image
*
* @return the value of category.image
*
* @mbg.generated
*/
public String getImage() {
return image;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column category.image
*
* @param image the value for category.image
*
* @mbg.generated
*/
public void setImage(String image) {
this.image = image == null ? null : image.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column category.type
*
* @return the value of category.type
*
* @mbg.generated
*/
public Byte getType() {
return type;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column category.type
*
* @param type the value for category.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 category.status
*
* @return the value of category.status
*
* @mbg.generated
*/
public Integer getStatus() {
return status;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column category.status
*
* @param status the value for category.status
*
* @mbg.generated
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column category.poem_ids
*
* @return the value of category.poem_ids
*
* @mbg.generated
*/
public String getPoemIds() {
return poemIds;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column category.poem_ids
*
* @param poemIds the value for category.poem_ids
*
* @mbg.generated
*/
public void setPoemIds(String poemIds) {
this.poemIds = poemIds == null ? null : poemIds.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table category
*
* @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(", subTitle=").append(subTitle);
sb.append(", desc=").append(desc);
sb.append(", image=").append(image);
sb.append(", type=").append(type);
sb.append(", status=").append(status);
sb.append(", poemIds=").append(poemIds);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

782
luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/CategoryExample.java

@ -0,0 +1,782 @@
package com.bzgame.server.luigi.dao.domain;
import java.util.ArrayList;
import java.util.List;
public class CategoryExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table category
*
* @mbg.generated
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table category
*
* @mbg.generated
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table category
*
* @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 category
*
* @mbg.generated
*/
public CategoryExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table category
*
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table category
*
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table category
*
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table category
*
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table category
*
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table category
*
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table category
*
* @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 category
*
* @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 category
*
* @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 category
*
* @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 category
*
* @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 andSubTitleIsNull() {
addCriterion("sub_title is null");
return (Criteria) this;
}
public Criteria andSubTitleIsNotNull() {
addCriterion("sub_title is not null");
return (Criteria) this;
}
public Criteria andSubTitleEqualTo(String value) {
addCriterion("sub_title =", value, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleNotEqualTo(String value) {
addCriterion("sub_title <>", value, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleGreaterThan(String value) {
addCriterion("sub_title >", value, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleGreaterThanOrEqualTo(String value) {
addCriterion("sub_title >=", value, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleLessThan(String value) {
addCriterion("sub_title <", value, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleLessThanOrEqualTo(String value) {
addCriterion("sub_title <=", value, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleLike(String value) {
addCriterion("sub_title like", value, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleNotLike(String value) {
addCriterion("sub_title not like", value, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleIn(List<String> values) {
addCriterion("sub_title in", values, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleNotIn(List<String> values) {
addCriterion("sub_title not in", values, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleBetween(String value1, String value2) {
addCriterion("sub_title between", value1, value2, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleNotBetween(String value1, String value2) {
addCriterion("sub_title not between", value1, value2, "subTitle");
return (Criteria) this;
}
public Criteria andDescIsNull() {
addCriterion("`desc` is null");
return (Criteria) this;
}
public Criteria andDescIsNotNull() {
addCriterion("`desc` is not null");
return (Criteria) this;
}
public Criteria andDescEqualTo(String value) {
addCriterion("`desc` =", value, "desc");
return (Criteria) this;
}
public Criteria andDescNotEqualTo(String value) {
addCriterion("`desc` <>", value, "desc");
return (Criteria) this;
}
public Criteria andDescGreaterThan(String value) {
addCriterion("`desc` >", value, "desc");
return (Criteria) this;
}
public Criteria andDescGreaterThanOrEqualTo(String value) {
addCriterion("`desc` >=", value, "desc");
return (Criteria) this;
}
public Criteria andDescLessThan(String value) {
addCriterion("`desc` <", value, "desc");
return (Criteria) this;
}
public Criteria andDescLessThanOrEqualTo(String value) {
addCriterion("`desc` <=", value, "desc");
return (Criteria) this;
}
public Criteria andDescLike(String value) {
addCriterion("`desc` like", value, "desc");
return (Criteria) this;
}
public Criteria andDescNotLike(String value) {
addCriterion("`desc` not like", value, "desc");
return (Criteria) this;
}
public Criteria andDescIn(List<String> values) {
addCriterion("`desc` in", values, "desc");
return (Criteria) this;
}
public Criteria andDescNotIn(List<String> values) {
addCriterion("`desc` not in", values, "desc");
return (Criteria) this;
}
public Criteria andDescBetween(String value1, String value2) {
addCriterion("`desc` between", value1, value2, "desc");
return (Criteria) this;
}
public Criteria andDescNotBetween(String value1, String value2) {
addCriterion("`desc` not between", value1, value2, "desc");
return (Criteria) this;
}
public Criteria andImageIsNull() {
addCriterion("image is null");
return (Criteria) this;
}
public Criteria andImageIsNotNull() {
addCriterion("image is not null");
return (Criteria) this;
}
public Criteria andImageEqualTo(String value) {
addCriterion("image =", value, "image");
return (Criteria) this;
}
public Criteria andImageNotEqualTo(String value) {
addCriterion("image <>", value, "image");
return (Criteria) this;
}
public Criteria andImageGreaterThan(String value) {
addCriterion("image >", value, "image");
return (Criteria) this;
}
public Criteria andImageGreaterThanOrEqualTo(String value) {
addCriterion("image >=", value, "image");
return (Criteria) this;
}
public Criteria andImageLessThan(String value) {
addCriterion("image <", value, "image");
return (Criteria) this;
}
public Criteria andImageLessThanOrEqualTo(String value) {
addCriterion("image <=", value, "image");
return (Criteria) this;
}
public Criteria andImageLike(String value) {
addCriterion("image like", value, "image");
return (Criteria) this;
}
public Criteria andImageNotLike(String value) {
addCriterion("image not like", value, "image");
return (Criteria) this;
}
public Criteria andImageIn(List<String> values) {
addCriterion("image in", values, "image");
return (Criteria) this;
}
public Criteria andImageNotIn(List<String> values) {
addCriterion("image not in", values, "image");
return (Criteria) this;
}
public Criteria andImageBetween(String value1, String value2) {
addCriterion("image between", value1, value2, "image");
return (Criteria) this;
}
public Criteria andImageNotBetween(String value1, String value2) {
addCriterion("image not between", value1, value2, "image");
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 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 category
*
* @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 category
*
* @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);
}
}
}

166
luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/Topic.java

@ -0,0 +1,166 @@
package com.bzgame.server.luigi.dao.domain;
import java.io.Serializable;
public class Topic implements Serializable {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column topic.id
*
* @mbg.generated
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column topic.title
*
* @mbg.generated
*/
private String title;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column topic.status
*
* @mbg.generated
*/
private Integer status;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column topic.cids
*
* @mbg.generated
*/
private String cids;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table topic
*
* @mbg.generated
*/
private static final long serialVersionUID = 1L;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column topic.id
*
* @return the value of topic.id
*
* @mbg.generated
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column topic.id
*
* @param id the value for topic.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 topic.title
*
* @return the value of topic.title
*
* @mbg.generated
*/
public String getTitle() {
return title;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column topic.title
*
* @param title the value for topic.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 topic.status
*
* @return the value of topic.status
*
* @mbg.generated
*/
public Integer getStatus() {
return status;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column topic.status
*
* @param status the value for topic.status
*
* @mbg.generated
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column topic.cids
*
* @return the value of topic.cids
*
* @mbg.generated
*/
public String getCids() {
return cids;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column topic.cids
*
* @param cids the value for topic.cids
*
* @mbg.generated
*/
public void setCids(String cids) {
this.cids = cids == null ? null : cids.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table topic
*
* @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(", status=").append(status);
sb.append(", cids=").append(cids);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

512
luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/TopicExample.java

@ -0,0 +1,512 @@
package com.bzgame.server.luigi.dao.domain;
import java.util.ArrayList;
import java.util.List;
public class TopicExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table topic
*
* @mbg.generated
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table topic
*
* @mbg.generated
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table topic
*
* @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 topic
*
* @mbg.generated
*/
public TopicExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table topic
*
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table topic
*
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table topic
*
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table topic
*
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table topic
*
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table topic
*
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table topic
*
* @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 topic
*
* @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 topic
*
* @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 topic
*
* @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 topic
*
* @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 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 topic
*
* @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 topic
*
* @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);
}
}
}

120
luigi-dao/src/main/java/com/bzgame/server/luigi/dao/mapper/CategoryMapper.java

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

120
luigi-dao/src/main/java/com/bzgame/server/luigi/dao/mapper/TopicMapper.java

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

402
luigi-dao/src/main/resources/mapper/CategoryMapper.xml

@ -0,0 +1,402 @@
<?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.CategoryMapper">
<resultMap id="BaseResultMap" type="com.bzgame.server.luigi.dao.domain.Category">
<!--
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="sub_title" jdbcType="VARCHAR" property="subTitle" />
<result column="desc" jdbcType="VARCHAR" property="desc" />
<result column="image" jdbcType="VARCHAR" property="image" />
<result column="type" jdbcType="TINYINT" property="type" />
<result column="status" jdbcType="INTEGER" property="status" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.bzgame.server.luigi.dao.domain.Category">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<result column="poem_ids" jdbcType="LONGVARCHAR" property="poemIds" />
</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, sub_title, `desc`, image, `type`, `status`
</sql>
<sql id="Blob_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
poem_ids
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.bzgame.server.luigi.dao.domain.CategoryExample" resultMap="ResultMapWithBLOBs">
<!--
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" />
,
<include refid="Blob_Column_List" />
from category
<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="com.bzgame.server.luigi.dao.domain.CategoryExample" 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 category
<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="ResultMapWithBLOBs">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from category
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 category
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.bzgame.server.luigi.dao.domain.CategoryExample">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from category
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.bzgame.server.luigi.dao.domain.Category">
<!--
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 category (title, sub_title, `desc`,
image, `type`, `status`,
poem_ids)
values (#{title,jdbcType=VARCHAR}, #{subTitle,jdbcType=VARCHAR}, #{desc,jdbcType=VARCHAR},
#{image,jdbcType=VARCHAR}, #{type,jdbcType=TINYINT}, #{status,jdbcType=INTEGER},
#{poemIds,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.bzgame.server.luigi.dao.domain.Category">
<!--
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 category
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null">
title,
</if>
<if test="subTitle != null">
sub_title,
</if>
<if test="desc != null">
`desc`,
</if>
<if test="image != null">
image,
</if>
<if test="type != null">
`type`,
</if>
<if test="status != null">
`status`,
</if>
<if test="poemIds != null">
poem_ids,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="subTitle != null">
#{subTitle,jdbcType=VARCHAR},
</if>
<if test="desc != null">
#{desc,jdbcType=VARCHAR},
</if>
<if test="image != null">
#{image,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=TINYINT},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="poemIds != null">
#{poemIds,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.bzgame.server.luigi.dao.domain.CategoryExample" resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from category
<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 category
<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.subTitle != null">
sub_title = #{record.subTitle,jdbcType=VARCHAR},
</if>
<if test="record.desc != null">
`desc` = #{record.desc,jdbcType=VARCHAR},
</if>
<if test="record.image != null">
image = #{record.image,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=TINYINT},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.poemIds != null">
poem_ids = #{record.poemIds,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update category
set id = #{record.id,jdbcType=INTEGER},
title = #{record.title,jdbcType=VARCHAR},
sub_title = #{record.subTitle,jdbcType=VARCHAR},
`desc` = #{record.desc,jdbcType=VARCHAR},
image = #{record.image,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=TINYINT},
`status` = #{record.status,jdbcType=INTEGER},
poem_ids = #{record.poemIds,jdbcType=LONGVARCHAR}
<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 category
set id = #{record.id,jdbcType=INTEGER},
title = #{record.title,jdbcType=VARCHAR},
sub_title = #{record.subTitle,jdbcType=VARCHAR},
`desc` = #{record.desc,jdbcType=VARCHAR},
image = #{record.image,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=TINYINT},
`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.Category">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update category
<set>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="subTitle != null">
sub_title = #{subTitle,jdbcType=VARCHAR},
</if>
<if test="desc != null">
`desc` = #{desc,jdbcType=VARCHAR},
</if>
<if test="image != null">
image = #{image,jdbcType=VARCHAR},
</if>
<if test="type != null">
`type` = #{type,jdbcType=TINYINT},
</if>
<if test="status != null">
`status` = #{status,jdbcType=INTEGER},
</if>
<if test="poemIds != null">
poem_ids = #{poemIds,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.bzgame.server.luigi.dao.domain.Category">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update category
set title = #{title,jdbcType=VARCHAR},
sub_title = #{subTitle,jdbcType=VARCHAR},
`desc` = #{desc,jdbcType=VARCHAR},
image = #{image,jdbcType=VARCHAR},
`type` = #{type,jdbcType=TINYINT},
`status` = #{status,jdbcType=INTEGER},
poem_ids = #{poemIds,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.bzgame.server.luigi.dao.domain.Category">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update category
set title = #{title,jdbcType=VARCHAR},
sub_title = #{subTitle,jdbcType=VARCHAR},
`desc` = #{desc,jdbcType=VARCHAR},
image = #{image,jdbcType=VARCHAR},
`type` = #{type,jdbcType=TINYINT},
`status` = #{status,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

332
luigi-dao/src/main/resources/mapper/TopicMapper.xml

@ -0,0 +1,332 @@
<?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.TopicMapper">
<resultMap id="BaseResultMap" type="com.bzgame.server.luigi.dao.domain.Topic">
<!--
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="status" jdbcType="INTEGER" property="status" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.bzgame.server.luigi.dao.domain.Topic">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<result column="cids" jdbcType="LONGVARCHAR" property="cids" />
</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, `status`
</sql>
<sql id="Blob_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
cids
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.bzgame.server.luigi.dao.domain.TopicExample" resultMap="ResultMapWithBLOBs">
<!--
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" />
,
<include refid="Blob_Column_List" />
from topic
<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="com.bzgame.server.luigi.dao.domain.TopicExample" 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 topic
<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="ResultMapWithBLOBs">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from topic
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 topic
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.bzgame.server.luigi.dao.domain.TopicExample">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from topic
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.bzgame.server.luigi.dao.domain.Topic">
<!--
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 topic (title, `status`, cids
)
values (#{title,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{cids,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.bzgame.server.luigi.dao.domain.Topic">
<!--
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 topic
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null">
title,
</if>
<if test="status != null">
`status`,
</if>
<if test="cids != null">
cids,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="cids != null">
#{cids,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.bzgame.server.luigi.dao.domain.TopicExample" resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from topic
<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 topic
<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.status != null">
`status` = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.cids != null">
cids = #{record.cids,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update topic
set id = #{record.id,jdbcType=INTEGER},
title = #{record.title,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=INTEGER},
cids = #{record.cids,jdbcType=LONGVARCHAR}
<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 topic
set id = #{record.id,jdbcType=INTEGER},
title = #{record.title,jdbcType=VARCHAR},
`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.Topic">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update topic
<set>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="status != null">
`status` = #{status,jdbcType=INTEGER},
</if>
<if test="cids != null">
cids = #{cids,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.bzgame.server.luigi.dao.domain.Topic">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update topic
set title = #{title,jdbcType=VARCHAR},
`status` = #{status,jdbcType=INTEGER},
cids = #{cids,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.bzgame.server.luigi.dao.domain.Topic">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update topic
set title = #{title,jdbcType=VARCHAR},
`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"/> <property name="enableSubPackages" value="false"/>
</javaClientGenerator> </javaClientGenerator>
<table tableName="verse" enableCountByExample="true" enableUpdateByExample="true" <table tableName="category" enableCountByExample="true" enableUpdateByExample="true"
enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true"> enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<property name="useActualColumnNames" value="false"/> <property name="useActualColumnNames" value="false"/>
<generatedKey column="id" sqlStatement="Mysql" identity="true"/> <generatedKey column="id" sqlStatement="Mysql" identity="true"/>

95
luigi-service/src/main/java/com/bzgame/server/luigi/service/CategoryService.java

@ -0,0 +1,95 @@
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.Category;
import com.bzgame.server.luigi.dao.domain.CategoryExample;
import com.bzgame.server.luigi.dao.domain.VerseExample;
import com.bzgame.server.luigi.dao.mapper.CategoryMapper;
import com.bzgame.server.luigi.service.bo.request.PaginationQuery;
import com.bzgame.server.luigi.service.bo.response.CategoryDetail;
import com.bzgame.server.luigi.service.bo.response.CommonList;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.List;
/**
* @author nidaren
*/
@Service
public class CategoryService {
@Resource
private CategoryMapper categoryMapper;
@Resource
private PoemService poemService;
public CommonList<Category> seek(String title) {
CategoryExample example = new CategoryExample();
example.createCriteria().andTitleLike(title + "%").andStatusGreaterThanOrEqualTo(0);
List<Category> categoryList = categoryMapper.selectByExample(example);
return new CommonList<>(categoryList);
}
public CommonList<Category> query(PaginationQuery query) {
CategoryExample example = new CategoryExample();
CategoryExample.Criteria criteria = example.createCriteria();
setQuery(query, criteria);
example.setOffset((query.getCurrent() - 1) * query.getPageSize());
example.setLimit(query.getPageSize());
List<Category> list = categoryMapper.selectByExample(example);
CommonList<Category> res = new CommonList<>(list);
res.setTotal((int) categoryMapper.countByExample(example));
return res;
}
public CategoryDetail detail(Integer id) {
Category c = categoryMapper.selectByPrimaryKey(id);
CategoryDetail detail = new CategoryDetail(c);
if (!StringUtils.hasText(c.getPoemIds())) {
return detail;
}
Gson gson = new Gson();
List<Integer> poemIds = gson.fromJson(c.getPoemIds(), new TypeToken<List<Integer>>() {
}.getType());
detail.setPoems(poemService.getByIds(poemIds));
return detail;
}
public Integer save(Category category) {
if (category.getId() != null) {
categoryMapper.updateByPrimaryKeySelective(category);
} else {
categoryMapper.insertSelective(category);
}
return category.getId();
}
private void setQuery(PaginationQuery query, CategoryExample.Criteria criteria) {
criteria.andStatusGreaterThanOrEqualTo(0);
if (CollectionUtils.isEmpty(query.getQuery())) {
return;
}
query.getQuery().forEach(x -> {
switch (x.getKey()) {
case "status":
criteria.andStatusEqualTo(Integer.valueOf(x.getVal()));
break;
case "id":
criteria.andIdEqualTo(Integer.valueOf(x.getVal()));
break;
case "title":
criteria.andTitleLike(x.getVal() + "%");
break;
default:
throw new BizException(ExceptionCode.PARAM_ILLEGAL_WARN, "参数非法");
}
});
}
}

18
luigi-service/src/main/java/com/bzgame/server/luigi/service/PoemService.java

@ -17,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -96,6 +97,23 @@ public class PoemService {
return p.getId(); return p.getId();
} }
public List<Poem> getByIds(List<Integer> ids) {
if (CollectionUtils.isEmpty(ids)) {
return new ArrayList<>();
}
PoemExample example = new PoemExample();
example.createCriteria().andIdIn(ids).andStatusGreaterThanOrEqualTo(0);
List<Poem> data = poemMapper.selectByExample(example);
Map<Integer, Poem> map = data.stream().collect(Collectors.toMap(Poem::getId, x->x));
List<Poem> res =new ArrayList<>();
for(Integer id: ids) {
if(map.containsKey(id)) {
res.add(map.get(id));
}
}
return res;
}
private List<PoemBo> convert(List<Poem> poems) { private List<PoemBo> convert(List<Poem> poems) {
List<Integer> authorIds = poems.stream().map(Poem::getAuthorId).collect(Collectors.toList()); List<Integer> authorIds = poems.stream().map(Poem::getAuthorId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(authorIds)) { if (CollectionUtils.isEmpty(authorIds)) {

83
luigi-service/src/main/java/com/bzgame/server/luigi/service/TopicService.java

@ -0,0 +1,83 @@
package com.bzgame.server.luigi.service;
import com.bzgame.server.luigi.dao.domain.Category;
import com.bzgame.server.luigi.dao.domain.CategoryExample;
import com.bzgame.server.luigi.dao.domain.Topic;
import com.bzgame.server.luigi.dao.domain.TopicExample;
import com.bzgame.server.luigi.dao.mapper.CategoryMapper;
import com.bzgame.server.luigi.dao.mapper.TopicMapper;
import com.bzgame.server.luigi.service.bo.response.CommonList;
import com.bzgame.server.luigi.service.bo.response.TopicDetail;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author nidaren
*/
@Service
public class TopicService {
@Resource
private TopicMapper topicMapper;
@Resource
private CategoryMapper categoryMapper;
private static Gson gson = new Gson();
public CommonList<Topic> allTopic() {
TopicExample example = new TopicExample();
example.createCriteria().andStatusGreaterThanOrEqualTo(0);
List<Topic> topics = topicMapper.selectByExample(example);
CommonList<Topic> res = new CommonList<>();
res.setList(topics);
return res;
}
public TopicDetail topicDetail(Integer id) {
Topic topic = topicMapper.selectByPrimaryKey(id);
TopicDetail detail = new TopicDetail(topic);
if (!StringUtils.hasText(topic.getCids())) {
return detail;
}
List<Integer> cids = gson.fromJson(topic.getCids(), new TypeToken<List<Integer>>() {
}.getType());
detail.setCategoryList(getByIds(cids));
return detail;
}
public Integer saveTopicDetail(TopicDetail topicDetail) {
if (topicDetail.getId() != null) {
topicMapper.updateByPrimaryKeySelective(topicDetail);
} else {
topicMapper.insertSelective(topicDetail);
}
return topicDetail.getId();
}
public List<Category> getByIds(List<Integer> cids) {
if (CollectionUtils.isEmpty(cids)) {
return new ArrayList<>();
}
CategoryExample example = new CategoryExample();
example.createCriteria().andIdIn(cids).andStatusGreaterThanOrEqualTo(0);
List<Category> categoryList = categoryMapper.selectByExample(example);
Map<Integer, Category> cMap = categoryList.stream().collect(Collectors.toMap(Category::getId, x -> x));
List<Category> res = new ArrayList<>();
for (Integer id : cids) {
if (cMap.containsKey(id)) {
res.add(cMap.get(id));
}
}
return res;
}
}

30
luigi-service/src/main/java/com/bzgame/server/luigi/service/bo/response/CategoryDetail.java

@ -0,0 +1,30 @@
package com.bzgame.server.luigi.service.bo.response;
import com.bzgame.server.luigi.dao.domain.Category;
import com.bzgame.server.luigi.dao.domain.Poem;
import org.springframework.beans.BeanUtils;
import java.util.List;
/**
* @author nidaren
*/
public class CategoryDetail extends Category {
private List<Poem> poems;
public CategoryDetail() {
}
public CategoryDetail(Category category) {
BeanUtils.copyProperties(category, this);
}
public List<Poem> getPoems() {
return poems;
}
public void setPoems(List<Poem> poems) {
this.poems = poems;
}
}

7
luigi-service/src/main/java/com/bzgame/server/luigi/service/bo/response/CommonList.java

@ -11,6 +11,13 @@ public class CommonList<T> {
private Integer pageSize; private Integer pageSize;
private Integer current; private Integer current;
public CommonList() {
}
public CommonList(List<T> list) {
this.list = list;
}
public List<T> getList() { public List<T> getList() {
return list; return list;
} }

29
luigi-service/src/main/java/com/bzgame/server/luigi/service/bo/response/TopicDetail.java

@ -0,0 +1,29 @@
package com.bzgame.server.luigi.service.bo.response;
import com.bzgame.server.luigi.dao.domain.Category;
import com.bzgame.server.luigi.dao.domain.Topic;
import org.springframework.beans.BeanUtils;
import java.util.List;
/**
* @author nidaren
*/
public class TopicDetail extends Topic {
private List<Category> categoryList;
public TopicDetail() {
}
public TopicDetail(Topic t) {
BeanUtils.copyProperties(t, this);
}
public List<Category> getCategoryList() {
return categoryList;
}
public void setCategoryList(List<Category> categoryList) {
this.categoryList = categoryList;
}
}
Loading…
Cancel
Save