ソースを参照

平台管理-列表查询

jichaobo 3 年 前
コミット
55ddea321a

+ 33 - 6
fiveep-controller/src/main/java/com/bizmatics/controller/web/SysPlatformController.java

@@ -1,21 +1,48 @@
 package com.bizmatics.controller.web;
 
 
+import com.bizmatics.common.core.bean.ApiResult;
+import com.bizmatics.common.core.bean.CommonPage;
+import com.bizmatics.model.vo.SysPlatformVo;
+import com.bizmatics.service.SysPlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 /**
- * <p>
- * 平台信息表 前端控制器
- * </p>
+ * 平台挂管理
  *
  * @author ya
  * @since 2022-05-18
  */
-@Controller
+@RestController
 @RequestMapping("/sysPlatform")
 public class SysPlatformController {
+    @Autowired
+    private SysPlatformService sysPlatformService;
+
+    /**
+     * 平台挂管理-列表查询
+     *
+     * @param platformName 平台名称
+     * @param startTime    开始时间
+     * @param endTime      结束时间
+     * @param page         当前页
+     * @param size         每页条数
+     * @param id           平台ID
+     * @return
+     */
+    @GetMapping("/getPlatformList")
+    public ApiResult<CommonPage<SysPlatformVo>> getPlatformList(@RequestParam(value = "platformName", required = false) String platformName,
+                                                                @RequestParam(value = "startTime", required = false) String startTime,
+                                                                @RequestParam(value = "endTime", required = false) String endTime,
+                                                                @RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
+                                                                @RequestParam(value = "size", required = false, defaultValue = "0") Integer size,
+                                                                @RequestParam(value = "id", required = false, defaultValue = "0") Integer id) {
+        return ApiResult.success(sysPlatformService.getPlatformList(platformName, startTime, endTime, page, size, id));
+    }
 
 }
 

+ 1 - 1
fiveep-controller/src/main/java/com/bizmatics/controller/web/SysTenantConfigController.java

