| | |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.BasWhs; |
| | | import com.zy.asrs.service.BasWhsService; |
| | | import com.zy.asrs.entity.BasWhsType; |
| | | import com.zy.asrs.service.BasWhsTypeService; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | public class BasWhsController extends BaseController { |
| | | |
| | | @Autowired |
| | | private BasWhsService basWhsService; |
| | | private BasWhsTypeService basWhsService; |
| | | |
| | | @RequestMapping(value = "/basWhs/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | |
| | | @RequestMapping(value = "/basWhs/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) { |
| | | 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) { |
| | | excludeTrash(param); |
| | | EntityWrapper<BasWhs> wrapper = new EntityWrapper<>(); |
| | | EntityWrapper<BasWhsType> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | |
| | | |
| | | @RequestMapping(value = "/basWhs/add/auth") |
| | | @ManagerAuth(memo = "库位类型添加") |
| | | public R add(BasWhs basWhs) { |
| | | public R add(BasWhsType basWhs) { |
| | | basWhs.setModiUser(getUserId()); |
| | | basWhs.setModiTime(new Date()); |
| | | basWhs.setAppeUser(getUserId()); |
| | |
| | | |
| | | @RequestMapping(value = "/basWhs/update/auth") |
| | | @ManagerAuth(memo = "库位类型修改") |
| | | public R update(BasWhs basWhs) { |
| | | public R update(BasWhsType basWhs) { |
| | | if (Cools.isEmpty(basWhs) || null == basWhs.getId()) { |
| | | return R.error(); |
| | | } |
| | |
| | | @RequestMapping(value = "/basWhs/delete/auth") |
| | | @ManagerAuth(memo = "库位类型删除") |
| | | public R delete(@RequestParam String param) { |
| | | List<BasWhs> list = JSONArray.parseArray(param, BasWhs.class); |
| | | List<BasWhsType> list = JSONArray.parseArray(param, BasWhsType.class); |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error(); |
| | | } |
| | | for (BasWhs entity : list) { |
| | | for (BasWhsType entity : list) { |
| | | basWhsService.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<BasWhs> wrapper = new EntityWrapper<>(); |
| | | EntityWrapper<BasWhsType> wrapper = new EntityWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("basWhs")); |
| | | convert(map, wrapper); |
| | | List<BasWhs> list = basWhsService.selectList(wrapper); |
| | | List<BasWhsType> list = basWhsService.selectList(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basWhsQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<BasWhs> wrapper = new EntityWrapper<>(); |
| | | EntityWrapper<BasWhsType> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("whs_desc", condition); |
| | | Page<BasWhs> page = basWhsService.selectPage(new Page<>(0, 10), wrapper); |
| | | Page<BasWhsType> page = basWhsService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (BasWhs basWhs : page.getRecords()) { |
| | | for (BasWhsType BasWhsType : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", basWhs.getIdentifying()); |
| | | map.put("value", basWhs.getWhsDesc()); |
| | | map.put("id", BasWhsType.getIdentifying()); |
| | | map.put("value", BasWhsType.getWhsDesc()); |
| | | result.add(map); |
| | | } |
| | | return R.ok(result); |
| | |
| | | @RequestMapping(value = "/basWhs/check/column/auth") |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<BasWhs> wrapper = new EntityWrapper<BasWhs>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | Wrapper<BasWhsType> wrapper = new EntityWrapper<BasWhsType>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != basWhsService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(BasWhs.class, String.valueOf(param.get("key")))); |
| | | return R.parse(BaseRes.REPEAT).add(getComment(BasWhsType.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | | } |