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

commit commit

上级 d4a2384d
...@@ -98,7 +98,7 @@ public class AuthController extends Controller { ...@@ -98,7 +98,7 @@ public class AuthController extends Controller {
TbCfUserInfo userInfo = byAccount.get(); TbCfUserInfo userInfo = byAccount.get();
fixCode(userInfo); fixCode(userInfo);
Authentication authentication; Authentication authentication;
try { try {
authentication = authenticationManager.authenticate( authentication = authenticationManager.authenticate(
...@@ -263,7 +263,7 @@ public class AuthController extends Controller { ...@@ -263,7 +263,7 @@ public class AuthController extends Controller {
if (phone.isEmpty()) { if (phone.isEmpty()) {
return new Result<>(ResultCodeEnum.VALIDATE_ERROR.getCode(), "Email is empty"); return new Result<>(ResultCodeEnum.VALIDATE_ERROR.getCode(), "Phone is empty");
} }
if (!isPhoneValid(phone)) { if (!isPhoneValid(phone)) {
......
...@@ -5,7 +5,11 @@ import lombok.Setter; ...@@ -5,7 +5,11 @@ import lombok.Setter;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Transient;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/** /**
* 商品二级分类表实体 * 商品二级分类表实体
...@@ -37,6 +41,13 @@ public class TbCfGoodstwotype{ ...@@ -37,6 +41,13 @@ public class TbCfGoodstwotype{
*/ */
private String goodstwotypeUrl; private String goodstwotypeUrl;
@Transient
private boolean autoLoad = false;
@OneToMany(mappedBy = "goodstwotypeId")
private List<TbCfDescripiton> categoryList = new ArrayList<>();
/** /**
* 设置:商品二级分类Id * 设置:商品二级分类Id
*/ */
...@@ -50,6 +61,10 @@ public class TbCfGoodstwotype{ ...@@ -50,6 +61,10 @@ public class TbCfGoodstwotype{
public String getGoodstwotypeId() { public String getGoodstwotypeId() {
return goodstwotypeId; return goodstwotypeId;
} }
public void enableAutoLoad(){
this.autoLoad = true;
}
/** /**
* 设置:商品二级分类标题 * 设置:商品二级分类标题
*/ */
...@@ -57,6 +72,10 @@ public class TbCfGoodstwotype{ ...@@ -57,6 +72,10 @@ public class TbCfGoodstwotype{
this.goodstwotypeTitle = goodstwotypeTitle; this.goodstwotypeTitle = goodstwotypeTitle;
} }
public List<TbCfDescripiton> getCategoryList() {
return autoLoad ? categoryList : new ArrayList<>();
}
/** /**
* 获取:商品二级分类标题 * 获取:商品二级分类标题
*/ */
......
package com.example.afrishop_v3.models;
import lombok.Data;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.util.Date;
@Entity
@Data
public class TbCfSolve {
/**
* ID
*/
@Id
private String id;
/**
* 类型 1:about us 2:contact us 3:faq
*/
private Integer type;
/**
* 用户ID
*/
private String userId;
/**
* 是否有帮助 1:yes 2:no
*/
private Integer isSolve;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 设置:ID
*/
public void setId(String id) {
this.id = id;
}
/**
* 获取:ID
*/
public String getId() {
return id;
}
/**
* 设置:类型 1:about us 2:contact us 3:faq
*/
public void setType(Integer type) {
this.type = type;
}
/**
* 获取:类型 1:about us 2:contact us 3:faq
*/
public Integer getType() {
return type;
}
/**
* 设置:用户ID
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
* 获取:用户ID
*/
public String getUserId() {
return userId;
}
/**
* 设置:是否有帮助 1:yes 2:no
*/
public void setIsSolve(Integer isSolve) {
this.isSolve = isSolve;
}
/**
* 获取:是否有帮助 1:yes 2:no
*/
public Integer getIsSolve() {
return isSolve;
}
/**
* 设置:创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取:创建时间
*/
public Date getCreateTime() {
return createTime;
}
/**
* 设置:更新时间
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* 获取:更新时间
*/
public Date getUpdateTime() {
return updateTime;
}
}
package com.example.afrishop_v3.repository;
import com.example.afrishop_v3.models.TbCfSolve;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface TbCfSolveRepository extends PagingAndSortingRepository<TbCfSolve,String> {
}
package com.example.afrishop_v3.web.controllers;
import com.example.afrishop_v3.base.Result;
import com.example.afrishop_v3.models.TbCfHomePage;
import com.example.afrishop_v3.repository.TbCfHomePageRepository;
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("/website/banner")
public class BannerController {
private final TbCfHomePageRepository repository;
public BannerController(TbCfHomePageRepository repository) {
this.repository = repository;
}
@GetMapping
public Result getBannerList(@RequestParam(value = "version") Integer version) {
List<TbCfHomePage> list = repository.getAllByImgVersionAndEnableFlag(version, 1);
return new Result<>(list);
}
}
package com.example.afrishop_v3.web.controllers;
import com.example.afrishop_v3.base.Result;
import com.example.afrishop_v3.models.TbCfGoodstwotype;
import com.example.afrishop_v3.models.TbCfGoodstype;
import com.example.afrishop_v3.repository.TbCfGoodstwotypeRepository;
import com.example.afrishop_v3.repository.TbCfGoodstypeRepository;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/website/column2")
public class ColumnController {
private final TbCfGoodstypeRepository repository;
private final TbCfGoodstwotypeRepository goodstwotypeRepository;
public ColumnController(TbCfGoodstypeRepository repository, TbCfGoodstwotypeRepository goodstwotypeRepository) {
this.repository = repository;
this.goodstwotypeRepository = goodstwotypeRepository;
}
@GetMapping
public Result getAllColumn() {
Iterable<TbCfGoodstype> all = repository.findAll();
return new Result<>(all);
}
@GetMapping("/{id}")
public Result getColumnChildren(@PathVariable String id) {
List<TbCfGoodstwotype> list = goodstwotypeRepository.findAllByGoodstypeId(id);
list.forEach(TbCfGoodstwotype::enableAutoLoad);
return new Result<>(list);
}
}
package com.example.afrishop_v3.web.controllers;
import com.example.afrishop_v3.base.Result;
import com.example.afrishop_v3.models.TbCfSolve;
import com.example.afrishop_v3.repository.TbCfSolveRepository;
import com.example.afrishop_v3.util.IdUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/website/solve")
public class SolveController {
private final TbCfSolveRepository repository;
public SolveController(TbCfSolveRepository repository) {
this.repository = repository;
}
@PostMapping("/save")
public Result save(@RequestBody TbCfSolve tbCfSolve) {
tbCfSolve.setId(IdUtil.createIdbyUUID());
TbCfSolve cfSolve = repository.save(tbCfSolve);
return new Result<>(cfSolve);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论