| | |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.WrkMastLog; |
| | | import com.zy.asrs.service.WrkMastLogService; |
| | | import com.zy.asrs.entity.AgvWrkMastLog; |
| | | import com.zy.asrs.service.AgvWrkMastLogService; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | public class AgvWrkMastLogController extends BaseController { |
| | | |
| | | @Autowired |
| | | private WrkMastLogService wrkMastLogService; |
| | | private AgvWrkMastLogService agvWrkMastLogService; |
| | | |
| | | @RequestMapping(value = "/agvWrkMastLog/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") String id) { |
| | | return R.ok(wrkMastLogService.selectById(String.valueOf(id))); |
| | | return R.ok(agvWrkMastLogService.selectById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/agvWrkMastLog/list/auth") |
| | |
| | | @RequestParam(required = false) String condition, |
| | | @RequestParam Map<String, Object> param) { |
| | | excludeTrash(param); |
| | | EntityWrapper<WrkMastLog> wrapper = new EntityWrapper<>(); |
| | | EntityWrapper<AgvWrkMastLog> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | allLike(WrkMastLog.class, param.keySet(), wrapper, condition); |
| | | allLike(AgvWrkMastLog.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | if (orderByField.endsWith("$")) { |
| | | orderByField = orderByField.substring(0, orderByField.length() - 1); |
| | |
| | | } else { |
| | | wrapper.orderBy("modi_time", false); |
| | | } |
| | | return R.ok(wrkMastLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | return R.ok(agvWrkMastLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | |
| | | |
| | | @RequestMapping(value = "/agvWrkMastLog/add/auth") |
| | | @ManagerAuth(memo = "工作历史档添加") |
| | | public R add(WrkMastLog wrkMastLog) { |
| | | wrkMastLogService.insert(wrkMastLog); |
| | | public R add(AgvWrkMastLog wrkMastLog) { |
| | | agvWrkMastLogService.insert(wrkMastLog); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/agvWrkMastLog/update/auth") |
| | | @ManagerAuth(memo = "工作历史档修改") |
| | | public R update(WrkMastLog wrkMastLog) { |
| | | public R update(AgvWrkMastLog wrkMastLog) { |
| | | if (Cools.isEmpty(wrkMastLog) || null == wrkMastLog.getId()) { |
| | | return R.error(); |
| | | } |
| | | wrkMastLogService.updateById(wrkMastLog); |
| | | agvWrkMastLogService.updateById(wrkMastLog); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/agvWrkMastLog/delete/auth") |
| | | @ManagerAuth(memo = "工作历史档删除") |
| | | public R delete(@RequestParam String param) { |
| | | List<WrkMastLog> list = JSONArray.parseArray(param, WrkMastLog.class); |
| | | List<AgvWrkMastLog> list = JSONArray.parseArray(param, AgvWrkMastLog.class); |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error(); |
| | | } |
| | | for (WrkMastLog entity : list) { |
| | | wrkMastLogService.delete(new EntityWrapper<>(entity)); |
| | | for (AgvWrkMastLog entity : list) { |
| | | agvWrkMastLogService.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<WrkMastLog> wrapper = new EntityWrapper<>(); |
| | | EntityWrapper<AgvWrkMastLog> wrapper = new EntityWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("wrkMastLog")); |
| | | convert(map, wrapper); |
| | | List<WrkMastLog> list = wrkMastLogService.selectList(wrapper); |
| | | List<AgvWrkMastLog> list = agvWrkMastLogService.selectList(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/agvWrkMastLogQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<WrkMastLog> wrapper = new EntityWrapper<>(); |
| | | EntityWrapper<AgvWrkMastLog> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("id", condition); |
| | | Page<WrkMastLog> page = wrkMastLogService.selectPage(new Page<>(0, 10), wrapper); |
| | | Page<AgvWrkMastLog> page = agvWrkMastLogService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (WrkMastLog wrkMastLog : page.getRecords()) { |
| | | for (AgvWrkMastLog wrkMastLog : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", wrkMastLog.getId()); |
| | | map.put("value", wrkMastLog.getId()); |
| | |
| | | @RequestMapping(value = "/agvWrkMastLog/check/column/auth") |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<WrkMastLog> wrapper = new EntityWrapper<WrkMastLog>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != wrkMastLogService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(WrkMastLog.class, String.valueOf(param.get("key")))); |
| | | Wrapper<AgvWrkMastLog> wrapper = new EntityWrapper<AgvWrkMastLog>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != agvWrkMastLogService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(AgvWrkMastLog.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | | } |