Prechádzať zdrojové kódy

常熟万物墙二期 开发版 开始

wuweihao 2 rokov pred
rodič
commit
c077d67692
19 zmenil súbory, kde vykonal 325 pridanie a 78 odobranie
  1. 3 1
      README.md
  2. 60 0
      run.sh
  3. 26 15
      zhoushan-system-api/src/main/java/com/fdage/controller/ApiController.java
  4. 27 27
      zhoushan-system-api/src/main/java/com/fdage/controller/CollectionController.java
  5. 1 1
      zhoushan-system-api/src/main/java/com/fdage/controller/LoginController.java
  6. 4 2
      zhoushan-system-api/src/main/java/com/fdage/controller/UserController.java
  7. 9 25
      zhoushan-system-api/src/main/java/com/fdage/listner/LoggerInterceptor.java
  8. 1 1
      zhoushan-system-api/src/main/java/com/fdage/shiro/ShiroConfig.java
  9. 27 0
      zhoushan-system-common/src/main/java/com/fdage/dto/PageDateDto.java
  10. 26 0
      zhoushan-system-common/src/main/java/com/fdage/dto/PageDto.java
  11. 19 0
      zhoushan-system-common/src/main/java/com/fdage/mapper/BaseProvider.java
  12. 5 0
      zhoushan-system-common/src/main/java/com/fdage/respon/ResponCollection.java
  13. 22 0
      zhoushan-system-common/src/main/java/com/fdage/util/BaseUtil.java
  14. 2 2
      zhoushan-system-common/src/main/java/com/fdage/util/PasswordUtils.java
  15. 8 0
      zhoushan-system-dao/src/main/java/com/fdage/dao/base/TbCollectionMapper.java
  16. 27 0
      zhoushan-system-dao/src/main/java/com/fdage/dto/CollectionPageDto.java
  17. 8 2
      zhoushan-system-dao/src/main/java/com/fdage/pojo/TbCollection.java
  18. 5 0
      zhoushan-system-service/src/main/java/com/fdage/service/ICollectionService.java
  19. 45 2
      zhoushan-system-service/src/main/java/com/fdage/service/impl/CollectionServiceImpl.java

+ 3 - 1
README.md

@@ -2,4 +2,6 @@
 
 博物馆-常熟 2021-08-03
 
-# admin 1234abcd
+# admin 1234abcd
+
+# 常熟万物墙-v2  2022-10-25

+ 60 - 0
run.sh

@@ -0,0 +1,60 @@
+#!/bin/sh
+APP_NAME=museum_changshu.jar
+APP_PORT=8002
+APP_EVN=$2   #执行环境 sit|pro
+APP_ORDER=$1   #执行方法  start|stop|restart
+# 获取进程号
+APP_PID=`netstat -ntpl | grep $APP_PORT | grep LISTEN | awk '{print $7}' | awk -F "/" '{print $1}'`
+
+
+# 启动命令
+startApp(){
+    if [ ${APP_PID} ];
+    then
+    	echo "程序已经在运行了"
+    else
+    	echo "执行 start 方法"
+    	nohup java -jar -Xmx3072M -Xms512M ./$APP_NAME --spring.profiles.active=$APP_EVN --server.port=$APP_PORT > logs.log 2>error.log &  # 说明pid为空
+	echo Start Success!
+fi
+}
+
+# 停止命令
+stopApp(){
+    echo "执行 stop 方法"
+    if [ ${APP_PID} ];
+	then
+		echo $APP_NAME "存在,执行 stop 方法"
+			kill -9 ${APP_PID} && echo 'Kill Process!'
+	else
+		echo $APP_NAME 没有运行
+    fi
+}
+
+# 重启命令
+restartApp(){
+    echo " 1 执行 restart 方法"
+	stopApp
+	APP_PID=''  #将进程号置空
+	sleep 2
+	echo "进程号:" ${APP_PID} "端口号:" ${APP_PORT}
+	echo " 2 执行 restart 方法"
+	startApp
+}
+
+# 判断执行命令 取第一个参数
+case $APP_ORDER in
+    "start")
+        startApp
+        ;;
+    "stop")
+        stopApp
+        ;;
+	"restart")
+		restartApp
+        ;;
+        *)
+     ;;
+esac
+
+

