| | |
| | | return R.ok(basCrnpService.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.eq(entry.getKey(), String.valueOf(entry.getValue())); |
| | | wrapper.like(entry.getKey(), val); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/basCrnp/add/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "response.crane_add") |
| | | public R add(BasCrnp basCrnp) { |
| | | basCrnp.setModiUser(getUserId()); |
| | | basCrnp.setModiTime(new Date()); |
| | | basCrnp.setAppeUser(getUserId()); |
| | | basCrnp.setAppeTime(new Date()); |
| | | basCrnpService.insert(basCrnp); |
| | | return R.ok(); |
| | | return R.ok("response.save_success"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basCrnp/update/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "response.crane_update") |
| | | public R update(BasCrnp basCrnp){ |
| | | if (Cools.isEmpty(basCrnp) || null==basCrnp.getCrnNo()){ |
| | | return R.error(); |
| | | return R.error("response.param_error"); |
| | | } |
| | | basCrnp.setModiUser(getUserId()); |
| | | basCrnp.setModiTime(new Date()); |
| | | basCrnpService.updateById(basCrnp); |
| | | return R.ok(); |
| | | return R.ok("response.update_success"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basCrnp/delete/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "response.crane_delete") |
| | | public R delete(@RequestParam String param){ |
| | | List<BasCrnp> list = JSONArray.parseArray(param, BasCrnp.class); |
| | | if (Cools.isEmpty(list)){ |
| | | return R.error(); |
| | | return R.error("response.param_error"); |
| | | } |
| | | for (BasCrnp entity : list){ |
| | | basCrnpService.delete(new EntityWrapper<>(entity)); |
| | | } |
| | | return R.ok(); |
| | | return R.ok("response.delete_success"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basCrnp/export/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "response.crane_export") |
| | | public R export(@RequestBody JSONObject param){ |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<BasCrnp> wrapper = new EntityWrapper<>(); |
| | |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<BasCrnp> wrapper = new EntityWrapper<BasCrnp>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != basCrnpService.selectOne(wrapper)){ |
| | | return R.parse(BaseRes.REPEAT).add(getComment(BasCrnp.class, String.valueOf(param.get("key")))); |
| | | R r = R.parse(BaseRes.REPEAT); |
| | | r.put("data", getComment(BasCrnp.class, String.valueOf(param.get("key")))); |
| | | return r; |
| | | } |
| | | return R.ok(); |
| | | } |