| | |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | |
| | | @RequestMapping(value = "/wrkMast/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | return R.ok(wrkMastService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | if (entry.getKey().endsWith(">")) { |
| | | wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue()))); |
| | | } else if (entry.getKey().endsWith("<")) { |
| | | wrapper.le(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue()))); |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); |
| | | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); |
| | | } else { |
| | | wrapper.like(entry.getKey(), String.valueOf(entry.getValue())); |
| | | if (entry.getKey().equals("loc_no") || entry.getKey().equals("source_loc_no")) { |
| | | List<String> locNos = locMastService.selectLocNosByNoOrAlias(val); |
| | | if (locNos.isEmpty()) { |
| | | wrapper.eq(entry.getKey(), "__NO_MATCH__"); |
| | | } else { |
| | | wrapper.in(entry.getKey(), locNos); |
| | | } |
| | | } else if (entry.getKey().equals("area_id")) { |
| | | wrapper.eq(entry.getKey(), val); |
| | | } else { |
| | | wrapper.like(entry.getKey(), val); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<WrkMast> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("wrk_no", condition); |
| | | Page<WrkMast> page = wrkMastService.selectPage(new Page<>(0, 10), wrapper); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.where("CAST(wrk_no AS VARCHAR(20)) LIKE {0}", "%" + condition + "%"); |
| | | } |
| | | Page<WrkMast> page = wrkMastService.selectPage(new Page<>(1, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (WrkMast wrkMast : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |