ferrero project records

1, a code sequence from to

form to come from custom, and other such plants RDC

When setting is code, to show the need to show name.

And a name may have multiple code

Set a table loction maintenance, custon data over time to get one of the code and name save to loction table

code to set a unique index.

Then when the show, according to the code to query name to

2, according to shipping inquiries

 

 

The storage lists over time, from delivery to storage is the code, when the show is name.

So when searching the name is converted to code, according to the table query code. There may be more than a name and code,

So according to name queries to multiple code, then in query.

If you start to know all the code, stored in a single storage when you can store code and name so you can directly query the Receipt table

 

List<String> codes = getlocCode(param.getFrom());
            String snListString = codes.stream().collect(Collectors.joining(","));
            log.info("code="+snListString);
            query.addCriteria(Criteria.where("from").in(codes));

 private List<String> getlocCode(String name){
        List<Location> byName = locationRepository.findByName(name);
        List<String> codes = byName.stream().map(Location::getName).collect(Collectors.toList());

        if(ListUtil.isNotEmpty(codes)){
            return codes;
        }else{
            log.info("根据name"+name+"未查询到Loc");
            List<String> names = new ArrayList<>();
            names.add(name);
            return names;
        }
    }

 

Guess you like

Origin www.cnblogs.com/lyon91/p/11457042.html