From e0ad5f0cbe54f54dc5f9d5839b3d3cd92dfbc18f Mon Sep 17 00:00:00 2001 From: nili Date: Thu, 14 Apr 2022 16:07:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../luigi/api/rest/CategoryController.java | 55 ++ .../luigi/api/rest/TopicController.java | 42 + .../server/luigi/dao/domain/Category.java | 302 +++++++ .../luigi/dao/domain/CategoryExample.java | 782 ++++++++++++++++++ .../bzgame/server/luigi/dao/domain/Topic.java | 166 ++++ .../server/luigi/dao/domain/TopicExample.java | 512 ++++++++++++ .../luigi/dao/mapper/CategoryMapper.java | 120 +++ .../server/luigi/dao/mapper/TopicMapper.java | 120 +++ .../main/resources/mapper/CategoryMapper.xml | 402 +++++++++ .../src/main/resources/mapper/TopicMapper.xml | 332 ++++++++ .../mybatis-generator/generatorConfig.xml | 2 +- .../server/luigi/service/CategoryService.java | 95 +++ .../server/luigi/service/PoemService.java | 18 + .../server/luigi/service/TopicService.java | 83 ++ .../service/bo/response/CategoryDetail.java | 30 + .../luigi/service/bo/response/CommonList.java | 7 + .../service/bo/response/TopicDetail.java | 29 + 17 files changed, 3096 insertions(+), 1 deletion(-) create mode 100644 luigi-api/src/main/java/com/bzgame/server/luigi/api/rest/CategoryController.java create mode 100644 luigi-api/src/main/java/com/bzgame/server/luigi/api/rest/TopicController.java create mode 100644 luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/Category.java create mode 100644 luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/CategoryExample.java create mode 100644 luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/Topic.java create mode 100644 luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/TopicExample.java create mode 100644 luigi-dao/src/main/java/com/bzgame/server/luigi/dao/mapper/CategoryMapper.java create mode 100644 luigi-dao/src/main/java/com/bzgame/server/luigi/dao/mapper/TopicMapper.java create mode 100644 luigi-dao/src/main/resources/mapper/CategoryMapper.xml create mode 100644 luigi-dao/src/main/resources/mapper/TopicMapper.xml create mode 100644 luigi-service/src/main/java/com/bzgame/server/luigi/service/CategoryService.java create mode 100644 luigi-service/src/main/java/com/bzgame/server/luigi/service/TopicService.java create mode 100644 luigi-service/src/main/java/com/bzgame/server/luigi/service/bo/response/CategoryDetail.java create mode 100644 luigi-service/src/main/java/com/bzgame/server/luigi/service/bo/response/TopicDetail.java diff --git a/luigi-api/src/main/java/com/bzgame/server/luigi/api/rest/CategoryController.java b/luigi-api/src/main/java/com/bzgame/server/luigi/api/rest/CategoryController.java new file mode 100644 index 0000000..8b563c6 --- /dev/null +++ b/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> 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> categoryList(@RequestBody PaginationQuery query) { + return new Response<>(categoryService.query(query), "ok", Response.CODE_SUCCESS); + } + + + @GetMapping("/detail") + @ApiFlag + public Response categoryDetail(@RequestParam Integer id) { + return new Response<>(categoryService.detail(id), "ok", Response.CODE_SUCCESS); + } + + @PostMapping("/save") + @ApiFlag + public Response saveCategory(@RequestBody Category category) { + return new Response<>(categoryService.save(category), "ok", 1); + } +} diff --git a/luigi-api/src/main/java/com/bzgame/server/luigi/api/rest/TopicController.java b/luigi-api/src/main/java/com/bzgame/server/luigi/api/rest/TopicController.java new file mode 100644 index 0000000..f478979 --- /dev/null +++ b/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> getTopicList() { + return new Response<>(topicService.allTopic(), "ok", Response.CODE_SUCCESS); + } + + @GetMapping("/detail") + @ApiFlag + public Response getTopicDetail(@RequestParam Integer id) { + return new Response<>(topicService.topicDetail(id), "ok", Response.CODE_SUCCESS); + } + + @PostMapping("/save") + @ApiFlag + public Response saveTopic(@RequestBody TopicDetail detail) { + return new Response<>(topicService.saveTopicDetail(detail), "ok", Response.CODE_SUCCESS); + } + +} diff --git a/luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/Category.java b/luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/Category.java new file mode 100644 index 0000000..426433a --- /dev/null +++ b/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(); + } +} \ No newline at end of file diff --git a/luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/CategoryExample.java b/luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/CategoryExample.java new file mode 100644 index 0000000..1b8f00e --- /dev/null +++ b/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 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(); + } + + /** + * 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 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 criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria 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 values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List 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 values) { + addCriterion("title in", values, "title"); + return (Criteria) this; + } + + public Criteria andTitleNotIn(List 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 values) { + addCriterion("sub_title in", values, "subTitle"); + return (Criteria) this; + } + + public Criteria andSubTitleNotIn(List 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 values) { + addCriterion("`desc` in", values, "desc"); + return (Criteria) this; + } + + public Criteria andDescNotIn(List 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 values) { + addCriterion("image in", values, "image"); + return (Criteria) this; + } + + public Criteria andImageNotIn(List 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 values) { + addCriterion("`type` in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotIn(List 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 values) { + addCriterion("`status` in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotIn(List 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); + } + } +} \ No newline at end of file diff --git a/luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/Topic.java b/luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/Topic.java new file mode 100644 index 0000000..d9134ad --- /dev/null +++ b/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(); + } +} \ No newline at end of file diff --git a/luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/TopicExample.java b/luigi-dao/src/main/java/com/bzgame/server/luigi/dao/domain/TopicExample.java new file mode 100644 index 0000000..576bc91 --- /dev/null +++ b/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 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(); + } + + /** + * 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 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 criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria 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 values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List 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 values) { + addCriterion("title in", values, "title"); + return (Criteria) this; + } + + public Criteria andTitleNotIn(List 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 values) { + addCriterion("`status` in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotIn(List 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); + } + } +} \ No newline at end of file diff --git a/luigi-dao/src/main/java/com/bzgame/server/luigi/dao/mapper/CategoryMapper.java b/luigi-dao/src/main/java/com/bzgame/server/luigi/dao/mapper/CategoryMapper.java new file mode 100644 index 0000000..08207d2 --- /dev/null +++ b/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 selectByExampleWithBLOBs(CategoryExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table category + * + * @mbg.generated + */ + List 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); +} \ No newline at end of file diff --git a/luigi-dao/src/main/java/com/bzgame/server/luigi/dao/mapper/TopicMapper.java b/luigi-dao/src/main/java/com/bzgame/server/luigi/dao/mapper/TopicMapper.java new file mode 100644 index 0000000..c05fc05 --- /dev/null +++ b/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 selectByExampleWithBLOBs(TopicExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table topic + * + * @mbg.generated + */ + List 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); +} \ No newline at end of file diff --git a/luigi-dao/src/main/resources/mapper/CategoryMapper.xml b/luigi-dao/src/main/resources/mapper/CategoryMapper.xml new file mode 100644 index 0000000..7a99bd1 --- /dev/null +++ b/luigi-dao/src/main/resources/mapper/CategoryMapper.xml @@ -0,0 +1,402 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + id, title, sub_title, `desc`, image, `type`, `status` + + + + poem_ids + + + + + + + delete from category + where id = #{id,jdbcType=INTEGER} + + + + delete from category + + + + + + + + SELECT LAST_INSERT_ID() + + 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}) + + + + + SELECT LAST_INSERT_ID() + + insert into category + + + title, + + + sub_title, + + + `desc`, + + + image, + + + `type`, + + + `status`, + + + poem_ids, + + + + + #{title,jdbcType=VARCHAR}, + + + #{subTitle,jdbcType=VARCHAR}, + + + #{desc,jdbcType=VARCHAR}, + + + #{image,jdbcType=VARCHAR}, + + + #{type,jdbcType=TINYINT}, + + + #{status,jdbcType=INTEGER}, + + + #{poemIds,jdbcType=LONGVARCHAR}, + + + + + + + update category + + + 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}, + + + + + + + + + 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} + + + + + + + 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} + + + + + + + update category + + + 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 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 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} + + \ No newline at end of file diff --git a/luigi-dao/src/main/resources/mapper/TopicMapper.xml b/luigi-dao/src/main/resources/mapper/TopicMapper.xml new file mode 100644 index 0000000..4db5dd1 --- /dev/null +++ b/luigi-dao/src/main/resources/mapper/TopicMapper.xml @@ -0,0 +1,332 @@ + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + id, title, `status` + + + + cids + + + + + + + delete from topic + where id = #{id,jdbcType=INTEGER} + + + + delete from topic + + + + + + + + SELECT LAST_INSERT_ID() + + insert into topic (title, `status`, cids + ) + values (#{title,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{cids,jdbcType=LONGVARCHAR} + ) + + + + + SELECT LAST_INSERT_ID() + + insert into topic + + + title, + + + `status`, + + + cids, + + + + + #{title,jdbcType=VARCHAR}, + + + #{status,jdbcType=INTEGER}, + + + #{cids,jdbcType=LONGVARCHAR}, + + + + + + + update topic + + + id = #{record.id,jdbcType=INTEGER}, + + + title = #{record.title,jdbcType=VARCHAR}, + + + `status` = #{record.status,jdbcType=INTEGER}, + + + cids = #{record.cids,jdbcType=LONGVARCHAR}, + + + + + + + + + update topic + set id = #{record.id,jdbcType=INTEGER}, + title = #{record.title,jdbcType=VARCHAR}, + `status` = #{record.status,jdbcType=INTEGER}, + cids = #{record.cids,jdbcType=LONGVARCHAR} + + + + + + + update topic + set id = #{record.id,jdbcType=INTEGER}, + title = #{record.title,jdbcType=VARCHAR}, + `status` = #{record.status,jdbcType=INTEGER} + + + + + + + update topic + + + title = #{title,jdbcType=VARCHAR}, + + + `status` = #{status,jdbcType=INTEGER}, + + + cids = #{cids,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + + update topic + set title = #{title,jdbcType=VARCHAR}, + `status` = #{status,jdbcType=INTEGER}, + cids = #{cids,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=INTEGER} + + + + update topic + set title = #{title,jdbcType=VARCHAR}, + `status` = #{status,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/luigi-dao/src/main/resources/mybatis-generator/generatorConfig.xml b/luigi-dao/src/main/resources/mybatis-generator/generatorConfig.xml index 008a2bc..46179eb 100644 --- a/luigi-dao/src/main/resources/mybatis-generator/generatorConfig.xml +++ b/luigi-dao/src/main/resources/mybatis-generator/generatorConfig.xml @@ -45,7 +45,7 @@ - diff --git a/luigi-service/src/main/java/com/bzgame/server/luigi/service/CategoryService.java b/luigi-service/src/main/java/com/bzgame/server/luigi/service/CategoryService.java new file mode 100644 index 0000000..32aedb7 --- /dev/null +++ b/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 seek(String title) { + CategoryExample example = new CategoryExample(); + example.createCriteria().andTitleLike(title + "%").andStatusGreaterThanOrEqualTo(0); + List categoryList = categoryMapper.selectByExample(example); + return new CommonList<>(categoryList); + } + + public CommonList 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 list = categoryMapper.selectByExample(example); + CommonList 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 poemIds = gson.fromJson(c.getPoemIds(), new TypeToken>() { + }.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, "参数非法"); + } + }); + } +} diff --git a/luigi-service/src/main/java/com/bzgame/server/luigi/service/PoemService.java b/luigi-service/src/main/java/com/bzgame/server/luigi/service/PoemService.java index d334f46..088de9d 100644 --- a/luigi-service/src/main/java/com/bzgame/server/luigi/service/PoemService.java +++ b/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 javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -96,6 +97,23 @@ public class PoemService { return p.getId(); } + public List getByIds(List ids) { + if (CollectionUtils.isEmpty(ids)) { + return new ArrayList<>(); + } + PoemExample example = new PoemExample(); + example.createCriteria().andIdIn(ids).andStatusGreaterThanOrEqualTo(0); + List data = poemMapper.selectByExample(example); + Map map = data.stream().collect(Collectors.toMap(Poem::getId, x->x)); + List res =new ArrayList<>(); + for(Integer id: ids) { + if(map.containsKey(id)) { + res.add(map.get(id)); + } + } + return res; + } + private List convert(List poems) { List authorIds = poems.stream().map(Poem::getAuthorId).collect(Collectors.toList()); if (CollectionUtils.isEmpty(authorIds)) { diff --git a/luigi-service/src/main/java/com/bzgame/server/luigi/service/TopicService.java b/luigi-service/src/main/java/com/bzgame/server/luigi/service/TopicService.java new file mode 100644 index 0000000..9d3b17e --- /dev/null +++ b/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 allTopic() { + TopicExample example = new TopicExample(); + example.createCriteria().andStatusGreaterThanOrEqualTo(0); + List topics = topicMapper.selectByExample(example); + CommonList 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 cids = gson.fromJson(topic.getCids(), new TypeToken>() { + }.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 getByIds(List cids) { + if (CollectionUtils.isEmpty(cids)) { + return new ArrayList<>(); + } + CategoryExample example = new CategoryExample(); + example.createCriteria().andIdIn(cids).andStatusGreaterThanOrEqualTo(0); + List categoryList = categoryMapper.selectByExample(example); + Map cMap = categoryList.stream().collect(Collectors.toMap(Category::getId, x -> x)); + List res = new ArrayList<>(); + for (Integer id : cids) { + if (cMap.containsKey(id)) { + res.add(cMap.get(id)); + } + } + return res; + } + +} diff --git a/luigi-service/src/main/java/com/bzgame/server/luigi/service/bo/response/CategoryDetail.java b/luigi-service/src/main/java/com/bzgame/server/luigi/service/bo/response/CategoryDetail.java new file mode 100644 index 0000000..2bb5e1f --- /dev/null +++ b/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 poems; + + public CategoryDetail() { + } + + + public CategoryDetail(Category category) { + BeanUtils.copyProperties(category, this); + } + + public List getPoems() { + return poems; + } + + public void setPoems(List poems) { + this.poems = poems; + } +} diff --git a/luigi-service/src/main/java/com/bzgame/server/luigi/service/bo/response/CommonList.java b/luigi-service/src/main/java/com/bzgame/server/luigi/service/bo/response/CommonList.java index 3d2384a..6864072 100644 --- a/luigi-service/src/main/java/com/bzgame/server/luigi/service/bo/response/CommonList.java +++ b/luigi-service/src/main/java/com/bzgame/server/luigi/service/bo/response/CommonList.java @@ -11,6 +11,13 @@ public class CommonList { private Integer pageSize; private Integer current; + public CommonList() { + } + + public CommonList(List list) { + this.list = list; + } + public List getList() { return list; } diff --git a/luigi-service/src/main/java/com/bzgame/server/luigi/service/bo/response/TopicDetail.java b/luigi-service/src/main/java/com/bzgame/server/luigi/service/bo/response/TopicDetail.java new file mode 100644 index 0000000..c839804 --- /dev/null +++ b/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 categoryList; + + public TopicDetail() { + } + + public TopicDetail(Topic t) { + BeanUtils.copyProperties(t, this); + } + + public List getCategoryList() { + return categoryList; + } + + public void setCategoryList(List categoryList) { + this.categoryList = categoryList; + } +}