+ 26 - 15
zhoushan-system-api/src/main/java/com/fdage/controller/ApiController.java

@@ -1,10 +1,9 @@
 package com.fdage.controller;
 
-import com.fdage.aop.WebControllerLog;
+import com.fdage.dto.CollectionPageDto;
 import com.fdage.enums.ResponEnum;
 import com.fdage.request.RequestCollection;
 import com.fdage.request.RequestExhibition;
-import com.fdage.request.RequestInformation;
 import com.fdage.respon.ResponCollection;
 import com.fdage.respon.ResponExhibition;
 import com.fdage.respon.ResponInformation;
@@ -13,8 +12,6 @@ import com.fdage.service.IExhibitionService;
 import com.fdage.service.IInformationService;
 import com.fdage.util.AjaxJson;
 import com.fdage.util.DateUtil;
-import com.github.pagehelper.PageInfo;
-import com.github.pagehelper.util.StringUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -23,18 +20,18 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
 
+import javax.validation.Valid;
 import java.util.List;
 
 /**
  * Created by Hb_zzZ on 2020/7/30.
+ * edit by owen 2022-10-25
+ * 给app使用
  */
 @Api(tags = "w-门户网站")
-@Controller
+@RestController
 @RequestMapping("/api")
 @Slf4j
 public class ApiController {
@@ -93,12 +90,20 @@ public class ApiController {
         return AjaxJson.success(list);
     }
 
+//    @PostMapping("collectionList")
+//    @ResponseBody
+//    @ApiOperation("获取所有文物列表")
+//    public AjaxJson collectionList(){
+//        List<ResponCollection> list = collectionService.findList(null);
+//        return AjaxJson.success(list);
+//    }
+
+
     @PostMapping("collectionList")
-    @ResponseBody
-    @ApiOperation("获取所有文物列表")
-    public AjaxJson collectionList(){
-        List<ResponCollection> list = collectionService.findList(null);
-        return AjaxJson.success(list);
+    @ApiOperation("v2-获取所有文物列表")
+    public AjaxJson collectionList(@Valid @RequestBody CollectionPageDto pageDto){
+//        List<ResponCollection> list = collectionService.findList(null);
+        return AjaxJson.success(collectionService.list(pageDto));
     }
 
     @PostMapping("collectionFindById")
@@ -107,11 +112,15 @@ public class ApiController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "id", value = "文物id", dataType = "String")})
     public AjaxJson findById(@RequestBody RequestCollection bo){
+
         if(bo == null || bo.getId() == null){
             return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
         }
+        Long id = bo.getId();
+//        // 2022-10-25 添加访问量
+//        collectionService.addVisit(id);
 
-        return AjaxJson.success(collectionService.findById(bo.getId()));
+        return AjaxJson.success(collectionService.findById(id));
     }
 
     @PostMapping("likeCollection")
@@ -187,4 +196,6 @@ public class ApiController {
         collectionService.addDownloadNum(bo.getId());
         return AjaxJson.success();
     }
+
+
 }

+ 27 - 27
zhoushan-system-api/src/main/java/com/fdage/controller/CollectionController.java

@@ -1,19 +1,14 @@
 package com.fdage.controller;
 
-import cn.hutool.core.collection.CollectionUtil;
-import cn.hutool.core.collection.ListUtil;
-import cn.hutool.core.util.StrUtil;
 import com.fdage.aop.WebControllerLog;
 import com.fdage.constant.ConfigConstant;
-import com.fdage.constant.ConstantUrl;
+import com.fdage.dto.CollectionPageDto;
 import com.fdage.enums.ResponEnum;
 import com.fdage.pojo.TbCollection;
 import com.fdage.request.RequestCollection;
-import com.fdage.respon.ResponCollection;
 import com.fdage.service.ICollectionService;
 import com.fdage.util.AjaxJson;
 import com.fdage.util.FileUtil;
-import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -23,17 +18,16 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.util.List;
+import javax.validation.Valid;
 
 /**
  * Created by Hb_zzZ on 2019/9/11.
  */
-@Api(tags = "文物库模块")
-@Controller
+@Api(tags = "v2-文物库模块")
+@RestController
 @RequestMapping("/zhoushan/collection")
 @Slf4j
 public class CollectionController {
@@ -128,7 +122,7 @@ public class CollectionController {
     @PostMapping("findById")
     @ResponseBody
     @WebControllerLog(description = "文物库-查询文物库详情")
-    @ApiOperation("查询文物库详情")
+    @ApiOperation("v2-查询文物库详情")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "id", value = "文物id", dataType = "String")})
     public AjaxJson findById(@RequestBody RequestCollection bo){
@@ -139,20 +133,29 @@ public class CollectionController {
         return AjaxJson.success(service.findById(bo.getId()));
     }
 
-    @PostMapping("list")
-    @ResponseBody
+//    @PostMapping("list")
+//    @ResponseBody
+//    @WebControllerLog(description = "文物库-获取文物列表")
+//    @ApiOperation("获取文物列表")
+//    @ApiImplicitParams({
+//            @ApiImplicitParam(name = "timeId", value = "年代id", dataType = "String"),
+//            @ApiImplicitParam(name = "typeId", value = "类型id", dataType = "String"),
+//            @ApiImplicitParam(name = "name", value = "文物名称", dataType = "String"),
+//            @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "String"),
+//            @ApiImplicitParam(name = "pageSize", value = "每页数量", dataType = "String")})
+//    public AjaxJson list(@RequestBody RequestCollection bo){
+//        List<ResponCollection> list = service.findList(bo);
+//        PageInfo<ResponCollection> pageInfo = new PageInfo<>(list);
+//        return AjaxJson.success(pageInfo);
+//    }
+
+//    @ResponseBody
+    @PostMapping("/list")
     @WebControllerLog(description = "文物库-获取文物列表")
-    @ApiOperation("获取文物列表")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "timeId", value = "年代id", dataType = "String"),
-            @ApiImplicitParam(name = "typeId", value = "类型id", dataType = "String"),
-            @ApiImplicitParam(name = "name", value = "文物名称", dataType = "String"),
-            @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "String"),
-            @ApiImplicitParam(name = "pageSize", value = "每页数量", dataType = "String")})
-    public AjaxJson list(@RequestBody RequestCollection bo){
-        List<ResponCollection> list = service.findList(bo);
-        PageInfo<ResponCollection> pageInfo = new PageInfo<>(list);
-        return AjaxJson.success(pageInfo);
+    @ApiOperation("v2-获取文物列表")
+    public AjaxJson listPage(@Valid @RequestBody CollectionPageDto param){
+
+        return service.listPage(param);
     }
 
     @PostMapping("/upload")
@@ -177,9 +180,6 @@ public class CollectionController {
             return AjaxJson.failure("上传图片失败");
         }
 
-//        Map<String, String> map = new HashMap<>();
-//        map.put(path + "/" + fileName, "company/" + fileName);
-//        uploadToAlibabaService.upload(map);
 
         return AjaxJson.success((Object) ("/collection/" + fileName));
     }

+ 1 - 1
zhoushan-system-api/src/main/java/com/fdage/controller/LoginController.java

