diff --git a/backend-assets/img/logos/midnight-mobile.png b/backend-assets/img/logos/midnight-mobile.png new file mode 100644 index 0000000..5d6d239 Binary files /dev/null and b/backend-assets/img/logos/midnight-mobile.png differ diff --git a/backend-assets/img/logos/midnight-mobile.psd b/backend-assets/img/logos/midnight-mobile.psd new file mode 100644 index 0000000..00b9aff Binary files /dev/null and b/backend-assets/img/logos/midnight-mobile.psd differ diff --git a/src/main/java/com/zfgc/zfgbb/ZfgbbApplication.java b/src/main/java/com/zfgc/zfgbb/ZfgbbApplication.java index 901c273..61381e4 100644 --- a/src/main/java/com/zfgc/zfgbb/ZfgbbApplication.java +++ b/src/main/java/com/zfgc/zfgbb/ZfgbbApplication.java @@ -12,13 +12,14 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @SpringBootApplication @MapperScan("com.zfgc.zfgbb.mappers") -@EnableGlobalMethodSecurity(prePostEnabled = true) +@EnableMethodSecurity(prePostEnabled = true) public class ZfgbbApplication { public static void main(String[] args) { diff --git a/src/main/java/com/zfgc/zfgbb/dataprovider/forum/ForumDataProvider.java b/src/main/java/com/zfgc/zfgbb/dataprovider/forum/ForumDataProvider.java index cca65e3..dd48fb9 100644 --- a/src/main/java/com/zfgc/zfgbb/dataprovider/forum/ForumDataProvider.java +++ b/src/main/java/com/zfgc/zfgbb/dataprovider/forum/ForumDataProvider.java @@ -1,6 +1,8 @@ package com.zfgc.zfgbb.dataprovider.forum; import java.util.List; +import java.util.Map; +import java.util.function.Function; import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; @@ -15,11 +17,14 @@ import com.zfgc.zfgbb.dbo.BoardPermissionViewDboExample; import com.zfgc.zfgbb.dbo.BoardSummaryViewDboExample; import com.zfgc.zfgbb.dbo.CategoryDboExample; +import com.zfgc.zfgbb.dbo.ChildBoardViewDboExample; import com.zfgc.zfgbb.dbo.ThreadDboExample; import com.zfgc.zfgbb.mappers.BoardSummaryViewDboMapper; +import com.zfgc.zfgbb.mappers.ChildBoardViewDboMapper; import com.zfgc.zfgbb.model.forum.Board; import com.zfgc.zfgbb.model.forum.BoardSummary; import com.zfgc.zfgbb.model.forum.Category; +import com.zfgc.zfgbb.model.forum.ChildBoard; import com.zfgc.zfgbb.model.forum.Forum; import com.zfgc.zfgbb.model.forum.Thread; import com.zfgc.zfgbb.model.users.Permission; @@ -45,6 +50,9 @@ public class ForumDataProvider extends AbstractDataProvider { @Autowired private BoardSummaryViewDboMapper boardSummaryMapper; + @Autowired + private ChildBoardViewDboMapper childBoardMapper; + public Board getBoard(Integer boardId, Integer pageNo, Integer threadsPerPage) { BoardDbo boardDbo = boardDao.get(boardId); Board board = mapper.map(boardDbo, Board.class); @@ -59,12 +67,30 @@ public Board getBoard(Integer boardId, Integer pageNo, Integer threadsPerPage) { threadEx.createCriteria().andBoardIdEqualTo(boardId).andPinnedFlagEqualTo(false); Long threadCount = threadDao.getMapper().countByExample(threadEx); board.setThreadCount(threadCount); + + board.setChildBoards(getBoardSummaries(board.getBoardId())); + + return board; + } + private List getBoardSummaries(Integer parentBoardId){ BoardSummaryViewDboExample bEx = new BoardSummaryViewDboExample(); - bEx.createCriteria().andParentBoardIdEqualTo(boardId); - board.setChildBoards(boardSummaryMapper.selectByExample(bEx).stream().map(b -> mapper.map(b, BoardSummary.class)).collect(Collectors.toList())); + bEx.createCriteria().andParentBoardIdEqualTo(parentBoardId); + List result = (boardSummaryMapper.selectByExample(bEx).stream().map(b -> mapper.map(b, BoardSummary.class)).collect(Collectors.toList())); - return board; + ChildBoardViewDboExample cEx = new ChildBoardViewDboExample(); + cEx.createCriteria().andParentBoardIdEqualTo(parentBoardId); + + Map> childBoards = childBoardMapper.selectByExample(cEx).stream() + .map(c -> mapper.map(c, ChildBoard.class)) + .collect(Collectors.groupingBy(ChildBoard::getParentBoardId)); + + result.forEach(bs -> { + bs.setChildBoards(childBoards.get(bs.getBoardId())); + }); + + + return result; } public Forum getForum() { diff --git a/src/main/java/com/zfgc/zfgbb/dbo/ChildBoardViewDbo.java b/src/main/java/com/zfgc/zfgbb/dbo/ChildBoardViewDbo.java new file mode 100644 index 0000000..27ecc51 --- /dev/null +++ b/src/main/java/com/zfgc/zfgbb/dbo/ChildBoardViewDbo.java @@ -0,0 +1,74 @@ +package com.zfgc.zfgbb.dbo; + +public class ChildBoardViewDbo { + + /** + * This field was generated by MyBatis Generator. This field corresponds to the database column zfgbb.child_board_view.board_id + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + private Integer boardId; + /** + * This field was generated by MyBatis Generator. This field corresponds to the database column zfgbb.child_board_view.board_name + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + private String boardName; + /** + * This field was generated by MyBatis Generator. This field corresponds to the database column zfgbb.child_board_view.parent_board_id + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + private Integer parentBoardId; + + /** + * This method was generated by MyBatis Generator. This method returns the value of the database column zfgbb.child_board_view.board_id + * @return the value of zfgbb.child_board_view.board_id + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + public Integer getBoardId() { + return boardId; + } + + /** + * This method was generated by MyBatis Generator. This method sets the value of the database column zfgbb.child_board_view.board_id + * @param boardId the value for zfgbb.child_board_view.board_id + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + public void setBoardId(Integer boardId) { + this.boardId = boardId; + } + + /** + * This method was generated by MyBatis Generator. This method returns the value of the database column zfgbb.child_board_view.board_name + * @return the value of zfgbb.child_board_view.board_name + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + public String getBoardName() { + return boardName; + } + + /** + * This method was generated by MyBatis Generator. This method sets the value of the database column zfgbb.child_board_view.board_name + * @param boardName the value for zfgbb.child_board_view.board_name + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + public void setBoardName(String boardName) { + this.boardName = boardName; + } + + /** + * This method was generated by MyBatis Generator. This method returns the value of the database column zfgbb.child_board_view.parent_board_id + * @return the value of zfgbb.child_board_view.parent_board_id + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + public Integer getParentBoardId() { + return parentBoardId; + } + + /** + * This method was generated by MyBatis Generator. This method sets the value of the database column zfgbb.child_board_view.parent_board_id + * @param parentBoardId the value for zfgbb.child_board_view.parent_board_id + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + public void setParentBoardId(Integer parentBoardId) { + this.parentBoardId = parentBoardId; + } +} \ No newline at end of file diff --git a/src/main/java/com/zfgc/zfgbb/dbo/ChildBoardViewDboExample.java b/src/main/java/com/zfgc/zfgbb/dbo/ChildBoardViewDboExample.java new file mode 100644 index 0000000..45e3aee --- /dev/null +++ b/src/main/java/com/zfgc/zfgbb/dbo/ChildBoardViewDboExample.java @@ -0,0 +1,450 @@ +package com.zfgc.zfgbb.dbo; + +import java.util.ArrayList; +import java.util.List; + +public class ChildBoardViewDboExample { + /** + * This field was generated by MyBatis Generator. This field corresponds to the database table zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + protected String orderByClause; + /** + * This field was generated by MyBatis Generator. This field corresponds to the database table zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + protected boolean distinct; + /** + * This field was generated by MyBatis Generator. This field corresponds to the database table zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + protected List oredCriteria; + + /** + * This method was generated by MyBatis Generator. This method corresponds to the database table zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + public ChildBoardViewDboExample() { + oredCriteria = new ArrayList<>(); + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to the database table zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to the database table zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + public String getOrderByClause() { + return orderByClause; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to the database table zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to the database table zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + public boolean isDistinct() { + return distinct; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to the database table zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + public List getOredCriteria() { + return oredCriteria; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to the database table zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to the database table zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + 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 zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + 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 zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to the database table zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + /** + * This class was generated by MyBatis Generator. This class corresponds to the database table zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + 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 andBoardIdIsNull() { + addCriterion("board_id is null"); + return (Criteria) this; + } + + public Criteria andBoardIdIsNotNull() { + addCriterion("board_id is not null"); + return (Criteria) this; + } + + public Criteria andBoardIdEqualTo(Integer value) { + addCriterion("board_id =", value, "boardId"); + return (Criteria) this; + } + + public Criteria andBoardIdNotEqualTo(Integer value) { + addCriterion("board_id <>", value, "boardId"); + return (Criteria) this; + } + + public Criteria andBoardIdGreaterThan(Integer value) { + addCriterion("board_id >", value, "boardId"); + return (Criteria) this; + } + + public Criteria andBoardIdGreaterThanOrEqualTo(Integer value) { + addCriterion("board_id >=", value, "boardId"); + return (Criteria) this; + } + + public Criteria andBoardIdLessThan(Integer value) { + addCriterion("board_id <", value, "boardId"); + return (Criteria) this; + } + + public Criteria andBoardIdLessThanOrEqualTo(Integer value) { + addCriterion("board_id <=", value, "boardId"); + return (Criteria) this; + } + + public Criteria andBoardIdIn(List values) { + addCriterion("board_id in", values, "boardId"); + return (Criteria) this; + } + + public Criteria andBoardIdNotIn(List values) { + addCriterion("board_id not in", values, "boardId"); + return (Criteria) this; + } + + public Criteria andBoardIdBetween(Integer value1, Integer value2) { + addCriterion("board_id between", value1, value2, "boardId"); + return (Criteria) this; + } + + public Criteria andBoardIdNotBetween(Integer value1, Integer value2) { + addCriterion("board_id not between", value1, value2, "boardId"); + return (Criteria) this; + } + + public Criteria andBoardNameIsNull() { + addCriterion("board_name is null"); + return (Criteria) this; + } + + public Criteria andBoardNameIsNotNull() { + addCriterion("board_name is not null"); + return (Criteria) this; + } + + public Criteria andBoardNameEqualTo(String value) { + addCriterion("board_name =", value, "boardName"); + return (Criteria) this; + } + + public Criteria andBoardNameNotEqualTo(String value) { + addCriterion("board_name <>", value, "boardName"); + return (Criteria) this; + } + + public Criteria andBoardNameGreaterThan(String value) { + addCriterion("board_name >", value, "boardName"); + return (Criteria) this; + } + + public Criteria andBoardNameGreaterThanOrEqualTo(String value) { + addCriterion("board_name >=", value, "boardName"); + return (Criteria) this; + } + + public Criteria andBoardNameLessThan(String value) { + addCriterion("board_name <", value, "boardName"); + return (Criteria) this; + } + + public Criteria andBoardNameLessThanOrEqualTo(String value) { + addCriterion("board_name <=", value, "boardName"); + return (Criteria) this; + } + + public Criteria andBoardNameLike(String value) { + addCriterion("board_name like", value, "boardName"); + return (Criteria) this; + } + + public Criteria andBoardNameNotLike(String value) { + addCriterion("board_name not like", value, "boardName"); + return (Criteria) this; + } + + public Criteria andBoardNameIn(List values) { + addCriterion("board_name in", values, "boardName"); + return (Criteria) this; + } + + public Criteria andBoardNameNotIn(List values) { + addCriterion("board_name not in", values, "boardName"); + return (Criteria) this; + } + + public Criteria andBoardNameBetween(String value1, String value2) { + addCriterion("board_name between", value1, value2, "boardName"); + return (Criteria) this; + } + + public Criteria andBoardNameNotBetween(String value1, String value2) { + addCriterion("board_name not between", value1, value2, "boardName"); + return (Criteria) this; + } + + public Criteria andParentBoardIdIsNull() { + addCriterion("parent_board_id is null"); + return (Criteria) this; + } + + public Criteria andParentBoardIdIsNotNull() { + addCriterion("parent_board_id is not null"); + return (Criteria) this; + } + + public Criteria andParentBoardIdEqualTo(Integer value) { + addCriterion("parent_board_id =", value, "parentBoardId"); + return (Criteria) this; + } + + public Criteria andParentBoardIdNotEqualTo(Integer value) { + addCriterion("parent_board_id <>", value, "parentBoardId"); + return (Criteria) this; + } + + public Criteria andParentBoardIdGreaterThan(Integer value) { + addCriterion("parent_board_id >", value, "parentBoardId"); + return (Criteria) this; + } + + public Criteria andParentBoardIdGreaterThanOrEqualTo(Integer value) { + addCriterion("parent_board_id >=", value, "parentBoardId"); + return (Criteria) this; + } + + public Criteria andParentBoardIdLessThan(Integer value) { + addCriterion("parent_board_id <", value, "parentBoardId"); + return (Criteria) this; + } + + public Criteria andParentBoardIdLessThanOrEqualTo(Integer value) { + addCriterion("parent_board_id <=", value, "parentBoardId"); + return (Criteria) this; + } + + public Criteria andParentBoardIdIn(List values) { + addCriterion("parent_board_id in", values, "parentBoardId"); + return (Criteria) this; + } + + public Criteria andParentBoardIdNotIn(List values) { + addCriterion("parent_board_id not in", values, "parentBoardId"); + return (Criteria) this; + } + + public Criteria andParentBoardIdBetween(Integer value1, Integer value2) { + addCriterion("parent_board_id between", value1, value2, "parentBoardId"); + return (Criteria) this; + } + + public Criteria andParentBoardIdNotBetween(Integer value1, Integer value2) { + addCriterion("parent_board_id not between", value1, value2, "parentBoardId"); + return (Criteria) this; + } + } + + /** + * This class was generated by MyBatis Generator. This class corresponds to the database table zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + 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); + } + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table zfgbb.child_board_view + * + * @mbg.generated do_not_delete_during_merge Mon Oct 14 23:33:01 EDT 2024 + */ + public static class Criteria extends GeneratedCriteria { + protected Criteria() { + super(); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/zfgc/zfgbb/mappers/ChildBoardViewDboMapper.java b/src/main/java/com/zfgc/zfgbb/mappers/ChildBoardViewDboMapper.java new file mode 100644 index 0000000..b4268a0 --- /dev/null +++ b/src/main/java/com/zfgc/zfgbb/mappers/ChildBoardViewDboMapper.java @@ -0,0 +1,52 @@ +package com.zfgc.zfgbb.mappers; + +import com.zfgc.zfgbb.dbo.ChildBoardViewDbo; +import com.zfgc.zfgbb.dbo.ChildBoardViewDboExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface ChildBoardViewDboMapper { + + /** + * This method was generated by MyBatis Generator. This method corresponds to the database table zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + long countByExample(ChildBoardViewDboExample example); + + /** + * This method was generated by MyBatis Generator. This method corresponds to the database table zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + int deleteByExample(ChildBoardViewDboExample example); + + /** + * This method was generated by MyBatis Generator. This method corresponds to the database table zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + int insert(ChildBoardViewDbo record); + + /** + * This method was generated by MyBatis Generator. This method corresponds to the database table zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + int insertSelective(ChildBoardViewDbo record); + + /** + * This method was generated by MyBatis Generator. This method corresponds to the database table zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + List selectByExample(ChildBoardViewDboExample example); + + /** + * This method was generated by MyBatis Generator. This method corresponds to the database table zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + int updateByExampleSelective(@Param("record") ChildBoardViewDbo record, + @Param("example") ChildBoardViewDboExample example); + + /** + * This method was generated by MyBatis Generator. This method corresponds to the database table zfgbb.child_board_view + * @mbg.generated Mon Oct 14 23:44:38 EDT 2024 + */ + int updateByExample(@Param("record") ChildBoardViewDbo record, @Param("example") ChildBoardViewDboExample example); +} \ No newline at end of file diff --git a/src/main/java/com/zfgc/zfgbb/mappers/ChildBoardViewDboMapper.xml b/src/main/java/com/zfgc/zfgbb/mappers/ChildBoardViewDboMapper.xml new file mode 100644 index 0000000..fa6accb --- /dev/null +++ b/src/main/java/com/zfgc/zfgbb/mappers/ChildBoardViewDboMapper.xml @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + 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} + + + + + + + + + + + + board_id, board_name, parent_board_id + + + + + delete from zfgbb.child_board_view + + + + + + + insert into zfgbb.child_board_view (board_id, board_name, parent_board_id + ) + values (#{boardId,jdbcType=INTEGER}, #{boardName,jdbcType=VARCHAR}, #{parentBoardId,jdbcType=INTEGER} + ) + + + + insert into zfgbb.child_board_view + + + board_id, + + + board_name, + + + parent_board_id, + + + + + #{boardId,jdbcType=INTEGER}, + + + #{boardName,jdbcType=VARCHAR}, + + + #{parentBoardId,jdbcType=INTEGER}, + + + + + + + update zfgbb.child_board_view + + + board_id = #{record.boardId,jdbcType=INTEGER}, + + + board_name = #{record.boardName,jdbcType=VARCHAR}, + + + parent_board_id = #{record.parentBoardId,jdbcType=INTEGER}, + + + + + + + + + update zfgbb.child_board_view + set board_id = #{record.boardId,jdbcType=INTEGER}, + board_name = #{record.boardName,jdbcType=VARCHAR}, + parent_board_id = #{record.parentBoardId,jdbcType=INTEGER} + + + + + \ No newline at end of file diff --git a/src/main/java/com/zfgc/zfgbb/model/forum/BoardSummary.java b/src/main/java/com/zfgc/zfgbb/model/forum/BoardSummary.java index d495f4e..33b4940 100644 --- a/src/main/java/com/zfgc/zfgbb/model/forum/BoardSummary.java +++ b/src/main/java/com/zfgc/zfgbb/model/forum/BoardSummary.java @@ -2,6 +2,7 @@ import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; +import java.util.List; import org.apache.commons.lang3.StringUtils; @@ -20,6 +21,8 @@ public class BoardSummary { private Integer categoryId; private Integer parentBoardId; + private List childBoards; + @JsonIgnore private LocalDateTime latestMessageCreatedTs; @@ -108,4 +111,10 @@ public Integer getCategoryId() { public void setCategoryId(Integer categoryId) { this.categoryId = categoryId; } + public List getChildBoards() { + return childBoards; + } + public void setChildBoards(List childBoards) { + this.childBoards = childBoards; + } } \ No newline at end of file diff --git a/src/main/java/com/zfgc/zfgbb/model/forum/ChildBoard.java b/src/main/java/com/zfgc/zfgbb/model/forum/ChildBoard.java new file mode 100644 index 0000000..9891b02 --- /dev/null +++ b/src/main/java/com/zfgc/zfgbb/model/forum/ChildBoard.java @@ -0,0 +1,26 @@ +package com.zfgc.zfgbb.model.forum; + +public class ChildBoard { + private Integer boardId; + private String boardName; + private Integer parentBoardId; + public Integer getBoardId() { + return boardId; + } + public void setBoardId(Integer boardId) { + this.boardId = boardId; + } + public String getBoardName() { + return boardName; + } + public void setBoardName(String boardName) { + this.boardName = boardName; + } + public Integer getParentBoardId() { + return parentBoardId; + } + public void setParentBoardId(Integer parentBoardId) { + this.parentBoardId = parentBoardId; + } + +} \ No newline at end of file diff --git a/src/main/resources/db/migration/views/forum/boards/R__CHILD_BOARD_VIEW.SQL.sql b/src/main/resources/db/migration/views/forum/boards/R__CHILD_BOARD_VIEW.SQL.sql new file mode 100644 index 0000000..9937ee1 --- /dev/null +++ b/src/main/resources/db/migration/views/forum/boards/R__CHILD_BOARD_VIEW.SQL.sql @@ -0,0 +1,4 @@ +create or replace view zfgbb.child_board_view as +select board.board_id, board.board_name, board.parent_board_id +from zfgbb.board +where parent_board_id is not null \ No newline at end of file diff --git a/src/main/resources/generatorConfig.xml b/src/main/resources/generatorConfig.xml index e2ef545..d668cc7 100644 --- a/src/main/resources/generatorConfig.xml +++ b/src/main/resources/generatorConfig.xml @@ -18,10 +18,13 @@ - - +
+ +