|
|
@@ -9,13 +9,17 @@ import com.izouma.nineth.repo.PriceListRepo;
|
|
|
import com.izouma.nineth.utils.ObjUtils;
|
|
|
import com.izouma.nineth.utils.excel.ExcelUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.springframework.cache.annotation.Cacheable;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("/priceList")
|
|
|
@@ -64,5 +68,17 @@ public class PriceListController extends BaseController {
|
|
|
List<PriceList> data = all(pageQuery).getContent();
|
|
|
ExcelUtils.export(response, data);
|
|
|
}
|
|
|
+
|
|
|
+ @GetMapping("/list")
|
|
|
+ @Cacheable("priceList")
|
|
|
+ public List<Map<String, String>> list() {
|
|
|
+ return priceListRepo.findAll().stream().map(priceList -> {
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put("name", priceList.getName());
|
|
|
+ map.put("img", priceList.getPic());
|
|
|
+ map.put("price", priceList.getPrice());
|
|
|
+ return map;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ }
|
|
|
}
|
|
|
|