3.7
fxl
2023-03-07 52cffc4ab8e9787a6f233295502c7c9788dddae1
src/main/java/com/hxzkoa/services/MapService.java
@@ -27,7 +27,7 @@
   public List<tb_map> getMapManagement() {
      String sql = null;
      Query query = null;
      sql = "SELECT id,floor,mapname,x_Truelength,y_Truewidth,x0_length,y0_width,x_Pixel,y_Pixel,addTime FROM tb_map";
      sql = "SELECT id,floor,mapname,x_Truelength,y_Truewidth,x0_length,y0_width,x_Pixel,y_Pixel,addTime FROM tb_map order by addtime desc";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_map> tb_mapList = new ArrayList<tb_map>();
@@ -57,7 +57,7 @@
      int end = perPage;
      String sql = null;
      Query query = null;
      sql = "SELECT id,floor,mapname,x_Truelength,y_Truewidth,x0_length,y0_width,x_Pixel,y_Pixel,addTime FROM tb_map LIMIT :start,:end";
      sql = "SELECT id,floor,mapname,x_Truelength,y_Truewidth,x0_length,y0_width,x_Pixel,y_Pixel,addTime,baoliu3,baoliu4 FROM tb_map LIMIT :start,:end";
      query = this.em.createNativeQuery(sql);
      query.setParameter("start", start);
      query.setParameter("end", end);
@@ -77,6 +77,37 @@
            map.setX_Pixel(obj[7] == null ? "" : obj[7].toString());
            map.setY_Pixel(obj[8] == null ? "" : obj[8].toString());
            map.setAddTime(obj[9] == null ? "" : obj[9].toString());
            map.setBaoliu3(obj[10] == null ? "" : obj[10].toString());
            map.setBaoliu4(obj[11] == null ? "" : obj[11].toString());
            tb_mapList.add(map);
         }
      }
      return tb_mapList;
   }
   public List<tb_map> getMapManagementa() {
      String sql = null;
      Query query = null;
      sql = "SELECT id,floor,mapname,x_Truelength,y_Truewidth,x0_length,y0_width,x_Pixel,y_Pixel,addTime,baoliu3,baoliu4 FROM tb_map";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_map> tb_mapList = new ArrayList<tb_map>();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
            tb_map map = new tb_map();
            Object[] obj = (Object[]) resultList.get(i);
            map.setId((int) obj[0]);
            map.setFloor(obj[1] == null ? "" : obj[1].toString());
            map.setMapname(obj[2] == null ? "" : obj[2].toString());
            map.setX_Truelength(obj[3] == null ? "" : obj[3].toString());
            map.setY_Truewidth(obj[4] == null ? "" : obj[4].toString());
            map.setX0_length(obj[5] == null ? "" : obj[5].toString());
            map.setY0_width(obj[6] == null ? "" : obj[6].toString());
            map.setX_Pixel(obj[7] == null ? "" : obj[7].toString());
            map.setY_Pixel(obj[8] == null ? "" : obj[8].toString());
            map.setAddTime(obj[9] == null ? "" : obj[9].toString());
            map.setBaoliu3(obj[10] == null ? "" : obj[10].toString());
            map.setBaoliu4(obj[11] == null ? "" : obj[11].toString());
            tb_mapList.add(map);
         }
      }
@@ -95,7 +126,7 @@
      String mapname = input;
      String sql = null;
      Query query = null;
      sql = "SELECT id,floor,mapname,x_Truelength,y_Truewidth,x0_length,y0_width,x_Pixel,y_Pixel,addTime FROM tb_map WHERE mapname = :mapname";
      sql = "SELECT id,floor,mapname,x_Truelength,y_Truewidth,x0_length,y0_width,x_Pixel,y_Pixel,addTime,baoliu3,baoliu4 FROM tb_map WHERE mapname = :mapname";
      query = this.em.createNativeQuery(sql);
      query.setParameter("mapname", mapname);
      List resultList = query.getResultList();
@@ -114,6 +145,8 @@
            map.setX_Pixel(obj[7] == null ? "" : obj[7].toString());
            map.setY_Pixel(obj[8] == null ? "" : obj[8].toString());
            map.setAddTime(obj[9] == null ? "" : obj[9].toString());
            map.setBaoliu3(obj[10] == null ? "" : obj[10].toString());
            map.setBaoliu4(obj[11] == null ? "" : obj[11].toString());
            tb_mapList.add(map);
         }
      }
@@ -148,7 +181,7 @@
   public int mapManagement_add(tb_map map) {
      String sql = null;
      Query query = null;
      sql = "INSERT INTO tb_map(floor,mapname,x_Truelength,y_Truewidth,x0_length,y0_width,x_Pixel,y_Pixel,addTime) VALUES(:floor,:mapname,:x_Truelength,:y_Truewidth,:x0_length,:y0_width,:x_Pixel,:y_Pixel,now())";
      sql = "INSERT INTO tb_map(floor,mapname,x_Truelength,y_Truewidth,x0_length,y0_width,x_Pixel,y_Pixel,addTime,baoliu3,baoliu4) VALUES(:floor,:mapname,:x_Truelength,:y_Truewidth,:x0_length,:y0_width,:x_Pixel,:y_Pixel,now(),:baoliu3,:baoliu4)";
      cs.tb_caozuo("tb_map", 1);
      query = this.em.createNativeQuery(sql);
      query.setParameter("floor", map.getFloor());
@@ -159,6 +192,8 @@
      query.setParameter("y0_width", map.getY0_width());
      query.setParameter("x_Pixel", map.getX_Pixel());
      query.setParameter("y_Pixel", map.getY_Pixel());
      query.setParameter("baoliu3", map.getBaoliu3());
      query.setParameter("baoliu4", map.getBaoliu4());
      int executeUpdate = query.executeUpdate();
      return executeUpdate;
   }
@@ -167,7 +202,7 @@
   public int mapManagement_modify(tb_map map) {
      String sql = null;
      Query query = null;
      sql = "UPDATE tb_map SET floor = :floor,mapname = :mapname,x_Truelength = :x_Truelength,y_Truewidth = :y_Truewidth,x0_length = :x0_length,y0_width = :y0_width,x_Pixel = :x_Pixel,y_Pixel = :y_Pixel,addTime = now() WHERE id= :id";
      sql = "UPDATE tb_map SET floor = :floor,mapname = :mapname,x_Truelength = :x_Truelength,y_Truewidth = :y_Truewidth,x0_length = :x0_length,y0_width = :y0_width,x_Pixel = :x_Pixel,y_Pixel = :y_Pixel,addTime = now(),baoliu3 = :baoliu3,baoliu4 = :baoliu4 WHERE id= :id";
      cs.tb_caozuo("tb_map", 3);
      query = this.em.createNativeQuery(sql);
      query.setParameter("id", map.getId());
@@ -179,6 +214,8 @@
      query.setParameter("y0_width", map.getY0_width());
      query.setParameter("x_Pixel", map.getX_Pixel());
      query.setParameter("y_Pixel", map.getY_Pixel());
      query.setParameter("baoliu3", map.getBaoliu3());
      query.setParameter("baoliu4", map.getBaoliu4());
      int executeUpdate = query.executeUpdate();
      return executeUpdate;
   }
@@ -187,7 +224,7 @@
   public int mapManagement_modify2(tb_map map) {
      String sql = null;
      Query query = null;
      sql = "UPDATE tb_map SET floor = :floor,x_Truelength = :x_Truelength,y_Truewidth = :y_Truewidth,x0_length = :x0_length,y0_width = :y0_width,x_Pixel = :x_Pixel,y_Pixel = :y_Pixel,addTime = now() WHERE id= :id";
      sql = "UPDATE tb_map SET floor = :floor,x_Truelength = :x_Truelength,y_Truewidth = :y_Truewidth,x0_length = :x0_length,y0_width = :y0_width,x_Pixel = :x_Pixel,y_Pixel = :y_Pixel,addTime = now(),baoliu3 = :baoliu3,baoliu4 = :baoliu4 WHERE id= :id";
      cs.tb_caozuo("tb_map", 3);
      query = this.em.createNativeQuery(sql);
      query.setParameter("id", map.getId());
@@ -198,6 +235,8 @@
      query.setParameter("y0_width", map.getY0_width());
      query.setParameter("x_Pixel", map.getX_Pixel());
      query.setParameter("y_Pixel", map.getY_Pixel());
      query.setParameter("baoliu3", map.getBaoliu3());
      query.setParameter("baoliu4", map.getBaoliu4());
      int executeUpdate = query.executeUpdate();
      return executeUpdate;
   }