| New file | 
|  |  |  | 
|---|
|  |  |  | package com.moral.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import static com.moral.common.util.WebUtils.getParametersStartingWith; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  | import javax.servlet.http.HttpServletRequest; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.GetMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestBody; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.moral.common.bean.PageBean; | 
|---|
|  |  |  | import com.moral.common.bean.ResultBean; | 
|---|
|  |  |  | import com.moral.entity.Account; | 
|---|
|  |  |  | import com.moral.service.AccountService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | @RequestMapping("account") | 
|---|
|  |  |  | public class AccountController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private AccountService accountService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @GetMapping("list") | 
|---|
|  |  |  | public ResultBean<PageBean<Account>> getAccountListByPage(HttpServletRequest request) { | 
|---|
|  |  |  | Map<String, Object> parameters = getParametersStartingWith(request, null); | 
|---|
|  |  |  | PageBean<Account> accounts = accountService.getAccountListByPage(parameters); | 
|---|
|  |  |  | return new ResultBean<PageBean<Account>>(accounts); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @GetMapping("account") | 
|---|
|  |  |  | public ResultBean<Integer> saveOrUpdateAccount(@RequestBody Account account) { | 
|---|
|  |  |  | Integer result = accountService.saveOrUpdateAccount(account); | 
|---|
|  |  |  | return new ResultBean<Integer>(result); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|