-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cdsl #49
base: master
Are you sure you want to change the base?
cdsl #49
Conversation
public class AddingController { | ||
@Autowired | ||
CustomerServices cServices; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tên của service sẽ là số ít
chuyển: CustomerService
-> CustomerService
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Tên các package, class nên đặt ở số ít: sửa
models
thànhmodel
- Với project nhỏ có thể chia thành nhiều controller (
AddingController
, ...), tuy nhiên, nên gộp lại thànhCustomerController
- Đặt các controller vào package
controller
- 2 hàm
transferMoney
vàreceiveMoney
trongCustomer.java
phải đưa vàoCustomerService
vì nó liên quan tới business,Customer.java
chỉ có nhiệm vụ mô tả dữ liệu - Push thừa: thư mục .idea và thay đổi trong thư mục của bạn khác (Chu Van Hung và Vu Van Tung)
|
||
|
||
@RestController | ||
public class Search { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sửa thành SearchController
import org.springframework.stereotype.Controller; | ||
import org.springframework.ui.ModelMap; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
|
||
@Controller | ||
public class TransferingController { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sai chính tả: transferring
|
||
@PostMapping(value="/delete") | ||
public void delCustomer(@RequestBody String delId) { | ||
delId = delId.substring(3,delId.length()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e có thể dùng delId.substring(3)
để thay thế
customerRepository.save(c); | ||
return true; | ||
} | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dòng 45->50, có thể thay thế bằng đoạn code này => code rõ ràng, dễ nhìn hơn
if (!c.getPassword().equals(pass)) return false;
c.setLogin(1);
customerRepository.save(c);
return true;
String result = new String(); | ||
|
||
List<String> listResult = new ArrayList<>(); | ||
for(Customer customer : getAllCustomer()){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hàm search()
chỉ nên trả về List<Customer>
, nó không làm nhiệm vụ generate UI.
nên thực hiện việc đó sau khi ajax lấy được kết quả của /search
No description provided.