@@ -111,7 +111,7 @@ public class LoginController {
 //        log.info("token create");
 
 
-        // 更新到 redis, 有效期24h, 旧token无效
+        // 更新到 redis, 有效期24h, 旧token无效 , 单用户登录
         redisTemplate.opsForValue().set(user.getUserName(), token, Long.parseLong("23"), TimeUnit.HOURS);
 
         TbLog logEntity = new TbLog();

+ 4 - 2
zhoushan-system-api/src/main/java/com/fdage/controller/UserController.java

@@ -69,7 +69,8 @@ public class UserController {
 
         user = new TbUser();
         BeanUtils.copyProperties(bo, user);
-        user.setPassword(PasswordUtils.encrypt("1234abcd", bo.getUserName(), PasswordUtils.getStaticSalt()));
+//        user.setPassword(PasswordUtils.encrypt("1234abcd", bo.getUserName(), PasswordUtils.getStaticSalt()));
+        user.setPassword(PasswordUtils.encrypt("123456", bo.getUserName(), PasswordUtils.getStaticSalt()));
         userService.insert(user);
 
         roleService.saveRoleUser(bo.getRoleId(), user.getId());
@@ -220,7 +221,8 @@ public class UserController {
             return AjaxJson.failure(ResponEnum.USER_NOT_EXIST.getCode(), ResponEnum.USER_NOT_EXIST.getMessage());
         }
 
-        user.setPassword(PasswordUtils.encrypt("1234abcd", user.getUserName(), PasswordUtils.getStaticSalt()));
+//        user.setPassword(PasswordUtils.encrypt("1234abcd", user.getUserName(), PasswordUtils.getStaticSalt()));
+        user.setPassword(PasswordUtils.encrypt("123456", user.getUserName(), PasswordUtils.getStaticSalt()));
         userService.update(user);
         return AjaxJson.success();
     }

+ 9 - 25
zhoushan-system-api/src/main/java/com/fdage/listner/LoggerInterceptor.java

@@ -1,6 +1,5 @@
 package com.fdage.listner;
 
-//import com.fdage.util.JwtUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -20,29 +19,12 @@ public class LoggerInterceptor implements HandlerInterceptor {
     @Override
     public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
         String uri = request.getRequestURI();
-        log.info("进入" + uri + "请求");
-
-//        String token = request.getHeader("token");
-//        if(StringUtils.isEmpty(token) || "null".equals(token)){
-//            log.info(uri + "请求token为空");
-//            response.setContentType("text/html;charset=UTF-8");
-//            JSONObject responseJson = new JSONObject();
-//            responseJson.put("code", 202);
-//            responseJson.put("message", "token不能为空");
-//            response.getWriter().println(responseJson);
-//            return false;
-//        }
-//        Claims claims = JwtUtil.parseJWT(token);
-//        Object obj = redisUtils.get(CommonConf.REDIS_LOGIN_TOKEN + claims.get("username", String.class));
-//        if(obj == null || !obj.equals(token)){
-//            log.info(uri + "请求token错误被拦截");
-//            response.setContentType("text/html;charset=UTF-8");
-//            JSONObject responseJson = new JSONObject();
-//            responseJson.put("code", 202);
-//            responseJson.put("message", "token不正确请重新登陆");
-//            response.getWriter().println(responseJson);
-//            return false;
-//        }
+        if (uri.endsWith(".jpg")){
+            return true;
+        }
+
+        log.info("进入: " + uri + ", 请求");
+
         return true;
     }
 
@@ -54,6 +36,8 @@ public class LoggerInterceptor implements HandlerInterceptor {
     @Override
     public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
         String uri = request.getRequestURI();
-        log.info(uri + "请求结束");
+        if (!uri.endsWith(".jpg")){
+            log.info(uri + ", 请求结束");
+        }
     }
 }

+ 1 - 1
zhoushan-system-api/src/main/java/com/fdage/shiro/ShiroConfig.java

