提交 cfb991da authored 作者: Whispa's avatar Whispa

commit

上级 b77b087d
package com.example.afrishop_v3.controllers;
import com.example.afrishop_v3.models.TbCfVersion;
import com.example.afrishop_v3.repository.TbCfVersionRepository;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/version")
public class VersionController {
private final TbCfVersionRepository repository;
public VersionController(TbCfVersionRepository repository) {
this.repository = repository;
}
@RequestMapping("/getVersionCode")
@GetMapping
public List<TbCfVersion> getList(@RequestParam(required = false) String code){
return code == null ? (List<TbCfVersion>) repository.findAll() : repository.findAllByVersionCode(code);
}
}
package com.example.afrishop_v3.models;
import lombok.Data;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.io.Serializable;
/**
* 实体
* 表名 tb_cf_version
*
* @author lipengjun
* @date 2019-10-22 14:33:29
*/
@Entity
@Data
public class TbCfVersion implements Serializable {
/**
* 版本号Id
*/
@Id
private String versionId;
/**
* 版本code
*/
private String versionCode;
/**
* 版本更新链接
*/
private String versionLike;
/**
* 版本更新内容
*/
private String versionDetail;
/**
* 版本分类(0安卓,1苹果)
*/
private Integer versionSort;
/**
* 设置:版本号Id
*/
public void setVersionId(String versionId) {
this.versionId = versionId;
}
/**
* 获取:版本号Id
*/
public String getVersionId() {
return versionId;
}
/**
* 设置:版本code
*/
public void setVersionCode(String versionCode) {
this.versionCode = versionCode;
}
/**
* 获取:版本code
*/
public String getVersionCode() {
return versionCode;
}
/**
* 设置:版本更新链接
*/
public void setVersionLike(String versionLike) {
this.versionLike = versionLike;
}
/**
* 获取:版本更新链接
*/
public String getVersionLike() {
return versionLike;
}
/**
* 设置:版本更新内容
*/
public void setVersionDetail(String versionDetail) {
this.versionDetail = versionDetail;
}
/**
* 获取:版本更新内容
*/
public String getVersionDetail() {
return versionDetail;
}
/**
* 获取: 版本分类(0安卓,1苹果)
*/
public Integer getVersionSort() {
return versionSort;
}
/**
* 设置: 版本分类(0安卓,1苹果)
*/
public void setVersionSort(Integer versionSort) {
this.versionSort = versionSort;
}
}
package com.example.afrishop_v3.repository;
import com.example.afrishop_v3.models.TbCfVersion;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface TbCfVersionRepository extends PagingAndSortingRepository<TbCfVersion,String> {
List<TbCfVersion> findAllByVersionCode(String versionCode);
}
...@@ -58,7 +58,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -58,7 +58,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
http.cors().and().csrf().disable() http.cors().and().csrf().disable()
.exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and() .exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and() .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
.authorizeRequests().antMatchers("/api/auth/**", "/itemStation/**", "/startPage/**", "/goodsType/**", "/home/**", "/spider/**", "/store/**", "/shopify/**", "/community/**").permitAll() .authorizeRequests().antMatchers("/api/auth/**", "/itemStation/**", "/startPage/**", "/goodsType/**", "/home/**", "/spider/**", "/store/**", "/shopify/**", "/community/**","/version/**").permitAll()
.antMatchers("/api/test/**").permitAll() .antMatchers("/api/test/**").permitAll()
.anyRequest().authenticated(); .anyRequest().authenticated();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论