anderx 1 год назад
Родитель
Сommit
6973090ee7

+ 1 - 1
src/main/java/com/goafanti/common/dao/StandardPlatformLinkMapper.java

@@ -38,7 +38,7 @@ public interface StandardPlatformLinkMapper {
      * @param standardPlatformLink 查询条件
      * @return 总行数
      */
-    long count(StandardPlatformLink standardPlatformLink);
+    Integer queryAllByCount(StandardPlatformLink standardPlatformLink);
 
     /**
      * 新增数据

+ 13 - 4
src/main/java/com/goafanti/common/mapper/StandardPlatformLinkMapper.xml

@@ -37,7 +37,7 @@
                 and id = #{id}
             </if>
             <if test="name != null and name != ''">
-                and name = #{name}
+                and name like concat('%',#{name},'%')
             </if>
             <if test="url != null and url != ''">
                 and url = #{url}
@@ -57,12 +57,18 @@
             <if test="updateTime != null">
                 and update_time = #{updateTime}
             </if>
+            <if test="startTime != null and endTime !=null">
+                and update_time between #{startTime} and #{endTime}
+            </if>
         </where>
-        limit #{pageable.offset}, #{pageable.pageSize}
+        order by sort desc
+        <if test="page_sql!=null">
+            ${page_sql}
+        </if>
     </select>
 
     <!--统计总行数-->
-    <select id="count" resultType="java.lang.Long">
+    <select id="queryAllByCount" resultType="java.lang.Integer">
         select count(1)
         from standard_platform_link
         <where>
@@ -70,7 +76,7 @@
                 and id = #{id}
             </if>
             <if test="name != null and name != ''">
-                and name = #{name}
+                and name like concat('%',#{name},'%')
             </if>
             <if test="url != null and url != ''">
                 and url = #{url}
@@ -90,6 +96,9 @@
             <if test="updateTime != null">
                 and update_time = #{updateTime}
             </if>
+            <if test="startTime != null and endTime !=null">
+                and update_time between #{startTime} and #{endTime}
+            </if>
         </where>
     </select>
 

+ 4 - 0
src/main/java/com/goafanti/common/model/StandardPlatformLink.java

@@ -1,5 +1,7 @@
 package com.goafanti.common.model;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -92,6 +94,7 @@ public class StandardPlatformLink implements Serializable {
         this.sort = sort;
     }
 
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     public Date getCreateTime() {
         return createTime;
     }
@@ -100,6 +103,7 @@ public class StandardPlatformLink implements Serializable {
         this.createTime = createTime;
     }
 
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     public Date getUpdateTime() {
         return updateTime;
     }

+ 45 - 0
src/main/java/com/goafanti/standard/bo/InputStandardPlatformLink.java

@@ -0,0 +1,45 @@
+package com.goafanti.standard.bo;
+
+import com.goafanti.common.model.StandardPlatformLink;
+
+public class InputStandardPlatformLink extends StandardPlatformLink {
+
+    private String startTime;
+    private String endTime;
+
+    private Integer pageNo;
+    private Integer pageSize;
+
+    public String getStartTime() {
+        return startTime;
+    }
+
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
+
+    public Integer getPageNo() {
+        return pageNo;
+    }
+
+    public void setPageNo(Integer pageNo) {
+        this.pageNo = pageNo;
+    }
+
+    public Integer getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(Integer pageSize) {
+        this.pageSize = pageSize;
+    }
+}

+ 11 - 0
src/main/java/com/goafanti/standard/controller/StandardPlatformLinkController.java

@@ -2,6 +2,7 @@ package com.goafanti.standard.controller;
 
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.model.StandardPlatformLink;
+import com.goafanti.standard.bo.InputStandardPlatformLink;
 import com.goafanti.standard.service.StandardPlatformLinkService;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -27,6 +28,16 @@ public class StandardPlatformLinkController {
 
 
     /**
+     * 列表查询
+     * @param in 参数
+     * @return
+     */
+    @GetMapping("/list")
+    public Result<StandardPlatformLink> list(InputStandardPlatformLink in ) {
+        return new Result<>().data(this.standardPlatformLinkService.list(in));
+    }
+
+    /**
      * 通过主键查询单条数据
      *
      * @param id 主键

+ 2 - 0
src/main/java/com/goafanti/standard/service/StandardPlatformLinkService.java

@@ -1,6 +1,7 @@
 package com.goafanti.standard.service;
 
 import com.goafanti.common.model.StandardPlatformLink;
+import com.goafanti.standard.bo.InputStandardPlatformLink;
 
 /**
  * 标准平台连接(StandardPlatformLink)表服务接口
@@ -43,4 +44,5 @@ public interface StandardPlatformLinkService {
      */
     boolean deleteById(Integer id);
 
+    Object list(InputStandardPlatformLink in);
 }

+ 13 - 4
src/main/java/com/goafanti/standard/service/impl/StandardPlatformLinkServiceImpl.java

@@ -5,10 +5,12 @@ import com.goafanti.common.model.StandardPlatformLink;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.standard.bo.InputStandardPlatformLink;
 import com.goafanti.standard.service.StandardPlatformLinkService;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -24,11 +26,14 @@ public class StandardPlatformLinkServiceImpl extends BaseMybatisDao<StandardPlat
     private StandardPlatformLinkMapper standardPlatformLinkMapper;
 
 
-    public Pagination<StandardPlatformLink> list(StandardPlatformLink standardPlatformLink, Integer pageNo, Integer pageSize) {
+    public Pagination<StandardPlatformLink> list(InputStandardPlatformLink in) {
         Map<String, Object> params = new HashMap<>();
-        params.put("in", standardPlatformLink);
-        return (Pagination<StandardPlatformLink>) findPage("findStandardPlatformLinkList",
-                "findStandardPlatformLinkCount", params, pageNo, pageSize);
+        if (in.getName() != null)params.put("name", in.getName());
+        if (in.getStatus() != null)params.put("status", in.getStatus());
+        if (in.getStartTime()!= null)params.put("startTime", in.getStartTime());
+        if (in.getEndTime()!= null)params.put("endTime", in.getEndTime()+" 23:59:59");
+        return (Pagination<StandardPlatformLink>) findPage("queryAllByLimit",
+                "queryAllByCount", params, in.getPageNo(), in.getPageSize());
     }
 
     /**
@@ -52,6 +57,9 @@ public class StandardPlatformLinkServiceImpl extends BaseMybatisDao<StandardPlat
     @Override
     public StandardPlatformLink insert(StandardPlatformLink in) {
         in.setAid(TokenManager.getAdminId());
+        Date now = new Date();
+        in.setCreateTime(now);
+        in.setUpdateTime(now);
         this.standardPlatformLinkMapper.insert(in);
         return in;
     }
@@ -64,6 +72,7 @@ public class StandardPlatformLinkServiceImpl extends BaseMybatisDao<StandardPlat
      */
     @Override
     public StandardPlatformLink update(StandardPlatformLink standardPlatformLink) {
+        standardPlatformLink.setUpdateTime(new Date());
         this.standardPlatformLinkMapper.update(standardPlatformLink);
         return this.queryById(standardPlatformLink.getId());
     }