Commit e26af96c authored by tangf's avatar tangf

新增公司消息

parent bf0c48e9
......@@ -6,6 +6,7 @@ import com.pangding.web.vo.system.res.DeviceResVo;
import com.yanzuoguang.util.vo.PageSizeData;
import com.yanzuoguang.util.vo.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -17,7 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
* @author tangfang
* @date 2020-08-19
*/
@Api()
@Api(value = "设备类", description = "设备的查询,新增,修改,删除等相关操作")
@RestController
@RequestMapping("/device")
public class DevideController {
......@@ -26,6 +27,7 @@ public class DevideController {
private DeviceService deviceService;
@RequestMapping(value = "/findDeviceList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "获取设备列表", notes = "返回设备列表")
public ResponseResult<PageSizeData<DeviceResVo>> findDeviceList(@RequestBody DeviceReqVo req){
// CheckerHelper.newInstance().notBlankCheck("id",req.getId()).checkException();
return deviceService.findDeviceList(req);
......@@ -33,30 +35,35 @@ public class DevideController {
@RequestMapping(value = "/findDeviceInfo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "获取设备信息", notes = "返回设备信息")
public ResponseResult<DeviceResVo> findDeviceInfo(@RequestBody DeviceReqVo req){
// CheckerHelper.newInstance().notBlankCheck("id",req.getId()).checkException();
return deviceService.findDeviceInfo(req);
}
@RequestMapping(value = "/findDeviceInfoByCode", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "根据设备编号获取设备信息", notes = "返回设备信息")
public ResponseResult<DeviceResVo> findDeviceInfoByCode(@RequestBody DeviceReqVo req){
// CheckerHelper.newInstance().notBlankCheck("id",req.getId()).checkException();
return deviceService.findDeviceInfoByCode(req);
}
@RequestMapping(value = "/saveDevice", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "保存设备信息", notes = "返回保存结果")
public ResponseResult saveDevice(@RequestBody DeviceReqVo req){
// CheckerHelper.newInstance().notBlankCheck("id",req.getId()).checkException();
return deviceService.saveDevice(req);
}
@RequestMapping(value = "/updateDevice", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "修改设备信息", notes = "返回修改结果")
public ResponseResult updateDevice(@RequestBody DeviceReqVo req){
// CheckerHelper.newInstance().notBlankCheck("id",req.getId()).checkException();
return deviceService.updateDevice(req);
}
@RequestMapping(value = "/delDevice", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "删除设备信息", notes = "返回删除结果")
public ResponseResult delDevice(@RequestBody DeviceReqVo req){
// CheckerHelper.newInstance().notBlankCheck("id",req.getId()).checkException();
return deviceService.delDevice(req);
......
......@@ -25,6 +25,7 @@ public class DeviceDaoImpl extends BaseDaoImpl implements DeviceDao {
table.add(QUERY_LIST, "SELECT * FROM pd_device WHERE 1=1 {WHERE}")
.add("deviceId", " AND device_id = ? ")
.add("deviceCode", "AND device_code = ? ")
.add("deviceName", " AND device_name = ? ")
.add("deviceType", " AND device_type = ? ")
.add("companyId", " AND company_id = ? ")
......
......@@ -6,6 +6,7 @@ import com.pangding.web.vo.system.pd.device.DeviceVo;
import com.pangding.web.vo.system.req.DeviceReqVo;
import com.pangding.web.vo.system.res.DeviceResVo;
import com.yanzuoguang.util.base.ObjectHelper;
import com.yanzuoguang.util.helper.DateHelper;
import com.yanzuoguang.util.helper.StringHelper;
import com.yanzuoguang.util.vo.PageSizeData;
import com.yanzuoguang.util.vo.ResponseResult;
......@@ -30,6 +31,7 @@ public class DeviceServiceImpl implements DeviceService {
return ResponseResult.result(deviceResVo);
}
@Override
public ResponseResult<DeviceResVo> findDeviceInfoByCode(DeviceReqVo req) {
DeviceResVo deviceResVo = deviceDao.findDeviceInfo(req);
return ResponseResult.result(deviceResVo);
......@@ -37,13 +39,18 @@ public class DeviceServiceImpl implements DeviceService {
@Override
public ResponseResult saveDevice(DeviceReqVo req) {
return ResponseResult.result(null);
DeviceVo deviceVo = new DeviceVo();
ObjectHelper.writeWithFrom(deviceVo, req);
deviceVo.setDeviceId(StringHelper.getNewID());
deviceVo.setCreateTime(DateHelper.getNow());
deviceDao.create(deviceVo);
return ResponseResult.result(deviceVo);
}
@Override
public ResponseResult<DeviceVo> updateDevice(DeviceReqVo req) {
DeviceVo deviceVo = deviceDao.load(req.getDeviceId(), DeviceVo.class);
if(StringHelper.isEmpty(deviceVo)){
if (StringHelper.isEmpty(deviceVo)) {
return ResponseResult.error("99", "设备编号有误");
}
ObjectHelper.writeWithFrom(deviceVo, req);
......@@ -54,6 +61,6 @@ public class DeviceServiceImpl implements DeviceService {
@Override
public ResponseResult delDevice(DeviceReqVo req) {
deviceDao.remove(req);
return ResponseResult.result(null);
return ResponseResult.result("删除成功");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment