List of commits:
Subject Hash Author Date (UTC)
相册 711f5793832b739df993e593852411342a448670 Darren 2022-01-20 14:54:03
配置数据库 cb660a7086abc552cf99603a66cd2b0cae821ec8 Darren 2022-01-20 14:52:46
引入mybatis-plus-boot-starter@3.5.0 5de6337c72596d94847273e1f5c1eac72f615a62 Darren 2022-01-20 14:52:28
init 987817948db6829151065d2f8a7873b5ddb25773 Darren 2022-01-17 09:15:49
Commit 711f5793832b739df993e593852411342a448670 - 相册
Author: Darren
Author date (UTC): 2022-01-20 14:54
Committer name: Darren
Committer date (UTC): 2022-01-20 14:54
Parent(s): cb660a7086abc552cf99603a66cd2b0cae821ec8
Signing key:
Tree: baafdf426dd2acc56eadb25710a4765c9c031b3f
File Lines added Lines deleted
src/main/java/com/darren/tommserver/ToMmServerApplication.java 5 0
src/main/java/com/darren/tommserver/controller/AlbumController.java 85 0
src/main/java/com/darren/tommserver/core/response/ErrorResponseData.java 31 0
src/main/java/com/darren/tommserver/core/response/ResponseData.java 74 0
src/main/java/com/darren/tommserver/core/response/SuccessResponseData.java 21 0
src/main/java/com/darren/tommserver/entity/Album.java 54 0
src/main/java/com/darren/tommserver/mapper/AlbumMapper.java 19 0
src/main/java/com/darren/tommserver/service/AlbumService.java 13 0
src/main/java/com/darren/tommserver/service/impl/AlbumServiceImpl.java 21 0
File src/main/java/com/darren/tommserver/ToMmServerApplication.java changed (mode: 100644) (index 4e9de7c..3082fe6)
... ... package com.darren.tommserver;
3 3 import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
4 4 import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
5 5
6 /**
7 * 启动类
8 *
9 * @author Darren
10 */
6 11 @SpringBootApplication @SpringBootApplication
7 12 public class ToMmServerApplication { public class ToMmServerApplication {
8 13
File src/main/java/com/darren/tommserver/controller/AlbumController.java added (mode: 100644) (index 0000000..f123b80)
1 package com.darren.tommserver.controller;
2
3 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 import com.darren.tommserver.core.response.ResponseData;
6 import com.darren.tommserver.core.response.SuccessResponseData;
7 import com.darren.tommserver.entity.Album;
8 import com.darren.tommserver.service.AlbumService;
9 import org.springframework.web.bind.annotation.*;
10
11 import javax.annotation.Resource;
12 import java.io.Serializable;
13 import java.util.List;
14
15 /**
16 * 相册(Album) 控制层
17 *
18 * @author Darren
19 */
20 @RestController
21 @RequestMapping("album")
22 public class AlbumController {
23 /**
24 * 服务对象
25 */
26 @Resource
27 private AlbumService albumService;
28
29 /**
30 * 分页查询所有数据
31 *
32 * @param page 分页对象
33 * @param album 查询实体
34 * @return 所有数据
35 */
36 @GetMapping
37 public ResponseData selectAll(Page<Album> page, Album album) {
38 return new SuccessResponseData(albumService.page(page, new QueryWrapper<>(album)));
39 }
40
41 /**
42 * 通过主键查询单条数据
43 *
44 * @param id 主键
45 * @return 单条数据
46 */
47 @GetMapping("{id}")
48 public ResponseData selectOne(@PathVariable Serializable id) {
49 return new SuccessResponseData(this.albumService.getById(id));
50 }
51
52 /**
53 * 新增数据
54 *
55 * @param album 实体对象
56 * @return 新增结果
57 */
58 @PostMapping
59 public ResponseData insert(@RequestBody Album album) {
60 return new SuccessResponseData(albumService.save(album));
61 }
62
63 /**
64 * 修改数据
65 *
66 * @param album 实体对象
67 * @return 修改结果
68 */
69 @PutMapping
70 public ResponseData update(@RequestBody Album album) {
71 return new SuccessResponseData(albumService.updateById(album));
72 }
73
74 /**
75 * 删除数据
76 *
77 * @param idList 主键结合
78 * @return 删除结果
79 */
80 @DeleteMapping
81 public ResponseData delete(@RequestParam("idList") List<Long> idList) {
82 return new SuccessResponseData(albumService.removeByIds(idList));
83 }
84 }
85
File src/main/java/com/darren/tommserver/core/response/ErrorResponseData.java added (mode: 100644) (index 0000000..6dd6861)
1 package com.darren.tommserver.core.response;
2
3 import lombok.Data;
4 import lombok.EqualsAndHashCode;
5
6 /**
7 * 失败响应结果
8 *
9 * @author Darren
10 */
11 @EqualsAndHashCode(callSuper = true)
12 @Data
13 public class ErrorResponseData extends ResponseData {
14
15 /**
16 * 异常的具体类名称
17 */
18 private String exceptionClazz;
19
20 ErrorResponseData(String message) {
21 super(false, DEFAULT_ERROR_CODE, message, null);
22 }
23
24 public ErrorResponseData(Integer code, String message) {
25 super(false, code, message, null);
26 }
27
28 ErrorResponseData(Integer code, String message, Object object) {
29 super(false, code, message, object);
30 }
31 }
File src/main/java/com/darren/tommserver/core/response/ResponseData.java added (mode: 100644) (index 0000000..971bc7f)
1 package com.darren.tommserver.core.response;
2
3 import lombok.Data;
4
5 /**
6 * 响应结果数据
7 *
8 * @author Darren
9 */
10 @Data
11 public class ResponseData {
12
13 public static final String DEFAULT_SUCCESS_MESSAGE = "请求成功";
14
15 public static final String DEFAULT_ERROR_MESSAGE = "网络异常";
16
17 public static final Integer DEFAULT_SUCCESS_CODE = 200;
18
19 public static final Integer DEFAULT_ERROR_CODE = 500;
20
21 /**
22 * 请求是否成功
23 */
24 private Boolean success;
25
26 /**
27 * 响应状态码
28 */
29 private Integer code;
30
31 /**
32 * 响应信息
33 */
34 private String message;
35
36 /**
37 * 响应对象
38 */
39 private Object data;
40
41 public ResponseData() {
42 }
43
44 public ResponseData(Boolean success, Integer code, String message, Object data) {
45 this.success = success;
46 this.code = code;
47 this.message = message;
48 this.data = data;
49 }
50
51 public static SuccessResponseData success() {
52 return new SuccessResponseData();
53 }
54
55 public static SuccessResponseData success(Object object) {
56 return new SuccessResponseData(object);
57 }
58
59 public static SuccessResponseData success(Integer code, String message, Object object) {
60 return new SuccessResponseData(code, message, object);
61 }
62
63 public static ErrorResponseData error(String message) {
64 return new ErrorResponseData(message);
65 }
66
67 public static ErrorResponseData error(Integer code, String message) {
68 return new ErrorResponseData(code, message);
69 }
70
71 public static ErrorResponseData error(Integer code, String message, Object object) {
72 return new ErrorResponseData(code, message, object);
73 }
74 }
File src/main/java/com/darren/tommserver/core/response/SuccessResponseData.java added (mode: 100644) (index 0000000..f6c48f8)
1 package com.darren.tommserver.core.response;
2
3 /**
4 * 成功响应结果
5 *
6 * @author Darren
7 */
8 public class SuccessResponseData extends ResponseData {
9
10 public SuccessResponseData() {
11 super(true, DEFAULT_SUCCESS_CODE, DEFAULT_SUCCESS_MESSAGE, null);
12 }
13
14 public SuccessResponseData(Object object) {
15 super(true, DEFAULT_SUCCESS_CODE, DEFAULT_SUCCESS_MESSAGE, object);
16 }
17
18 public SuccessResponseData(Integer code, String message, Object object) {
19 super(true, code, message, object);
20 }
21 }
File src/main/java/com/darren/tommserver/entity/Album.java added (mode: 100644) (index 0000000..9ef33d4)
1 package com.darren.tommserver.entity;
2
3 import com.baomidou.mybatisplus.annotation.IdType;
4 import com.baomidou.mybatisplus.annotation.TableField;
5 import com.baomidou.mybatisplus.annotation.TableId;
6 import com.baomidou.mybatisplus.annotation.TableName;
7
8 import java.io.Serializable;
9
10 import lombok.Data;
11
12 /**
13 * 相册
14 *
15 * @author Darren
16 */
17 @TableName(value = "album")
18 @Data
19 public class Album implements Serializable {
20 /**
21 * ID
22 */
23 @TableId(value = "id", type = IdType.AUTO)
24 private Integer id;
25
26 /**
27 * 名称
28 */
29 @TableField(value = "name")
30 private String name;
31
32 /**
33 * 图片url
34 */
35 @TableField(value = "url")
36 private String url;
37
38 @TableField(exist = false)
39 private static final long serialVersionUID = 1L;
40
41 @Override
42 public String toString() {
43 StringBuilder sb = new StringBuilder();
44 sb.append(getClass().getSimpleName());
45 sb.append(" [");
46 sb.append("Hash = ").append(hashCode());
47 sb.append(", id=").append(id);
48 sb.append(", name=").append(name);
49 sb.append(", url=").append(url);
50 sb.append(", serialVersionUID=").append(serialVersionUID);
51 sb.append("]");
52 return sb.toString();
53 }
54 }
File src/main/java/com/darren/tommserver/mapper/AlbumMapper.java added (mode: 100644) (index 0000000..681407d)
1 package com.darren.tommserver.mapper;
2
3 import org.apache.ibatis.annotations.Mapper;
4 import com.darren.tommserver.entity.Album;
5 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6
7 /**
8 * 相册(Album) Mapper
9 *
10 * @author Darren
11 */
12 @Mapper
13 public interface AlbumMapper extends BaseMapper<Album> {
14
15 }
16
17
18
19
File src/main/java/com/darren/tommserver/service/AlbumService.java added (mode: 100644) (index 0000000..c26dd63)
1 package com.darren.tommserver.service;
2
3 import com.darren.tommserver.entity.Album;
4 import com.baomidou.mybatisplus.extension.service.IService;
5
6 /**
7 * 相册(Album) Service
8 *
9 * @author Darren
10 */
11 public interface AlbumService extends IService<Album> {
12
13 }
File src/main/java/com/darren/tommserver/service/impl/AlbumServiceImpl.java added (mode: 100644) (index 0000000..9fb8570)
1 package com.darren.tommserver.service.impl;
2
3 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4 import com.darren.tommserver.entity.Album;
5 import com.darren.tommserver.service.AlbumService;
6 import com.darren.tommserver.mapper.AlbumMapper;
7 import org.springframework.stereotype.Service;
8
9 /**
10 * 相册(Album) Service实现
11 *
12 * @author Darren
13 */
14 @Service("albumService")
15 public class AlbumServiceImpl extends ServiceImpl<AlbumMapper, Album> implements AlbumService {
16
17 }
18
19
20
21
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/darren/ToMmServer

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/darren/ToMmServer

Clone this repository using git:
git clone git://git.rocketgit.com/user/darren/ToMmServer

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main