@@ -79,7 +79,7 @@ public class ShiroConfig {
 
 
         // 所有请求通过我们自己的JWT Filter
-//        filterRuleMap.put("/zhoushan/**", "jwt");
+        filterRuleMap.put("/zhoushan/**", "jwt");
 
 
         // 访问401和404页面不通过我们的Filter

+ 27 - 0
zhoushan-system-common/src/main/java/com/fdage/dto/PageDateDto.java

@@ -0,0 +1,27 @@
+package com.fdage.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * Created by Owen on 2019/10/28 0028 12:24
+ * 有时间
+ */
+@Data
+public class PageDateDto extends PageDto {
+
+    /**
+     * 开始时间
+     * 需要用字符串接收
+     */
+    @ApiModelProperty(value = "开始时间", name = "startTime")
+    private String startTime;
+
+
+    @ApiModelProperty(value = "结束时间", name = "endTime")
+    private String endTime;
+
+
+
+}

+ 26 - 0
zhoushan-system-common/src/main/java/com/fdage/dto/PageDto.java

@@ -0,0 +1,26 @@
+package com.fdage.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * Created by Owen on 2019/10/28 0028 12:24
+ */
+@Data
+public class PageDto {
+
+
+    @ApiModelProperty(value = "起始页码,默认1为第一页", name = "pageNum")
+    private Integer pageNum;
+
+    @ApiModelProperty(value = "每页数量", name = "pageSize")
+    private Integer pageSize;
+
+    @ApiModelProperty(value = "搜索条件", name = "searchKey")
+    private String searchKey;
+
+
+
+
+}

+ 19 - 0
zhoushan-system-common/src/main/java/com/fdage/mapper/BaseProvider.java

@@ -0,0 +1,19 @@
+package com.fdage.mapper;
+
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * Created by owen on 2022/2/9.
+ */
+@Slf4j
+public class BaseProvider {
+
+    public String runSql(String sqlStr){
+        log.info("sqlStr: {}", sqlStr);
+        return sqlStr;
+    }
+
+
+
+}

+ 5 - 0
zhoushan-system-common/src/main/java/com/fdage/respon/ResponCollection.java

@@ -44,6 +44,7 @@ public class ResponCollection {
 
     private Integer likeNum;
 
+    @ApiModelProperty(value = "访问量")
     private Integer openNum;
 
     private Integer searchNum;
@@ -71,4 +72,8 @@ public class ResponCollection {
 
     @ApiModelProperty(value = "二维码")
     private String qrCode;
+
+//    // 2022-10-25
+//    @ApiModelProperty(value = "访问量")
+//    private Integer visit;
 }

+ 22 - 0
zhoushan-system-common/src/main/java/com/fdage/util/BaseUtil.java

@@ -0,0 +1,22 @@
+package com.fdage.util;
+
+import com.fdage.dto.PageDto;
+import com.github.pagehelper.PageHelper;
+
+/**
+ * Created by owen on 2022/10/25 0025 12:10
+ */
+public class BaseUtil {
+
+    public static void startPage(PageDto param){
+        Integer pageNum = param.getPageNum();
+        Integer pageSize = param.getPageSize();
+        if (pageNum == null || pageNum <= 0) {
+            pageNum = 0;
+        }
+        if (pageSize == null || pageSize <= 0) {
+            pageSize = 10;
+        }
+        PageHelper.startPage(pageNum, pageSize);
+    }
+}

+ 2 - 2
zhoushan-system-common/src/main/java/com/fdage/util/PasswordUtils.java

@@ -168,14 +168,14 @@ public class PasswordUtils {
 
     public static void main(String[] args) {
 
-        String userName = "admin_p1";
+        String userName = "owen";
         String password = "123456";
 
         try {
             byte[] salt = PasswordUtils.getStaticSalt();
             String ciphertext = PasswordUtils.encrypt(password, userName, salt);
             System.out.println(ciphertext);
-            String plaintext = PasswordUtils.decrypt("2cd4167b1c627f11a6ce4ce7cadf1b18", "admin", salt);
+            String plaintext = PasswordUtils.decrypt("df809c9a09edd0120afe36f42b43f6df", "admin", salt);
             System.out.println(plaintext);
         } catch (Exception e) {
             e.printStackTrace();

+ 8 - 0
zhoushan-system-dao/src/main/java/com/fdage/dao/base/TbCollectionMapper.java

@@ -1,6 +1,11 @@
 package com.fdage.dao.base;
 
+import com.fdage.mapper.BaseProvider;
 import com.fdage.pojo.TbCollection;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.SelectProvider;
+
+import java.util.List;
 
 public interface TbCollectionMapper {
     int deleteByPrimaryKey(Long id);
@@ -20,4 +25,7 @@ public interface TbCollectionMapper {
     void addVisit(Long id);
 
     Long countVisit();
+
+    @SelectProvider(type = BaseProvider.class, method = "runSql")
+    List<TbCollection> mapperList(String toString);
 }

+ 27 - 0
zhoushan-system-dao/src/main/java/com/fdage/dto/CollectionPageDto.java

@@ -0,0 +1,27 @@
+package com.fdage.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * Created by owen on 2022/10/25 0025 12:01
+ */
+@Data
+public class CollectionPageDto extends PageDto {
+
+    @ApiModelProperty(value = "文物名称")
+    private String name;
+
+    @ApiModelProperty(value = "类型id")
+    private Long typeId;
+
+    @ApiModelProperty(value = "年代id")
+    private Long timeId;
+
+    @ApiModelProperty(value = "排序类型:0:默认排序 | 1:浏览量排序")
+    private Long sortType;
+
+
+
+
+}

+ 8 - 2
zhoushan-system-dao/src/main/java/com/fdage/pojo/TbCollection.java

@@ -42,6 +42,7 @@ public class TbCollection {
 
     private Integer likeNum;
 
+    @ApiModelProperty(value = "访问量")
     private Integer openNum;
 
     private Integer searchNum;
@@ -57,8 +58,6 @@ public class TbCollection {
     @ApiModelProperty(value = "目录code", notes = "上传文件使用")
     private String dirCode;
 
-    @ApiModelProperty(value = "访问量")
-    private String visit;
 
 
     // 2021-09-22
@@ -71,5 +70,12 @@ public class TbCollection {
     @ApiModelProperty(value = "二维码")
     private String qrCode;
 
+    // 2022-10-25
+    @ApiModelProperty(value = "类型名称")
+    private String typeName;
+
+    @ApiModelProperty(value = "时间名称")
+    private String timeName;
+
 
 }

+ 5 - 0
zhoushan-system-service/src/main/java/com/fdage/service/ICollectionService.java

@@ -1,5 +1,6 @@
 package com.fdage.service;
 
+import com.fdage.dto.CollectionPageDto;
 import com.fdage.pojo.TbCollection;
 import com.fdage.pojo.TbCollectionTime;
 import com.fdage.pojo.TbCollectionType;
@@ -53,4 +54,8 @@ public interface ICollectionService {
 
 
     Long countVisit();
+
+    AjaxJson listPage(CollectionPageDto param);
+
+    List<TbCollection> list(CollectionPageDto param);
 }

+ 45 - 2
zhoushan-system-service/src/main/java/com/fdage/service/impl/CollectionServiceImpl.java

@@ -10,6 +10,7 @@ import com.fdage.dao.cust.TbCollectionMapperCust;
 import com.fdage.dao.cust.TbCollectionTimeMapperCust;
 import com.fdage.dao.cust.TbCollectionTypeMapperCust;
 import com.fdage.dao.cust.TbExhibitionCollectionMapperCust;
+import com.fdage.dto.CollectionPageDto;
 import com.fdage.pojo.TbCollection;
 import com.fdage.pojo.TbCollectionTime;
 import com.fdage.pojo.TbCollectionType;
@@ -18,9 +19,10 @@ import com.fdage.respon.ResponCollection;
 import com.fdage.respon.ResponStatistics;
 import com.fdage.service.ICollectionService;
 import com.fdage.util.AjaxJson;
-import com.fdage.util.DateUtil;
+import com.fdage.util.BaseUtil;
 import com.fdage.util.ImportExeclUtil;
 import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.util.StringUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -29,7 +31,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.io.File;
 import java.io.IOException;
 import java.util.*;
 
@@ -114,6 +115,7 @@ public class CollectionServiceImpl implements ICollectionService {
             result.setRepairTime(String.valueOf(collection.getRepairTime().getTime()));
         }
 
+        // 2022-10-25 访问量
         mapperCust.addOpenNumById(id);
 
         return result;
@@ -278,6 +280,47 @@ public class CollectionServiceImpl implements ICollectionService {
         return mapper.countVisit();
     }
 
+    @Override
+    public AjaxJson listPage(CollectionPageDto param) {
+        BaseUtil.startPage(param);
+
+
+        PageInfo<TbCollection> pageInfo = new PageInfo<>(this.list(param));
+
+        return AjaxJson.success(pageInfo);
+    }
+
+    @Override
+    public List<TbCollection> list(CollectionPageDto param) {
+        StringBuilder builder = new StringBuilder();
+//        builder.append("select a.*, a.type_id as typeId, a.time_id as timeId from tb_collection a left join tb_collection_time b on a.time_id=b.id");
+        builder.append("select a.*, b.name as timeName, c.name as typeName from tb_collection a left join tb_collection_time b on a.time_id=b.id");
+        builder.append(" left join tb_collection_type c on a.type_id=c.id where 1=1");
+
+        Long timeId = param.getTimeId();
+        if (timeId != null){
+            builder.append(" and a.time_id=").append(timeId);
+        }
+
+        Long typeId = param.getTypeId();
+        if (typeId != null){
+            builder.append(" and a.type_id=").append(typeId);
+        }
+
+        String name = param.getName();
+        if (StrUtil.isNotBlank(name)){
+            builder.append(" a.name like '%").append(name).append("%'");
+        }
+
+        Long sortType = param.getSortType();
+        if (sortType!= null && 1 == sortType){
+            builder.append(" order by a.open_num desc");
+        }
+
+//        List<TbCollection> list = mapper.mapperList(builder.toString());
+        return mapper.mapperList(builder.toString());
+    }
+
     public static void main(String[] args) {
         CollectionServiceImpl service = new CollectionServiceImpl();