cy 3 vuotta sitten
vanhempi
commit
d8209f02e8
28 muutettua tiedostoa jossa 1036 lisäystä ja 277 poistoa
  1. 34 0
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/config/GlobalCorsConfig.java
  2. 73 0
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/config/LocalFastJsonHttpMessageConverter.java
  3. 86 0
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/config/ParameterCheckServletRequestWrapper.java
  4. 41 0
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/config/ResourceServerConfig.java
  5. 50 0
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/config/WebMvcConfig.java
  6. 51 0
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/config/filters/EmojiEncodingFilter.java
  7. 46 53
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/controller/BbsConfigLabelController.java
  8. 19 11
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/dao/BbsConfigLabelDao.java
  9. 11 0
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/dto/search/BbsConfigLabelSearch.java
  10. 91 74
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/entity/BbsArticle.java
  11. 20 16
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/entity/BbsCollect.java
  12. 43 29
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/entity/BbsConfigLabel.java
  13. 20 16
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/entity/BbsFollow.java
  14. 20 16
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/entity/BbsLike.java
  15. 25 20
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/entity/BbsPrivateMessage.java
  16. 39 31
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/entity/BbsReply.java
  17. 18 5
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/service/BbsConfigLabelService.java
  18. 10 5
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/service/impl/BbsConfigLabelServiceImpl.java
  19. 8 0
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/valid/AddGroup.java
  20. 8 0
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/valid/DeleteGroup.java
  21. 27 0
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/valid/EnumValid.java
  22. 31 0
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/valid/ListValue.java
  23. 8 0
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/valid/SelectGroup.java
  24. 8 0
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/valid/UpdateGroup.java
  25. 63 0
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/valid/impl/EnumValidtor.java
  26. 33 0
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/valid/impl/ListValueValidator.java
  27. 138 0
      cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/valid/impl/ValidList.java
  28. 15 1
      cooleshow-bbs/src/main/resources/config/mybatis/BbsConfigLabelMapper.xml

+ 34 - 0
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/config/GlobalCorsConfig.java

@@ -0,0 +1,34 @@
+package com.yonge.cooleshow.bbs.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
+import org.springframework.web.filter.CorsFilter;
+
+/**
+ * 全局跨域配置
+ * Created by macro on 2019/7/27.
+ */
+@Configuration
+public class GlobalCorsConfig {
+
+    /**
+     * 允许跨域调用的过滤器
+     */
+    @Bean
+    public CorsFilter corsFilter() {
+        CorsConfiguration config = new CorsConfiguration();
+        //允许所有域名进行跨域调用
+        config.addAllowedOrigin("*");
+        //允许跨越发送cookie
+        config.setAllowCredentials(true);
+        //放行全部原始头信息
+        config.addAllowedHeader("*");
+        //允许所有请求方法跨域调用
+        config.addAllowedMethod("*");
+        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
+        source.registerCorsConfiguration("/**", config);
+        return new CorsFilter(source);
+    }
+}

+ 73 - 0
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/config/LocalFastJsonHttpMessageConverter.java

@@ -0,0 +1,73 @@
+package com.yonge.cooleshow.bbs.config;
+
+import com.alibaba.fastjson.serializer.JSONSerializer;
+import com.alibaba.fastjson.serializer.ObjectSerializer;
+import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;
+import com.alibaba.fastjson.serializer.ValueFilter;
+import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
+import com.vdurmont.emoji.EmojiParser;
+import com.yonge.toolset.base.enums.BaseEnum;
+import com.yonge.toolset.utils.json.JsonUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.http.HttpInputMessage;
+import org.springframework.http.HttpOutputMessage;
+import org.springframework.http.converter.HttpMessageNotReadableException;
+import org.springframework.http.converter.HttpMessageNotWritableException;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.reflect.Type;
+import java.math.BigDecimal;
+import java.util.Date;
+
+public class LocalFastJsonHttpMessageConverter extends FastJsonHttpMessageConverter {
+
+	private static final String FORMAT = "yyyy-MM-dd HH:mm:ss";
+
+	@Override
+	protected Object readInternal(Class<? extends Object> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException {
+		return super.readInternal(clazz, inputMessage);
+	}
+
+	@Override
+	protected void writeInternal(Object obj, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException {
+
+		OutputStream out = outputMessage.getBody();
+		JsonUtil.getConfig().put(Date.class, new SimpleDateFormatSerializer(FORMAT));
+		//JsonUtil.getConfig().put(String.class, new EmojiSerializer());
+		String text = JsonUtil.toJSONString(obj, EnumFilter.instance, getFeatures());
+		byte[] bytes = text.getBytes(getCharset());
+		out.write(bytes);
+	}
+}
+
+class EmojiSerializer implements ObjectSerializer{
+
+	@Override
+	public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
+		serializer.write(EmojiParser.parseToUnicode(object.toString()));
+	}
+	
+}
+
+class EnumFilter implements ValueFilter {
+
+	public static EnumFilter instance = new EnumFilter();
+
+	public EnumFilter() {
+	}
+
+	@Override
+	public Object process(Object object, String name, Object value) {
+		if (value == null || StringUtils.isBlank(value.toString())) {
+			return value;
+		}
+		if (value instanceof BigDecimal || value instanceof Double || value instanceof Float) {
+			return new BigDecimal(value.toString());
+		}
+		if (BaseEnum.class.isAssignableFrom(value.getClass())) {
+			return ((BaseEnum<?, ?>) value).getCode();
+		}
+		return value;
+	}
+}

+ 86 - 0
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/config/ParameterCheckServletRequestWrapper.java

@@ -0,0 +1,86 @@
+package com.yonge.cooleshow.bbs.config;
+
+import com.vdurmont.emoji.EmojiParser;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.util.StreamUtils;
+
+import javax.servlet.ReadListener;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.nio.charset.Charset;
+
+public class ParameterCheckServletRequestWrapper extends HttpServletRequestWrapper {
+
+	private byte[] requestBody;
+	private Charset charSet;
+
+	public ParameterCheckServletRequestWrapper(HttpServletRequest request) throws IOException {
+		super(request);
+
+		String requestBodyStr = getRequestPostStr(request);
+		if (StringUtils.isNotBlank(requestBodyStr)) {
+			requestBodyStr = EmojiParser.removeAllEmojis(requestBodyStr);
+			requestBody = requestBodyStr.getBytes(charSet);
+		} else {
+			requestBody = new byte[0];
+		}
+	}
+
+	public String getRequestPostStr(HttpServletRequest request) throws IOException {
+		String charSetStr = request.getCharacterEncoding();
+		if (charSetStr == null) {
+			charSetStr = "UTF-8";
+		}
+		charSet = Charset.forName(charSetStr);
+
+		return StreamUtils.copyToString(request.getInputStream(), charSet);
+	}
+
+	/**
+	 * 重写 getInputStream()
+	 */
+	@Override
+	public ServletInputStream getInputStream() {
+		if (requestBody == null) {
+			requestBody = new byte[0];
+		}
+
+		final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(requestBody);
+
+		return new ServletInputStream() {
+			@Override
+			public boolean isFinished() {
+				return false;
+			}
+
+			@Override
+			public boolean isReady() {
+				return false;
+			}
+
+			@Override
+			public void setReadListener(ReadListener readListener) {
+
+			}
+
+			@Override
+			public int read() {
+				return byteArrayInputStream.read();
+			}
+		};
+	}
+
+	/**
+	 * 重写 getReader()
+	 */
+	@Override
+	public BufferedReader getReader() {
+		return new BufferedReader(new InputStreamReader(getInputStream()));
+	}
+
+}

+ 41 - 0
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/config/ResourceServerConfig.java

@@ -0,0 +1,41 @@
+package com.yonge.cooleshow.bbs.config;
+
+import com.yonge.cooleshow.common.security.BaseAccessDeniedHandler;
+import com.yonge.cooleshow.common.security.BaseAuthenticationEntryPoint;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.HttpMethod;
+import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
+import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
+import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
+
+@Configuration
+@EnableResourceServer
+@EnableGlobalMethodSecurity(prePostEnabled = true)
+public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
+
+    @Autowired
+    private BaseAccessDeniedHandler baseAccessDeniedHandler;
+
+    @Autowired
+    private BaseAuthenticationEntryPoint baseAuthenticationEntryPoint;
+
+    @Override
+    public void configure(HttpSecurity http) throws Exception {
+        http.cors().and().csrf().disable().exceptionHandling().accessDeniedHandler(baseAccessDeniedHandler).authenticationEntryPoint(baseAuthenticationEntryPoint).and()
+                .authorizeRequests()
+                .antMatchers(HttpMethod.OPTIONS)
+                .permitAll()
+            .and()
+                .authorizeRequests()
+                .antMatchers("/wechat/*","/feign-client/**","/v2/api-docs", "/code/*","/payment/callback","/admin/login")
+            .permitAll().anyRequest().authenticated().and().httpBasic();
+    }
+
+    @Override
+    public void configure(ResourceServerSecurityConfigurer resources) throws Exception {
+        resources.authenticationEntryPoint(baseAuthenticationEntryPoint).accessDeniedHandler(baseAccessDeniedHandler);
+    }
+}

