wangchangsheng 3 年之前
父节点
当前提交
b4d206d3fe

+ 1 - 0
pom.xml

@@ -106,6 +106,7 @@
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <configuration>
                     <includeSystemScope>true</includeSystemScope>
+
                 </configuration>
             </plugin>
         </plugins>

+ 2 - 2
src/main/java/com/gyee/viewticket/MpGenerator.java

@@ -28,7 +28,7 @@ public class MpGenerator {
     //作者
     private static String authorName = "admin";
     //要生成的表名
-    private static String[] tables = {"WINDTURBINE"};
+    private static String[] tables = {"POLINE"};
     //table前缀
     private static String prefix = "";
 
@@ -42,7 +42,7 @@ public class MpGenerator {
     private static String username = "sa";
     private static String password = "Gyee@321#!";
 
-    public static void main(String[] args) {
+    public static void main1(String[] args) {
         AutoGenerator gen = new AutoGenerator();
 
         /**

+ 30 - 0
src/main/java/com/gyee/viewticket/config/MybatisPlusConfig.java

@@ -0,0 +1,30 @@
+package com.gyee.viewticket.config;
+
+import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
+import com.baomidou.mybatisplus.core.injector.ISqlInjector;
+import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+
+@Configuration
+public class MybatisPlusConfig {
+
+    /*
+     * 分页插件,自动识别数据库类型
+     * 多租户,请参考官网【插件扩展】
+     */
+    @Bean
+    public PaginationInterceptor paginationInterceptor() {
+        PaginationInterceptor pi =  new PaginationInterceptor();
+        pi.setLimit(10000L);
+        return pi;
+    }
+
+//    @Bean
+//    public ISqlInjector sqlInjector() {
+//        return new DefaultSqlInjector();
+//    }
+
+
+}

+ 57 - 0
src/main/java/com/gyee/viewticket/controller/viewticket/WindturbineController.java

@@ -0,0 +1,57 @@
+package com.gyee.viewticket.controller.viewticket;
+
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.viewticket.comm.domain.AjaxResult;
+import com.gyee.viewticket.model.ticket.Windturbine;
+import com.gyee.viewticket.service.ticket.WindturbineService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author admin
+ * @since 2021-06-24
+ */
+@RestController
+@RequestMapping("/windturbine")
+public class WindturbineController {
+
+
+
+
+
+    private static final Logger log = LoggerFactory.getLogger(WindturbineController.class);
+
+    @Autowired
+    WindturbineService windturbineService;
+
+
+
+
+    /**
+     * 按场站获取所有风机
+     * @param wtid 风机编号
+     * @return
+     */
+    @CrossOrigin(origins = "*",maxAge = 3600)
+    @GetMapping(value = "list")
+    public AjaxResult getWindturbineid(
+            @RequestParam(value = "wtid",required = false)String wtid) {
+        List<Map> list = windturbineService.getWindturbinePageList(wtid);
+        return AjaxResult.successData(list);
+
+
+    }
+
+}
+

+ 6 - 0
src/main/java/com/gyee/viewticket/mapper/ticket/WindturbineMapper.java

@@ -1,5 +1,7 @@
 package com.gyee.viewticket.mapper.ticket;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gyee.viewticket.model.ticket.Windturbine;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Mapper;
@@ -21,4 +23,8 @@ import java.util.Map;
 public interface WindturbineMapper extends BaseMapper<Windturbine> {
 
     List<Map> getWindturbineList(String deptnum);
+
+
+    List<Map> selectWindturbinePageList(String wtid);
+
 }

+ 1 - 1
src/main/java/com/gyee/viewticket/model/ticket/Ibsidgen.java

@@ -23,7 +23,7 @@ public class Ibsidgen extends Model<Ibsidgen> {
 
     private static final long serialVersionUID=1L;
 
-      @TableId("ID")
+    @TableId("ID")
     private Double id;
 
     @TableField("TABLENAME")

+ 5 - 0
src/main/java/com/gyee/viewticket/model/ticket/Windturbine.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
 import java.util.Date;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -95,15 +96,19 @@ public class Windturbine extends Model<Windturbine> {
     private Double hubheight;
 
     @TableField("RELEASEDATE")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date releasedate;
 
     @TableField("INSTALLDATE")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date installdate;
 
     @TableField("TESTDATE")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date testdate;
 
     @TableField("OPDATE")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date opdate;
 
     @TableField("LOCATION")

+ 10 - 0
src/main/java/com/gyee/viewticket/service/impl/ticket/WindturbineServiceImpl.java

@@ -1,5 +1,7 @@
 package com.gyee.viewticket.service.impl.ticket;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gyee.viewticket.model.ticket.Windturbine;
 import com.gyee.viewticket.mapper.ticket.WindturbineMapper;
 import com.gyee.viewticket.service.ticket.WindturbineService;
@@ -30,4 +32,12 @@ public class WindturbineServiceImpl extends ServiceImpl<WindturbineMapper, Windt
         List<Map> map  = windturbineMapper.getWindturbineList(deptnum);
         return map;
     }
+
+    @Override
+    public List<Map> getWindturbinePageList(String wtid) {
+        List<Map> lists= windturbineMapper.selectWindturbinePageList(wtid);
+        return lists;
+    }
+
+
 }

+ 9 - 1
src/main/java/com/gyee/viewticket/service/ticket/WindturbineService.java

@@ -1,5 +1,7 @@
 package com.gyee.viewticket.service.ticket;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gyee.viewticket.model.ticket.Windturbine;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.springframework.stereotype.Service;
@@ -15,8 +17,14 @@ import java.util.Map;
  * @author admin
  * @since 2021-03-09
  */
-@Service
+
 public interface WindturbineService extends IService<Windturbine> {
 
     List<Map> getWindturbineList(String deptnum);
+
+    List<Map> getWindturbinePageList(String wtid);
+
+
+
+
 }

+ 7 - 2
src/main/resources/application.yml

@@ -9,6 +9,9 @@ mybatis-plus:
       logic-delete-value: 1
 
 spring:
+  jackson:
+    date-format: yyyy-MM-dd HH:mm:ss
+    time-zone: GMT+8
   datasource:
     driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
     type: com.alibaba.druid.pool.DruidDataSource
@@ -33,6 +36,8 @@ logging:
     com.gyee.viewticket.mapper.ticket: trace # 设置为自己的mapper目录
 
 
-#  application:
-#    name: microservice-provider
+
+
+
+
 

+ 44 - 0
src/main/resources/mapper/ticket/WindturbineMapper.xml

@@ -58,4 +58,48 @@
         </where>
 
     </select>
+
+
+    <select id="selectWindturbinePageList" resultType="java.util.HashMap">
+        SELECT
+        w.wtnum,
+        w.ownerwf,
+        w.ownerproject,
+        w.ownerline,
+        w.ordernum,
+        w.wtwfnum,
+        w.wtgridnum,
+        w.vendor,
+        w.model,
+        w.ratedpower,
+        w.ratedwinspe,
+        w.ratedvoltage,
+        w.ratedrev,
+        w.cutinwinspe,
+        w.cutoutwinspe,
+        w.maxwinspe,
+        w.lowertemp,
+        w.hightemp,
+        w.lowerrev,
+        w.highrev,
+        w.roterdiameter,
+        w.hubheight,
+        w.releasedate,
+        w.installdate,
+        w.testdate,
+        w.opdate,
+        w.location,
+        w.wflocation,
+        w.wtid
+        FROM
+        WINDTURBINE w
+        LEFT JOIN LOCATIONS l ON w.LOCATION = l.LOCATION
+        <where>
+            <if test=" '' != wtid and null != wtid ">
+                and  w.WTID = #{wtid}
+            </if>
+        </where>
+    </select>
+
+
 </mapper>