6.07

kxzzow發表於2024-06-13
package com.example.spring2.controller;

import com.example.spring2.entity.User;
import com.example.spring2.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping("/user")
public class UserController {

@Autowired
private UserService userService;

// 根據使用者名稱統計數量
@GetMapping("/countByName")
public Map<String, User> getCountByName(@RequestParam String user) {
return userService.getCountByName(user);
}

// 根據文件統計數量
@GetMapping("/countByDocument")
public Map<String, User> getCountByDocument(@RequestParam String user) {
return userService.getCountByDocument(user);
}

// 根據組織統計數量
@GetMapping("/countByOrgan")
public Map<String, User> getCountByOrgan(@RequestParam String user) {
return userService.getCountByOrgan(user);
}

// 根據文字內容統計數量
@GetMapping("/countByText")
public Map<String, User> getCountByText(@RequestParam String user) {
return userService.getCountByText(user);
}

// 獲取總數量
@GetMapping("/totalCount")
public Map<String, User> getTotalCount() {
return userService.getTotalCount();
}

// 顯示資訊 name type category range dociment form orgn viadata pubdata perdata

@GetMapping("/ALLname")
public List<User> getAllPolicies() {
return userService.getAllPolicies();
}


@GetMapping("/ALLtext")
public List<String> getAllPolicies2(@RequestParam("name") String name) {
return userService.getAllPolicies2(name);
}

@GetMapping("/findname")
public List<User> getAllPolicies3(@RequestParam("name") String name) {
return userService.getAllPolicies3(name);
}

//多條件查詢 name type range text 為空的時候不查詢 是否模糊


}