master
parent
31fde98d7a
commit
0d560afee0
@ -0,0 +1,38 @@ |
|||||||
|
package com.psdc.service; |
||||||
|
|
||||||
|
import com.psdc.entity.PsdcDevice; |
||||||
|
import org.springframework.data.domain.PageRequest; |
||||||
|
|
||||||
|
public interface IPsdcDeviceService { |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过ID查询单条数据 |
||||||
|
* |
||||||
|
* @param deviceId 主键 |
||||||
|
* @return 实例对象 |
||||||
|
*/ |
||||||
|
PsdcDevice queryById(Integer deviceId); |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增数据 |
||||||
|
* |
||||||
|
* @param psdcDevice 实例对象 |
||||||
|
* @return 实例对象 |
||||||
|
*/ |
||||||
|
PsdcDevice insert(PsdcDevice psdcDevice); |
||||||
|
/** |
||||||
|
* 更新数据 |
||||||
|
* |
||||||
|
* @param psdcDevice 实例对象 |
||||||
|
* @return 实例对象 |
||||||
|
*/ |
||||||
|
PsdcDevice update(PsdcDevice psdcDevice); |
||||||
|
/** |
||||||
|
* 通过主键删除数据 |
||||||
|
* |
||||||
|
* @param deviceId 主键 |
||||||
|
* @return 是否成功 |
||||||
|
*/ |
||||||
|
boolean deleteById(Integer deviceId); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,58 @@ |
|||||||
|
package com.psdc.service.impl; |
||||||
|
|
||||||
|
import com.psdc.entity.PsdcDevice; |
||||||
|
import com.psdc.mapper.PsdcDeviceMapper; |
||||||
|
import com.psdc.service.IPsdcDeviceService; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.data.domain.PageImpl; |
||||||
|
import org.springframework.data.domain.PageRequest; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
@Service |
||||||
|
public class PsdcDeviceServiceImpl implements IPsdcDeviceService{ |
||||||
|
@Autowired |
||||||
|
private PsdcDeviceMapper psdcDeviceMapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过ID查询单条数据 |
||||||
|
* |
||||||
|
* @param deviceId 主键 |
||||||
|
* @return 实例对象 |
||||||
|
*/ |
||||||
|
public PsdcDevice queryById(Integer deviceId){ |
||||||
|
return psdcDeviceMapper.queryById(deviceId); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增数据 |
||||||
|
* |
||||||
|
* @param psdcDevice 实例对象 |
||||||
|
* @return 实例对象 |
||||||
|
*/ |
||||||
|
public PsdcDevice insert(PsdcDevice psdcDevice){ |
||||||
|
psdcDeviceMapper.insert(psdcDevice); |
||||||
|
return psdcDevice; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新数据 |
||||||
|
* |
||||||
|
* @param psdcDevice 实例对象 |
||||||
|
* @return 实例对象 |
||||||
|
*/ |
||||||
|
public PsdcDevice update(PsdcDevice psdcDevice){ |
||||||
|
psdcDeviceMapper.update(psdcDevice); |
||||||
|
return queryById(psdcDevice.getDeviceId()); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过主键删除数据 |
||||||
|
* |
||||||
|
* @param deviceId 主键 |
||||||
|
* @return 是否成功 |
||||||
|
*/ |
||||||
|
public boolean deleteById(Integer deviceId){ |
||||||
|
int total = psdcDeviceMapper.deleteById(deviceId); |
||||||
|
return total > 0; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,32 @@ |
|||||||
|
package com.psdc.controller.control; |
||||||
|
|
||||||
|
import com.psdc.core.domain.AjaxResult; |
||||||
|
import com.psdc.core.domain.R; |
||||||
|
import com.psdc.core.domain.entity.SysRole; |
||||||
|
import com.psdc.core.domain.entity.SysUser; |
||||||
|
import com.psdc.utils.StringUtils; |
||||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping("/control/manual") |
||||||
|
public class ManualControl { |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('control:user:query')") |
||||||
|
@GetMapping("/deviceList") |
||||||
|
public AjaxResult getControlDeviceList() { |
||||||
|
|
||||||
|
return ajax; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
@ -1,4 +1,4 @@ |
|||||||
package com.psdc.controller.control; |
package com.psdc.controller.control; |
||||||
|
|
||||||
public class PowerControl { |
public class TimerControl { |
||||||
} |
} |
Loading…
Reference in new issue