mirror of https://github.com/halo-dev/halo
commit
7235b45fbb
|
@ -35,7 +35,7 @@ public class LinkController {
|
|||
* @return List
|
||||
*/
|
||||
@GetMapping
|
||||
public List<LinkDTO> listLinks(@SortDefault(sort = "updateTime", direction = Sort.Direction.DESC) Sort sort) {
|
||||
public List<LinkDTO> listLinks(@SortDefault(sort = "priority", direction = Sort.Direction.ASC) Sort sort) {
|
||||
return linkService.listDtos(sort);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,4 +24,6 @@ public class LinkDTO implements OutputConverter<LinkDTO, Link> {
|
|||
private String description;
|
||||
|
||||
private String team;
|
||||
|
||||
private Integer priority;
|
||||
}
|
||||
|
|
|
@ -54,6 +54,11 @@ public class Link extends BaseEntity {
|
|||
@Column(name = "team", columnDefinition = "varchar(255) default ''")
|
||||
private String team;
|
||||
|
||||
/**
|
||||
* Sort.
|
||||
*/
|
||||
@Column(name = "priority", columnDefinition = "int default 0")
|
||||
private Integer priority;
|
||||
|
||||
@Override
|
||||
public void prePersist() {
|
||||
|
@ -61,6 +66,10 @@ public class Link extends BaseEntity {
|
|||
|
||||
id = null;
|
||||
|
||||
if (priority == null) {
|
||||
priority = 0;
|
||||
}
|
||||
|
||||
if (logo == null) {
|
||||
logo = "";
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import org.hibernate.validator.constraints.URL;
|
|||
import run.halo.app.model.dto.base.InputConverter;
|
||||
import run.halo.app.model.entity.Link;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
|
@ -35,4 +36,6 @@ public class LinkParam implements InputConverter<Link> {
|
|||
@Size(max = 255, message = "友情链接分组的字符长度 {max}")
|
||||
private String team;
|
||||
|
||||
@Min(value = 0, message = "排序编号不能低于 {value}")
|
||||
private Integer priority;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue