| | |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.WrkDetl; |
| | | import com.zy.asrs.service.WrkDetlService; |
| | | import com.zy.asrs.entity.AgvWrkDetl; |
| | | import com.zy.asrs.service.AgvWrkDetlService; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | public class AgvWrkDetlController extends BaseController { |
| | | |
| | | @Autowired |
| | | private WrkDetlService wrkDetlService; |
| | | private AgvWrkDetlService agvWrkDetlService; |
| | | |
| | | @RequestMapping(value = "/agvWrkDetl/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") String id) { |
| | | return R.ok(wrkDetlService.selectById(String.valueOf(id))); |
| | | return R.ok(agvWrkDetlService.selectById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/agvWrkDetl/list/auth") |
| | |
| | | @RequestParam(required = false) String condition, |
| | | @RequestParam Map<String, Object> param) { |
| | | excludeTrash(param); |
| | | EntityWrapper<WrkDetl> wrapper = new EntityWrapper<>(); |
| | | EntityWrapper<AgvWrkDetl> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | allLike(WrkDetl.class, param.keySet(), wrapper, condition); |
| | | allLike(AgvWrkDetl.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } else { |
| | | wrapper.orderBy("appe_time", false); |
| | | } |
| | | return R.ok(wrkDetlService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | return R.ok(agvWrkDetlService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | |
| | | |
| | | @RequestMapping(value = "/agvWrkDetl/add/auth") |
| | | @ManagerAuth(memo = "工作档明细添加") |
| | | public R add(WrkDetl wrkDetl) { |
| | | wrkDetlService.insert(wrkDetl); |
| | | public R add(AgvWrkDetl wrkDetl) { |
| | | agvWrkDetlService.insert(wrkDetl); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/agvWrkDetl/delete/auth") |
| | | @ManagerAuth(memo = "工作档明细删除") |
| | | public R delete(@RequestParam String param) { |
| | | List<WrkDetl> list = JSONArray.parseArray(param, WrkDetl.class); |
| | | List<AgvWrkDetl> list = JSONArray.parseArray(param, AgvWrkDetl.class); |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error(); |
| | | } |
| | | for (WrkDetl entity : list) { |
| | | wrkDetlService.delete(new EntityWrapper<>(entity)); |
| | | for (AgvWrkDetl entity : list) { |
| | | agvWrkDetlService.delete(new EntityWrapper<>(entity)); |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | @ManagerAuth(memo = "工作档明细导出") |
| | | public R export(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<WrkDetl> wrapper = new EntityWrapper<>(); |
| | | EntityWrapper<AgvWrkDetl> wrapper = new EntityWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("wrkDetl")); |
| | | convert(map, wrapper); |
| | | List<WrkDetl> list = wrkDetlService.selectList(wrapper); |
| | | List<AgvWrkDetl> list = agvWrkDetlService.selectList(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/agvWrkDetlQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<WrkDetl> wrapper = new EntityWrapper<>(); |
| | | EntityWrapper<AgvWrkDetl> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("id", condition); |
| | | Page<WrkDetl> page = wrkDetlService.selectPage(new Page<>(0, 10), wrapper); |
| | | Page<AgvWrkDetl> page = agvWrkDetlService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (WrkDetl wrkDetl : page.getRecords()) { |
| | | for (AgvWrkDetl wrkDetl : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", wrkDetl.getWrkNo()); |
| | | map.put("value", wrkDetl.getWrkNo()); |
| | |
| | | @RequestMapping(value = "/agvWrkDetl/check/column/auth") |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<WrkDetl> wrapper = new EntityWrapper<WrkDetl>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != wrkDetlService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(WrkDetl.class, String.valueOf(param.get("key")))); |
| | | Wrapper<AgvWrkDetl> wrapper = new EntityWrapper<AgvWrkDetl>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != agvWrkDetlService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(AgvWrkDetl.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | | } |