From 93af1c6ffb9ae0e894689ad3a37b548e57d54cff Mon Sep 17 00:00:00 2001 From: linzhijie <19970921lzj> Date: 星期四, 11 三月 2021 19:10:07 +0800 Subject: [PATCH] 有注释的测评系统业务代码 --- src/main/java/com/ots/project/demo/controller/DemoTableController.java | 162 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 135 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/ots/project/demo/controller/DemoTableController.java b/src/main/java/com/ots/project/demo/controller/DemoTableController.java index 97f968d..189955b 100644 --- a/src/main/java/com/ots/project/demo/controller/DemoTableController.java +++ b/src/main/java/com/ots/project/demo/controller/DemoTableController.java @@ -1,4 +1,5 @@ package com.ots.project.demo.controller; + import com.fasterxml.jackson.annotation.JsonFormat; import com.ots.common.utils.DateUtils; import com.ots.common.utils.StringUtils; @@ -11,13 +12,21 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; + import java.util.*; +/** + * 琛ㄦ牸鐩稿叧 + * + * @author ots + */ @Controller @RequestMapping("/demo/table") public class DemoTableController extends BaseController { private String prefix = "demo/table"; + private final static List<UserTableModel> users = new ArrayList<UserTableModel>(); + { users.add(new UserTableModel(1, "1000001", "娴嬭瘯1", "0", "15888888888", "ry@qq.com", 150.0, "0")); users.add(new UserTableModel(2, "1000002", "娴嬭瘯2", "1", "15666666666", "ry@qq.com", 180.0, "1")); @@ -46,94 +55,145 @@ users.add(new UserTableModel(25, "1000025", "娴嬭瘯25", "1", "15666666666", "ry@qq.com", 250.0, "1")); users.add(new UserTableModel(26, "1000026", "娴嬭瘯26", "1", "15666666666", "ry@qq.com", 250.0, "1")); } - + + /** + * 鎼滅储鐩稿叧 + */ @GetMapping("/search") public String search() { return prefix + "/search"; } - + + /** + * 鏁版嵁姹囨�� + */ @GetMapping("/footer") public String footer() { return prefix + "/footer"; } - + + /** + * 缁勫悎琛ㄥご + */ @GetMapping("/groupHeader") public String groupHeader() { return prefix + "/groupHeader"; } - + + /** + * 琛ㄦ牸瀵煎嚭 + */ @GetMapping("/export") public String export() { return prefix + "/export"; } - + + /** + * 缈婚〉璁颁綇閫夋嫨 + */ @GetMapping("/remember") public String remember() { return prefix + "/remember"; } - + + /** + * 璺宠浆鑷虫寚瀹氶〉 + */ @GetMapping("/pageGo") public String pageGo() { return prefix + "/pageGo"; } - + + /** + * 鑷畾涔夋煡璇㈠弬鏁� + */ @GetMapping("/params") public String params() { return prefix + "/params"; } - + + /** + * 澶氳〃鏍� + */ @GetMapping("/multi") public String multi() { return prefix + "/multi"; } - + + /** + * 鐐瑰嚮鎸夐挳鍔犺浇琛ㄦ牸 + */ @GetMapping("/button") public String button() { return prefix + "/button"; } - + + /** + * 琛ㄦ牸鍐荤粨鍒� + */ @GetMapping("/fixedColumns") public String fixedColumns() { return prefix + "/fixedColumns"; } - + + /** + * 鑷畾涔夎Е鍙戜簨浠� + */ @GetMapping("/event") public String event() { return prefix + "/event"; } - + + /** + * 琛ㄦ牸缁嗚妭瑙嗗浘 + */ @GetMapping("/detail") public String detail() { return prefix + "/detail"; } - + + /** + * 琛ㄦ牸鍥剧墖棰勮 + */ @GetMapping("/image") public String image() { return prefix + "/image"; } - + + /** + * 鍔ㄦ�佸鍒犳敼鏌� + */ @GetMapping("/curd") public String curd() { return prefix + "/curd"; } - + + /** + * 琛ㄦ牸鎷栨嫿鎿嶄綔 + */ @GetMapping("/reorder") public String reorder() { return prefix + "/reorder"; } - + + /** + * 琛ㄦ牸鍏朵粬鎿嶄綔 + */ @GetMapping("/other") public String other() { return prefix + "/other"; } - + + /** + * 鏌ヨ鏁版嵁 + */ @PostMapping("/list") @ResponseBody public TableDataInfo list(UserTableModel userModel) { TableDataInfo rspData = new TableDataInfo(); List<UserTableModel> userList = new ArrayList<UserTableModel>(Arrays.asList(new UserTableModel[users.size()])); Collections.copy(userList, users); - + // 鏌ヨ鏉′欢杩囨护 if (StringUtils.isNotEmpty(userModel.getUserName())) { userList.clear(); for (UserTableModel user : users) { @@ -158,28 +218,58 @@ return rspData; } } + class UserTableModel { - + /** + * 鐢ㄦ埛ID + */ private int userId; - + + /** + * 鐢ㄦ埛缂栧彿 + */ private String userCode; - + + /** + * 鐢ㄦ埛濮撳悕 + */ private String userName; - + + /** + * 鐢ㄦ埛鎬у埆 + */ private String userSex; - + + /** + * 鐢ㄦ埛鎵嬫満 + */ private String userPhone; - + + /** + * 鐢ㄦ埛閭 + */ private String userEmail; - + + /** + * 鐢ㄦ埛浣欓 + */ private double userBalance; - + + /** + * 鐢ㄦ埛鐘舵�侊紙0姝e父 1鍋滅敤锛� + */ private String status; - + + /** + * 鍒涘缓鏃堕棿 + */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; + public UserTableModel() { + } + public UserTableModel(int userId, String userCode, String userName, String userSex, String userPhone, String userEmail, double userBalance, String status) { this.userId = userId; @@ -192,57 +282,75 @@ this.status = status; this.createTime = DateUtils.getNowDate(); } + public int getUserId() { return userId; } + public void setUserId(int userId) { this.userId = userId; } + public String getUserCode() { return userCode; } + public void setUserCode(String userCode) { this.userCode = userCode; } + public String getUserName() { return userName; } + public void setUserName(String userName) { this.userName = userName; } + public String getUserSex() { return userSex; } + public void setUserSex(String userSex) { this.userSex = userSex; } + public String getUserPhone() { return userPhone; } + public void setUserPhone(String userPhone) { this.userPhone = userPhone; } + public String getUserEmail() { return userEmail; } + public void setUserEmail(String userEmail) { this.userEmail = userEmail; } + public double getUserBalance() { return userBalance; } + public void setUserBalance(double userBalance) { this.userBalance = userBalance; } + public String getStatus() { return status; } + public void setStatus(String status) { this.status = status; } + public Date getCreateTime() { return createTime; } + public void setCreateTime(Date createTime) { this.createTime = createTime; } -- Gitblit v1.9.1