| | |
| | | return tb_tagList; |
| | | } |
| | | |
| | | public List<tb_tag> getLabelManagementa() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT id,tag_id,state,power,status,gaodu,sudu,pinglv,sleep_satus,sleep_time,gongfang,dong_status,version,addtime,imu FROM (SELECT id,tag_id,state,power,status,gaodu,sudu,pinglv,sleep_satus,sleep_time,gongfang,dong_status,version,addtime,imu FROM tb_tag ORDER BY id DESC) s"; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | List<tb_tag> tb_tagList = new ArrayList<tb_tag>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | tb_tag tag = new tb_tag(); |
| | | tag.setId((int) obj[0]); |
| | | tag.setStatus(obj[4] == null ? "" : obj[4].toString()); |
| | | tag.setTag_id(obj[1] == null ? "" : obj[1].toString()); |
| | | tag.setState(obj[2] == null ? "" : obj[2].toString()); |
| | | tag.setPower(obj[3] == null ? "" : obj[3].toString()); |
| | | tag.setGaodu(obj[5] == null ? "" : obj[5].toString()); |
| | | tag.setSudu(obj[6] == null ? "" : obj[6].toString()); |
| | | tag.setPinglv(obj[7] == null ? "" : obj[7].toString()); |
| | | tag.setVersion(obj[12] == null ? "" : obj[12].toString()); |
| | | tag.setAddtime(obj[13] == null ? "" : obj[13].toString()); |
| | | tb_tagList.add(tag); |
| | | } |
| | | } |
| | | return tb_tagList; |
| | | } |
| | | |
| | | public List<tb_tag> searchLabelManagement(String input) { |
| | | String sql = null; |
| | | Query query = null; |
| | |
| | | } |
| | | |
| | | @Transactional |
| | | public int labelManagement_modifytag(tb_tag tag) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "UPDATE tb_tag SET state=:state WHERE tag_id=:tag_id"; |
| | | cs.tb_caozuo("tb_tag", 3); |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("tag_id", tag.getTag_id()); |
| | | query.setParameter("state", tag.getState()); |
| | | int aaa = query.executeUpdate(); |
| | | return aaa; |
| | | } |
| | | |
| | | @Transactional |
| | | public void labelManagement_modifyperson(tb_person person) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "UPDATE tb_person SET p_name=:p_name,baoliu1=:baoliu1,p_idcardnum=:p_idcardnum WHERE p_tagid=:p_tagid"; |
| | | cs.tb_caozuo("tb_tag", 3); |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("p_tagid", person.getP_tagid()); |
| | | query.setParameter("p_name", person.getP_name()); |
| | | // query.setParameter("p_sex", person.getP_sex()); |
| | | // query.setParameter("p_minzu", person.getP_minzu()); |
| | | query.setParameter("baoliu1", person.getP_fangkeid()); |
| | | query.setParameter("p_idcardnum", person.getP_idcardnum()); |
| | | // query.setParameter("p_adress", person.getP_adress()); |
| | | query.executeUpdate(); |
| | | } |
| | | |
| | | @Transactional |
| | | public int labelManagement_modifypersonaa(tb_person person) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "INSERT into tb_fangke(userid,name,idcardnum) value(:userid,:name,:idcardnum)"; |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("userid", person.getP_tagid()); |
| | | query.setParameter("name", person.getP_name()); |
| | | query.setParameter("idcardnum", person.getP_idcardnum()); |
| | | int executeUpdate = query.executeUpdate(); |
| | | return executeUpdate; |
| | | } |
| | | |
| | | @Transactional |
| | | public int labelManagement_modifya(tb_tag tag) { |
| | | //默认值逻辑处理 |
| | | if(("").equals(tag.getGaodu())){ |
| | | tag.setGaodu("150"); |
| | | } |
| | | if(("").equals(tag.getSudu())){ |
| | | tag.setSudu("无"); |
| | | } |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "UPDATE tb_tag SET state=:state,gaodu=:gaodu,sudu=:sudu,pinglv=:pinglv WHERE tag_id=:tag_id"; |
| | | cs.tb_caozuo("tb_tag", 3); |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("tag_id", tag.getTag_id()); |
| | | query.setParameter("state", tag.getState()); |
| | | query.setParameter("gaodu", tag.getGaodu()); |
| | | query.setParameter("sudu", tag.getSudu()); |
| | | query.setParameter("pinglv", tag.getPinglv()); |
| | | int aaa = query.executeUpdate(); |
| | | return aaa; |
| | | } |
| | | |
| | | @Transactional |
| | | public void labelManagement_modifyAll(tb_tag tag) { |
| | | //默认值逻辑处理 |
| | | if(("").equals(tag.getGaodu())){ |
| | |
| | | } |
| | | |
| | | @Transactional |
| | | public int labelManagement_modifyAlla(tb_tag tag) { |
| | | //默认值逻辑处理 |
| | | if(("").equals(tag.getGaodu())){ |
| | | tag.setGaodu("150"); |
| | | } |
| | | if(("").equals(tag.getSudu())){ |
| | | tag.setSudu("无"); |
| | | } |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "UPDATE tb_tag SET gaodu=:gaodu,sudu=:sudu,pinglv=:pinglv"; |
| | | cs.tb_caozuo("tb_tag", 3); |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("gaodu", tag.getGaodu()); |
| | | query.setParameter("sudu", tag.getSudu()); |
| | | query.setParameter("pinglv", tag.getPinglv()); |
| | | int aaa = query.executeUpdate(); |
| | | return aaa; |
| | | } |
| | | |
| | | @Transactional |
| | | public void labelManagement_delete(String[] checkVal) { |
| | | String sql = null; |
| | | Query query = null; |
| | |
| | | } |
| | | |
| | | @Transactional |
| | | public int labelManagement_deletea(String[] checkVal) { |
| | | String sql = null; |
| | | Query query = null; |
| | | int aaa = checkVal.length; |
| | | for (int i = 0; i < checkVal.length; i++) { |
| | | sql = "DELETE FROM tb_tag WHERE tag_id = :tag_id"; |
| | | cs.tb_caozuo("tb_tag", 2); |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("tag_id", checkVal[i]); |
| | | query.executeUpdate(); |
| | | } |
| | | return aaa; |
| | | } |
| | | |
| | | @Transactional |
| | | public void labelManagement_deleteAll() { |
| | | String sql = null; |
| | | Query query = null; |
| | |
| | | } |
| | | |
| | | @Transactional |
| | | public int labelManagement_deleteAlla() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "DELETE FROM tb_tag"; |
| | | cs.tb_caozuo("tb_tag", 2); |
| | | query = this.em.createNativeQuery(sql); |
| | | int aaa = query.executeUpdate(); |
| | | return aaa; |
| | | } |
| | | |
| | | @Transactional |
| | | public void labelManagement_state(String p_name, String tag_id) { |
| | | String sql = null; |
| | | Query query = null; |
| | |
| | | return tb_history_powerList; |
| | | } |
| | | |
| | | public List<tb_history_power> searchnameHistoricalPower(String begin,String end,String tagida) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT id,tagid,power,time FROM tb_history_power WHERE tagid = :tagida AND time>= :begin AND time<= :end ORDER BY power"; |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("begin", begin); |
| | | query.setParameter("end", end); |
| | | query.setParameter("tagida", tagida); |
| | | List resultList = query.getResultList(); |
| | | List<tb_history_power> tb_history_powerList = new ArrayList<tb_history_power>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | tb_history_power history_power = new tb_history_power(); |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | history_power.setId((int) obj[0]); |
| | | history_power.setTagid(obj[1] == null ? "" : obj[1].toString()); |
| | | history_power.setPower(obj[2] == null ? "" : obj[2].toString()); |
| | | history_power.setTime(obj[3] == null ? "" : obj[3].toString()); |
| | | tb_history_powerList.add(history_power); |
| | | } |
| | | } |
| | | return tb_history_powerList; |
| | | } |
| | | |
| | | public List<tb_history_power> searchPowerAnalysis(String input) { |
| | | String sql = null; |
| | | Query query = null; |
| | |
| | | } |
| | | } |
| | | |
| | | public List<tb_tag> searchidLabelManagement(String id) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT id,tag_id,state,power,'status',gaodu,sudu,pinglv,sleep_satus,sleep_time,gongfang,dong_status,version,addtime,imu FROM tb_tag WHERE id = :id"; |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("id", id); |
| | | List resultList = query.getResultList(); |
| | | List<tb_tag> tb_tagList = new ArrayList<tb_tag>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | tb_tag tag = new tb_tag(); |
| | | tag.setId((int) obj[0]); |
| | | tag.setStatus(obj[4] == null ? "" : obj[4].toString()); |
| | | tag.setTag_id(obj[1] == null ? "" : obj[1].toString()); |
| | | tag.setState(obj[2] == null ? "" : obj[2].toString()); |
| | | tag.setPower(obj[3] == null ? "" : obj[3].toString()); |
| | | tag.setGaodu(obj[5] == null ? "" : obj[5].toString()); |
| | | tag.setSudu(obj[6] == null ? "" : obj[6].toString()); |
| | | tag.setPinglv(obj[7] == null ? "" : obj[7].toString()); |
| | | tag.setVersion(obj[12] == null ? "" : obj[12].toString()); |
| | | tag.setAddtime(obj[13] == null ? "" : obj[13].toString()); |
| | | tb_tagList.add(tag); |
| | | } |
| | | } |
| | | return tb_tagList; |
| | | } |
| | | |
| | | } |