+ 50 - 0
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/config/WebMvcConfig.java

@@ -0,0 +1,50 @@
+package com.yonge.cooleshow.bbs.config;
+
+import com.yonge.cooleshow.common.config.EnumConverterFactory;
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.format.FormatterRegistry;
+import org.springframework.http.MediaType;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Configuration
+public class WebMvcConfig implements WebMvcConfigurer {
+
+
+	/**
+	 * 枚举类的转换器 addConverterFactory
+	 */
+	@Override
+	public void addFormatters(FormatterRegistry registry) {
+		registry.addConverterFactory(new EnumConverterFactory());
+	}
+
+	@Override
+	public void addInterceptors(InterceptorRegistry registry) {
+		// addPathPatterns 用于添加拦截规则, 这里假设拦截 /url 后面的全部链接
+		List<String> includePathPatterns = new ArrayList<String>();
+		includePathPatterns.add("/**");
+
+		// excludePathPatterns 用户排除拦截
+		List<String> excludePathPatterns = new ArrayList<String>();
+		excludePathPatterns.add("/login");
+
+		// registry.addInterceptor(mdcInterceptor).addPathPatterns(includePathPatterns).excludePathPatterns(excludePathPatterns);
+
+//		registry.addInterceptor(operationLogInterceptor).addPathPatterns("/**").excludePathPatterns("/login");
+	}
+
+	@Bean
+	public HttpMessageConverters fastJsonHttpMessageConverters() {
+		LocalFastJsonHttpMessageConverter converter = new LocalFastJsonHttpMessageConverter();
+		List<MediaType> fastMediaTypes = new ArrayList<MediaType>();
+		fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
+		converter.setSupportedMediaTypes(fastMediaTypes);
+		return new HttpMessageConverters(converter);
+	}
+}

+ 51 - 0
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/config/filters/EmojiEncodingFilter.java

@@ -0,0 +1,51 @@
+package com.yonge.cooleshow.bbs.config.filters;
+
+import com.vdurmont.emoji.EmojiParser;
+import com.yonge.cooleshow.bbs.config.ParameterCheckServletRequestWrapper;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.servlet.*;
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+
+public class EmojiEncodingFilter implements Filter {
+
+	@Override
+	public void init(FilterConfig filterConfig) throws ServletException {
+		Filter.super.init(filterConfig);
+	}
+
+	@Override
+	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+		request = new ParameterCheckServletRequestWrapper((HttpServletRequest) request) {
+
+			@Override
+			public String getParameter(String name) {
+				// 参数名
+				String value = super.getParameter(name);
+				if (StringUtils.isNotBlank(value)) {
+					// 返回值之前 先进行 Emoji 转化
+					return EmojiParser.removeAllEmojis(value);
+				}
+				return value;
+			}
+
+			@Override
+			public String[] getParameterValues(String name) {
+				// 参数值
+				// 返回值之前 先进行 Emoji 转化
+				String[] values = super.getParameterValues(name);
+				if (values != null) {
+					for (int i = 0; i < values.length; i++) {
+						values[i] = EmojiParser.removeAllEmojis(values[i]);
+					}
+				}
+				return values;
+			}
+
+		};
+		
+		chain.doFilter(request, response);
+	}
+
+}

+ 46 - 53
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/controller/BbsConfigLabelController.java

@@ -1,6 +1,10 @@
 package com.yonge.cooleshow.bbs.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
+import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.yonge.cooleshow.bbs.valid.AddGroup;
+import com.yonge.cooleshow.bbs.valid.UpdateGroup;
 import com.yonge.toolset.base.page.PageInfo;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
@@ -10,78 +14,67 @@ import com.yonge.toolset.mybatis.support.PageUtil;
 import com.yonge.toolset.utils.string.StringUtil;
 import io.swagger.annotations.*;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
-import javax.validation.Valid;
-
 import com.yonge.cooleshow.bbs.vo.BbsConfigLabelVo;
 import com.yonge.cooleshow.bbs.dto.search.BbsConfigLabelSearch;
 import com.yonge.cooleshow.bbs.entity.BbsConfigLabel;
 import com.yonge.cooleshow.bbs.service.BbsConfigLabelService;
 
