提交 99628d31 authored 作者: Whispa's avatar Whispa

second commit

上级 5a4b543c
...@@ -3,7 +3,7 @@ package com.example.afrishop_v3.controllers; ...@@ -3,7 +3,7 @@ package com.example.afrishop_v3.controllers;
import com.example.afrishop_v3.base.Result; import com.example.afrishop_v3.base.Result;
import com.example.afrishop_v3.enums.ResultCodeEnum; import com.example.afrishop_v3.enums.ResultCodeEnum;
import com.example.afrishop_v3.models.TbCfSearch; import com.example.afrishop_v3.models.TbCfSearch;
import com.example.afrishop_v3.repository.TbCfSearchEntityRepository; import com.example.afrishop_v3.repository.TbCfSearchRepository;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
...@@ -11,9 +11,9 @@ import java.util.List; ...@@ -11,9 +11,9 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/search") @RequestMapping("/search")
public class SearchController { public class SearchController {
private final TbCfSearchEntityRepository repository; private final TbCfSearchRepository repository;
public SearchController(TbCfSearchEntityRepository repository) { public SearchController(TbCfSearchRepository repository) {
this.repository = repository; this.repository = repository;
} }
...@@ -34,7 +34,7 @@ public class SearchController { ...@@ -34,7 +34,7 @@ public class SearchController {
@DeleteMapping("/deleteRecords") @DeleteMapping("/deleteRecords")
public Result deleteRecords(@RequestBody String[] ids) { public Result deleteRecords(@RequestBody String[] ids) {
if (ids != null) { if (ids != null) {
repository.deleteRecordsWithIds(ids); repository.deleteAllByIdIn(ids);
return new Result(); return new Result();
} }
return new Result(ResultCodeEnum.SERVICE_ERROR.getCode(), return new Result(ResultCodeEnum.SERVICE_ERROR.getCode(),
......
...@@ -2,7 +2,7 @@ package com.example.afrishop_v3.controllers; ...@@ -2,7 +2,7 @@ package com.example.afrishop_v3.controllers;
import com.example.afrishop_v3.base.Result; import com.example.afrishop_v3.base.Result;
import com.example.afrishop_v3.models.TbCfHomePage; import com.example.afrishop_v3.models.TbCfHomePage;
import com.example.afrishop_v3.repository.TbCfHomePageEntityRepository; import com.example.afrishop_v3.repository.TbCfHomePageRepository;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -13,9 +13,9 @@ import java.util.List; ...@@ -13,9 +13,9 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/startPage") @RequestMapping("/startPage")
public class TbCfHomePageEntityController { public class TbCfHomePageEntityController {
private final TbCfHomePageEntityRepository repository; private final TbCfHomePageRepository repository;
public TbCfHomePageEntityController(TbCfHomePageEntityRepository repository) { public TbCfHomePageEntityController(TbCfHomePageRepository repository) {
this.repository = repository; this.repository = repository;
} }
......
...@@ -17,6 +17,7 @@ import java.io.Serializable; ...@@ -17,6 +17,7 @@ import java.io.Serializable;
*/ */
@Getter @Getter
@Setter @Setter
@Entity
public class TbCfHomePage { public class TbCfHomePage {
/** /**
......
...@@ -6,6 +6,7 @@ import lombok.Setter; ...@@ -6,6 +6,7 @@ import lombok.Setter;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.ManyToOne;
@Entity @Entity
@Getter @Getter
...@@ -21,6 +22,10 @@ public class TbCfSearch { ...@@ -21,6 +22,10 @@ public class TbCfSearch {
* 搜索关键字 * 搜索关键字
*/ */
private String searchKeywords; private String searchKeywords;
@ManyToOne()
private TbCfUserInfo userInfo;
/** /**
* 用户ID * 用户ID
*/ */
......
...@@ -5,6 +5,6 @@ import org.springframework.data.repository.PagingAndSortingRepository; ...@@ -5,6 +5,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List; import java.util.List;
public interface TbCfHomePageEntityRepository extends PagingAndSortingRepository<TbCfHomePage,String> { public interface TbCfHomePageRepository extends PagingAndSortingRepository<TbCfHomePage,String> {
List<TbCfHomePage> getAllByImgVersionAndEnableFlag(Integer imgVersion, Integer enableFlag); List<TbCfHomePage> getAllByImgVersionAndEnableFlag(Integer imgVersion, Integer enableFlag);
} }
...@@ -7,10 +7,8 @@ import org.springframework.data.repository.PagingAndSortingRepository; ...@@ -7,10 +7,8 @@ import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List; import java.util.List;
public interface TbCfSearchEntityRepository extends PagingAndSortingRepository<TbCfSearch,String> { public interface TbCfSearchRepository extends PagingAndSortingRepository<TbCfSearch,String> {
List<TbCfSearch> getAllByUserId(String userId); List<TbCfSearch> getAllByUserId(String userId);
@Modifying void deleteAllByIdIn(String[] ids);
@Query("delete from tb_cf_search u where u.id in ?1")
void deleteRecordsWithIds(String[] ids);
} }
...@@ -3,5 +3,5 @@ package com.example.afrishop_v3.repository; ...@@ -3,5 +3,5 @@ package com.example.afrishop_v3.repository;
import com.example.afrishop_v3.models.TbCfSort; import com.example.afrishop_v3.models.TbCfSort;
import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.PagingAndSortingRepository;
public interface TbCfSortEntityRepository extends PagingAndSortingRepository<TbCfSort,String> { public interface TbCfSortRepository extends PagingAndSortingRepository<TbCfSort,String> {
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论