| | |
| | | package com.zy.asrs.common.sys.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.common.sys.entity.Host; |
| | |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.sql.Wrapper; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | |
| | | @RequestMapping(value = "/host/add/auth") |
| | | @ManagerAuth |
| | | public R add(Host host) { |
| | | host.setStatus(1); |
| | | host.setCreateTime(new Date()); |
| | | hostService.save(host); |
| | | return R.ok(); |
| | | } |
| | |
| | | if (Cools.isEmpty(host) || null==host.getId()){ |
| | | return R.error(); |
| | | } |
| | | host.setUpdateTime(new Date()); |
| | | hostService.updateById(host); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/host/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(Integer[] ids){ |
| | | if (Cools.isEmpty(ids)){ |
| | | public R delete(@RequestParam(value = "ids[]") Integer[] ids) { |
| | | if (Cools.isEmpty(ids)) { |
| | | return R.error(); |
| | | } |
| | | hostService.removeByIds(Arrays.asList(ids)); |
| | |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @RequestMapping(value = "/host/delete/one/auth") |
| | | @ManagerAuth |
| | | public R deleteOne(@RequestParam String param){ |
| | | if (getUserId() != 9527) { |
| | | if (getUser().getRoleId() != 2) { |
| | | return R.error("权限不足"); |
| | | } |
| | | } |
| | | Host host = JSONArray.parseObject(param, Host.class); |
| | | if (Cools.isEmpty(host)){ |
| | | return R.error(); |
| | | } |
| | | hostService.removeById(host.getId()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |