feat: 设备管理-卡片开发
parent
8fa0556e89
commit
371c37c35f
@ -1,13 +1,91 @@
|
|||||||
package com.glxp.api.controller.dev;
|
package com.glxp.api.controller.dev;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.glxp.api.annotation.AuthRuleAnnotation;
|
||||||
|
import com.glxp.api.annotation.Log;
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.common.util.ResultVOUtils;
|
||||||
|
import com.glxp.api.constant.BusinessType;
|
||||||
import com.glxp.api.controller.BaseController;
|
import com.glxp.api.controller.BaseController;
|
||||||
|
import com.glxp.api.entity.dev.DeviceAssetUserEntity;
|
||||||
|
import com.glxp.api.req.inv.FilterInvUserRequest;
|
||||||
|
import com.glxp.api.req.system.DeleteDeviceFileRequest;
|
||||||
|
import com.glxp.api.res.PageSimpleResponse;
|
||||||
|
import com.glxp.api.service.auth.CustomerService;
|
||||||
|
import com.glxp.api.service.dev.DeviceAssetUserService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备相关人员
|
* 设备相关人员
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
public class DeviceAssetUserController extends BaseController {
|
public class DeviceAssetUserController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DeviceAssetUserService deviceAssetUserService;
|
||||||
|
@Resource
|
||||||
|
private CustomerService customerService;
|
||||||
|
|
||||||
|
@AuthRuleAnnotation("")
|
||||||
|
@GetMapping("/inv/device/user/filter")
|
||||||
|
public BaseResponse filterDeviceUser(FilterInvUserRequest filterInvUserRequest) {
|
||||||
|
List<DeviceAssetUserEntity> deviceAssetUserEntityList
|
||||||
|
= deviceAssetUserService.filterDeviceUser(filterInvUserRequest);
|
||||||
|
PageInfo<DeviceAssetUserEntity> pageInfo;
|
||||||
|
pageInfo = new PageInfo<>(deviceAssetUserEntityList);
|
||||||
|
PageSimpleResponse<DeviceAssetUserEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
||||||
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||||
|
pageSimpleResponse.setList(deviceAssetUserEntityList);
|
||||||
|
return ResultVOUtils.success(pageSimpleResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AuthRuleAnnotation("")
|
||||||
|
@PostMapping("/inv/info/insertDeviceUser")
|
||||||
|
@Log(title = "相关人员", businessType = BusinessType.INSERT)
|
||||||
|
public BaseResponse insertDeviceUser(@RequestBody DeviceAssetUserEntity deviceAssetUserEntity) {
|
||||||
|
String userId = customerService.getUserId()+ "";
|
||||||
|
Date now = new Date();
|
||||||
|
deviceAssetUserEntity.setCreateTime(now);
|
||||||
|
deviceAssetUserEntity.setUpdateTime(now);
|
||||||
|
deviceAssetUserEntity.setCreateUser(userId);
|
||||||
|
deviceAssetUserEntity.setUpdateUser(userId);
|
||||||
|
deviceAssetUserEntity.setId(IdUtil.getSnowflakeNextId());
|
||||||
|
boolean b = deviceAssetUserService.insertDeviceUser(deviceAssetUserEntity);
|
||||||
|
return ResultVOUtils.success("成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@AuthRuleAnnotation("")
|
||||||
|
@PostMapping("/inv/info/deleteDeviceUser")
|
||||||
|
public BaseResponse deleteDeviceUser(@RequestBody DeleteDeviceFileRequest deleteDeviceFileRequest) {
|
||||||
|
boolean b = deviceAssetUserService.deleteById(deleteDeviceFileRequest.getId());
|
||||||
|
return ResultVOUtils.success("成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@AuthRuleAnnotation("")
|
||||||
|
@PostMapping("/inv/info/updateDeviceUser")
|
||||||
|
@Log(title = "相关人员", businessType = BusinessType.UPDATE)
|
||||||
|
public BaseResponse updateDeviceUser(@RequestBody DeviceAssetUserEntity deviceAssetUserEntity) {
|
||||||
|
String userId = customerService.getUserId()+ "";
|
||||||
|
Date now = new Date();
|
||||||
|
deviceAssetUserEntity.setUpdateTime(now);
|
||||||
|
deviceAssetUserEntity.setUpdateUser(userId);
|
||||||
|
boolean b = deviceAssetUserService.updateDeviceUser(deviceAssetUserEntity);
|
||||||
|
if (b){
|
||||||
|
return ResultVOUtils.success("修改成功");
|
||||||
|
}else {
|
||||||
|
return ResultVOUtils.error("修改失败!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,75 @@
|
|||||||
|
package com.glxp.api.req.inv;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.glxp.api.util.page.ListPageRequest;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门设备明细接口参数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class FilterInvUserRequest extends ListPageRequest {
|
||||||
|
@TableId(value = "id", type = IdType.INPUT)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备资产编码
|
||||||
|
*/
|
||||||
|
@TableField(value = "devCodeFk")
|
||||||
|
private String devCodeFk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 相关人员名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "userName")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系方式1
|
||||||
|
*/
|
||||||
|
@TableField(value = "contact1")
|
||||||
|
private String contact1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系方式2
|
||||||
|
*/
|
||||||
|
@TableField(value = "contact2")
|
||||||
|
private String contact2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注说明
|
||||||
|
*/
|
||||||
|
@TableField(value = "remark")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@TableField(value = "`createUser`")
|
||||||
|
private String createUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "createTime")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
@TableField(value = "updateUser")
|
||||||
|
private String updateUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "updateTime")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,10 +1,22 @@
|
|||||||
package com.glxp.api.service.dev;
|
package com.glxp.api.service.dev;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.glxp.api.entity.dev.DeviceAssetUserEntity;
|
import com.glxp.api.entity.dev.DeviceAssetUserEntity;
|
||||||
import com.glxp.api.dao.dev.DeviceAssetUserMapper;
|
import com.glxp.api.req.inv.FilterInvUserRequest;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class DeviceAssetUserService extends ServiceImpl<DeviceAssetUserMapper, DeviceAssetUserEntity> {
|
public interface DeviceAssetUserService extends IService<DeviceAssetUserEntity> {
|
||||||
|
|
||||||
|
List<DeviceAssetUserEntity> filterDeviceUser(FilterInvUserRequest filterInvUserRequest);
|
||||||
|
|
||||||
|
boolean insertDeviceUser(DeviceAssetUserEntity deviceAssetUserEntity);
|
||||||
|
|
||||||
|
boolean deleteById(String id);
|
||||||
|
|
||||||
|
boolean updateDeviceUser(DeviceAssetUserEntity deviceAssetUserEntity);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,54 @@
|
|||||||
|
package com.glxp.api.service.dev.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.glxp.api.dao.dev.DeviceAssetUserMapper;
|
||||||
|
import com.glxp.api.entity.dev.DeviceAssetUserEntity;
|
||||||
|
import com.glxp.api.req.inv.FilterInvUserRequest;
|
||||||
|
import com.glxp.api.service.dev.DeviceAssetUserService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public class DeviceAssetUserServiceImpl extends ServiceImpl<DeviceAssetUserMapper, DeviceAssetUserEntity> implements DeviceAssetUserService {
|
||||||
|
@Resource
|
||||||
|
DeviceAssetUserMapper deviceAssetUserMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeviceAssetUserEntity> filterDeviceUser(FilterInvUserRequest filterInvUserRequest) {
|
||||||
|
if (filterInvUserRequest == null) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
if (filterInvUserRequest.getPage() != null) {
|
||||||
|
int offset = (filterInvUserRequest.getPage() - 1) * filterInvUserRequest.getLimit();
|
||||||
|
PageHelper.offsetPage(offset, filterInvUserRequest.getLimit());
|
||||||
|
}
|
||||||
|
return deviceAssetUserMapper.filterCompanyUser(filterInvUserRequest);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean insertDeviceUser(DeviceAssetUserEntity deviceAssetUserEntity) {
|
||||||
|
return deviceAssetUserMapper.insert(deviceAssetUserEntity) > 0 ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean deleteById(String id) {
|
||||||
|
return deviceAssetUserMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateDeviceUser(DeviceAssetUserEntity deviceAssetUserEntity) {
|
||||||
|
return deviceAssetUserMapper.updateDeviceUser(deviceAssetUserEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue