| | |
| | | shipin.setShebeiid(obj[2] == null ? "" : obj[2].toString()); |
| | | shipin.setTongdaoid(obj[3] == null ? "" : obj[3].toString()); |
| | | shipin.setAddtime(obj[4] == null ? "" : obj[4].toString()); |
| | | shipin.setPosx(obj[5] == null ? "" : obj[5].toString()); |
| | | shipin.setPosy(obj[6] == null ? "" : obj[6].toString()); |
| | | shipin.setPosz(obj[7] == null ? "" : obj[7].toString()); |
| | | shipin.setFloor(obj[8] == null ? "" : obj[8].toString()); |
| | | shipin.setName(obj[9] == null ? "" : obj[9].toString()); |
| | | tb_shipinList.add(shipin); |
| | | } |
| | | } |
| | |
| | | public int shipinManagement_add(tb_shipin shipin) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "INSERT INTO tb_shipin(fencename,shebeiid,tongdaoid,addtime) VALUES(:fencename,:shebeiid,:tongdaoid,now())"; |
| | | sql = "INSERT INTO tb_shipin(fencename,shebeiid,tongdaoid,addtime,posx,posy,posz,floor,name) VALUES(:fencename,:shebeiid,:tongdaoid,now(),:posx,:posy,:posz,:floor,:name)"; |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("fencename", shipin.getFencename()); |
| | | query.setParameter("shebeiid", shipin.getShebeiid()); |
| | | query.setParameter("tongdaoid", shipin.getTongdaoid()); |
| | | query.setParameter("posx", shipin.getPosx()); |
| | | query.setParameter("posy", shipin.getPosy()); |
| | | query.setParameter("posz", shipin.getPosz()); |
| | | query.setParameter("floor", shipin.getFloor()); |
| | | query.setParameter("name", shipin.getName()); |
| | | int executeUpdate = query.executeUpdate(); |
| | | // String sql2 = null; |
| | | // Query query2 = null; |
| | | // sql2 = "SELECT id FROM tb_shipin WHERE shebeiid=:shebeiid"; |
| | | // query2 = this.em.createNativeQuery(sql2); |
| | | // query2.setParameter("shebeiid",shipin.getShebeiid()); |
| | | // List resultList2 = query2.getResultList(); |
| | | // String id = null; |
| | | // if (resultList2.size() > 0) { |
| | | // Object[] obj = (Object[])resultList2.get(0); |
| | | // id = obj[0].toString(); |
| | | // } |
| | | // String xieyi = "BSTOCS1,ADDVIDEO,"+id+","+shipin.getFencename()+","+shipin.getShebeiid()+","+shipin.getTongdaoid()+","+shipin.getPosx()+","+shipin.getPosy()+","+shipin.getPosz()+","+shipin.getFloor()+","+shipin.getName()+",END"; |
| | | // Udp_ |
| | | return executeUpdate; |
| | | } |
| | | |
| | |
| | | public void shipinManagement_modify(tb_shipin shipin) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "UPDATE tb_shipin SET fencename=:fencename,shebeiid=:shebeiid,tongdaoid=:tongdaoid WHERE id=:id"; |
| | | sql = "UPDATE tb_shipin SET fencename=:fencename,shebeiid=:shebeiid,tongdaoid=:tongdaoid,posx=:posx,posy=:posy,posz=:posz,floor=:floor,name=:name WHERE id=:id"; |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("id", shipin.getId()); |
| | | query.setParameter("fencename", shipin.getFencename()); |
| | | query.setParameter("shebeiid", shipin.getShebeiid()); |
| | | query.setParameter("tongdaoid", shipin.getTongdaoid()); |
| | | System.out.print(sql); |
| | | query.setParameter("posx", shipin.getPosx()); |
| | | query.setParameter("posy", shipin.getPosy()); |
| | | query.setParameter("posz", shipin.getPosz()); |
| | | query.setParameter("floor", shipin.getFloor()); |
| | | query.setParameter("name", shipin.getName()); |
| | | query.executeUpdate(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Transactional |
| | | public List idfindshebeiid(String id) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT shebeiid FROM tb_shipin WHERE id = :id"; |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("id", id); |
| | | List resultList = query.getResultList(); |
| | | return resultList; |
| | | } |
| | | |
| | | @Transactional |
| | | public void shipinManagement_deleteAll() { |
| | | String sql = null; |
| | | Query query = null; |
| | |
| | | public List<tb_shipin> searchshipinManagement(String input) { |
| | | String sql = null; |
| | | Query query = null; |
| | | System.out.print(input); |
| | | sql = "SELECT * FROM tb_shipin WHERE fencename = :fencename"; |
| | | sql = "SELECT * FROM tb_shipin WHERE name = :name"; |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("fencename", input); |
| | | query.setParameter("name", input); |
| | | List resultList = query.getResultList(); |
| | | List<tb_shipin> tb_shipinList = new ArrayList<tb_shipin>(); |
| | | if (resultList.size() > 0) { |
| | |
| | | shipin.setShebeiid(obj[2] == null ? "" : obj[2].toString()); |
| | | shipin.setTongdaoid(obj[3] == null ? "" : obj[3].toString()); |
| | | shipin.setAddtime(obj[4] == null ? "" : obj[4].toString()); |
| | | shipin.setPosx(obj[5] == null ? "" : obj[5].toString()); |
| | | shipin.setPosy(obj[6] == null ? "" : obj[6].toString()); |
| | | shipin.setPosz(obj[7] == null ? "" : obj[7].toString()); |
| | | shipin.setFloor(obj[8] == null ? "" : obj[8].toString()); |
| | | shipin.setName(obj[9] == null ? "" : obj[9].toString()); |
| | | tb_shipinList.add(shipin); |
| | | } |
| | | } |