优化博客
This commit is contained in:
@@ -27,5 +27,5 @@ public interface QuinnConstant {
|
|||||||
String EDIT_SOURCE_FIRST = "lw@";
|
String EDIT_SOURCE_FIRST = "lw@";
|
||||||
String EDIT_SOURCE_LAST = "#";
|
String EDIT_SOURCE_LAST = "#";
|
||||||
|
|
||||||
String DEFAULT_ATTR_BASE64 = "/attrIcon";
|
String DEFAULT_ATTR_BASE64 = "/images/avatar/quinn.png";
|
||||||
}
|
}
|
||||||
|
|||||||
16
src/main/java/com/quinn/common/RoleType.java
Normal file
16
src/main/java/com/quinn/common/RoleType.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package com.quinn.common;
|
||||||
|
|
||||||
|
public enum RoleType {
|
||||||
|
/**
|
||||||
|
* 管理员
|
||||||
|
*/
|
||||||
|
ADMIN,
|
||||||
|
/**
|
||||||
|
* 普通用户
|
||||||
|
*/
|
||||||
|
NORMAL,
|
||||||
|
/**
|
||||||
|
* VIP
|
||||||
|
*/
|
||||||
|
VIP
|
||||||
|
}
|
||||||
@@ -3,14 +3,19 @@ package com.quinn.controller;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.quinn.common.RoleType;
|
||||||
import com.quinn.pojo.About;
|
import com.quinn.pojo.About;
|
||||||
|
import com.quinn.pojo.User;
|
||||||
import com.quinn.service.AboutService;
|
import com.quinn.service.AboutService;
|
||||||
|
import com.quinn.service.UserService;
|
||||||
import com.quinn.utils.QuinnUtils;
|
import com.quinn.utils.QuinnUtils;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.management.relation.Role;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -22,10 +27,12 @@ import java.util.List;
|
|||||||
* @since 2022-05-01
|
* @since 2022-05-01
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
public class AboutController {
|
public class AboutController extends BaseModelController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
AboutService aboutService;
|
AboutService aboutService;
|
||||||
|
@Resource
|
||||||
|
UserService userService;
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/about")
|
@GetMapping("/about")
|
||||||
@@ -40,10 +47,12 @@ public class AboutController {
|
|||||||
return "page/about";
|
return "page/about";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/about/{role}")
|
@PostMapping("/about")
|
||||||
public String saveSay(@PathVariable("role") int role, About about){
|
public String saveSay(HttpServletRequest request, About about){
|
||||||
|
String loginUserId = getLoginUserId(request);
|
||||||
|
User user = userService.getOne(new QueryWrapper<User>().eq("uid", ""));
|
||||||
// 防止请求提交
|
// 防止请求提交
|
||||||
if (role!=1){
|
if (!RoleType.ADMIN.name().equals(user)){
|
||||||
return "redirect:/about";
|
return "redirect:/about";
|
||||||
}
|
}
|
||||||
about.setId(QuinnUtils.getUuid());
|
about.setId(QuinnUtils.getUuid());
|
||||||
|
|||||||
@@ -6,10 +6,7 @@ import com.quinn.common.Category;
|
|||||||
import com.quinn.pojo.*;
|
import com.quinn.pojo.*;
|
||||||
import com.quinn.service.*;
|
import com.quinn.service.*;
|
||||||
import com.quinn.utils.QuinnUtils;
|
import com.quinn.utils.QuinnUtils;
|
||||||
import com.quinn.vo.StarReq;
|
import com.quinn.vo.*;
|
||||||
import com.quinn.vo.MyPageParam;
|
|
||||||
import com.quinn.vo.QuestionWriteForm;
|
|
||||||
import com.quinn.vo.StarValue;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -51,7 +48,7 @@ public class BlogController extends BaseModelController{
|
|||||||
List<BlogWithUser> blogList = blogService.getBlogWithUserOrderBySort(myPageParam);
|
List<BlogWithUser> blogList = blogService.getBlogWithUserOrderBySort(myPageParam);
|
||||||
// 结果
|
// 结果
|
||||||
model.addAttribute("blogList",blogList);
|
model.addAttribute("blogList",blogList);
|
||||||
model.addAttribute("myPageParam",myPageParam);
|
model.addAttribute("pageParam",myPageParam);
|
||||||
|
|
||||||
List<Blog> topBlogList = blogService.getTopBlog();
|
List<Blog> topBlogList = blogService.getTopBlog();
|
||||||
model.addAttribute("topBlogList",topBlogList);
|
model.addAttribute("topBlogList",topBlogList);
|
||||||
@@ -63,20 +60,17 @@ public class BlogController extends BaseModelController{
|
|||||||
return "blog/list";
|
return "blog/list";
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/blog/{page}/{limit}")
|
@PostMapping("/blog")
|
||||||
public String blogListPage(
|
public String blogListPage(NavReq navReq, Model model){
|
||||||
@PathVariable int page,
|
// 用户的论坛列表
|
||||||
@PathVariable int limit,
|
if (navReq.getPageNum() < 1){
|
||||||
Model model){
|
navReq.setPageNum(1);
|
||||||
|
|
||||||
if (page < 1){
|
|
||||||
page = 1;
|
|
||||||
}
|
}
|
||||||
MyPageParam myPageParam = new MyPageParam(page,limit);
|
MyPageParam myPageParam = new MyPageParam(navReq.getPageNum(),navReq.getLimit());
|
||||||
List<BlogWithUser> blogList = blogService.getBlogWithUserOrderBySort(myPageParam);
|
List<BlogWithUser> blogList = blogService.getBlogWithUserOrderBySort(myPageParam);
|
||||||
// 结果
|
// 结果
|
||||||
model.addAttribute("blogList",blogList);
|
model.addAttribute("blogList",blogList);
|
||||||
model.addAttribute("myPageParam",myPageParam);
|
model.addAttribute("pageParam",myPageParam);
|
||||||
|
|
||||||
List<Blog> topBlogList = blogService.getTopBlog();
|
List<Blog> topBlogList = blogService.getTopBlog();
|
||||||
model.addAttribute("topBlogList",topBlogList);
|
model.addAttribute("topBlogList",topBlogList);
|
||||||
@@ -85,7 +79,7 @@ public class BlogController extends BaseModelController{
|
|||||||
List<BlogCategory> categoryList = blogCategoryService.list(null);
|
List<BlogCategory> categoryList = blogCategoryService.list(null);
|
||||||
model.addAttribute("categoryList",categoryList);
|
model.addAttribute("categoryList",categoryList);
|
||||||
|
|
||||||
return "blog/list";
|
return "blog/list::s_table_refresh";
|
||||||
}
|
}
|
||||||
|
|
||||||
// 写文章
|
// 写文章
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.quinn.controller;
|
package com.quinn.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.quinn.common.RoleType;
|
||||||
import com.quinn.pojo.Invite;
|
import com.quinn.pojo.Invite;
|
||||||
import com.quinn.pojo.User;
|
import com.quinn.pojo.User;
|
||||||
import com.quinn.pojo.UserInfo;
|
import com.quinn.pojo.UserInfo;
|
||||||
@@ -78,7 +79,7 @@ public class LoginController {
|
|||||||
// 构建用户对象
|
// 构建用户对象
|
||||||
User user = new User();
|
User user = new User();
|
||||||
user.setUid(QuinnUtils.getUuid()); // 用户唯一id
|
user.setUid(QuinnUtils.getUuid()); // 用户唯一id
|
||||||
user.setRoleId(2);
|
user.setRoleId(RoleType.NORMAL.name());
|
||||||
user.setUsername(registerForm.getUsername());
|
user.setUsername(registerForm.getUsername());
|
||||||
// 密码加密
|
// 密码加密
|
||||||
String bCryptPassword = new BCryptPasswordEncoder().encode(registerForm.getPassword());
|
String bCryptPassword = new BCryptPasswordEncoder().encode(registerForm.getPassword());
|
||||||
@@ -93,7 +94,6 @@ public class LoginController {
|
|||||||
invite.setUid(user.getUid());
|
invite.setUid(user.getUid());
|
||||||
inviteService.updateById(invite);
|
inviteService.updateById(invite);
|
||||||
|
|
||||||
// todo: 用户信息
|
|
||||||
userInfoService.save(new UserInfo().setUid(user.getUid()));
|
userInfoService.save(new UserInfo().setUid(user.getUid()));
|
||||||
|
|
||||||
// 注册成功,重定向到登录页面
|
// 注册成功,重定向到登录页面
|
||||||
|
|||||||
@@ -7,13 +7,11 @@ import com.quinn.common.Category;
|
|||||||
import com.quinn.common.QuinnConstant;
|
import com.quinn.common.QuinnConstant;
|
||||||
import com.quinn.common.SourceType;
|
import com.quinn.common.SourceType;
|
||||||
import com.quinn.pojo.*;
|
import com.quinn.pojo.*;
|
||||||
import com.quinn.pojo.param.QuerySource;
|
|
||||||
import com.quinn.service.CommentService;
|
import com.quinn.service.CommentService;
|
||||||
import com.quinn.service.SourceCategoryService;
|
import com.quinn.service.SourceCategoryService;
|
||||||
import com.quinn.service.SourceService;
|
import com.quinn.service.SourceService;
|
||||||
import com.quinn.service.StarService;
|
import com.quinn.service.StarService;
|
||||||
import com.quinn.vo.StarReq;
|
import com.quinn.vo.*;
|
||||||
import com.quinn.vo.StarValue;
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
@@ -52,23 +50,12 @@ public class SourceController extends BaseModelController {
|
|||||||
// 列表展示
|
// 列表展示
|
||||||
@GetMapping("/source")
|
@GetMapping("/source")
|
||||||
public String sourceList(Model model){
|
public String sourceList(Model model){
|
||||||
Page<Source> pageParam = new Page<>(1, 10);
|
QuerySource querySource = new QuerySource();
|
||||||
QueryWrapper<Source> sourceQuery = new QueryWrapper<>();
|
MyPageParam myPageParam = new MyPageParam(1,10);
|
||||||
sourceQuery.orderByDesc("gmt_create");
|
List<SourceWithStar> sourceList = sourceService.listPageStar(querySource,myPageParam);
|
||||||
sourceService.page(pageParam,sourceQuery);
|
|
||||||
// 结果
|
// 结果
|
||||||
List<Source> sourceList = pageParam.getRecords();
|
|
||||||
if (!CollectionUtils.isEmpty(sourceList)){
|
|
||||||
sourceList.forEach(x ->{
|
|
||||||
x.setSourceLink(QuinnConstant.GUN);
|
|
||||||
x.setKeyWord1(QuinnConstant.GUN);
|
|
||||||
x.setKeyWord2(QuinnConstant.GUN);
|
|
||||||
x.setKeyWord3(QuinnConstant.GUN);
|
|
||||||
x.setSourceContent(QuinnConstant.GUN);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
model.addAttribute("sourceList",sourceList);
|
model.addAttribute("sourceList",sourceList);
|
||||||
model.addAttribute("pageParam",pageParam);
|
model.addAttribute("pageParam",myPageParam);
|
||||||
|
|
||||||
// 分类信息
|
// 分类信息
|
||||||
List<SourceCategory> categoryList = sourceCategoryService.list(null);
|
List<SourceCategory> categoryList = sourceCategoryService.list(null);
|
||||||
@@ -77,23 +64,19 @@ public class SourceController extends BaseModelController {
|
|||||||
return "source/list";
|
return "source/list";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/source/page")
|
@PostMapping("/source")
|
||||||
public String blogListPage(QuerySource querySource, Model model){
|
public String blogListPage(QuerySourcePage querySource, Model model){
|
||||||
int page = querySource.getPageNum();
|
int page = querySource.getPageNum();
|
||||||
int limit = querySource.getLimit();
|
int limit = querySource.getLimit();
|
||||||
if (querySource.getPageNum() < 1){
|
if (querySource.getPageNum() < 1){
|
||||||
page = 1;
|
page = 1;
|
||||||
}
|
}
|
||||||
Page<Source> pageParam = new Page<>(page, limit);
|
MyPageParam myPageParam = new MyPageParam(page,limit);
|
||||||
QueryWrapper<Source> sourceQuery = new QueryWrapper<>();
|
List<SourceWithStar> sourceList = sourceService.listPageStar(querySource,myPageParam);
|
||||||
addParam(sourceQuery,querySource.getName(),querySource.getCategory());
|
|
||||||
sourceQuery.orderByDesc("gmt_create");
|
|
||||||
sourceService.page(pageParam,sourceQuery);
|
|
||||||
|
|
||||||
// 结果
|
// 结果
|
||||||
List<Source> blogList = pageParam.getRecords();
|
model.addAttribute("sourceList",sourceList);
|
||||||
model.addAttribute("sourceList",blogList);
|
model.addAttribute("pageParam",myPageParam);
|
||||||
model.addAttribute("pageParam",pageParam);
|
|
||||||
return "source/list::s_table_refresh";
|
return "source/list::s_table_refresh";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,13 +157,4 @@ public class SourceController extends BaseModelController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addParam(QueryWrapper<Source> sourceQuery, String name, int category) {
|
|
||||||
if (!StringUtils.isEmpty(name)){
|
|
||||||
sourceQuery.like("source_name",name);
|
|
||||||
}
|
|
||||||
if (category > 0){
|
|
||||||
sourceQuery.eq("category_id",category);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class StarController extends BaseModelController {
|
|||||||
StarService starService;
|
StarService starService;
|
||||||
|
|
||||||
// 取消收藏
|
// 取消收藏
|
||||||
@GetMapping("/user/comment/delete/{starId}")
|
@GetMapping("/user/star/delete/{starId}")
|
||||||
public String deleteComment(HttpServletRequest request, @PathVariable String starId){
|
public String deleteComment(HttpServletRequest request, @PathVariable String starId){
|
||||||
String loginUserId = getLoginUserId(request);
|
String loginUserId = getLoginUserId(request);
|
||||||
Star star = starService.getById(starId);
|
Star star = starService.getById(starId);
|
||||||
|
|||||||
@@ -12,6 +12,15 @@ public enum AttrIcon {
|
|||||||
|
|
||||||
INSTANCE;
|
INSTANCE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
* @param name
|
||||||
|
*/
|
||||||
|
public String generateImgUrl(String name) {
|
||||||
|
String attrUrl = "https://api.multiavatar.com/";
|
||||||
|
return attrUrl + name + ".png";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户名
|
* 用户名
|
||||||
* @param name
|
* @param name
|
||||||
|
|||||||
@@ -2,6 +2,11 @@ package com.quinn.mapper;
|
|||||||
|
|
||||||
import com.quinn.pojo.Source;
|
import com.quinn.pojo.Source;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.quinn.pojo.SourceWithStar;
|
||||||
|
import com.quinn.vo.MyPageParam;
|
||||||
|
import com.quinn.vo.QuerySource;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -13,4 +18,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||||||
*/
|
*/
|
||||||
public interface SourceMapper extends BaseMapper<Source> {
|
public interface SourceMapper extends BaseMapper<Source> {
|
||||||
|
|
||||||
|
List<SourceWithStar> listPageStar(QuerySource querySource, MyPageParam myPageParam);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,4 +2,20 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.quinn.mapper.SourceMapper">
|
<mapper namespace="com.quinn.mapper.SourceMapper">
|
||||||
|
|
||||||
|
<select id="listPageStar" resultType="com.quinn.pojo.SourceWithStar">
|
||||||
|
select id,sid,source_name,detail,source_type,category_id,category_name,en_name,file_type,down_record,gmt_create,gmt_update,
|
||||||
|
(select count(1) from qn_star c where c.topic_id = sid and c.topic_category = 'SOURCE') as star
|
||||||
|
from qn_source
|
||||||
|
<where>
|
||||||
|
<if test="querySource.name!=null and querySource.name != ''">
|
||||||
|
and source_name like CONCAT('%',#{querySource.name},'%')
|
||||||
|
</if>
|
||||||
|
<if test="querySource.category > 0">
|
||||||
|
and category_id = #{querySource.category}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by gmt_create desc
|
||||||
|
limit #{myPageParam.pageNum},#{myPageParam.size}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class Source implements Serializable {
|
|||||||
private String fileType;
|
private String fileType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "下载次数")
|
@ApiModelProperty(value = "下载次数")
|
||||||
private Integer downRecord;
|
private int downRecord;
|
||||||
|
|
||||||
@ApiModelProperty(value = "创建时间")
|
@ApiModelProperty(value = "创建时间")
|
||||||
private Date gmtCreate;
|
private Date gmtCreate;
|
||||||
|
|||||||
27
src/main/java/com/quinn/pojo/SourceWithStar.java
Normal file
27
src/main/java/com/quinn/pojo/SourceWithStar.java
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package com.quinn.pojo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author limqsh
|
||||||
|
* @since 2022-05-03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class SourceWithStar extends Source implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "收藏")
|
||||||
|
private int star;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -36,7 +36,7 @@ public class User implements Serializable {
|
|||||||
private String uid;
|
private String uid;
|
||||||
|
|
||||||
@ApiModelProperty(value = "角色编号")
|
@ApiModelProperty(value = "角色编号")
|
||||||
private Integer roleId;
|
private String roleId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "用户名")
|
@ApiModelProperty(value = "用户名")
|
||||||
private String username;
|
private String username;
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package com.quinn.service;
|
|||||||
|
|
||||||
import com.quinn.pojo.Source;
|
import com.quinn.pojo.Source;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.quinn.pojo.SourceWithStar;
|
||||||
|
import com.quinn.vo.MyPageParam;
|
||||||
|
import com.quinn.vo.QuerySource;
|
||||||
import com.quinn.vo.SourceUpdateForm;
|
import com.quinn.vo.SourceUpdateForm;
|
||||||
import com.quinn.vo.SourceWriteForm;
|
import com.quinn.vo.SourceWriteForm;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@@ -10,6 +13,7 @@ import javax.servlet.ServletOutputStream;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -57,4 +61,6 @@ public interface SourceService extends IService<Source> {
|
|||||||
* @param sid
|
* @param sid
|
||||||
*/
|
*/
|
||||||
void deleteSource(String sid);
|
void deleteSource(String sid);
|
||||||
|
|
||||||
|
List<SourceWithStar> listPageStar(QuerySource querySource, MyPageParam myPageParam);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.quinn.service;
|
|
||||||
|
|
||||||
import com.quinn.pojo.UserRole;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 服务类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author limqsh
|
|
||||||
* @since 2020-06-28
|
|
||||||
*/
|
|
||||||
public interface UserRoleService extends IService<UserRole> {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -7,11 +7,14 @@ import com.quinn.mapper.SourceCategoryMapper;
|
|||||||
import com.quinn.pojo.Source;
|
import com.quinn.pojo.Source;
|
||||||
import com.quinn.mapper.SourceMapper;
|
import com.quinn.mapper.SourceMapper;
|
||||||
import com.quinn.pojo.SourceCategory;
|
import com.quinn.pojo.SourceCategory;
|
||||||
|
import com.quinn.pojo.SourceWithStar;
|
||||||
import com.quinn.service.SourceService;
|
import com.quinn.service.SourceService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.quinn.utils.OSSClientUtil;
|
import com.quinn.utils.OSSClientUtil;
|
||||||
import com.quinn.utils.QuinnUtils;
|
import com.quinn.utils.QuinnUtils;
|
||||||
import com.quinn.utils.RedisUtils;
|
import com.quinn.utils.RedisUtils;
|
||||||
|
import com.quinn.vo.MyPageParam;
|
||||||
|
import com.quinn.vo.QuerySource;
|
||||||
import com.quinn.vo.SourceUpdateForm;
|
import com.quinn.vo.SourceUpdateForm;
|
||||||
import com.quinn.vo.SourceWriteForm;
|
import com.quinn.vo.SourceWriteForm;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -25,6 +28,7 @@ import java.io.BufferedOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -43,6 +47,8 @@ public class SourceServiceImpl extends ServiceImpl<SourceMapper, Source> impleme
|
|||||||
RedisUtils redisUtils;
|
RedisUtils redisUtils;
|
||||||
@Resource
|
@Resource
|
||||||
SourceCategoryMapper sourceCategoryMapper;
|
SourceCategoryMapper sourceCategoryMapper;
|
||||||
|
@Resource
|
||||||
|
SourceMapper sourceMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void downloadSource(HttpServletResponse response, Source source) throws IOException {
|
public void downloadSource(HttpServletResponse response, Source source) throws IOException {
|
||||||
@@ -182,6 +188,27 @@ public class SourceServiceImpl extends ServiceImpl<SourceMapper, Source> impleme
|
|||||||
removeById(before);
|
removeById(before);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SourceWithStar> listPageStar(QuerySource querySource, MyPageParam myPageParam) {
|
||||||
|
QueryWrapper<Source> sourceQuery = new QueryWrapper<>();
|
||||||
|
int allCount = count(sourceQuery);
|
||||||
|
myPageParam.setAllTotal(allCount);
|
||||||
|
addParam(sourceQuery,querySource.getName(),querySource.getCategory());
|
||||||
|
int count = count(sourceQuery);
|
||||||
|
myPageParam.setTotal(count);
|
||||||
|
return sourceMapper.listPageStar(querySource,myPageParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void addParam(QueryWrapper<Source> sourceQuery, String name, int category) {
|
||||||
|
if (!StringUtils.isEmpty(name)){
|
||||||
|
sourceQuery.like("source_name",name);
|
||||||
|
}
|
||||||
|
if (category > 0){
|
||||||
|
sourceQuery.eq("category_id",category);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新页码
|
* 更新页码
|
||||||
* @param source
|
* @param source
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
package com.quinn.service.impl;
|
|
||||||
|
|
||||||
import com.quinn.pojo.UserRole;
|
|
||||||
import com.quinn.mapper.UserRoleMapper;
|
|
||||||
import com.quinn.service.UserRoleService;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 服务实现类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author limqsh
|
|
||||||
* @since 2020-06-28
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> implements UserRoleService {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.quinn.service.impl;
|
package com.quinn.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.quinn.common.QuinnConstant;
|
||||||
|
import com.quinn.common.RoleType;
|
||||||
import com.quinn.pojo.User;
|
import com.quinn.pojo.User;
|
||||||
import com.quinn.mapper.UserMapper;
|
import com.quinn.mapper.UserMapper;
|
||||||
import com.quinn.pojo.UserRole;
|
|
||||||
import com.quinn.service.UserRoleService;
|
|
||||||
import com.quinn.service.UserService;
|
import com.quinn.service.UserService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -17,7 +17,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,8 +37,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|||||||
@Autowired
|
@Autowired
|
||||||
UserService userService;
|
UserService userService;
|
||||||
@Autowired
|
@Autowired
|
||||||
UserRoleService roleService;
|
|
||||||
@Autowired
|
|
||||||
HttpSession session;
|
HttpSession session;
|
||||||
|
|
||||||
// 用户登录逻辑和验证处理
|
// 用户登录逻辑和验证处理
|
||||||
@@ -47,9 +45,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|||||||
// 通过用户名查询用户
|
// 通过用户名查询用户
|
||||||
User user = userService.getOne(new QueryWrapper<User>().eq("username", s));
|
User user = userService.getOne(new QueryWrapper<User>().eq("username", s));
|
||||||
|
|
||||||
// 放入session
|
|
||||||
session.setAttribute("loginUser",user);
|
|
||||||
|
|
||||||
//创建一个新的UserDetails对象,最后验证登陆的需要
|
//创建一个新的UserDetails对象,最后验证登陆的需要
|
||||||
UserDetails userDetails=null;
|
UserDetails userDetails=null;
|
||||||
if(user!=null){
|
if(user!=null){
|
||||||
@@ -57,26 +52,23 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|||||||
//String BCryptPassword = new BCryptPasswordEncoder().encode(user.getPassword());
|
//String BCryptPassword = new BCryptPasswordEncoder().encode(user.getPassword());
|
||||||
// 登录后会将登录密码进行加密,然后比对数据库中的密码,数据库密码需要加密存储!
|
// 登录后会将登录密码进行加密,然后比对数据库中的密码,数据库密码需要加密存储!
|
||||||
String password = user.getPassword();
|
String password = user.getPassword();
|
||||||
|
user.setPassword(QuinnConstant.GUN);
|
||||||
|
// 放入session
|
||||||
|
session.setAttribute("loginUser",user);
|
||||||
//创建一个集合来存放权限
|
//创建一个集合来存放权限
|
||||||
Collection<GrantedAuthority> authorities = getAuthorities(user);
|
List<GrantedAuthority> authList = new ArrayList<GrantedAuthority>();
|
||||||
|
RoleType[] values = RoleType.values();
|
||||||
|
Arrays.stream(values).forEach(x->{
|
||||||
|
authList.add(new SimpleGrantedAuthority("ROLE_" + x.name()));
|
||||||
|
});
|
||||||
//实例化UserDetails对象
|
//实例化UserDetails对象
|
||||||
userDetails=new org.springframework.security.core.userdetails.User(s,password,
|
userDetails=new org.springframework.security.core.userdetails.User(s,password,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true, authorities);
|
true, authList);
|
||||||
}
|
}
|
||||||
return userDetails;
|
return userDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取角色信息
|
|
||||||
private Collection<GrantedAuthority> getAuthorities(User user){
|
|
||||||
List<GrantedAuthority> authList = new ArrayList<GrantedAuthority>();
|
|
||||||
UserRole role = roleService.getById(user.getRoleId());
|
|
||||||
//注意:这里每个权限前面都要加ROLE_。否在最后验证不会通过
|
|
||||||
authList.add(new SimpleGrantedAuthority("ROLE_"+role.getName()));
|
|
||||||
return authList;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ public class MyPageParam {
|
|||||||
@ApiModelProperty(value = "总量")
|
@ApiModelProperty(value = "总量")
|
||||||
private int total;
|
private int total;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "总量")
|
||||||
|
private int allTotal;
|
||||||
|
|
||||||
public boolean hasPrevious(){
|
public boolean hasPrevious(){
|
||||||
return current > 1;
|
return current > 1;
|
||||||
}
|
}
|
||||||
|
|||||||
19
src/main/java/com/quinn/vo/NavReq.java
Normal file
19
src/main/java/com/quinn/vo/NavReq.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package com.quinn.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class NavReq {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "页码")
|
||||||
|
private int pageNum;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "个数")
|
||||||
|
private int limit;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.quinn.pojo.param;
|
package com.quinn.vo;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -13,13 +13,5 @@ public class QuerySource {
|
|||||||
* 资源类别
|
* 资源类别
|
||||||
*/
|
*/
|
||||||
private int category;
|
private int category;
|
||||||
/**
|
|
||||||
* 页码
|
|
||||||
*/
|
|
||||||
private int pageNum;
|
|
||||||
/**
|
|
||||||
* 每页数量
|
|
||||||
*/
|
|
||||||
private int limit;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
16
src/main/java/com/quinn/vo/QuerySourcePage.java
Normal file
16
src/main/java/com/quinn/vo/QuerySourcePage.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package com.quinn.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class QuerySourcePage extends QuerySource{
|
||||||
|
/**
|
||||||
|
* 页码
|
||||||
|
*/
|
||||||
|
private int pageNum;
|
||||||
|
/**
|
||||||
|
* 每页数量
|
||||||
|
*/
|
||||||
|
private int limit;
|
||||||
|
|
||||||
|
}
|
||||||
BIN
src/main/resources/static/images/avatar/quinn.png
Normal file
BIN
src/main/resources/static/images/avatar/quinn.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 61 KiB |
@@ -15,11 +15,11 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-9 blog-main">
|
<div class="col-md-9 blog-main">
|
||||||
<div class="my-3 p-3 bg-white rounded shadow-sm">
|
<div class="my-3 p-3 bg-white rounded shadow-sm">
|
||||||
|
<div th:fragment="s_table_refresh" th:id="id_s_table_refresh">
|
||||||
<h6 class="border-bottom border-gray pb-2 mb-0">
|
<h6 class="border-bottom border-gray pb-2 mb-0">
|
||||||
论坛累计:
|
论坛累计:
|
||||||
<span th:text="${myPageParam.getTotal()}"></span>
|
<span th:text="${pageParam.getTotal()}"></span>
|
||||||
</h6>
|
</h6>
|
||||||
<!-- 时间 -->
|
|
||||||
<div th:each="blog:${blogList}" class="media pt-3 border-bottom border-gray">
|
<div th:each="blog:${blogList}" class="media pt-3 border-bottom border-gray">
|
||||||
<!-- 头像 -->
|
<!-- 头像 -->
|
||||||
<img th:src="${blog.getAvatar()}" style="border-radius: 5px " width="32" height="32">
|
<img th:src="${blog.getAvatar()}" style="border-radius: 5px " width="32" height="32">
|
||||||
@@ -60,24 +60,24 @@
|
|||||||
<!--分页-->
|
<!--分页-->
|
||||||
<nav aria-label="Page navigation example" class="mt-4">
|
<nav aria-label="Page navigation example" class="mt-4">
|
||||||
<ul class="pagination justify-content-center pagination-sm">
|
<ul class="pagination justify-content-center pagination-sm">
|
||||||
<li th:class="${myPageParam.hasPrevious()==true?'page-item':'page-item disabled'}">
|
<li th:class="${pageParam.hasPrevious()==true?'page-item':'page-item disabled'}">
|
||||||
<a class="page-link" th:href="@{'/blog/'+${myPageParam.getCurrent()-1}+'/10'}" tabindex="">Previous</a>
|
<a class="page-link" href="javascript:navChange(-1);" tabindex="">Previous</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="page-item" th:if="${myPageParam.hasPrevious()}">
|
<li class="page-item" th:if="${pageParam.hasPrevious()}">
|
||||||
<a class="page-link" th:href="@{'/blog/'+${myPageParam.getCurrent()-1}+'/10'}" th:text="${myPageParam.getCurrent()-1}"></a>
|
<a class="page-link" href="javascript:navChange(-1);" th:text="${pageParam.getCurrent()-1}"></a>
|
||||||
</li>
|
</li>
|
||||||
<li class="page-item active">
|
<li class="page-item active">
|
||||||
<a class="page-link" th:href="@{'/blog/'+${myPageParam.getCurrent()}+'/10'}" th:text="${myPageParam.getCurrent()}"></a>
|
<a id = "current" class="page-link" href="javascript:navChange(0);" th:text="${pageParam.getCurrent()}"></a>
|
||||||
</li>
|
</li>
|
||||||
<li class="page-item" th:if="${myPageParam.hasNext()}">
|
<li class="page-item" th:if="${pageParam.hasNext()}">
|
||||||
<a class="page-link" th:href="@{'/blog/'+${myPageParam.getCurrent()+1}+'/10'}" th:text="${myPageParam.getCurrent()+1}"></a>
|
<a class="page-link" href="javascript:navChange(1);" th:text="${pageParam.getCurrent()+1}"></a>
|
||||||
</li>
|
</li>
|
||||||
<li th:class="${myPageParam.hasNext()==true?'page-item':'page-item disabled'}">
|
<li th:class="${pageParam.hasNext()==true?'page-item':'page-item disabled'}">
|
||||||
<a class="page-link" th:href="@{'/blog/'+${myPageParam.getCurrent()+1}+'/10'}" >Next</a>
|
<a class="page-link" href="javascript:navChange(1);">Next</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -101,7 +101,6 @@
|
|||||||
<br/>
|
<br/>
|
||||||
<span>如果发的帖子水分过大,可能会被封禁账号,请酌情发帖评论!</span>
|
<span>如果发的帖子水分过大,可能会被封禁账号,请酌情发帖评论!</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="p-4 my-3 bg-white rounded">
|
<div class="p-4 my-3 bg-white rounded">
|
||||||
<h4 class="pb-1">推荐</h4>
|
<h4 class="pb-1">推荐</h4>
|
||||||
<ul class="list-unstyled small" th:each="topBlog:${topBlogList}">
|
<ul class="list-unstyled small" th:each="topBlog:${topBlogList}">
|
||||||
@@ -131,10 +130,20 @@
|
|||||||
<script th:src="@{/js/toTop.js}"></script>
|
<script th:src="@{/js/toTop.js}"></script>
|
||||||
<script th:src="@{/js/jquery-ui.min.js}"></script>
|
<script th:src="@{/js/jquery-ui.min.js}"></script>
|
||||||
<script th:src="@{/live/js/addlive2d.js}"></script>
|
<script th:src="@{/live/js/addlive2d.js}"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
<script>
|
function navChange(page){
|
||||||
|
var current = $('#current').text();
|
||||||
|
var pageNum = parseInt(current) + page;
|
||||||
|
$.ajax({
|
||||||
|
url: "/blog",
|
||||||
|
async: false,
|
||||||
|
type: "post",
|
||||||
|
data: {"pageNum": pageNum, "limit": 10},
|
||||||
|
success: function (data) {
|
||||||
|
$('#id_s_table_refresh').html(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<main role="main">
|
<main role="main">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="col-md-12 blog-main" style="margin-top: 20px">
|
<div class="col-md-12 blog-main" style="margin-top: 20px">
|
||||||
<form th:action="@{'/about/'+${session.loginUser.getRoleId()}}" method="post">
|
<form th:action="@{'/about'}" method="post">
|
||||||
<div class="col-md-12 mb-3">
|
<div class="col-md-12 mb-3">
|
||||||
<label>标题</label>
|
<label>标题</label>
|
||||||
<input type="text" name="title" class="form-control" value="" required>
|
<input type="text" name="title" class="form-control" value="" required>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<input type="text" name="username" class="form-control mb-2" placeholder="用户名" required="">
|
<input type="text" name="username" class="form-control mb-2" placeholder="用户名" required="">
|
||||||
<input type="password" name="password" class="form-control" placeholder="密码" required="">
|
<input type="password" name="password" class="form-control" placeholder="密码" required="">
|
||||||
<input type="password" name="repassword" class="form-control" placeholder="确认密码" required="">
|
<input type="password" name="repassword" class="form-control" placeholder="确认密码" required="">
|
||||||
<input type="text" name="code" class="form-control" placeholder="社区邀请码" required="">
|
<input type="text" name="code" class="form-control" placeholder="邀请码" required="">
|
||||||
|
|
||||||
<button class="btn btn-lg btn-primary btn-block mt-3" type="submit" onclick="this.disabled=true; this.form.submit();">注 册</button>
|
<button class="btn btn-lg btn-primary btn-block mt-3" type="submit" onclick="this.disabled=true; this.form.submit();">注 册</button>
|
||||||
|
|
||||||
|
|||||||
@@ -5,87 +5,121 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
<title>资源库-Quinn</title>
|
<title>资源库-Quinn</title>
|
||||||
<link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}">
|
<link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}">
|
||||||
<link rel="stylesheet" th:href="@{/css/download.css}">
|
<style>
|
||||||
|
#maxLength {
|
||||||
|
max-width: 500px;
|
||||||
|
white-space: nowrap; /* 不换行 */
|
||||||
|
overflow: hidden; /* 超出部分不显示 */
|
||||||
|
text-overflow: ellipsis; /* 超出部分显示为... */
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div th:replace="~{common/header::header(activeUrl='source')}"></div>
|
<div th:replace="~{common/header::header(activeUrl='source')}"></div>
|
||||||
|
|
||||||
<main role="main" class="mt-3">
|
<main role="main" class="container">
|
||||||
<div class="container">
|
<div class="row">
|
||||||
<form action="javascript:navChange(0);" method="post">
|
<div class="col-md-9 blog-main">
|
||||||
<div class="form-row align-items-center">
|
<div class="my-3 p-3 bg-white rounded shadow-sm">
|
||||||
<div class="col-auto">
|
<h6 class="border-bottom border-gray pb-2 mb-0">
|
||||||
<label class="sr-only" for="name">KEYWORD</label>
|
累计资源总量:
|
||||||
<div class="input-group mb-2">
|
<span th:text="${pageParam.getAllTotal()}"></span>
|
||||||
<div class="input-group-prepend">
|
</h6>
|
||||||
<div class="input-group-text">关键字</div>
|
<div th:fragment="s_table_refresh" th:id="id_s_table_refresh">
|
||||||
|
<div th:each="source:${sourceList}" class="media pt-3 border-bottom border-gray">
|
||||||
|
<div class="media-body small pl-2">
|
||||||
|
<!-- 标题 -->
|
||||||
|
<a th:href="@{'/source/view/'+${source.getSid()}}"
|
||||||
|
class="text-dark font-weight-bold text-decoration-none">
|
||||||
|
<span th:if="${source.getDownRecord() > 20}" class="badge badge-danger">精</span>
|
||||||
|
[[${source.getSourceName()}]]
|
||||||
|
</a>
|
||||||
|
<!-- 收藏 -->
|
||||||
|
<span class="badge badge-dark">
|
||||||
|
[[${source.getCategoryName()}]]
|
||||||
|
(
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" class="bi bi-heart-fill" viewBox="0 0 16 16">
|
||||||
|
<path fill-rule="evenodd" d="M8 1.314C12.438-3.248 23.534 4.735 8 15-7.534 4.736 3.562-3.248 8 1.314z"/>
|
||||||
|
</svg>
|
||||||
|
[[${source.getStar()}]]
|
||||||
|
)
|
||||||
|
</span>
|
||||||
|
<p class="float-right" th:text="${#dates.format(source.getGmtUpdate(),'yyyy-MM-dd HH:mm:ss')}"></p>
|
||||||
|
<div class="small">
|
||||||
|
<span id="maxLength" th:text="${source.getDetail()}"
|
||||||
|
class="d-block">
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" id="name" name="name" placeholder="请输入关键字"/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<!--分页-->
|
||||||
<div class="col-auto">
|
<nav aria-label="Page navigation example" class="mt-4">
|
||||||
<label class="sr-only" for="category">SOURCE-TYPE</label>
|
<ul class="pagination justify-content-center pagination-sm">
|
||||||
<div class="input-group mb-2">
|
<li th:class="${pageParam.hasPrevious()==true?'page-item':'page-item disabled'}">
|
||||||
<div class="input-group-prepend">
|
<a class="page-link" href="javascript:navChange(-1);" tabindex="">Previous</a>
|
||||||
<div class="input-group-text">类别</div>
|
</li>
|
||||||
</div>
|
<li class="page-item" th:if="${pageParam.hasPrevious()}">
|
||||||
<select id="category" name="category" class="form-control custom-select">
|
<a class="page-link" href="javascript:navChange(-1);" th:text="${pageParam.getCurrent()-1}"></a>
|
||||||
<option th:value=-1 th:text="请选择"></option>
|
</li>
|
||||||
<option th:each="category:${categoryList}" th:value="${category.getId()}" th:text="${category.getCategory()}"></option>
|
<li class="page-item active">
|
||||||
</select>
|
<a id = "current" class="page-link" href="javascript:navChange(0);" th:text="${pageParam.getCurrent()}"></a>
|
||||||
</div>
|
</li>
|
||||||
|
<li class="page-item" th:if="${pageParam.hasNext()}">
|
||||||
</div>
|
<a class="page-link" href="javascript:navChange(1);" th:text="${pageParam.getCurrent()+1}"></a>
|
||||||
<div class="col-auto ml-auto">
|
</li>
|
||||||
<button type="submit" class="btn btn-primary mb-2">查询</button>
|
<li th:class="${pageParam.hasNext()==true?'page-item':'page-item disabled'}">
|
||||||
|
<a class="page-link" href="javascript:navChange(1);">Next</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</div>
|
||||||
</div>
|
<aside class="col-md-3 blog-sidebar">
|
||||||
<div class="container" th:fragment="s_table_refresh" th:id="id_s_table_refresh">
|
<div class="p-1 my-2 bg-white rounded">
|
||||||
<table class="table">
|
<strong class="mb-0">
|
||||||
<thead class="thead-light">
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-bookmarks-fill" viewBox="0 0 16 16">
|
||||||
<tr>
|
<path d="M2 4a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v11.5a.5.5 0 0 1-.777.416L7 13.101l-4.223 2.815A.5.5 0 0 1 2 15.5V4z"/>
|
||||||
<th scope="col">资源名</th>
|
<path d="M4.268 1A2 2 0 0 1 6 0h6a2 2 0 0 1 2 2v11.5a.5.5 0 0 1-.777.416L13 13.768V2a1 1 0 0 0-1-1H4.268z"/>
|
||||||
<th scope="col">资源简介</th>
|
</svg>
|
||||||
<th scope="col">资源类型</th>
|
敲黑板
|
||||||
<th scope="col">热度</th>
|
</strong>
|
||||||
<th scope="col">去下载</th>
|
<br/>
|
||||||
</tr>
|
<span>如果发的帖子水分过大,可能会被封禁账号,请酌情发帖评论!</span>
|
||||||
</thead>
|
</div>
|
||||||
<tbody>
|
<div class="p-1 my-2 bg-white rounded">
|
||||||
<tr th:each="source:${sourceList}">
|
<form action="javascript:navChange(0);" method="post">
|
||||||
<td th:text="${source.getSourceName()}"></td>
|
<div class="form-row align-items-center">
|
||||||
<td th:text="${source.getDetail()}"></td>
|
<div class="col-md-12 form-control-sm">
|
||||||
<td th:text="${source.getCategoryName()}"></td>
|
<label class="sr-only" for="name">KEYWORD</label>
|
||||||
<td th:text="${source.getDownRecord()}"></td>
|
<div class="input-group">
|
||||||
<td th:name="${source.getSid()}">
|
<div class="input-group-prepend">
|
||||||
<a style="color: white" th:href="@{'/source/view/'+${source.getSid()}}" class="btn btn-sm btn-secondary">详情</a>
|
<div class="input-group-text">名称</div>
|
||||||
</td>
|
</div>
|
||||||
</tr>
|
<input type="text" class="form-control" id="name" name="name" placeholder="请输入关键字"/>
|
||||||
</tbody>
|
</div>
|
||||||
</table>
|
</div>
|
||||||
<nav aria-label="Page navigation example">
|
<div class="col-md-12 mt-3 form-control-sm">
|
||||||
<ul class="pagination justify-content-center">
|
<label class="sr-only" for="category">SOURCE-TYPE</label>
|
||||||
<li th:class="${pageParam.hasPrevious()==true?'page-item':'page-item disabled'}">
|
<div class="input-group">
|
||||||
<a class="page-link" href="javascript:navChange(-1);" tabindex="">Previous</a>
|
<div class="input-group-prepend">
|
||||||
</li>
|
<div class="input-group-text">类别</div>
|
||||||
<li class="page-item" th:if="${pageParam.hasPrevious()}">
|
</div>
|
||||||
<a class="page-link" href="javascript:navChange(-1);" th:text="${pageParam.getCurrent()-1}"></a>
|
<select id="category" name="category" class="form-control custom-select">
|
||||||
</li>
|
<option th:value=-1 th:text="请选择"></option>
|
||||||
<li class="page-item active">
|
<option th:each="category:${categoryList}" th:value="${category.getId()}" th:text="${category.getCategory()}"></option>
|
||||||
<a id = "current" class="page-link" href="javascript:navChange(0);" th:text="${pageParam.getCurrent()}"></a>
|
</select>
|
||||||
</li>
|
</div>
|
||||||
<li class="page-item" th:if="${pageParam.hasNext()}">
|
|
||||||
<a class="page-link" href="javascript:navChange(1);" th:text="${pageParam.getCurrent()+1}"></a>
|
</div>
|
||||||
</li>
|
<div class="col-md-12 mt-3 form-control-sm">
|
||||||
<li th:class="${pageParam.hasNext()==true?'page-item':'page-item disabled'}">
|
<button type="submit" class="btn btn-primary btn-block">查询</button>
|
||||||
<a class="page-link" href="javascript:navChange(1);">Next</a>
|
</div>
|
||||||
</li>
|
</div>
|
||||||
</ul>
|
</form>
|
||||||
</nav>
|
</div>
|
||||||
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
@@ -104,7 +138,8 @@
|
|||||||
var current = $('#current').text();
|
var current = $('#current').text();
|
||||||
var pageNum = parseInt(current) + page;
|
var pageNum = parseInt(current) + page;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/source/page",
|
url: "/source",
|
||||||
|
async: false,
|
||||||
type: "post",
|
type: "post",
|
||||||
data: {"name": name, "category": category, "pageNum": pageNum, "limit": 10},
|
data: {"name": name, "category": category, "pageNum": pageNum, "limit": 10},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
|
|||||||
@@ -62,14 +62,12 @@
|
|||||||
class="text-dark font-weight-bold text-decoration-none d-block">
|
class="text-dark font-weight-bold text-decoration-none d-block">
|
||||||
</a>
|
</a>
|
||||||
<!-- 浏览量 -->
|
<!-- 浏览量 -->
|
||||||
<span style="color: red">
|
<span class="badge badge-success">
|
||||||
<svg class="bi bi-eye-fill" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
<svg class="bi bi-eye-fill" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
||||||
<path d="M10.5 8a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0z"/>
|
<path d="M10.5 8a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0z"/>
|
||||||
<path fill-rule="evenodd" d="M0 8s3-5.5 8-5.5S16 8 16 8s-3 5.5-8 5.5S0 8 0 8zm8 3.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z"/>
|
<path fill-rule="evenodd" d="M0 8s3-5.5 8-5.5S16 8 16 8s-3 5.5-8 5.5S0 8 0 8zm8 3.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z"/>
|
||||||
</svg>
|
</svg>
|
||||||
[[${blog.getViews()}]]
|
[[${blog.getViews()}]]
|
||||||
</span>
|
|
||||||
<span style="color: red">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" class="bi bi-heart-fill" viewBox="0 0 16 16">
|
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" class="bi bi-heart-fill" viewBox="0 0 16 16">
|
||||||
<path fill-rule="evenodd" d="M8 1.314C12.438-3.248 23.534 4.735 8 15-7.534 4.736 3.562-3.248 8 1.314z"/>
|
<path fill-rule="evenodd" d="M8 1.314C12.438-3.248 23.534 4.735 8 15-7.534 4.736 3.562-3.248 8 1.314z"/>
|
||||||
</svg>
|
</svg>
|
||||||
@@ -139,9 +137,9 @@
|
|||||||
<span th:text="${session.loginUser.getUsername()}"></span>
|
<span th:text="${session.loginUser.getUsername()}"></span>
|
||||||
<br>
|
<br>
|
||||||
<small>
|
<small>
|
||||||
<!--<span class="badge badge-primary">普通用户</span>-->
|
<span th:if="${session.loginUser.getRoleId()=='ADMIN'}" class="badge badge-primary">超级管理员</span>
|
||||||
<span th:class="${session.loginUser.getRoleId()==2?'badge badge-warning':'badge badge-success'}"
|
<span th:if="${session.loginUser.getRoleId()!='ADMIN'}" th:class="${session.loginUser.getRoleId()=='VIP'?'badge badge-warning':'badge badge-success'}"
|
||||||
th:text="${session.loginUser.getRoleId()==2?'Vip会员':'管理员'}">
|
th:text="${session.loginUser.getRoleId()=='VIP'?'VIP会员':'普通用户'}">
|
||||||
</span>
|
</span>
|
||||||
</small>
|
</small>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
Reference in New Issue
Block a user