+import java.util.List;
+
 @RestController
 @RequestMapping("/bbsConfigLabel")
 @Api(value = "论坛标签设置", tags = "论坛标签设置")
 public class BbsConfigLabelController extends BaseController {
-
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
     @Autowired
     private BbsConfigLabelService bbsConfigLabelService;
 
-	/**
-     * 查询单条
-     */
-    @GetMapping("/detail/{id}")
-    @ApiOperation(value = "详情", notes = "传入id")
-    public HttpResponseResult<BbsConfigLabelVo> detail(@PathVariable("id") Long id) {
-    	return succeed(bbsConfigLabelService.detail(id));
-	}
-    
-    /**
-     * 查询分页
-     */
+    @ApiOperation(value = "查询全部")
+    @PostMapping("/selectAll")
+    public HttpResponseResult<List<BbsConfigLabel>> selectAll(Integer delFlag) {
+        return succeed(bbsConfigLabelService.selectAll(delFlag));
+    }
+
+    @ApiOperation(value = "查询分页")
     @PostMapping("/page")
-    @ApiOperation(value = "查询分页", notes = "传入bbsConfigLabelSearch")
     public HttpResponseResult<PageInfo<BbsConfigLabelVo>> page(@RequestBody BbsConfigLabelSearch query) {
-		IPage<BbsConfigLabelVo> pages = bbsConfigLabelService.selectPage(PageUtil.getPage(query), query);
+        IPage<BbsConfigLabelVo> pages = bbsConfigLabelService.selectPage(PageUtil.getPage(query), query);
         return succeed(PageUtil.pageInfo(pages));
-	}
-    
-    /**
-	 * 新增
-	 */
-	@PostMapping("/save")
-	@ApiOperation(value = "新增", notes = "传入bbsConfigLabel")
-	public HttpResponseResult save(@Valid @RequestBody BbsConfigLabel bbsConfigLabel) {
-    	return status(bbsConfigLabelService.save(bbsConfigLabel));
-	}
-    
-    /**
-	 * 修改
-	 */
-	@PostMapping("/update")
-	@ApiOperation(value = "修改", notes = "传入bbsConfigLabel")
-	public HttpResponseResult update(@Valid @RequestBody BbsConfigLabel bbsConfigLabel) {
+    }
+
+    @ApiOperation(value = "新增")
+    @PostMapping("/save")
+    public HttpResponseResult save(@Validated(AddGroup.class) @RequestBody BbsConfigLabel bbsConfigLabel) {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || null == user.getId()) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        bbsConfigLabel.setCreateBy(user.getId());
+        return status(bbsConfigLabelService.save(bbsConfigLabel));
+    }
+
+    @ApiOperation(value = "修改")
+    @PostMapping("/update")
+    public HttpResponseResult update(@Validated(UpdateGroup.class) @RequestBody BbsConfigLabel bbsConfigLabel) {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || null == user.getId()) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        bbsConfigLabel.setUpdateBy(user.getId());
         return status(bbsConfigLabelService.updateById(bbsConfigLabel));
-	}
-    
-    /**
-	 * 新增或修改
-	 */
-    @PostMapping("/submit")
-    @ApiOperation(value = "新增或修改", notes = "传入bbsConfigLabel")
-	public HttpResponseResult submit(@Valid @RequestBody BbsConfigLabel bbsConfigLabel) {
-        return status(bbsConfigLabelService.saveOrUpdate(bbsConfigLabel));
     }
 
- 	/**
-	 * 删除
-	 */
-	@PostMapping("/remove")
-	@ApiOperation(value = "逻辑删除", notes = "传入ids")
-	public HttpResponseResult remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+    @ApiOperation(value = "逻辑删除", notes = "传入ids")
+    @PostMapping("/remove")
+    public HttpResponseResult remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
         if (StringUtil.isEmpty(ids)) {
-			return failed("参数不能为空");
-		}
-		return status(bbsConfigLabelService.removeByIds(StringUtil.toLongList(ids)));
-	}
+            return failed("参数不能为空");
+        }
+        return status(bbsConfigLabelService.removeByIds(StringUtil.toLongList(ids)));
+    }
 }

+ 19 - 11
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/dao/BbsConfigLabelDao.java

@@ -9,22 +9,30 @@ import com.yonge.cooleshow.bbs.entity.BbsConfigLabel;
 import com.yonge.cooleshow.bbs.vo.BbsConfigLabelVo;
 import com.yonge.cooleshow.bbs.dto.search.BbsConfigLabelSearch;
 
-
-public interface BbsConfigLabelDao extends BaseMapper<BbsConfigLabel>{
-	/**
-	 * 查询详情
+public interface BbsConfigLabelDao extends BaseMapper<BbsConfigLabel> {
+    /**
+     * 查询详情
+     *
      * @author liweifan
      * @date 2022-06-09 17:27:11
      * @return: com.yonge.cooleshow.bbs.vo.BbsConfigLabelVo
-	 */
-	BbsConfigLabelVo detail(@Param("id") Long id);
+     */
+    BbsConfigLabelVo detail(@Param("id") Long id);
 
-	/**
-	 * 分页查询
+    /**
+     * 分页查询
+     *
      * @author liweifan
      * @date 2022-06-09 17:27:11
      * @return: com.yonge.cooleshow.bbs.vo.BbsConfigLabelVo
-	 */
-	List<BbsConfigLabelVo> selectPage(@Param("page") IPage page, @Param("param") BbsConfigLabelSearch bbsConfigLabel);
-	
+     */
+    List<BbsConfigLabelVo> selectPage(@Param("page") IPage page, @Param("param") BbsConfigLabelSearch bbsConfigLabel);
+
+    /**
+     * 查询所有
+     *
+     * @param delFlag 删除状态
+     * @return
+     */
+    List<BbsConfigLabel> selectAll(Integer delFlag);
 }

+ 11 - 0
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/dto/search/BbsConfigLabelSearch.java