@@ -108,7 +108,7 @@ public class SysTenantConfigController {
      * @return
      */
     @PostMapping("pictureUpload")
-    public ApiResult<String> c(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request
+    public ApiResult<String> pictureUpload(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request
     ) {
         return ApiResult.success(patrolInspectionDeviceService.pictureUpload(file, request));
     }

+ 82 - 0
fiveep-model/src/main/java/com/bizmatics/model/vo/SysPlatformVo.java

@@ -0,0 +1,82 @@
+package com.bizmatics.model.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 平台信息表
+ * </p>
+ *
+ * @author ya
+ * @since 2022-05-18
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class SysPlatformVo implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 平台名称
+     */
+    private String platformName;
+
+    /**
+     * 平台状态(0 停用 1 启用)
+     */
+    private String status;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 创建者
+     */
+    private String createBy;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 更新者
+     */
+    private String updateBy;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+
+    /**
+     * 激活码
+     */
+    @TableField("tenantKey")
+    private String tenantKey;
+
+    /**
+     * 租户数量
+     */
+    @TableField("tenantCount")
+    private Integer tenantCount;
+
+
+}

+ 11 - 0
fiveep-persistence/src/main/java/com/bizmatics/persistence/mapper/SysPlatformMapper.java

@@ -2,6 +2,11 @@ package com.bizmatics.persistence.mapper;
 
 import com.bizmatics.model.SysPlatform;
 import com.bizmatics.common.mvc.base.CrudMapper;
+import com.bizmatics.model.vo.SysPlatformVo;
+import com.bizmatics.model.vo.SysTenantTwoVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +18,10 @@ import com.bizmatics.common.mvc.base.CrudMapper;
  */
 public interface SysPlatformMapper extends CrudMapper<SysPlatform> {
 
+    List<SysPlatformVo> getPlatformList(@Param("platformName") String platformName,
+                                        @Param("startTime") String startTime,
+                                        @Param("endTime") String endTime,
+                                        @Param("current") Integer current,
+                                        @Param("size") Integer size,
+                                        @Param("id") Integer id);
 }

+ 26 - 0
fiveep-persistence/src/main/resources/mapper/mysql/SysPlatformMapper.xml

@@ -15,4 +15,30 @@
         <result column="tenantKey" property="tenantKey" />
     </resultMap>
 
+    <select id="getPlatformList" resultType="com.bizmatics.model.vo.SysPlatformVo">
+        SELECT
+        a.*, COUNT(b.id) AS tenantCount
+        FROM
+        sys_platform AS a
+        LEFT JOIN sys_tenant AS b ON a.id = b.system_name
+        <where>
+            b. STATUS = 0
+            and a.status=1
+            <if test="platformName != null and platformName != ''">
+                and a.platform_name LIKE CONCAT(CONCAT('%', #{platformName}), '%')
+            </if>
+            <if test="id != null and id != 0 and id != ''">
+                and a.id = #{id}
+            </if>
+            <if test="endTime != null and startTime != null and endTime != '' and startTime != ''">
+                and a.create_time BETWEEN #{startTime} and #{endTime}
+            </if>
+        </where>
+        GROUP BY
+        a.id
+        <if test="current != null and size != null and size != 0">
+            limit #{current},#{size}
+        </if>
+    </select>
+
 </mapper>

+ 5 - 1
fiveep-service/src/main/java/com/bizmatics/service/SysPlatformService.java

@@ -1,7 +1,9 @@
 package com.bizmatics.service;
 
-import com.bizmatics.model.SysPlatform;
+import com.bizmatics.common.core.bean.CommonPage;
 import com.bizmatics.common.mvc.base.CrudService;
+import com.bizmatics.model.SysPlatform;
+import com.bizmatics.model.vo.SysPlatformVo;
 
 import java.util.List;
 
@@ -15,4 +17,6 @@ import java.util.List;
  */
 public interface SysPlatformService extends CrudService<SysPlatform> {
     List<SysPlatform> getPlatformBoxList();
+
+    CommonPage<SysPlatformVo> getPlatformList(String platformName, String startTime, String endTime, Integer page, Integer size, Integer id);
 }

+ 18 - 5
fiveep-service/src/main/java/com/bizmatics/service/impl/SysPlatformServiceImpl.java

@@ -2,14 +2,12 @@ package com.bizmatics.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.bizmatics.common.core.exception.BusinessException;
+import com.bizmatics.common.core.bean.CommonPage;
+import com.bizmatics.common.mvc.base.AbstractCrudService;
 import com.bizmatics.model.SysPlatform;
-import com.bizmatics.model.SysTenantConfig;
-import com.bizmatics.model.system.SysUser;
+import com.bizmatics.model.vo.SysPlatformVo;
 import com.bizmatics.persistence.mapper.SysPlatformMapper;
 import com.bizmatics.service.SysPlatformService;
-import com.bizmatics.common.mvc.base.AbstractCrudService;
-import com.bizmatics.service.util.SecurityUtils;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -32,4 +30,19 @@ public class SysPlatformServiceImpl extends AbstractCrudService<SysPlatformMappe
         List<SysPlatform> list = this.list(queryWrapper);
         return list;
     }
+
+    @Override
+    public CommonPage<SysPlatformVo> getPlatformList(String platformName, String startTime, String endTime, Integer page, Integer size, Integer id) {
+        List<SysPlatformVo> list1 = baseMapper.getPlatformList(platformName, startTime, endTime, null, null, id);
+        int total = 0;
+        if (list1.size() > 0) {
+            total = list1.size();
+        }
+        Integer current = null;
+        if (page != null && size > 0) {
+            current = (page - 1) * size;
+        }
+        List<SysPlatformVo> list = baseMapper.getPlatformList(platformName, startTime, endTime, current, size, id);
+        return new CommonPage<>(list, total, size, page);
+    }
 }