Commit a3f88960 authored by zhangjianqian's avatar zhangjianqian

液化气用户以及设备

parent cca291df
package com.zehong.web.controller.system;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TYehuaqiDevice;
import com.zehong.system.service.ITYehuaqiDeviceService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 【请填写功能名称】Controller
*
* @author zehong
* @date 2022-09-14
*/
@RestController
@RequestMapping("/system/yehuaqiDevice")
public class TYehuaqiDeviceController extends BaseController
{
@Autowired
private ITYehuaqiDeviceService tYehuaqiDeviceService;
/**
* 查询【请填写功能名称】列表
*/
@GetMapping("/list")
public TableDataInfo list(TYehuaqiDevice tYehuaqiDevice)
{
startPage();
List<TYehuaqiDevice> list = tYehuaqiDeviceService.selectTYehuaqiDeviceList(tYehuaqiDevice);
return getDataTable(list);
}
/**
* 导出【请填写功能名称】列表
*/
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TYehuaqiDevice tYehuaqiDevice)
{
List<TYehuaqiDevice> list = tYehuaqiDeviceService.selectTYehuaqiDeviceList(tYehuaqiDevice);
ExcelUtil<TYehuaqiDevice> util = new ExcelUtil<TYehuaqiDevice>(TYehuaqiDevice.class);
return util.exportExcel(list, "【请填写功能名称】数据");
}
/**
* 获取【请填写功能名称】详细信息
*/
@GetMapping(value = "/{detectorId}")
public AjaxResult getInfo(@PathVariable("detectorId") Long detectorId)
{
return AjaxResult.success(tYehuaqiDeviceService.selectTYehuaqiDeviceById(detectorId));
}
/**
* 新增【请填写功能名称】
*/
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TYehuaqiDevice tYehuaqiDevice)
{
return toAjax(tYehuaqiDeviceService.insertTYehuaqiDevice(tYehuaqiDevice));
}
/**
* 修改【请填写功能名称】
*/
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TYehuaqiDevice tYehuaqiDevice)
{
return toAjax(tYehuaqiDeviceService.updateTYehuaqiDevice(tYehuaqiDevice));
}
/**
* 删除【请填写功能名称】
*/
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
@DeleteMapping("/{detectorIds}")
public AjaxResult remove(@PathVariable Long[] detectorIds)
{
return toAjax(tYehuaqiDeviceService.deleteTYehuaqiDeviceByIds(detectorIds));
}
}
package com.zehong.web.controller.system;
import java.util.List;
import com.zehong.system.domain.TDetectorUser;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TYehuaqiUser;
import com.zehong.system.service.ITYehuaqiUserService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 燃气用户Controller
*
* @author zehong
* @date 2022-09-14
*/
@RestController
@RequestMapping("/system/yehuaqiUser")
public class TYehuaqiUserController extends BaseController
{
@Autowired
private ITYehuaqiUserService tYehuaqiUserService;
/**
* 查询燃气用户列表
*/
@GetMapping("/list")
public TableDataInfo list(TYehuaqiUser tYehuaqiUser)
{
startPage();
List<TYehuaqiUser> list = tYehuaqiUserService.selectTYehuaqiUserList(tYehuaqiUser);
return getDataTable(list);
}
/**
* 导出燃气用户列表
*/
@Log(title = "燃气用户", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TYehuaqiUser tYehuaqiUser)
{
List<TYehuaqiUser> list = tYehuaqiUserService.selectTYehuaqiUserList(tYehuaqiUser);
ExcelUtil<TYehuaqiUser> util = new ExcelUtil<TYehuaqiUser>(TYehuaqiUser.class);
return util.exportExcel(list, "燃气用户数据");
}
/**
* 获取燃气用户详细信息
*/
@GetMapping(value = "/{userId}")
public AjaxResult getInfo(@PathVariable("userId") Long userId)
{
return AjaxResult.success(tYehuaqiUserService.selectTYehuaqiUserById(userId));
}
/**
* 新增燃气用户
*/
@Log(title = "燃气用户", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TYehuaqiUser tYehuaqiUser)
{
return toAjax(tYehuaqiUserService.insertTYehuaqiUser(tYehuaqiUser));
}
/**
* 修改燃气用户
*/
@Log(title = "燃气用户", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TYehuaqiUser tYehuaqiUser)
{
return toAjax(tYehuaqiUserService.updateTYehuaqiUser(tYehuaqiUser));
}
/**
* 删除燃气用户
*/
@Log(title = "燃气用户", businessType = BusinessType.DELETE)
@DeleteMapping("/{userIds}")
public AjaxResult remove(@PathVariable Long[] userIds)
{
return toAjax(tYehuaqiUserService.deleteTYehuaqiUserByIds(userIds));
}
@GetMapping("/allList")
public TableDataInfo allList(TYehuaqiUser tYehuaqiUser)
{
List<TYehuaqiUser> list = tYehuaqiUserService.selectAllUserList(tYehuaqiUser);
return getDataTable(list);
}
}
package com.zehong.system.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 【请填写功能名称】对象 t_yehuaqi_device
*
* @author zehong
* @date 2022-09-14
*/
public class TYehuaqiDevice extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 设备id */
private Long detectorId;
/** 企业id */
@Excel(name = "企业id")
private Long enterpriseId;
/** 所属用户id */
@Excel(name = "所属用户id")
private Long userId;
/** 所属设备id(阀门井、调压箱) */
@Excel(name = "所属设备id", readConverterExp = "阀=门井、调压箱")
private Long deviceId;
/** 所属场站id */
@Excel(name = "所属场站id")
private Long siteStationId;
/** 设备名称 */
@Excel(name = "设备名称")
private String detectorName;
/** 设备编号 */
@Excel(name = "设备编号")
private String detectorCode;
/** 设备地址 */
@Excel(name = "设备地址")
private String detectorAddr;
/** 设备类型(1家用报警器,2工业报警器) */
@Excel(name = "设备类型", readConverterExp = "1=家用报警器,2工业报警器")
private String detectorType;
/** 检测介质(1甲烷,2氨气,3一氧化碳,4可燃气体,5有毒气体) */
@Excel(name = "检测介质", readConverterExp = "1=甲烷,2氨气,3一氧化碳,4可燃气体,5有毒气体")
private String medium;
/** 经度 */
@Excel(name = "经度")
private BigDecimal longitude;
/** 纬度 */
@Excel(name = "纬度")
private BigDecimal latitude;
/** 物联网编号 */
@Excel(name = "物联网编号")
private String iotNo;
/** 联系人 */
@Excel(name = "联系人")
private String linkman;
/** 电话 */
@Excel(name = "电话")
private String phone;
/** 最后巡检时间 */
@Excel(name = "最后巡检时间")
private String alarmTime;
/** 设备状态,0正常,1故障(掉线) */
@Excel(name = "设备状态,0正常,1故障", readConverterExp = "掉=线")
private String detectorStatus;
/** 是否删除(0正常,1删除) */
@Excel(name = "是否删除(0正常,1删除)")
private String isDel;
/** 备注 */
@Excel(name = "备注")
private String remarks;
public void setDetectorId(Long detectorId)
{
this.detectorId = detectorId;
}
public Long getDetectorId()
{
return detectorId;
}
public void setEnterpriseId(Long enterpriseId)
{
this.enterpriseId = enterpriseId;
}
public Long getEnterpriseId()
{
return enterpriseId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setDeviceId(Long deviceId)
{
this.deviceId = deviceId;
}
public Long getDeviceId()
{
return deviceId;
}
public void setSiteStationId(Long siteStationId)
{
this.siteStationId = siteStationId;
}
public Long getSiteStationId()
{
return siteStationId;
}
public void setDetectorName(String detectorName)
{
this.detectorName = detectorName;
}
public String getDetectorName()
{
return detectorName;
}
public void setDetectorCode(String detectorCode)
{
this.detectorCode = detectorCode;
}
public String getDetectorCode()
{
return detectorCode;
}
public void setDetectorAddr(String detectorAddr)
{
this.detectorAddr = detectorAddr;
}
public String getDetectorAddr()
{
return detectorAddr;
}
public void setDetectorType(String detectorType)
{
this.detectorType = detectorType;
}
public String getDetectorType()
{
return detectorType;
}
public void setMedium(String medium)
{
this.medium = medium;
}
public String getMedium()
{
return medium;
}
public void setLongitude(BigDecimal longitude)
{
this.longitude = longitude;
}
public BigDecimal getLongitude()
{
return longitude;
}
public void setLatitude(BigDecimal latitude)
{
this.latitude = latitude;
}
public BigDecimal getLatitude()
{
return latitude;
}
public void setIotNo(String iotNo)
{
this.iotNo = iotNo;
}
public String getIotNo()
{
return iotNo;
}
public void setLinkman(String linkman)
{
this.linkman = linkman;
}
public String getLinkman()
{
return linkman;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
{
return phone;
}
public void setAlarmTime(String alarmTime)
{
this.alarmTime = alarmTime;
}
public String getAlarmTime()
{
return alarmTime;
}
public void setDetectorStatus(String detectorStatus)
{
this.detectorStatus = detectorStatus;
}
public String getDetectorStatus()
{
return detectorStatus;
}
public void setIsDel(String isDel)
{
this.isDel = isDel;
}
public String getIsDel()
{
return isDel;
}
public void setRemarks(String remarks)
{
this.remarks = remarks;
}
public String getRemarks()
{
return remarks;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("detectorId", getDetectorId())
.append("enterpriseId", getEnterpriseId())
.append("userId", getUserId())
.append("deviceId", getDeviceId())
.append("siteStationId", getSiteStationId())
.append("detectorName", getDetectorName())
.append("detectorCode", getDetectorCode())
.append("detectorAddr", getDetectorAddr())
.append("detectorType", getDetectorType())
.append("medium", getMedium())
.append("longitude", getLongitude())
.append("latitude", getLatitude())
.append("iotNo", getIotNo())
.append("linkman", getLinkman())
.append("phone", getPhone())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("alarmTime", getAlarmTime())
.append("detectorStatus", getDetectorStatus())
.append("isDel", getIsDel())
.append("remarks", getRemarks())
.toString();
}
}
package com.zehong.system.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 燃气用户对象 t_yehuaqi_user
*
* @author zehong
* @date 2022-09-14
*/
public class TYehuaqiUser extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 用户id */
private Long userId;
/** 用户账号 */
@Excel(name = "用户账号")
private String username;
/** 用户名称 */
@Excel(name = "用户名称")
private String nickName;
/** 权属单位id */
@Excel(name = "权属单位id")
private Long beyondEnterpriseId;
/** 用户类型 */
@Excel(name = "用户类型")
private String userType;
/** 地址 */
@Excel(name = "地址")
private String address;
/** 经度 */
@Excel(name = "经度")
private BigDecimal longitude;
/** 纬度 */
@Excel(name = "纬度")
private BigDecimal latitude;
/** 联系人 */
@Excel(name = "联系人")
private String linkman;
/** 电话 */
@Excel(name = "电话")
private String phone;
/** 邮箱 */
@Excel(name = "邮箱")
private String email;
/** 是否删除(0正常,1删除) */
private String isDel;
/** 备注 */
private String remarks;
private Integer deviceNum;
private Integer zxnum;
public Integer getZxnum() {
return zxnum;
}
public void setZxnum(Integer zxnum) {
this.zxnum = zxnum;
}
public Integer getDeviceNum() {
return deviceNum;
}
public void setDeviceNum(Integer deviceNum) {
this.deviceNum = deviceNum;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setUsername(String username)
{
this.username = username;
}
public String getUsername()
{
return username;
}
public void setNickName(String nickName)
{
this.nickName = nickName;
}
public String getNickName()
{
return nickName;
}
public void setBeyondEnterpriseId(Long beyondEnterpriseId)
{
this.beyondEnterpriseId = beyondEnterpriseId;
}
public Long getBeyondEnterpriseId()
{
return beyondEnterpriseId;
}
public void setUserType(String userType)
{
this.userType = userType;
}
public String getUserType()
{
return userType;
}
public void setAddress(String address)
{
this.address = address;
}
public String getAddress()
{
return address;
}
public void setLongitude(BigDecimal longitude)
{
this.longitude = longitude;
}
public BigDecimal getLongitude()
{
return longitude;
}
public void setLatitude(BigDecimal latitude)
{
this.latitude = latitude;
}
public BigDecimal getLatitude()
{
return latitude;
}
public void setLinkman(String linkman)
{
this.linkman = linkman;
}
public String getLinkman()
{
return linkman;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
{
return phone;
}
public void setEmail(String email)
{
this.email = email;
}
public String getEmail()
{
return email;
}
public void setIsDel(String isDel)
{
this.isDel = isDel;
}
public String getIsDel()
{
return isDel;
}
public void setRemarks(String remarks)
{
this.remarks = remarks;
}
public String getRemarks()
{
return remarks;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId())
.append("username", getUsername())
.append("nickName", getNickName())
.append("beyondEnterpriseId", getBeyondEnterpriseId())
.append("userType", getUserType())
.append("address", getAddress())
.append("longitude", getLongitude())
.append("latitude", getLatitude())
.append("linkman", getLinkman())
.append("phone", getPhone())
.append("email", getEmail())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("isDel", getIsDel())
.append("remarks", getRemarks())
.toString();
}
}
package com.zehong.system.domain.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* 探测器用户对象 t_detector_user
*
* @author zehong
* @date 2021-11-02
*/
@Data
public class TYehuaqiUserVO
{
private static final long serialVersionUID = 1L;
/** 用户id */
private Long userId;
/** 图标类型 */
private String iconType;
/** 用户状态(1正常,2报警) */
private String userStatus;
/** 用户名称 */
private String nickName;
/** 用户类型(1居民用户,2商业用户,3工业用户) */
private String userType;
private List<Object> detectorCountList;
/** 设备类型 */
private String detectorType;
/** 探测器总数 */
private Integer detectorCount;
/** 在线数量 */
private Integer onLineNum;
/** 离线数量 */
private Integer offLineNum;
/** 历史报警数 */
private Integer historyAlarmNum;
/** 已处理报警 */
private Integer cancelAlarmNum;
/** 报警中 */
private Integer processingAlarmNum;
/** 地址 */
private String address;
/** 经度 */
private BigDecimal longitude;
/** 纬度 */
private BigDecimal latitude;
/** 联系人 */
private String linkman;
/** 电话 */
private String phone;
/** 邮箱 */
private String email;
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TYehuaqiDevice;
/**
* 【请填写功能名称】Mapper接口
*
* @author zehong
* @date 2022-09-14
*/
public interface TYehuaqiDeviceMapper
{
/**
* 查询【请填写功能名称】
*
* @param detectorId 【请填写功能名称】ID
* @return 【请填写功能名称】
*/
public TYehuaqiDevice selectTYehuaqiDeviceById(Long detectorId);
/**
* 查询【请填写功能名称】列表
*
* @param tYehuaqiDevice 【请填写功能名称】
* @return 【请填写功能名称】集合
*/
public List<TYehuaqiDevice> selectTYehuaqiDeviceList(TYehuaqiDevice tYehuaqiDevice);
/**
* 新增【请填写功能名称】
*
* @param tYehuaqiDevice 【请填写功能名称】
* @return 结果
*/
public int insertTYehuaqiDevice(TYehuaqiDevice tYehuaqiDevice);
/**
* 修改【请填写功能名称】
*
* @param tYehuaqiDevice 【请填写功能名称】
* @return 结果
*/
public int updateTYehuaqiDevice(TYehuaqiDevice tYehuaqiDevice);
/**
* 删除【请填写功能名称】
*
* @param detectorId 【请填写功能名称】ID
* @return 结果
*/
public int deleteTYehuaqiDeviceById(Long detectorId);
/**
* 批量删除【请填写功能名称】
*
* @param detectorIds 需要删除的数据ID
* @return 结果
*/
public int deleteTYehuaqiDeviceByIds(Long[] detectorIds);
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TDetectorUser;
import com.zehong.system.domain.TYehuaqiUser;
import com.zehong.system.domain.vo.TDetectorUserVO;
import com.zehong.system.domain.vo.TYehuaqiUserVO;
/**
* 燃气用户Mapper接口
*
* @author zehong
* @date 2022-09-14
*/
public interface TYehuaqiUserMapper
{
/**
* 查询燃气用户
*
* @param userId 燃气用户ID
* @return 燃气用户
*/
public TYehuaqiUser selectTYehuaqiUserById(Long userId);
/**
* 查询燃气用户列表
*
* @param tYehuaqiUser 燃气用户
* @return 燃气用户集合
*/
public List<TYehuaqiUser> selectTYehuaqiUserList(TYehuaqiUser tYehuaqiUser);
public List<TYehuaqiUser> selectTYehuaqiUserListTwo(TYehuaqiUser tYehuaqiUser);
/**
* 新增燃气用户
*
* @param tYehuaqiUser 燃气用户
* @return 结果
*/
public int insertTYehuaqiUser(TYehuaqiUser tYehuaqiUser);
/**
* 修改燃气用户
*
* @param tYehuaqiUser 燃气用户
* @return 结果
*/
public int updateTYehuaqiUser(TYehuaqiUser tYehuaqiUser);
/**
* 删除燃气用户
*
* @param userId 燃气用户ID
* @return 结果
*/
public int deleteTYehuaqiUserById(Long userId);
/**
* 批量删除燃气用户
*
* @param userIds 需要删除的数据ID
* @return 结果
*/
public int deleteTYehuaqiUserByIds(Long[] userIds);
}
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TYehuaqiDevice;
/**
* 【请填写功能名称】Service接口
*
* @author zehong
* @date 2022-09-14
*/
public interface ITYehuaqiDeviceService
{
/**
* 查询【请填写功能名称】
*
* @param detectorId 【请填写功能名称】ID
* @return 【请填写功能名称】
*/
public TYehuaqiDevice selectTYehuaqiDeviceById(Long detectorId);
/**
* 查询【请填写功能名称】列表
*
* @param tYehuaqiDevice 【请填写功能名称】
* @return 【请填写功能名称】集合
*/
public List<TYehuaqiDevice> selectTYehuaqiDeviceList(TYehuaqiDevice tYehuaqiDevice);
/**
* 新增【请填写功能名称】
*
* @param tYehuaqiDevice 【请填写功能名称】
* @return 结果
*/
public int insertTYehuaqiDevice(TYehuaqiDevice tYehuaqiDevice);
/**
* 修改【请填写功能名称】
*
* @param tYehuaqiDevice 【请填写功能名称】
* @return 结果
*/
public int updateTYehuaqiDevice(TYehuaqiDevice tYehuaqiDevice);
/**
* 批量删除【请填写功能名称】
*
* @param detectorIds 需要删除的【请填写功能名称】ID
* @return 结果
*/
public int deleteTYehuaqiDeviceByIds(Long[] detectorIds);
/**
* 删除【请填写功能名称】信息
*
* @param detectorId 【请填写功能名称】ID
* @return 结果
*/
public int deleteTYehuaqiDeviceById(Long detectorId);
}
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TDetectorUser;
import com.zehong.system.domain.TYehuaqiUser;
import com.zehong.system.domain.vo.TDetectorUserVO;
import com.zehong.system.domain.vo.TYehuaqiUserVO;
/**
* 燃气用户Service接口
*
* @author zehong
* @date 2022-09-14
*/
public interface ITYehuaqiUserService
{
/**
* 查询燃气用户
*
* @param userId 燃气用户ID
* @return 燃气用户
*/
public TYehuaqiUser selectTYehuaqiUserById(Long userId);
/**
* 查询燃气用户列表
*
* @param tYehuaqiUser 燃气用户
* @return 燃气用户集合
*/
public List<TYehuaqiUser> selectTYehuaqiUserList(TYehuaqiUser tYehuaqiUser);
public List<TYehuaqiUser> selectAllUserList(TYehuaqiUser tYehuaqiUser);
/**
* 新增燃气用户
*
* @param tYehuaqiUser 燃气用户
* @return 结果
*/
public int insertTYehuaqiUser(TYehuaqiUser tYehuaqiUser);
/**
* 修改燃气用户
*
* @param tYehuaqiUser 燃气用户
* @return 结果
*/
public int updateTYehuaqiUser(TYehuaqiUser tYehuaqiUser);
/**
* 批量删除燃气用户
*
* @param userIds 需要删除的燃气用户ID
* @return 结果
*/
public int deleteTYehuaqiUserByIds(Long[] userIds);
/**
* 删除燃气用户信息
*
* @param userId 燃气用户ID
* @return 结果
*/
public int deleteTYehuaqiUserById(Long userId);
}
package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TYehuaqiDeviceMapper;
import com.zehong.system.domain.TYehuaqiDevice;
import com.zehong.system.service.ITYehuaqiDeviceService;
/**
* 【请填写功能名称】Service业务层处理
*
* @author zehong
* @date 2022-09-14
*/
@Service
public class TYehuaqiDeviceServiceImpl implements ITYehuaqiDeviceService
{
@Autowired
private TYehuaqiDeviceMapper tYehuaqiDeviceMapper;
/**
* 查询【请填写功能名称】
*
* @param detectorId 【请填写功能名称】ID
* @return 【请填写功能名称】
*/
@Override
public TYehuaqiDevice selectTYehuaqiDeviceById(Long detectorId)
{
return tYehuaqiDeviceMapper.selectTYehuaqiDeviceById(detectorId);
}
/**
* 查询【请填写功能名称】列表
*
* @param tYehuaqiDevice 【请填写功能名称】
* @return 【请填写功能名称】
*/
@Override
public List<TYehuaqiDevice> selectTYehuaqiDeviceList(TYehuaqiDevice tYehuaqiDevice)
{
return tYehuaqiDeviceMapper.selectTYehuaqiDeviceList(tYehuaqiDevice);
}
/**
* 新增【请填写功能名称】
*
* @param tYehuaqiDevice 【请填写功能名称】
* @return 结果
*/
@Override
public int insertTYehuaqiDevice(TYehuaqiDevice tYehuaqiDevice)
{
tYehuaqiDevice.setCreateTime(DateUtils.getNowDate());
return tYehuaqiDeviceMapper.insertTYehuaqiDevice(tYehuaqiDevice);
}
/**
* 修改【请填写功能名称】
*
* @param tYehuaqiDevice 【请填写功能名称】
* @return 结果
*/
@Override
public int updateTYehuaqiDevice(TYehuaqiDevice tYehuaqiDevice)
{
tYehuaqiDevice.setUpdateTime(DateUtils.getNowDate());
return tYehuaqiDeviceMapper.updateTYehuaqiDevice(tYehuaqiDevice);
}
/**
* 批量删除【请填写功能名称】
*
* @param detectorIds 需要删除的【请填写功能名称】ID
* @return 结果
*/
@Override
public int deleteTYehuaqiDeviceByIds(Long[] detectorIds)
{
return tYehuaqiDeviceMapper.deleteTYehuaqiDeviceByIds(detectorIds);
}
/**
* 删除【请填写功能名称】信息
*
* @param detectorId 【请填写功能名称】ID
* @return 结果
*/
@Override
public int deleteTYehuaqiDeviceById(Long detectorId)
{
return tYehuaqiDeviceMapper.deleteTYehuaqiDeviceById(detectorId);
}
}
package com.zehong.system.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.TDetectorUser;
import com.zehong.system.domain.TYehuaqiDevice;
import com.zehong.system.domain.vo.TDetectorUserVO;
import com.zehong.system.domain.vo.TYehuaqiUserVO;
import com.zehong.system.mapper.TYehuaqiDeviceMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TYehuaqiUserMapper;
import com.zehong.system.domain.TYehuaqiUser;
import com.zehong.system.service.ITYehuaqiUserService;
/**
* 燃气用户Service业务层处理
*
* @author zehong
* @date 2022-09-14
*/
@Service
public class TYehuaqiUserServiceImpl implements ITYehuaqiUserService
{
@Autowired
private TYehuaqiUserMapper tYehuaqiUserMapper;
@Autowired
private TYehuaqiDeviceMapper tYehuaqiDeviceMapper;
/**
* 查询燃气用户
*
* @param userId 燃气用户ID
* @return 燃气用户
*/
@Override
public TYehuaqiUser selectTYehuaqiUserById(Long userId)
{
return tYehuaqiUserMapper.selectTYehuaqiUserById(userId);
}
/**
* 查询燃气用户列表
*
* @param tYehuaqiUser 燃气用户
* @return 燃气用户
*/
@Override
public List<TYehuaqiUser> selectTYehuaqiUserList(TYehuaqiUser tYehuaqiUser)
{
return tYehuaqiUserMapper.selectTYehuaqiUserList(tYehuaqiUser);
}
@Override
public List<TYehuaqiUser> selectAllUserList(TYehuaqiUser tYehuaqiUser)
{
List<TYehuaqiUser> list = tYehuaqiUserMapper.selectTYehuaqiUserListTwo(tYehuaqiUser);
// for (TYehuaqiUser user : list){
// TYehuaqiDevice d = new TYehuaqiDevice();
// d.setUserId(user.getUserId());
// List<TYehuaqiDevice> devices = tYehuaqiDeviceMapper.selectTYehuaqiDeviceList(d);
// user.setDeviceNum(devices.size());
// }
return list;
}
/**
* 新增燃气用户
*
* @param tYehuaqiUser 燃气用户
* @return 结果
*/
@Override
public int insertTYehuaqiUser(TYehuaqiUser tYehuaqiUser)
{
tYehuaqiUser.setCreateTime(DateUtils.getNowDate());
return tYehuaqiUserMapper.insertTYehuaqiUser(tYehuaqiUser);
}
/**
* 修改燃气用户
*
* @param tYehuaqiUser 燃气用户
* @return 结果
*/
@Override
public int updateTYehuaqiUser(TYehuaqiUser tYehuaqiUser)
{
tYehuaqiUser.setUpdateTime(DateUtils.getNowDate());
return tYehuaqiUserMapper.updateTYehuaqiUser(tYehuaqiUser);
}
/**
* 批量删除燃气用户
*
* @param userIds 需要删除的燃气用户ID
* @return 结果
*/
@Override
public int deleteTYehuaqiUserByIds(Long[] userIds)
{
return tYehuaqiUserMapper.deleteTYehuaqiUserByIds(userIds);
}
/**
* 删除燃气用户信息
*
* @param userId 燃气用户ID
* @return 结果
*/
@Override
public int deleteTYehuaqiUserById(Long userId)
{
return tYehuaqiUserMapper.deleteTYehuaqiUserById(userId);
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TYehuaqiDeviceMapper">
<resultMap type="TYehuaqiDevice" id="TYehuaqiDeviceResult">
<result property="detectorId" column="detector_id" />
<result property="enterpriseId" column="enterprise_id" />
<result property="userId" column="user_id" />
<result property="deviceId" column="device_id" />
<result property="siteStationId" column="site_station_id" />
<result property="detectorName" column="detector_name" />
<result property="detectorCode" column="detector_code" />
<result property="detectorAddr" column="detector_addr" />
<result property="detectorType" column="detector_type" />
<result property="medium" column="medium" />
<result property="longitude" column="longitude" />
<result property="latitude" column="latitude" />
<result property="iotNo" column="iot_no" />
<result property="linkman" column="linkman" />
<result property="phone" column="phone" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="alarmTime" column="alarm_time" />
<result property="detectorStatus" column="detector_status" />
<result property="isDel" column="is_del" />
<result property="remarks" column="remarks" />
</resultMap>
<sql id="selectTYehuaqiDeviceVo">
select detector_id, enterprise_id, user_id, device_id, site_station_id, detector_name, detector_code, detector_addr, detector_type, medium, longitude, latitude, iot_no, linkman, phone, create_time, update_time, alarm_time, detector_status, is_del, remarks from t_yehuaqi_device
</sql>
<select id="selectTYehuaqiDeviceList" parameterType="TYehuaqiDevice" resultMap="TYehuaqiDeviceResult">
<include refid="selectTYehuaqiDeviceVo"/>
<where>
<if test="enterpriseId != null "> and enterprise_id = #{enterpriseId}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="deviceId != null "> and device_id = #{deviceId}</if>
<if test="siteStationId != null "> and site_station_id = #{siteStationId}</if>
<if test="detectorName != null and detectorName != ''"> and detector_name like concat('%', #{detectorName}, '%')</if>
<if test="detectorCode != null and detectorCode != ''"> and detector_code = #{detectorCode}</if>
<if test="detectorAddr != null and detectorAddr != ''"> and detector_addr = #{detectorAddr}</if>
<if test="detectorType != null and detectorType != ''"> and detector_type = #{detectorType}</if>
<if test="medium != null and medium != ''"> and medium = #{medium}</if>
<if test="longitude != null "> and longitude = #{longitude}</if>
<if test="latitude != null "> and latitude = #{latitude}</if>
<if test="iotNo != null and iotNo != ''"> and iot_no = #{iotNo}</if>
<if test="linkman != null and linkman != ''"> and linkman = #{linkman}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="alarmTime != null and alarmTime != ''"> and alarm_time = #{alarmTime}</if>
<if test="detectorStatus != null and detectorStatus != ''"> and detector_status = #{detectorStatus}</if>
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
</where>
</select>
<select id="selectTYehuaqiDeviceById" parameterType="Long" resultMap="TYehuaqiDeviceResult">
<include refid="selectTYehuaqiDeviceVo"/>
where detector_id = #{detectorId}
</select>
<insert id="insertTYehuaqiDevice" parameterType="TYehuaqiDevice" useGeneratedKeys="true" keyProperty="detectorId">
insert into t_yehuaqi_device
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="enterpriseId != null">enterprise_id,</if>
<if test="userId != null">user_id,</if>
<if test="deviceId != null">device_id,</if>
<if test="siteStationId != null">site_station_id,</if>
<if test="detectorName != null">detector_name,</if>
<if test="detectorCode != null">detector_code,</if>
<if test="detectorAddr != null">detector_addr,</if>
<if test="detectorType != null">detector_type,</if>
<if test="medium != null">medium,</if>
<if test="longitude != null">longitude,</if>
<if test="latitude != null">latitude,</if>
<if test="iotNo != null">iot_no,</if>
<if test="linkman != null">linkman,</if>
<if test="phone != null">phone,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="alarmTime != null">alarm_time,</if>
<if test="detectorStatus != null">detector_status,</if>
<if test="isDel != null">is_del,</if>
<if test="remarks != null">remarks,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="enterpriseId != null">#{enterpriseId},</if>
<if test="userId != null">#{userId},</if>
<if test="deviceId != null">#{deviceId},</if>
<if test="siteStationId != null">#{siteStationId},</if>
<if test="detectorName != null">#{detectorName},</if>
<if test="detectorCode != null">#{detectorCode},</if>
<if test="detectorAddr != null">#{detectorAddr},</if>
<if test="detectorType != null">#{detectorType},</if>
<if test="medium != null">#{medium},</if>
<if test="longitude != null">#{longitude},</if>
<if test="latitude != null">#{latitude},</if>
<if test="iotNo != null">#{iotNo},</if>
<if test="linkman != null">#{linkman},</if>
<if test="phone != null">#{phone},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="alarmTime != null">#{alarmTime},</if>
<if test="detectorStatus != null">#{detectorStatus},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remarks != null">#{remarks},</if>
</trim>
</insert>
<update id="updateTYehuaqiDevice" parameterType="TYehuaqiDevice">
update t_yehuaqi_device
<trim prefix="SET" suffixOverrides=",">
<if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="deviceId != null">device_id = #{deviceId},</if>
<if test="siteStationId != null">site_station_id = #{siteStationId},</if>
<if test="detectorName != null">detector_name = #{detectorName},</if>
<if test="detectorCode != null">detector_code = #{detectorCode},</if>
<if test="detectorAddr != null">detector_addr = #{detectorAddr},</if>
<if test="detectorType != null">detector_type = #{detectorType},</if>
<if test="medium != null">medium = #{medium},</if>
<if test="longitude != null">longitude = #{longitude},</if>
<if test="latitude != null">latitude = #{latitude},</if>
<if test="iotNo != null">iot_no = #{iotNo},</if>
<if test="linkman != null">linkman = #{linkman},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="alarmTime != null">alarm_time = #{alarmTime},</if>
<if test="detectorStatus != null">detector_status = #{detectorStatus},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="remarks != null">remarks = #{remarks},</if>
</trim>
where detector_id = #{detectorId}
</update>
<delete id="deleteTYehuaqiDeviceById" parameterType="Long">
delete from t_yehuaqi_device where detector_id = #{detectorId}
</delete>
<delete id="deleteTYehuaqiDeviceByIds" parameterType="String">
delete from t_yehuaqi_device where detector_id in
<foreach item="detectorId" collection="array" open="(" separator="," close=")">
#{detectorId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TYehuaqiUserMapper">
<resultMap type="TYehuaqiUser" id="TYehuaqiUserResult">
<result property="userId" column="user_id" />
<result property="username" column="username" />
<result property="nickName" column="nick_name" />
<result property="beyondEnterpriseId" column="beyond_enterprise_id" />
<result property="userType" column="user_type" />
<result property="address" column="address" />
<result property="longitude" column="longitude" />
<result property="latitude" column="latitude" />
<result property="linkman" column="linkman" />
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="isDel" column="is_del" />
<result property="remarks" column="remarks" />
<result property="deviceNum" column="deviceNum" />
<result property="zxnum" column="zxnum" />
</resultMap>
<sql id="selectTYehuaqiUserVo">
select user_id, username, nick_name, beyond_enterprise_id, user_type, address, longitude, latitude, linkman, phone, email, create_time, update_time, is_del, remarks from t_yehuaqi_user
</sql>
<select id="selectTYehuaqiUserList" parameterType="TYehuaqiUser" resultMap="TYehuaqiUserResult">
<include refid="selectTYehuaqiUserVo"/>
<where>
<if test="username != null and username != ''"> and username like concat('%', #{username}, '%')</if>
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
<if test="phone != null and phone != ''"> and phone like concat('%', #{phone}, '%')</if>
</where>
</select>
<select id="selectTYehuaqiUserListTwo" parameterType="TYehuaqiUser" resultMap="TYehuaqiUserResult">
SELECT t2.zs as deviceNum,t2.zx as zxnum,t1.* FROM t_yehuaqi_user t1
LEFT JOIN (SELECT MAX(user_id)user_id,COUNT(user_id)zs,COUNT(detector_status)zx
FROM t_yehuaqi_device GROUP BY user_id) t2 ON t1.user_id=t2.user_id
<where>
<if test="userId != null and userId != ''"> and t1.user_id = #{userId}</if>
</where>
</select>
<select id="selectTYehuaqiUserById" parameterType="Long" resultMap="TYehuaqiUserResult">
<include refid="selectTYehuaqiUserVo"/>
where user_id = #{userId}
</select>
<insert id="insertTYehuaqiUser" parameterType="TYehuaqiUser" useGeneratedKeys="true" keyProperty="userId">
insert into t_yehuaqi_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="username != null">username,</if>
<if test="nickName != null">nick_name,</if>
<if test="beyondEnterpriseId != null">beyond_enterprise_id,</if>
<if test="userType != null">user_type,</if>
<if test="address != null">address,</if>
<if test="longitude != null">longitude,</if>
<if test="latitude != null">latitude,</if>
<if test="linkman != null">linkman,</if>
<if test="phone != null">phone,</if>
<if test="email != null">email,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="isDel != null">is_del,</if>
<if test="remarks != null">remarks,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="username != null">#{username},</if>
<if test="nickName != null">#{nickName},</if>
<if test="beyondEnterpriseId != null">#{beyondEnterpriseId},</if>
<if test="userType != null">#{userType},</if>
<if test="address != null">#{address},</if>
<if test="longitude != null">#{longitude},</if>
<if test="latitude != null">#{latitude},</if>
<if test="linkman != null">#{linkman},</if>
<if test="phone != null">#{phone},</if>
<if test="email != null">#{email},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remarks != null">#{remarks},</if>
</trim>
</insert>
<update id="updateTYehuaqiUser" parameterType="TYehuaqiUser">
update t_yehuaqi_user
<trim prefix="SET" suffixOverrides=",">
<if test="username != null">username = #{username},</if>
<if test="nickName != null">nick_name = #{nickName},</if>
<if test="beyondEnterpriseId != null">beyond_enterprise_id = #{beyondEnterpriseId},</if>
<if test="userType != null">user_type = #{userType},</if>
<if test="address != null">address = #{address},</if>
<if test="longitude != null">longitude = #{longitude},</if>
<if test="latitude != null">latitude = #{latitude},</if>
<if test="linkman != null">linkman = #{linkman},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="email != null">email = #{email},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="remarks != null">remarks = #{remarks},</if>
</trim>
where user_id = #{userId}
</update>
<delete id="deleteTYehuaqiUserById" parameterType="Long">
delete from t_yehuaqi_user where user_id = #{userId}
</delete>
<delete id="deleteTYehuaqiUserByIds" parameterType="String">
delete from t_yehuaqi_user where user_id in
<foreach item="userId" collection="array" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
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