| | |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import zy.cloud.wms.manager.entity.Cstmr; |
| | | import zy.cloud.wms.manager.entity.FlowStatus; |
| | | import zy.cloud.wms.manager.service.FlowStatusService; |
| | | import com.core.annotations.ManagerAuth; |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/flowStatus/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | // @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | EntityWrapper<FlowStatus> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(flowStatusService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | 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])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/flowStatus/update/auth") |
| | | @ManagerAuth |
| | | public R update(FlowStatus flowStatus){ |
| | | if (Cools.isEmpty(flowStatus) || null==flowStatus.getId()){ |
| | | @RequestMapping(value = "/flowStatus/update/auth") |
| | | @ManagerAuth |
| | | public R update(FlowStatus flowStatus) { |
| | | if (Cools.isEmpty(flowStatus) || null == flowStatus.getId()) { |
| | | return R.error(); |
| | | } |
| | | flowStatusService.updateById(flowStatus); |
| | |
| | | |
| | | @RequestMapping(value = "/flowStatus/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | flowStatusService.deleteById(id); |
| | | public R delete(@RequestParam(value = "ids[]") Long[] ids) { |
| | | for (Long id : ids) { |
| | | flowStatusService.delete(new EntityWrapper<FlowStatus>() |
| | | .eq("id",id)); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/flowStatus/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | EntityWrapper<FlowStatus> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("flowStatus")); |
| | |
| | | wrapper.like("id", condition); |
| | | Page<FlowStatus> page = flowStatusService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (FlowStatus flowStatus : page.getRecords()){ |
| | | for (FlowStatus flowStatus : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", flowStatus.getId()); |
| | | map.put("value", flowStatus.getId()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<FlowStatus> wrapper = new EntityWrapper<FlowStatus>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != flowStatusService.selectOne(wrapper)){ |
| | | if (null != flowStatusService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(FlowStatus.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 单击input之后弹出的选择框 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/flowId/auth") |
| | | public R getAllFlowIds(){ |
| | | List<FlowStatus> flowStatuses = flowStatusService.selectList(null); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (FlowStatus flowStatus : flowStatuses) { |
| | | Map<String,Object> content = new HashMap<>(); |
| | | content.put("id",flowStatus.getId()); |
| | | content.put("value",flowStatus.getName()); |
| | | result.add(content); |
| | | } |
| | | return R.ok(result); |
| | | } |
| | | |
| | | } |