map collection traversal, into id

BACKGROUND needs to be imported from a computer to the excel spreadsheet pages 
and table id company database needs to correspond to a corresponding method of key-value id by

the Office the Office Office new new = ();
office.setG001 (ShiroUser.getG001 ()); // removed username
office.setDelFlag ( "0"); // set the default value of 0
list <Office> officeList = officeService.selectList (Office); // Office list into a collection

Map <String, Integer> officemap = new HashMap < > (); // hashMap traversal
for (the Office OOO: officeList) {
officemap.put (ooo.getName (), ooo.getId ());
}


IF (officemap.get (i.getOfficename ()) = null!) { 
i.setOfficeid (officemap.get (i.getOfficename ())); // the name in association with id
}

Guess you like

Origin www.cnblogs.com/snail8698428/p/10939687.html