@@ -2,6 +2,7 @@ package com.yonge.cooleshow.bbs.dto.search;
 
 import com.yonge.toolset.base.page.QueryInfo;
 import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 
 /**
  * @Author: liweifan
@@ -11,4 +12,14 @@ import io.swagger.annotations.ApiModel;
 public class BbsConfigLabelSearch extends QueryInfo{
 	private static final long serialVersionUID = 1L;
 
+	@ApiModelProperty("0:正常 1:删除")
+	private Integer delFlag;
+
+	public Integer getDelFlag() {
+		return delFlag;
+	}
+
+	public void setDelFlag(Integer delFlag) {
+		this.delFlag = delFlag;
+	}
 }

+ 91 - 74
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/entity/BbsArticle.java

@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
 import java.util.Date;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 
@@ -18,196 +19,212 @@ import org.springframework.format.annotation.DateTimeFormat;
 @TableName("bbs_article")
 @ApiModel(value = "BbsArticle对象", description = "文章")
 public class BbsArticle implements Serializable {
-	private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
+
     @TableId(value = "id_", type = IdType.AUTO)
     private Long id;
-    @ApiModelProperty("发布者id ")
-	@TableField(value = "user_id_")
+
+    @ApiModelProperty("发布者id")
+    @TableField(value = "user_id_")
     private Long userId;
-    @ApiModelProperty("文章标题 ")
-	@TableField(value = "title_")
+
+    @ApiModelProperty("文章标题")
+    @TableField(value = "title_")
     private String title;
-    @ApiModelProperty("文章内容 ")
-	@TableField(value = "content_")
+
+    @ApiModelProperty("文章内容")
+    @TableField(value = "content_")
     private String content;
-    @ApiModelProperty("标签id ")
-	@TableField(value = "label_id_")
+
+    @ApiModelProperty("标签id")
+    @TableField(value = "label_id_")
     private Integer labelId;
-    @ApiModelProperty("标签名称(冗余字段) ")
-	@TableField(value = "label_name_")
+
+    @ApiModelProperty("标签名称(冗余字段)")
+    @TableField(value = "label_name_")
     private String labelName;
-    @ApiModelProperty("阅读量 ")
-	@TableField(value = "views_count_")
+
+    @ApiModelProperty("阅读量")
+    @TableField(value = "views_count_")
     private Long viewsCount;
-    @ApiModelProperty("点赞量 ")
-	@TableField(value = "likes_count_")
+
+    @ApiModelProperty("点赞量")
+    @TableField(value = "likes_count_")
     private Long likesCount;
-    @ApiModelProperty("评论量 ")
-	@TableField(value = "comments_count_")
+
+    @ApiModelProperty("评论量")
+    @TableField(value = "comments_count_")
     private Long commentsCount;
-    @ApiModelProperty("收藏量 ")
-	@TableField(value = "collects_count_")
+
+    @ApiModelProperty("收藏量")
+    @TableField(value = "collects_count_")
     private Long collectsCount;
-    @ApiModelProperty("草稿:DRAFT,审核中:DOING,通过:PASS,驳回:REJECT ")
-	@TableField(value = "status_")
+
+    @ApiModelProperty("草稿:DRAFT,审核中:DOING,通过:PASS,驳回:REJECT")
+    @TableField(value = "status_")
     private String status;
-    @ApiModelProperty("是否置顶 0:未置顶 1:置顶 ")
-	@TableField(value = "top_flag_")
-    private Byte topFlag;
-    @ApiModelProperty("是否可评论 0:不可评论 1:可评论 ")
-	@TableField(value = "reply_flag_")
-    private Byte replyFlag;
-    @ApiModelProperty("审核通过时间 ")
-	@TableField(value = "examine_time_")
+
+    @ApiModelProperty("是否置顶 0:未置顶 1:置顶")
+    @TableField(value = "top_flag_")
+    private Integer topFlag;
+
+    @ApiModelProperty("是否可评论 0:不可评论 1:可评论")
+    @TableField(value = "reply_flag_")
+    private Integer replyFlag;
+
+    @ApiModelProperty("审核通过时间")
+    @TableField(value = "examine_time_")
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date examineTime;
-	@TableField(value = "created_time_")
+
+    @TableField(value = "created_time_")
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date createdTime;
-	@TableField(value = "updated_time_")
+
+    @TableField(value = "updated_time_")
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date updatedTime;
-    @ApiModelProperty("0:正常 1:删除 ")
-	@TableField(value = "del_flag_")
-    private Byte delFlag;
 
-	public Long getId() {
+    @ApiModelProperty("0:正常 1:删除")
+    @TableField(value = "del_flag_")
+    private Integer delFlag;
+
+    public Long getId() {
         return id;
     }
 
     public void setId(Long id) {
         this.id = id;
     }
-    
-	public Long getUserId() {
+
+    public Long getUserId() {
         return userId;
     }
 
     public void setUserId(Long userId) {
         this.userId = userId;
     }
-    
-	public String getTitle() {
+
+    public String getTitle() {
         return title;
     }
 
     public void setTitle(String title) {
         this.title = title;
     }
-    
-	public String getContent() {
+
+    public String getContent() {
         return content;
     }
 
     public void setContent(String content) {
         this.content = content;
     }
-    
-	public Integer getLabelId() {
+
+    public Integer getLabelId() {
         return labelId;
     }
 
     public void setLabelId(Integer labelId) {
         this.labelId = labelId;
     }
-    
-	public String getLabelName() {
+
+    public String getLabelName() {
         return labelName;
     }
 
     public void setLabelName(String labelName) {
         this.labelName = labelName;
     }
-    
-	public Long getViewsCount() {
+
+    public Long getViewsCount() {
         return viewsCount;
     }
 
     public void setViewsCount(Long viewsCount) {
         this.viewsCount = viewsCount;
     }
-    
-	public Long getLikesCount() {
+
+    public Long getLikesCount() {
         return likesCount;
     }
 
     public void setLikesCount(Long likesCount) {
         this.likesCount = likesCount;
     }
-    
-	public Long getCommentsCount() {
+
+    public Long getCommentsCount() {
         return commentsCount;
     }
 
     public void setCommentsCount(Long commentsCount) {
         this.commentsCount = commentsCount;
     }
-    
-	public Long getCollectsCount() {
+
+    public Long getCollectsCount() {
         return collectsCount;
     }
 
     public void setCollectsCount(Long collectsCount) {
         this.collectsCount = collectsCount;
     }
-    
-	public String getStatus() {
+
+    public String getStatus() {
         return status;
     }
 
     public void setStatus(String status) {
         this.status = status;
     }
-    
-	public Byte getTopFlag() {
+
+    public Integer getTopFlag() {
         return topFlag;
     }
 
-    public void setTopFlag(Byte topFlag) {
+    public void setTopFlag(Integer topFlag) {
         this.topFlag = topFlag;
     }
-    
-	public Byte getReplyFlag() {
+
+    public Integer getReplyFlag() {
         return replyFlag;
     }
 
-    public void setReplyFlag(Byte replyFlag) {
+    public void setReplyFlag(Integer replyFlag) {
         this.replyFlag = replyFlag;
     }
-    
-	public Date getExamineTime() {
+
+    public Date getExamineTime() {
         return examineTime;
     }
 
     public void setExamineTime(Date examineTime) {
         this.examineTime = examineTime;
     }
-    
-	public Date getCreatedTime() {
+
+    public Date getCreatedTime() {
         return createdTime;
     }
 
     public void setCreatedTime(Date createdTime) {
         this.createdTime = createdTime;
     }
-    
-	public Date getUpdatedTime() {
+
+    public Date getUpdatedTime() {
         return updatedTime;
     }
 
     public void setUpdatedTime(Date updatedTime) {
         this.updatedTime = updatedTime;
     }
-    
-	public Byte getDelFlag() {
+
+    public Integer getDelFlag() {
         return delFlag;
     }
 
-    public void setDelFlag(Byte delFlag) {
+    public void setDelFlag(Integer delFlag) {
         this.delFlag = delFlag;
     }
-    
 }

+ 20 - 16
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/entity/BbsCollect.java

@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
 import java.util.Date;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 
@@ -18,51 +19,54 @@ import org.springframework.format.annotation.DateTimeFormat;
 @TableName("bbs_collect")
 @ApiModel(value = "BbsCollect对象", description = "收藏")
 public class BbsCollect implements Serializable {
-	private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
+
     @TableId(value = "id_", type = IdType.AUTO)
     private Long id;
-    @ApiModelProperty("文章id ")
-	@TableField(value = "article_id_")
+
+    @ApiModelProperty("文章id")
+    @TableField(value = "article_id_")
     private Long articleId;
-    @ApiModelProperty("收藏用户id ")
-	@TableField(value = "collect_user_id_")
+
+    @ApiModelProperty("收藏用户id")
+    @TableField(value = "collect_user_id_")
     private Long collectUserId;
-    @ApiModelProperty("收藏日期 ")
-	@TableField(value = "created_time_")
+
+    @ApiModelProperty("收藏日期")
+    @TableField(value = "created_time_")
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date createdTime;
 
-	public Long getId() {
+    public Long getId() {
         return id;
     }
 
     public void setId(Long id) {
         this.id = id;
     }
-    
-	public Long getArticleId() {
+
+    public Long getArticleId() {
         return articleId;
     }
 
     public void setArticleId(Long articleId) {
         this.articleId = articleId;
     }
-    
-	public Long getCollectUserId() {
+
+    public Long getCollectUserId() {
         return collectUserId;
     }
 
     public void setCollectUserId(Long collectUserId) {
         this.collectUserId = collectUserId;
     }
-    
-	public Date getCreatedTime() {
+
+    public Date getCreatedTime() {
         return createdTime;
     }
 
     public void setCreatedTime(Date createdTime) {
         this.createdTime = createdTime;
     }
-    
 }

+ 43 - 29
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/entity/BbsConfigLabel.java

@@ -4,98 +4,112 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.yonge.cooleshow.bbs.valid.AddGroup;
+import com.yonge.cooleshow.bbs.valid.UpdateGroup;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
 import java.util.Date;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
 /**
  * 论坛标签设置
  */
 @TableName("bbs_config_label")
 @ApiModel(value = "BbsConfigLabel对象", description = "论坛标签设置")
 public class BbsConfigLabel implements Serializable {
-	private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
+
     @TableId(value = "id_", type = IdType.AUTO)
+    @NotNull(groups = {UpdateGroup.class}, message = "标签id不能为空")
     private Long id;
-    @ApiModelProperty("标签 ")
-	@TableField(value = "label_name_")
+
+    @ApiModelProperty("标签")
+    @TableField(value = "label_name_")
+    @NotBlank(groups = {AddGroup.class}, message = "标签名不能为空")
     private String labelName;
-    @ApiModelProperty("创建者 ")
-	@TableField(value = "create_by_")
+
+    @ApiModelProperty("创建者")
+    @TableField(value = "create_by_")
     private Long createBy;
-    @ApiModelProperty("修改者 ")
-	@TableField(value = "update_by_")
+
+    @ApiModelProperty("修改者")
+    @TableField(value = "update_by_")
     private Long updateBy;
-	@TableField(value = "created_time_")
+
+    @TableField(value = "created_time_")
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date createdTime;
-	@TableField(value = "updated_time_")
+
+    @TableField(value = "updated_time_")
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date updatedTime;
-    @ApiModelProperty("0:正常 1:删除 ")
-	@TableField(value = "del_flag_")
-    private Byte delFlag;
 
-	public Long getId() {
+    @ApiModelProperty("0:正常 1:删除")
+    @TableField(value = "del_flag_")
+    private Integer delFlag;
+
+    public Long getId() {
         return id;
     }
 
     public void setId(Long id) {
         this.id = id;
     }
-    
-	public String getLabelName() {
+
+    public String getLabelName() {
         return labelName;
     }
 
     public void setLabelName(String labelName) {
         this.labelName = labelName;
     }
-    
-	public Long getCreateBy() {
+
+    public Long getCreateBy() {
         return createBy;
     }
 
     public void setCreateBy(Long createBy) {
         this.createBy = createBy;
     }
-    
-	public Long getUpdateBy() {
+
+    public Long getUpdateBy() {
         return updateBy;
     }
 
     public void setUpdateBy(Long updateBy) {
         this.updateBy = updateBy;
     }
-    
-	public Date getCreatedTime() {
+
+    public Date getCreatedTime() {
         return createdTime;
     }
 
     public void setCreatedTime(Date createdTime) {
         this.createdTime = createdTime;
     }
-    
-	public Date getUpdatedTime() {
+
+    public Date getUpdatedTime() {
         return updatedTime;
     }
 
     public void setUpdatedTime(Date updatedTime) {
         this.updatedTime = updatedTime;
     }
-    
-	public Byte getDelFlag() {
+
+    public Integer getDelFlag() {
         return delFlag;
     }
 
-    public void setDelFlag(Byte delFlag) {
+    public void setDelFlag(Integer delFlag) {
         this.delFlag = delFlag;
     }
-    
 }

+ 20 - 16
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/entity/BbsFollow.java

@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
 import java.util.Date;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 
@@ -18,51 +19,54 @@ import org.springframework.format.annotation.DateTimeFormat;
 @TableName("bbs_follow")
 @ApiModel(value = "BbsFollow对象", description = "关注")
 public class BbsFollow implements Serializable {
-	private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
+
     @TableId(value = "id_", type = IdType.AUTO)
     private Long id;
-    @ApiModelProperty("用户id ")
-	@TableField(value = "user_id_")
+
+    @ApiModelProperty("用户id")
+    @TableField(value = "user_id_")
     private Long userId;
-    @ApiModelProperty("关注用户id ")
-	@TableField(value = "friend_user_id")
+
+    @ApiModelProperty("关注用户id")
+    @TableField(value = "friend_user_id")
     private Long friendUserId;
-    @ApiModelProperty("关注时间 ")
-	@TableField(value = "created_time_")
+
+    @ApiModelProperty("关注时间")
+    @TableField(value = "created_time_")
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date createdTime;
 
-	public Long getId() {
+    public Long getId() {
         return id;
     }
 
     public void setId(Long id) {
         this.id = id;
     }
-    
-	public Long getUserId() {
+
+    public Long getUserId() {
         return userId;
     }
 
     public void setUserId(Long userId) {
         this.userId = userId;
     }
-    
-	public Long getFriendUserId() {
+
+    public Long getFriendUserId() {
         return friendUserId;
     }
 
     public void setFriendUserId(Long friendUserId) {
         this.friendUserId = friendUserId;
     }
-    
-	public Date getCreatedTime() {
+
+    public Date getCreatedTime() {
         return createdTime;
     }
 
     public void setCreatedTime(Date createdTime) {
         this.createdTime = createdTime;
     }
-    
 }

+ 20 - 16
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/entity/BbsLike.java

@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
 import java.util.Date;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 
@@ -18,51 +19,54 @@ import org.springframework.format.annotation.DateTimeFormat;
 @TableName("bbs_like")
 @ApiModel(value = "BbsLike对象", description = "点赞")
 public class BbsLike implements Serializable {
-	private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
+
     @TableId(value = "id_", type = IdType.AUTO)
     private Long id;
-    @ApiModelProperty("文章id ")
-	@TableField(value = "article_id_")
+
+    @ApiModelProperty("文章id")
+    @TableField(value = "article_id_")
     private Long articleId;
-    @ApiModelProperty("点赞用户id ")
-	@TableField(value = "like_user_id_")
+
+    @ApiModelProperty("点赞用户id")
+    @TableField(value = "like_user_id_")
     private Long likeUserId;
-    @ApiModelProperty("点赞日期 ")
-	@TableField(value = "created_time_")
+
+    @ApiModelProperty("点赞日期")
+    @TableField(value = "created_time_")
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date createdTime;
 
-	public Long getId() {
+    public Long getId() {
         return id;
     }
 
     public void setId(Long id) {
         this.id = id;
     }
-    
-	public Long getArticleId() {
+
+    public Long getArticleId() {
         return articleId;
     }
 
     public void setArticleId(Long articleId) {
         this.articleId = articleId;
     }
-    
-	public Long getLikeUserId() {
+
+    public Long getLikeUserId() {
         return likeUserId;
     }
 
     public void setLikeUserId(Long likeUserId) {
         this.likeUserId = likeUserId;
     }
-    
-	public Date getCreatedTime() {
+
+    public Date getCreatedTime() {
         return createdTime;
     }
 
     public void setCreatedTime(Date createdTime) {
         this.createdTime = createdTime;
     }
-    
 }

+ 25 - 20
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/entity/BbsPrivateMessage.java

@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
 import java.util.Date;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 
@@ -18,62 +19,66 @@ import org.springframework.format.annotation.DateTimeFormat;
 @TableName("bbs_private_message")
 @ApiModel(value = "BbsPrivateMessage对象", description = "私信")
 public class BbsPrivateMessage implements Serializable {
-	private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
+
     @TableId(value = "id", type = IdType.AUTO)
     private Long id;
-    @ApiModelProperty("发送用户id ")
-	@TableField(value = "send_user_id_")
+
+    @ApiModelProperty("发送用户id")
+    @TableField(value = "send_user_id_")
     private Long sendUserId;
-    @ApiModelProperty("接受方用户id ")
-	@TableField(value = "receiver_user_id_")
+
+    @ApiModelProperty("接受方用户id")
+    @TableField(value = "receiver_user_id_")
     private Long receiverUserId;
-    @ApiModelProperty("发送消息内容 ")
-	@TableField(value = "message_content_")
+
+    @ApiModelProperty("发送消息内容")
+    @TableField(value = "message_content_")
     private String messageContent;
-    @ApiModelProperty("发送时间 ")
-	@TableField(value = "created_time_")
+
+    @ApiModelProperty("发送时间")
+    @TableField(value = "created_time_")
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date createdTime;
 
-	public Long getId() {
+    public Long getId() {
         return id;
     }
 
     public void setId(Long id) {
         this.id = id;
     }
-    
-	public Long getSendUserId() {
+
+    public Long getSendUserId() {
         return sendUserId;
     }
 
     public void setSendUserId(Long sendUserId) {
         this.sendUserId = sendUserId;
     }
-    
-	public Long getReceiverUserId() {
+
+    public Long getReceiverUserId() {
         return receiverUserId;
     }
 
     public void setReceiverUserId(Long receiverUserId) {
         this.receiverUserId = receiverUserId;
     }
-    
-	public String getMessageContent() {
+
+    public String getMessageContent() {
         return messageContent;
     }
 
     public void setMessageContent(String messageContent) {
         this.messageContent = messageContent;
     }
-    
-	public Date getCreatedTime() {
+
+    public Date getCreatedTime() {
         return createdTime;
     }
 
     public void setCreatedTime(Date createdTime) {
         this.createdTime = createdTime;
     }
-    
 }

+ 39 - 31
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/entity/BbsReply.java

@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
 import java.util.Date;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 
@@ -18,96 +19,103 @@ import org.springframework.format.annotation.DateTimeFormat;
 @TableName("bbs_reply")
 @ApiModel(value = "BbsReply对象", description = "文章评论")
 public class BbsReply implements Serializable {
-	private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
+
     @TableId(value = "id_", type = IdType.AUTO)
     private Long id;
-    @ApiModelProperty("上级id ")
-	@TableField(value = "parent_id_")
+
+    @ApiModelProperty("上级id")
+    @TableField(value = "parent_id_")
     private Long parentId;
-    @ApiModelProperty("文章id ")
-	@TableField(value = "article_id")
+
+    @ApiModelProperty("文章id")
+    @TableField(value = "article_id")
     private Long articleId;
-    @ApiModelProperty("评论者id ")
-	@TableField(value = "user_id_")
+
+    @ApiModelProperty("评论者id")
+    @TableField(value = "user_id_")
     private Long userId;
-    @ApiModelProperty("评论内容 ")
-	@TableField(value = "content_")
+
+    @ApiModelProperty("评论内容")
+    @TableField(value = "content_")
     private String content;
-    @ApiModelProperty("审核中:DOING,通过:PASS,驳回:REJECT ")
-	@TableField(value = "status_")
+
+    @ApiModelProperty("审核中:DOING,通过:PASS,驳回:REJECT")
+    @TableField(value = "status_")
     private String status;
+
     @ApiModelProperty("评论日期 ")
-	@TableField(value = "created_time_")
+    @TableField(value = "created_time_")
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date createdTime;
-	@TableField(value = "updated_time_")
+
+    @TableField(value = "updated_time_")
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date updatedTime;
 
-	public Long getId() {
+    public Long getId() {
         return id;
     }
 
     public void setId(Long id) {
         this.id = id;
     }
-    
-	public Long getParentId() {
+
+    public Long getParentId() {
         return parentId;
     }
 
     public void setParentId(Long parentId) {
         this.parentId = parentId;
     }
-    
-	public Long getArticleId() {
+
+    public Long getArticleId() {
         return articleId;
     }
 
     public void setArticleId(Long articleId) {
         this.articleId = articleId;
     }
-    
-	public Long getUserId() {
+
+    public Long getUserId() {
         return userId;
     }
 
     public void setUserId(Long userId) {
         this.userId = userId;
     }
-    
-	public String getContent() {
+
+    public String getContent() {
         return content;
     }
 
     public void setContent(String content) {
         this.content = content;
     }
-    
-	public String getStatus() {
+
+    public String getStatus() {
         return status;
     }
 
     public void setStatus(String status) {
         this.status = status;
     }
-    
-	public Date getCreatedTime() {
+
+    public Date getCreatedTime() {
         return createdTime;
     }
 
     public void setCreatedTime(Date createdTime) {
         this.createdTime = createdTime;
     }
-    
-	public Date getUpdatedTime() {
+
+    public Date getUpdatedTime() {
         return updatedTime;
     }
 
     public void setUpdatedTime(Date updatedTime) {
         this.updatedTime = updatedTime;
     }
-    
 }

+ 18 - 5
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/service/BbsConfigLabelService.java

@@ -6,24 +6,37 @@ import com.yonge.cooleshow.bbs.vo.BbsConfigLabelVo;
 import com.yonge.cooleshow.bbs.dto.search.BbsConfigLabelSearch;
 import com.yonge.cooleshow.bbs.entity.BbsConfigLabel;
 
+import java.util.List;
+
 /**
  * 论坛标签设置 服务类
+ *
  * @author liweifan
  * @date 2022-06-09
  */
-public interface BbsConfigLabelService extends IService<BbsConfigLabel>  {
+public interface BbsConfigLabelService extends IService<BbsConfigLabel> {
 
-	/**
+    /**
      * 查询详情
+     *
      * @author liweifan
- 	 * @date 2022-06-09
+     * @date 2022-06-09
      */
-	BbsConfigLabelVo detail(Long id);
+    BbsConfigLabelVo detail(Long id);
 
     /**
      * 分页查询
+     *
      * @author liweifan
- 	 * @date 2022-06-09
+     * @date 2022-06-09
      */
     IPage<BbsConfigLabelVo> selectPage(IPage<BbsConfigLabelVo> page, BbsConfigLabelSearch query);
+
+    /**
+     * 查询所有
+     *
+     * @param delFlag 删除状态
+     * @return
+     */
+    List<BbsConfigLabel> selectAll(Integer delFlag);
 }

+ 10 - 5
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/service/impl/BbsConfigLabelServiceImpl.java

@@ -11,19 +11,24 @@ import com.yonge.cooleshow.bbs.dto.search.BbsConfigLabelSearch;
 import com.yonge.cooleshow.bbs.dao.BbsConfigLabelDao;
 import com.yonge.cooleshow.bbs.service.BbsConfigLabelService;
 
+import java.util.List;
 
 @Service
 public class BbsConfigLabelServiceImpl extends ServiceImpl<BbsConfigLabelDao, BbsConfigLabel> implements BbsConfigLabelService {
     private final static Logger log = LoggerFactory.getLogger(BbsConfigLabelServiceImpl.class);
 
-	@Override
+    @Override
     public BbsConfigLabelVo detail(Long id) {
         return baseMapper.detail(id);
     }
-    
-     @Override
-    public IPage<BbsConfigLabelVo> selectPage(IPage<BbsConfigLabelVo> page, BbsConfigLabelSearch query){
+
+    @Override
+    public IPage<BbsConfigLabelVo> selectPage(IPage<BbsConfigLabelVo> page, BbsConfigLabelSearch query) {
         return page.setRecords(baseMapper.selectPage(page, query));
     }
-	
+
+    @Override
+    public List<BbsConfigLabel> selectAll(Integer delFlag) {
+        return baseMapper.selectAll(delFlag);
+    }
 }

+ 8 - 0
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/valid/AddGroup.java

@@ -0,0 +1,8 @@
+package com.yonge.cooleshow.bbs.valid;
+
+/**
+ * @author: cy
+ * @date: 2022/3/31 09:54
+ */
+public interface AddGroup {
+}

+ 8 - 0
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/valid/DeleteGroup.java

@@ -0,0 +1,8 @@
+package com.yonge.cooleshow.bbs.valid;
+
+/**
+ * @author: cy
+ * @date: 2022/3/31 09:54
+ */
+public interface DeleteGroup {
+}

+ 27 - 0
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/valid/EnumValid.java

@@ -0,0 +1,27 @@
+package com.yonge.cooleshow.bbs.valid;
+
+import com.yonge.cooleshow.bbs.valid.impl.EnumValidtor;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import java.lang.annotation.*;
+
+/**
+ * 校验入参是否为指定enum的值的注解
+ */
+@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.ANNOTATION_TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+@Constraint(validatedBy = {EnumValidtor.class})
+@Documented
+public @interface EnumValid {
+
+    String message() default "";
+
+    Class<?>[] groups() default {};
+
+    Class<? extends Payload>[] payload() default {};
+
+    Class<?>[] target() default {};
+
+    String vaildField() default "getCode";
+}

+ 31 - 0
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/valid/ListValue.java

@@ -0,0 +1,31 @@
+package com.yonge.cooleshow.bbs.valid;
+
+
+import com.yonge.cooleshow.bbs.valid.impl.ListValueValidator;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * @author: cy
+ * @date: 2022/3/31 09:54
+ */
+@Documented
+@Constraint(validatedBy = {ListValueValidator.class})
+@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
+@Retention(RUNTIME)
+public @interface ListValue {
+    String message() default "必须提交指定的值";
+
+    Class<?>[] groups() default {};
+
+    Class<? extends Payload>[] payload() default {};
+
+    int[] vals() default {};
+}

+ 8 - 0
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/valid/SelectGroup.java

@@ -0,0 +1,8 @@
+package com.yonge.cooleshow.bbs.valid;
+
+/**
+* @Author: cy
+* @Date: 2022/4/6
+*/
+public interface SelectGroup {
+}

+ 8 - 0
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/valid/UpdateGroup.java

@@ -0,0 +1,8 @@
+package com.yonge.cooleshow.bbs.valid;
+
+/**
+ * @author: cy
+ * @date: 2022/3/31 09:54
+ */
+public interface UpdateGroup {
+}

+ 63 - 0
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/valid/impl/EnumValidtor.java

@@ -0,0 +1,63 @@
+package com.yonge.cooleshow.bbs.valid.impl;
+
+import com.yonge.cooleshow.bbs.valid.EnumValid;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * @author: cy
+ * @date: 2022/4/2 14:53
+ */
+public class EnumValidtor implements ConstraintValidator<EnumValid, Object> {
+
+    String vaildField;
+    Class<?>[] cls; //枚举类
+
+    @Override
+    public void initialize(EnumValid constraintAnnotation) {
+        cls = constraintAnnotation.target();
+        vaildField = constraintAnnotation.vaildField();
+    }
+
+    @Override
+    public boolean isValid(Object value, ConstraintValidatorContext context) {
+        if (value != null && value.toString().length() > 0 && cls.length > 0) {
+            for (Class<?> cl : cls) {
+                try {
+                    if (cl.isEnum()) {
+                        //枚举类验证
+                        Object[] objs = cl.getEnumConstants();
+                        Method method = cl.getMethod("name");
+                        for (Object obj : objs) {
+                            Object code = method.invoke(obj, null);
+                            if (value.equals(code.toString())) {
+                                return true;
+                            }
+                        }
+                        Method codeMethod = cl.getMethod(vaildField);
+                        for (Object obj : objs) {
+                            Object code = codeMethod.invoke(obj, null);
+                            if (value.toString().equals(code.toString())) {
+                                return true;
+                            }
+                        }
+                    }
+                } catch (NoSuchMethodException e) {
+                    e.printStackTrace();
+                } catch (IllegalAccessException e) {
+                    e.printStackTrace();
+                } catch (InvocationTargetException e) {
+                    e.printStackTrace();
+                }
+            }
+        } else {
+            return true;
+        }
+        return false;
+    }
+
+}
+

+ 33 - 0
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/valid/impl/ListValueValidator.java

@@ -0,0 +1,33 @@
+package com.yonge.cooleshow.bbs.valid.impl;
+
+import com.yonge.cooleshow.bbs.valid.ListValue;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author: cy
+ * @date: 2022/3/31 09:54
+ */
+public class ListValueValidator implements ConstraintValidator<ListValue, Integer> {
+    private Set<Integer> set = new HashSet<>();
+
+    @Override
+    public void initialize(ListValue constraintAnnotation) {
+        int[] vals = constraintAnnotation.vals();
+        for (int val : vals) {
+            set.add(null);
+            set.add(val);
+        }
+    }
+
+    @Override
+    public boolean isValid(Integer value, ConstraintValidatorContext context) {
+        if (value == null) {
+            return true;
+        }
+        return set.contains(value);
+    }
+}

+ 138 - 0
cooleshow-bbs/src/main/java/com/yonge/cooleshow/bbs/valid/impl/ValidList.java

@@ -0,0 +1,138 @@
+package com.yonge.cooleshow.bbs.valid.impl;
+
+import javax.validation.Valid;
+import java.util.*;
+
+/**
+ * @author: cy
+ * @date: 2022/3/31 09:54
+ */
+public class ValidList<E> implements List<E> {
+
+    @Valid
+    private List<E> list = new LinkedList<>();
+
+    @Override
+    public int size() {
+        return list.size();
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return list.isEmpty();
+    }
+
+    @Override
+    public boolean contains(Object o) {
+        return list.contains(o);
+    }
+
+    @Override
+    public Iterator<E> iterator() {
+        return list.iterator();
+    }
+
+    @Override
+    public Object[] toArray() {
+        return list.toArray();
+    }
+
+    @Override
+    public <T> T[] toArray(T[] a) {
+        return list.toArray(a);
+    }
+
+    @Override
+    public boolean add(E e) {
+        return list.add(e);
+    }
+
+    @Override
+    public boolean remove(Object o) {
+        return list.remove(o);
+    }
+
+    @Override
+    public boolean containsAll(Collection<?> c) {
+        return list.containsAll(c);
+    }
+
+    @Override
+    public boolean addAll(Collection<? extends E> c) {
+        return list.addAll(c);
+    }
+
+    @Override
+    public boolean addAll(int index, Collection<? extends E> c) {
+        return list.addAll(index, c);
+    }
+
+    @Override
+    public boolean removeAll(Collection<?> c) {
+        return list.removeAll(c);
+    }
+
+    @Override
+    public boolean retainAll(Collection<?> c) {
+        return list.retainAll(c);
+    }
+
+    @Override
+    public void clear() {
+        list.clear();
+    }
+
+    @Override
+    public E get(int index) {
+        return list.get(index);
+    }
+
+    @Override
+    public E set(int index, E element) {
+        return list.set(index, element);
+    }
+
+    @Override
+    public void add(int index, E element) {
+        list.add(index, element);
+    }
+
+    @Override
+    public E remove(int index) {
+        return list.remove(index);
+    }
+
+    @Override
+    public int indexOf(Object o) {
+        return list.indexOf(o);
+    }
+
+    @Override
+    public int lastIndexOf(Object o) {
+        return list.lastIndexOf(o);
+    }
+
+    @Override
+    public ListIterator<E> listIterator() {
+        return list.listIterator();
+    }
+
+    @Override
+    public ListIterator<E> listIterator(int index) {
+        return list.listIterator(index);
+    }
+
+    @Override
+    public List<E> subList(int fromIndex, int toIndex) {
+        return list.subList(fromIndex, toIndex);
+    }
+
+    public List<E> getList() {
+        return list;
+    }
+
+    public void setList(List<E> list) {
+        this.list = list;
+    }
+
+}

+ 15 - 1
cooleshow-bbs/src/main/resources/config/mybatis/BbsConfigLabelMapper.xml

@@ -28,10 +28,24 @@
         FROM bbs_config_label t
         where t.id_ = #{id}
     </select>
-    
     <select id="selectPage" resultType="com.yonge.cooleshow.bbs.vo.BbsConfigLabelVo">
 		SELECT         
         	<include refid="baseColumns" />
 		FROM bbs_config_label t
+        <where>
+            <if test="param.delFlag != null">
+                t.del_flag_ = #{param.delFlag}
+            </if>
+        </where>
 	</select>
+    <select id="selectAll" resultType="com.yonge.cooleshow.bbs.entity.BbsConfigLabel">
+        SELECT
+        <include refid="baseColumns" />
+        FROM bbs_config_label t
+        <where>
+            <if test="delFlag != null">
+                t.del_flag_ = #{delFlag}
+            </if>
+        </where>
+    </select>
 </mapper>