分离不同状态的数据 #11
@@ -59,8 +59,9 @@ public class LinksController {
|
||||
|
||||
@GetMapping("/admin/links")
|
||||
public Response all(@RequestParam("page") int page,
|
||||
@RequestParam("count") int count) {
|
||||
return Response.success(partnerSiteService.partnerSitePages(page, count));
|
||||
@RequestParam("count") int count,
|
||||
@RequestParam(value = "deleted", required = false) Boolean deleted) {
|
||||
return Response.success(partnerSiteService.partnerSitePages(page, count, deleted));
|
||||
}
|
||||
|
||||
@PostMapping("/apply")
|
||||
|
||||
@@ -36,5 +36,6 @@ public interface PartnerMapper {
|
||||
|
||||
List<PartnerSite> findAll();
|
||||
|
||||
List<PartnerSite> findAll(Boolean deleted);
|
||||
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public interface PartnerSiteService {
|
||||
* @param page 数据页
|
||||
* @return 分页数据
|
||||
*/
|
||||
PageData<PartnerSite> partnerSitePages(int page, int count);
|
||||
PageData<PartnerSite> partnerSitePages(int page, int count, Boolean deleted);
|
||||
|
||||
/**
|
||||
* 获取全部数据
|
||||
|
||||
@@ -123,9 +123,9 @@ public class PartnerSiteServiceImpl implements PartnerSiteService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageData<PartnerSite> partnerSitePages(int page, int count) {
|
||||
public PageData<PartnerSite> partnerSitePages(int page, int count, Boolean deleted) {
|
||||
PageHelper.startPage(page, count);
|
||||
List<PartnerSite> sitePage = partnerMapper.findAll();
|
||||
List<PartnerSite> sitePage = partnerMapper.findAll(deleted);
|
||||
PageInfo<PartnerSite> pageInfo = new PageInfo<PartnerSite>(sitePage);
|
||||
return new PageData<>(pageInfo, sitePage);
|
||||
}
|
||||
|
||||
@@ -78,6 +78,9 @@
|
||||
<select id="findAll" resultMap="partnerSiteResultMap">
|
||||
select *
|
||||
from links
|
||||
<if test="_parameter != null">
|
||||
where is_delete=#{deleted}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ CREATE TABLE `links`
|
||||
`l_url` varchar(255) unique not null comment '首页地址',
|
||||
`l_icon_path` varchar(255) not null comment '友链的icon地址',
|
||||
`l_desc` varchar(255) COLLATE utf8mb4_unicode_ci not null comment '友链的说明描述',
|
||||
`is_delete` boolean not null default false comment '该数据是否被删除',
|
||||
`is_delete` boolean not null default false comment '该数据是否被删除',
|
||||
`l_email` varchar(255) comment '网站管理员的邮箱',
|
||||
`l_notification` boolean default false comment '是否通知了'
|
||||
) comment '友站表';
|
||||
|
||||
Reference in New Issue
Block a user