| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.common.wms.entity.Mat; |
| | | import com.zy.asrs.common.wms.service.ManMatService; |
| | | import com.zy.asrs.common.wms.service.MatService; |
| | | import com.zy.asrs.framework.annotations.ManagerAuth; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | |
| | | public class ManMatController extends BaseController { |
| | | |
| | | @Autowired |
| | | private ManMatService manMatService; |
| | | private MatService matService; |
| | | |
| | | @RequestMapping(value = "/manMat/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok(manMatService.getById(id)); |
| | | return R.ok(matService.getById(id)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/manMat/page/auth") |
| | |
| | | wrapper.ge(Mat::getCreateTime, DateUtils.convert(range[0])); |
| | | wrapper.le(Mat::getCreateTime, DateUtils.convert(range[1])); |
| | | } |
| | | return R.ok(manMatService.page(new Page<>(curr, limit), wrapper)); |
| | | return R.ok(matService.page(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/manMat/add/auth") |
| | | @ManagerAuth |
| | | public R add(Mat mat) { |
| | | manMatService.save(mat); |
| | | matService.save(mat); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | if (Cools.isEmpty(mat) || null== mat.getId()){ |
| | | return R.error(); |
| | | } |
| | | manMatService.updateById(mat); |
| | | matService.updateById(mat); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | manMatService.removeById(id); |
| | | matService.removeById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | public R query(String condition) { |
| | | LambdaQueryWrapper<Mat> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.like(Mat::getId, condition); |
| | | Page<Mat> page = manMatService.page(new Page<>(0, 10), wrapper); |
| | | Page<Mat> page = matService.page(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (Mat mat : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(Mat::getId, condition); |
| | | } |
| | | manMatService.page(new Page<>(1, 30), wrapper).getRecords().forEach(item -> vos.add(new KeyValueVo(String.valueOf(item.getId()), item.getId()))); |
| | | matService.page(new Page<>(1, 30), wrapper).getRecords().forEach(item -> vos.add(new KeyValueVo(String.valueOf(item.getId()), item.getId()))); |
| | | return R.ok().add(vos); |
| | | } |
| | | |