Commit a31d6cec authored by co_dengxiongwen's avatar co_dengxiongwen

场景维护,阈值维护接口,资源点树接口

parent cde2170e
......@@ -5,13 +5,14 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Objects;
/**
* @author Administrator
*/
@Data
@ApiModel(value = "资源点管理表对象", description = "资源点管理表对象")
@TableName("li_resource")
public class LiResource implements Serializable {
......@@ -33,8 +34,8 @@ public class LiResource implements Serializable {
/** 资源点编码*/
private java.lang.String code;
@ApiModelProperty(value = "资源点类型(1枪机,2球机)", name = "type")
/** 资源点类型(1枪机,2球机)*/
@ApiModelProperty(value = "资源点类型(数据字典表id)", name = "type")
/** 资源点类型(数据字典表id)*/
private java.lang.String type;
@ApiModelProperty(value = "线路id", name = "lineId")
......@@ -53,10 +54,14 @@ public class LiResource implements Serializable {
/** 站点名称*/
private java.lang.String stationName;
@ApiModelProperty(value = "站层id(li_station_map表id)", name = "tierId")
/** 站层id(li_station_map表id)*/
@ApiModelProperty(value = "区域id(li_station_map表id)", name = "tierId")
/** 区域id(li_station_map表id)*/
private java.lang.String tierId;
@ApiModelProperty(value = "场景id(li_room表id)", name = "roomId")
/** 场景id(li_room表id)*/
private java.lang.String roomId;
@ApiModelProperty(value = "子系统", name = "subSystem")
/** 子系统*/
private java.lang.String subSystem;
......
package com.devplatform.admin.modules.liresource.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* @author dxw
*/
@Data
@ApiModel(value="场景表对象",description="场景表对象")
@TableName("li_room")
public class LiRoom implements Serializable {
private static final long serialVersionUID = 1L;
/** 主键id */
@ApiModelProperty(value="主键ID",name="id")
@TableId
private java.lang.String id;
/** 所属站点 */
@ApiModelProperty(value="所属站点",name="stationId")
private java.lang.String stationId;
/** 所属区域 */
@ApiModelProperty(value="所属区域",name="mapId")
private java.lang.String mapId;
/** 名称 */
@ApiModelProperty(value="名称",name="name")
private java.lang.String name;
/** 编号 */
@ApiModelProperty(value="编号",name="code")
private java.lang.String code;
/** 创建人 */
@ApiModelProperty(value="创建人",name="createUserId")
private java.lang.String createUserId;
/** 创建时间 */
@ApiModelProperty(value="创建时间",name="createTime")
private java.util.Date createTime;
/** 修改人 */
@ApiModelProperty(value="修改人",name="updateUserId")
private java.lang.String updateUserId;
/** 修改时间 */
@ApiModelProperty(value="修改时间",name="updateTime")
private java.util.Date updateTime;
/** 是否已删除(0未删除,1已删除) */
@ApiModelProperty(value="是否已删除(0未删除,1已删除)",name="deleted")
private Integer deleted;
/** 系统标识 */
@ApiModelProperty(value="系统标识",name="sysSign")
private java.lang.String sysSign;
/** 备用项1 */
@ApiModelProperty(value="备用项1",name="byx1")
private java.lang.String byx1;
/** 备用项2 */
@ApiModelProperty(value="备用项2",name="byx2")
private java.lang.String byx2;
/** 备用项3 */
@ApiModelProperty(value="备用项3",name="byx3")
private java.lang.String byx3;
}
package com.devplatform.admin.modules.liresource.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.devplatform.admin.common.utils.AbstractController;
import com.devplatform.admin.modules.liresource.bean.LiRoom;
import com.devplatform.admin.modules.liresource.model.LiRoomModel;
import com.devplatform.admin.modules.liresource.service.LiRoomService;
import com.devplatform.common.base.annotation.SysLog;
import com.devplatform.common.base.validator.ValidatorUtils;
import com.devplatform.common.util.PageUtils;
import com.devplatform.common.util.R;
import com.devplatform.common.util.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 场景表的Controller
* <br>
* @author 代码生成器产生
*/
@Api(tags={"场景表接口"})
@RestController
@RequestMapping("/liRoom")
public class LiRoomController extends AbstractController{
@Autowired
private LiRoomService liRoomService;
/**
* 列表页面列表数据获取
* @param params 承接对象
* @return
*/
@ApiOperation(value="根据条件获取场景表分页数据列表", notes="根据条件获取场景表分页数据列表")
@ApiImplicitParam(name = "params", value = "参数", required = true, dataType = "Map<String, Object>")
@PostMapping("/list")
public R list(@RequestParam Map<String, Object> params) {
//分页查询
PageUtils page = liRoomService.queryPage(params,null);
//返回分页结果
return R.ok().put("page", page);
}
/**
* 列表页面列表数据获取
* @param model 承接对象
* @return
*/
@ApiOperation(value="根据条件获取场景表分页数据列表", notes="根据条件获取场景表分页数据列表")
@ApiImplicitParam(name = "model", value = "参数", required = true, dataType = "LiRoomModel")
@PostMapping("/pageList")
public R pageList(@RequestBody LiRoomModel model) {
//如果model参数中没有设置排序方式,则默认以创建时间倒序排列
if(StringUtil.isEmpty(model.getSort())){
model.setSort("create_time desc");
}
//按条件查询分页数据
List<LiRoom> list = liRoomService.queryPageList(model);
//将查询结果中数据和数量封装起来做为接口返回值
return R.ok().put("page", getMyPage(list,model));
}
/**
* 添加
* @param bean 场景表对象
* @return
*/
@SysLog("添加场景表")
@ApiOperation(value="新增场景表数据", notes="新增场景表数据")
@PostMapping("/save")
public R save(@RequestBody @ApiParam(value="场景表实体对象", required = true)LiRoom bean) {
ValidatorUtils.validateEntity(bean);
bean.setCreateUserId(getUserId());
bean.setCreateTime(new Date());
liRoomService.save(bean);
return R.ok();
}
/**
* 修改
* @param bean 场景表对象
* @return
*/
@SysLog("修改场景表")
@ApiOperation(value="修改场景表数据", notes="修改场景表数据")
@PostMapping("/update")
public R update(@RequestBody @ApiParam(value="场景表实体对象", required = true)LiRoom bean) {
ValidatorUtils.validateEntity(bean);
bean.setUpdateUserId(getUserId());
bean.setUpdateTime(new Date());
liRoomService.update(bean,
new QueryWrapper<LiRoom>().eq(StringUtil.checkNotNull(bean.getId()),"id", bean.getId()));
return R.ok();
}
/**
* 根据ID获取场景表对象
* @param id 对象主键
* @return
*/
@ApiOperation(value="根据ID获取场景表对象", notes="根据ID获取场景表对象")
@ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "String")
@GetMapping("/getId/{id}")
public R getId(@PathVariable String id) {
LiRoom bean = liRoomService.getById(id);
return R.ok().put("bean", bean);
}
/**
* 根据ID获取场景表对象
* @param ids 场景表对象主键数组
* @return
*/
@SysLog("删除场景表数据")
@ApiOperation(value="根据ID批量删除场景表数据", notes="根据ID批量删除场景表数据")
@ApiImplicitParam(name = "ids", value = "主键数组", required = true, dataType = "String")
@PostMapping("/delete")
public R delete(@RequestBody String[] ids) {
liRoomService.removeByIds(Arrays.asList(ids));
return R.ok();
}
/**
* 逻辑删除
* 根据ID删除场景表对象
* @param ids 场景表对象主键数组
* @return
*/
@SysLog("删除场景表数据")
@ApiOperation(value="根据ID批量删除场景表数据", notes="根据ID批量删除场景表数据")
@ApiImplicitParam(name = "ids", value = "主键数组", required = true, dataType = "String[]")
@PostMapping("/deleteByFlag")
public R deleteByFlag(@RequestBody String[] ids) {
//根据id数组删除
liRoomService.deleteByFlagByIds(ids, getUserId());
//返回成功
return R.ok();
}
}
package com.devplatform.admin.modules.liresource.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.devplatform.admin.common.annotation.SysLogMethod;
import com.devplatform.admin.common.utils.AbstractController;
import com.devplatform.admin.common.utils.SftpUtil;
import com.devplatform.admin.common.utils.Constants;
import com.devplatform.admin.modules.liresource.bean.LiStationMap;
import com.devplatform.admin.modules.liresource.model.LiStationMapModel;
import com.devplatform.admin.modules.liresource.service.LiResourceService;
import com.devplatform.admin.modules.liresource.service.LiStationMapService;
import com.devplatform.admin.modules.sys.bean.SysFileDatasource;
import com.devplatform.admin.modules.sys.bean.SysSynchFilelog;
import com.devplatform.admin.modules.sys.model.SysFileDatasourceModel;
import com.devplatform.admin.modules.sys.service.SysFileDatasourceService;
import com.devplatform.admin.modules.sys.service.SysOssService;
import com.devplatform.admin.modules.sys.service.SysSynchFilelogService;
import com.devplatform.common.base.validator.ValidatorUtils;
import com.devplatform.common.util.PageUtils;
import com.devplatform.common.util.R;
import com.devplatform.common.util.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* @author Administrator
*/
......@@ -49,30 +35,24 @@ import org.springframework.web.multipart.MultipartFile;
public class LiStationMapController extends AbstractController {
@Autowired private LiStationMapService liStationMapService;
@Autowired private SysOssService sysOssService;
@Autowired private LiResourceService liResourceService;
@Autowired private SysFileDatasourceService sysFileDatasourceService;
@Autowired private SysSynchFilelogService sysSynchFilelogService;
@Value("${upload.realBaseDir}")
private String realBaseDir;
/**
* 列表页面列表数据获取
*
* @param params 承接对象
* @param model 承接对象
* @return
*/
@ApiOperation(value = "根据条件获取线路站点地图附件表分页数据列表", notes = "根据条件获取线路站点地图附件表分页数据列表")
@ApiOperation(value = "根据条件获取线路站点地图附件表数据列表", notes = "根据条件获取线路站点地图附件表数据列表")
@ApiImplicitParam(
name = "params",
name = "model",
value = "参数",
required = true,
dataType = "Map<String, Object>")
dataType = "LiRoomModel")
@PostMapping("/list")
public R list(@RequestParam Map<String, Object> params) {
PageUtils page = liStationMapService.queryPage(params, null);
return R.ok().put("page", page);
public R list(@RequestBody LiStationMapModel model) {
List<LiStationMap> list = liStationMapService.list(new LambdaQueryWrapper<LiStationMap>().eq(LiStationMap::getDeleted, Constants.INT_0)
.eq(LiStationMap::getStationId,model.getStationId()).orderByAsc(LiStationMap::getOrderNum));
return R.ok().put("list", list);
}
/**
......@@ -195,46 +175,6 @@ public class LiStationMapController extends AbstractController {
} catch (Exception e) {
e.printStackTrace();
}
try {
String childPath = savePath.substring(0, savePath.lastIndexOf("/"));
// 站点系统同步到线路系统
SysFileDatasourceModel model = new SysFileDatasourceModel();
List<SysFileDatasource> list = sysFileDatasourceService.queryList(model);
for (SysFileDatasource datasource : list) {
// type类型 1:站点 2:线路 3:线网
String sysType = getUser().getSysSystem().getType();
// 不等于当前站点
if (!String.valueOf(datasource.getType()).equals(sysType)) {
File fileNew = new File(realBaseDir + savePath);
try {
InputStream inputStream = new FileInputStream(fileNew);
SftpUtil.uploadFile(datasource.getUsername(),datasource.getPassword(),datasource.getIp(),22,realBaseDir,childPath,fileNew.getName(),null,inputStream);
System.out.println("站点地图上传成功====");
} catch (Exception e) {
System.out.println("站点地图上传失败====");
SysSynchFilelog filelog = new SysSynchFilelog();
filelog.setChildrenPath(childPath);
filelog.setUsername(datasource.getUsername());
filelog.setPassword(datasource.getPassword());
filelog.setIp(datasource.getIp());
filelog.setRealbasePath(realBaseDir);
filelog.setFileName(fileNew.getName());
// 失败
filelog.setState(2);
filelog.setDeleted(0);
filelog.setSysSign(getUser().getSysSystem().getCode());
filelog.setStationId(stationId);
filelog.setCreateTime(new Date());
filelog.setCreateUserId(getUserId());
filelog.setByx1("站点地图上传失败");
sysSynchFilelogService.save(filelog);
e.printStackTrace();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return R.ok().put("bean", stationMap).put("path", path);
}
}
package com.devplatform.admin.modules.liresource.dao;
import org.apache.ibatis.annotations.Mapper;
import com.devplatform.admin.modules.liresource.model.LiRoomModel;
import com.devplatform.admin.modules.liresource.bean.LiRoom;
import com.devplatform.common.dao.MyBaseMapper;
import java.util.List;
/**
* LiRoom Mapper
* 用于场景表的数据库操作
* @author 代码生成器产生
*
*/
@Mapper
public interface LiRoomDao extends MyBaseMapper<LiRoom> {
/**
* 查询分页数量
* @param model
* @return
*/
Integer queryPageByCount(LiRoomModel model);
/**
* 查询场景表分页数据
* @param model
* @return
*/
List<LiRoom> queryPageList(LiRoomModel model);
}
package com.devplatform.admin.modules.liresource.model;
import com.devplatform.admin.common.model.BaseModel;
import lombok.Data;
import java.util.List;
/**
......@@ -8,6 +10,7 @@ import java.util.List;
*
* @author 代码生成器产生
*/
@Data
public class LiResourceModel extends BaseModel {
/** 主键id*/
......@@ -27,7 +30,9 @@ public class LiResourceModel extends BaseModel {
/** 站点名称*/
private java.lang.String stationName;
/** 站层id(li_station_map表id)*/
private java.lang.String tierId;
private java.lang.String tierId;
/** 场景id(li_room表id)*/
private java.lang.String roomId;
/** 子系统*/
private java.lang.String subSystem;
/** 子系统资源编码*/
......
package com.devplatform.admin.modules.liresource.model;
import com.devplatform.admin.common.model.BaseModel;
import lombok.Data;
/**
* 场景表的Model
* <br>
* @author 代码生成器产生
*/
@Data
public class LiRoomModel extends BaseModel {
/** 主键id */
private java.lang.String id;
/** 所属站点 */
private java.lang.String stationId;
/** 所属区域 */
private java.lang.String mapId;
/** 名称 */
private java.lang.String name;
/** 编号 */
private java.lang.String code;
/** 创建人 */
private java.lang.String createUserId;
/** 创建时间 */
private java.util.Date createTime;
/** 修改人 */
private java.lang.String updateUserId;
/** 修改时间 */
private java.util.Date updateTime;
/** 是否已删除(0未删除,1已删除) */
private Integer deleted;
/** 系统标识 */
private java.lang.String sysSign;
/** 备用项1 */
private java.lang.String byx1;
/** 备用项2 */
private java.lang.String byx2;
/** 备用项3 */
private java.lang.String byx3;
}
package com.devplatform.admin.modules.liresource.service;
import com.devplatform.common.service.MyBaseService;
import com.devplatform.admin.modules.liresource.bean.LiRoom;
import com.devplatform.admin.modules.liresource.model.LiRoomModel;
import java.util.List;
/**
* 场景表的service接口
* <br>
* <b>功能:</b>LiRoomService<br>
* @author 代码生成器产生
*/
public interface LiRoomService extends MyBaseService<LiRoom> {
/**
* 查询场景表分页数据
* @param model
* @return
*/
List<LiRoom> queryPageList(LiRoomModel model);
/**
* 根据ID删除场景表对象
* @param ids
* @param userId
* @return void
*/
void deleteByFlagByIds(String[] ids, String userId);
}
package com.devplatform.admin.modules.liresource.service.impl;
import org.springframework.stereotype.Service;
import com.devplatform.admin.modules.liresource.model.LiRoomModel;
import com.devplatform.admin.modules.liresource.bean.LiRoom;
import com.devplatform.admin.modules.liresource.dao.LiRoomDao;
import com.devplatform.admin.modules.liresource.service.LiRoomService;
import com.devplatform.common.service.impl.MyBaseServiceImpl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 场景表的service接口实现类
* <br>
* <b>功能:</b>LiRoomServiceImpl<br>
* @author 代码生成器产生
*/
@Service("liRoomService")
public class LiRoomServiceImpl extends MyBaseServiceImpl<LiRoomDao, LiRoom> implements LiRoomService {
@Override
public List<LiRoom> queryPageList(LiRoomModel model) {
Integer rowCount = baseMapper.queryPageByCount(model);
model.getPager().setRowCount(rowCount);
return baseMapper.queryPageList(model);
}
@Override
public void deleteByFlagByIds(String[] ids, String userId){
//用来暂存所有要删除的对象
List<LiRoom> beans = new ArrayList<LiRoom>();
//遍历ids数组
for(String id: ids){
LiRoom temp = new LiRoom();
temp.setId(id);
//将数据标记为删除
temp.setDeleted(1);
temp.setUpdateUserId(userId);
temp.setUpdateTime(new Date());
//将要删除的对象存放在list中
beans.add(temp);
}
//调用批量更新操作
updateBatchById(beans);
}
}
package com.devplatform.admin.modules.sys.bean;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @author dxw
*/
@Data
@ApiModel(value="系统阈值配置表对象",description="系统阈值配置表对象")
@TableName("sys_threshold")
public class SysThreshold implements Serializable {
private static final long serialVersionUID = 1L;
/** 主键id */
@ApiModelProperty(value="主键ID",name="id")
@TableId
private java.lang.String id;
/** 资源点类型(数据字典表id) */
@ApiModelProperty(value="资源点类型(数据字典表id)",name="dicId")
private java.lang.String dicId;
/** 类型(1:压力 2:温度 3:水位) */
@ApiModelProperty(value="类型(1:压力 2:温度 3:水位)",name="type")
private Integer type;
/** 参数描述 */
@ApiModelProperty(value="参数描述",name="remark")
private java.lang.String remark;
/** 最小值 */
@ApiModelProperty(value="最小值",name="minValue")
private java.lang.String minValue;
/** 最大值 */
@ApiModelProperty(value="最大值",name="maxValue")
private java.lang.String maxValue;
/** 参数说明 */
@ApiModelProperty(value="参数说明",name="introduction")
private java.lang.String introduction;
/** 状态(1正常,0不可用) */
@ApiModelProperty(value="状态(1正常,0不可用)",name="status")
private Integer status;
/** 创建人 */
@ApiModelProperty(value="创建人",name="createUserId")
private java.lang.String createUserId;
/** 创建时间 */
@ApiModelProperty(value="创建时间",name="createTime")
private java.util.Date createTime;
/** 修改人 */
@ApiModelProperty(value="修改人",name="updateUserId")
private java.lang.String updateUserId;
/** 修改时间 */
@ApiModelProperty(value="修改时间",name="updateTime")
private java.util.Date updateTime;
/** 是否已删除(0未删除,1已删除) */
@ApiModelProperty(value="是否已删除(0未删除,1已删除)",name="deleted")
private Integer deleted;
/** 系统标识 */
@ApiModelProperty(value="系统标识",name="sysSign")
private java.lang.String sysSign;
/** 站点ID */
@ApiModelProperty(value="站点ID",name="stationId")
private java.lang.String stationId;
/** 备用项1 */
@ApiModelProperty(value="备用项1",name="byx1")
private java.lang.String byx1;
/** 备用项2 */
@ApiModelProperty(value="备用项2",name="byx2")
private java.lang.String byx2;
/** 备用项3 */
@ApiModelProperty(value="备用项3",name="byx3")
private java.lang.String byx3;
@TableField(exist = false)
/** 设备类型名称*/
private String dicName;
}
package com.devplatform.admin.modules.sys.controller;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import com.devplatform.admin.modules.sys.bean.SysThreshold;
import com.devplatform.admin.modules.sys.model.SysThresholdModel;
import com.devplatform.admin.modules.sys.service.SysThresholdService;
import com.devplatform.admin.modules.sys.bean.SysUserEntity;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.devplatform.common.base.annotation.SysLog;
import com.devplatform.common.base.validator.ValidatorUtils;
import com.devplatform.common.util.HtmlUtil;
import com.devplatform.admin.common.utils.AbstractController;
import com.devplatform.common.util.PageUtils;
import com.devplatform.common.util.R;
import com.devplatform.common.util.StringUtil;
/**
* <br>
* <b>功能:</b>SysThresholdController<br>
* @author 代码生成器产生
*/
@Api(tags={"系统阈值配置表接口"})
@RestController
@RequestMapping("/sysThreshold")
public class SysThresholdController extends AbstractController{
@Autowired
private SysThresholdService sysThresholdService;
/**
* 列表页面列表数据获取
* @param params 承接对象
* @return
*/
@ApiOperation(value="根据条件获取系统阈值配置表分页数据列表", notes="根据条件获取系统阈值配置表分页数据列表")
@ApiImplicitParam(name = "params", value = "参数", required = true, dataType = "Map<String, Object>")
@PostMapping("/list")
public R list(@RequestParam Map<String, Object> params) {
//分页查询
PageUtils page = sysThresholdService.queryPage(params,null);
//返回分页结果
return R.ok().put("page", page);
}
/**
* 列表页面列表数据获取
* @param model 承接对象
* @return
*/
@ApiOperation(value="根据条件获取系统阈值配置表分页数据列表", notes="根据条件获取系统阈值配置表分页数据列表")
@ApiImplicitParam(name = "model", value = "参数", required = true, dataType = "SysThresholdModel")
@PostMapping("/pageList")
public R pageList(@RequestBody SysThresholdModel model) {
//如果model参数中没有设置排序方式,则默认以创建时间倒序排列
if(StringUtil.isEmpty(model.getSort())){
model.setSort("create_time desc");
}
//按条件查询分页数据
List<SysThreshold> list = sysThresholdService.queryPageList(model);
//将查询结果中数据和数量封装起来做为接口返回值
return R.ok().put("page", getMyPage(list,model));
}
/**
* 添加
* @param bean 系统阈值配置表对象
* @return
*/
@SysLog("添加系统阈值配置表")
@ApiOperation(value="新增系统阈值配置表数据", notes="新增系统阈值配置表数据")
@PostMapping("/save")
public R save(@RequestBody @ApiParam(value="系统阈值配置表实体对象", required = true)SysThreshold bean) {
ValidatorUtils.validateEntity(bean);
bean.setCreateUserId(getUserId());
bean.setCreateTime(new Date());
sysThresholdService.save(bean);
return R.ok();
}
/**
* 修改
* @param bean 系统阈值配置表对象
* @return
*/
@SysLog("修改系统阈值配置表")
@ApiOperation(value="修改系统阈值配置表数据", notes="修改系统阈值配置表数据")
@PostMapping("/update")
public R update(@RequestBody @ApiParam(value="系统阈值配置表实体对象", required = true)SysThreshold bean) {
ValidatorUtils.validateEntity(bean);
bean.setUpdateUserId(getUserId());
bean.setUpdateTime(new Date());
sysThresholdService.update(bean,
new QueryWrapper<SysThreshold>().eq(StringUtil.checkNotNull(bean.getId()),"id", bean.getId()));
return R.ok();
}
/**
* 根据ID获取系统阈值配置表对象
* @param id 对象主键
* @return
*/
@ApiOperation(value="根据ID获取系统阈值配置表对象", notes="根据ID获取系统阈值配置表对象")
@ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "String")
@GetMapping("/getId/{id}")
public R getId(@PathVariable String id) {
SysThreshold bean = sysThresholdService.getById(id);
return R.ok().put("bean", bean);
}
/**
* 根据ID获取系统阈值配置表对象
* @param ids 系统阈值配置表对象主键数组
* @return
*/
@SysLog("删除系统阈值配置表数据")
@ApiOperation(value="根据ID批量删除系统阈值配置表数据", notes="根据ID批量删除系统阈值配置表数据")
@ApiImplicitParam(name = "ids", value = "主键数组", required = true, dataType = "String")
@PostMapping("/delete")
public R delete(@RequestBody String[] ids) {
sysThresholdService.removeByIds(Arrays.asList(ids));
return R.ok();
}
/**
* 逻辑删除
* 根据ID删除系统阈值配置表对象
* @param ids 系统阈值配置表对象主键数组
* @return
*/
@SysLog("删除系统阈值配置表数据")
@ApiOperation(value="根据ID批量删除系统阈值配置表数据", notes="根据ID批量删除系统阈值配置表数据")
@ApiImplicitParam(name = "ids", value = "主键数组", required = true, dataType = "String[]")
@PostMapping("/deleteByFlag")
public R deleteByFlag(@RequestBody String[] ids) {
//根据id数组删除
sysThresholdService.deleteByFlagByIds(ids, getUserId());
//返回成功
return R.ok();
}
}
package com.devplatform.admin.modules.sys.dao;
import org.apache.ibatis.annotations.Mapper;
import com.devplatform.admin.modules.sys.model.SysThresholdModel;
import com.devplatform.admin.modules.sys.bean.SysThreshold;
import com.devplatform.common.dao.MyBaseMapper;
import java.util.List;
/**
* SysThreshold Mapper
* 用于系统阈值配置表的数据库操作
* @author Administrator
*
*/
@Mapper
public interface SysThresholdDao extends MyBaseMapper<SysThreshold> {
/**
* 查询分页数量
* @param model
* @return
*/
Integer queryPageByCount(SysThresholdModel model);
/**
* 查询系统阈值配置表分页数据
* @param model
* @return
*/
List<SysThreshold> queryPageList(SysThresholdModel model);
}
package com.devplatform.admin.modules.sys.model;
import com.devplatform.admin.common.model.BaseModel;
import lombok.Data;
/**
* 系统阈值配置表的Model
* <br>
* @author 代码生成器产生
*/
@Data
public class SysThresholdModel extends BaseModel {
/** 主键id */
private java.lang.String id;
/** 资源点类型(数据字典表id) */
private java.lang.String dicId;
/** 类型(1:压力 2:温度 3:水位) */
private Integer type;
/** 参数描述 */
private java.lang.String remark;
/** 最小值 */
private java.lang.String minValue;
/** 最大值 */
private java.lang.String maxValue;
/** 参数说明 */
private java.lang.String introduction;
/** 状态(1正常,0不可用) */
private Integer status;
/** 创建人 */
private java.lang.String createUserId;
/** 创建时间 */
private java.util.Date createTime;
/** 修改人 */
private java.lang.String updateUserId;
/** 修改时间 */
private java.util.Date updateTime;
/** 是否已删除(0未删除,1已删除) */
private Integer deleted;
/** 系统标识 */
private java.lang.String sysSign;
/** 站点ID */
private java.lang.String stationId;
/** 备用项1 */
private java.lang.String byx1;
/** 备用项2 */
private java.lang.String byx2;
/** 备用项3 */
private java.lang.String byx3;
}
package com.devplatform.admin.modules.sys.service;
import com.devplatform.common.service.MyBaseService;
import com.devplatform.admin.modules.sys.bean.SysThreshold;
import com.devplatform.admin.modules.sys.model.SysThresholdModel;
import java.util.List;
/**
* 系统阈值配置表的service接口
* <br>
* <b>功能:</b>SysThresholdService<br>
* @author 代码生成器产生
*/
public interface SysThresholdService extends MyBaseService<SysThreshold> {
/**
* 查询系统阈值配置表分页数据
* @param model
* @return
*/
List<SysThreshold> queryPageList(SysThresholdModel model);
/**
* 根据ID删除系统阈值配置表对象
* @param ids
* @param userId
* @return void
*/
void deleteByFlagByIds(String[] ids, String userId);
}
package com.devplatform.admin.modules.sys.service.impl;
import org.springframework.stereotype.Service;
import com.devplatform.admin.modules.sys.model.SysThresholdModel;
import com.devplatform.admin.modules.sys.bean.SysThreshold;
import com.devplatform.admin.modules.sys.dao.SysThresholdDao;
import com.devplatform.admin.modules.sys.service.SysThresholdService;
import com.devplatform.common.service.impl.MyBaseServiceImpl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 系统阈值配置表的service接口实现类
* <br>
* <b>功能:</b>SysThresholdServiceImpl<br>
* @author 代码生成器产生
*/
@Service("sysThresholdService")
public class SysThresholdServiceImpl extends MyBaseServiceImpl<SysThresholdDao, SysThreshold> implements SysThresholdService {
@Override
public List<SysThreshold> queryPageList(SysThresholdModel model) {
Integer rowCount = baseMapper.queryPageByCount(model);
model.getPager().setRowCount(rowCount);
return baseMapper.queryPageList(model);
}
@Override
public void deleteByFlagByIds(String[] ids, String userId){
//用来暂存所有要删除的对象
List<SysThreshold> beans = new ArrayList<SysThreshold>();
//遍历ids数组
for(String id: ids){
SysThreshold temp = new SysThreshold();
temp.setId(id);
//将数据标记为删除
temp.setDeleted(1);
temp.setUpdateUserId(userId);
temp.setUpdateTime(new Date());
//将要删除的对象存放在list中
beans.add(temp);
}
//调用批量更新操作
updateBatchById(beans);
}
}
#######################mysql c3p0 DataSource################################
gpt.url=jdbc:mysql://mysql5.7:3306/crsf
gpt.url=jdbc:mysql://10.20.72.31:3306/zhxf
#gpt.username=root
#gpt.password=superAdmin&321
gpt.minPoolSize=10
......@@ -9,9 +9,9 @@ gpt.acquireIncrement=3
gpt.maxIdleTime=60
gpt.initialPoolSize=10
#gpt.devPath=/Users/suochaochao/Work/sjw-cloud/microservice-spring-cloud/microservice-admin/
gpt.java.devPath=D:\\ck_work\\Suntray\\crsh_java\\microservice-admin\\src\\main\\java\\com\\devplatform\\admin\\modules\\
gpt.xml.devPath=D:\\ck_work\\Suntray\\crsh_java\\microservice-admin\\src\\main\\resources\\
gpt.template.devPath=D:\\ck_work\\Suntray\\crsh_java\\microservice-admin\\src\\main\\resources\\
gpt.java.devPath=D:\\Git20210308\\zhxf_java\\microservice-admin\\src\\main\\java\\com\\devplatform\\admin\\modules\\
gpt.xml.devPath=D:\\Git20210308\\zhxf_java\\microservice-admin\\src\\main\\resources\\
gpt.template.devPath=D:\\Git20210308\\zhxf_java\\microservice-admin\\src\\main\\resources\\
#gpt.java.devPath=G:\\environment\\test\\
#gpt.xml.devPath=G:\\environment\\test\\
gpt.pfix=t_
\ No newline at end of file
......@@ -12,6 +12,7 @@
<result column="station_id" property="stationId"/>
<result column="station_name" property="stationName"/>
<result column="tier_id" property="tierId"/>
<result column="room_Id" property="roomId"/>
<result column="sub_system" property="subSystem"/>
<result column="sub_code" property="subCode"/>
<result column="address_code" property="addressCode"/>
......@@ -48,7 +49,7 @@
<!-- li_resource table all fields -->
<sql id="Base_Column_List">
id,name,code,type,line_id,line_name,station_id,station_name,tier_id,sub_system,sub_code,address_code,port,ajj_port,username,password,xpoint,ypoint,width,rotate,deploy_location,operator_id,operator_name,attached_info,remark,icon,parent_name,sys_sign,status,deleted,create_user_id,create_time,update_user_id,update_time,byx1,byx2,byx3,brand,xlongit,ylat,image_src
id,name,code,type,line_id,line_name,station_id,station_name,tier_id,room_Id,sub_system,sub_code,address_code,port,ajj_port,username,password,xpoint,ypoint,width,rotate,deploy_location,operator_id,operator_name,attached_info,remark,icon,parent_name,sys_sign,status,deleted,create_user_id,create_time,update_user_id,update_time,byx1,byx2,byx3,brand,xlongit,ylat,image_src
</sql>
<!-- 公共查询条件 -->
......@@ -63,6 +64,7 @@
<if test="stationId!=null and stationId!=''">and station_id = #{stationId}</if>
<if test="stationName!=null and stationName!=''">and station_name = #{stationName}</if>
<if test="tierId!=null and tierId!=''">and tier_id = #{tierId}</if>
<if test="roomId!=null and roomId!=''">and room_Id = #{roomId}</if>
<if test="subSystem!=null and subSystem!=''">and sub_system = #{subSystem}</if>
<if test="subCode!=null and subCode!=''">and sub_code = #{subCode}</if>
<if test="addressCode!=null and addressCode!=''">and address_code = #{addressCode}</if>
......@@ -120,6 +122,7 @@
<if test="stationId!=null and stationId!=''">and station_id = #{stationId}</if>
<if test="stationName!=null and stationName!=''">and station_name = #{stationName}</if>
<if test="tierId!=null and tierId!=''">and tier_id = #{tierId}</if>
<if test="roomId!=null and roomId!=''">and room_id = #{roomId}</if>
<if test="subSystem!=null and subSystem!=''">and sub_system = #{subSystem}</if>
<if test="subCode!=null and subCode!=''">and sub_code = #{subCode}</if>
<if test="addressCode!=null and addressCode!=''">and address_code = #{addressCode}</if>
......@@ -167,6 +170,7 @@
<if test="stationId!=null and stationId!=''">and li.station_id = #{stationId}</if>
<if test="stationName!=null and stationName!=''">and li.station_name = #{stationName}</if>
<if test="tierId!=null and tierId!=''">and li.tier_id = #{tierId}</if>
<if test="roomId!=null and roomId!=''">and li.room_id = #{roomId}</if>
<if test="subSystem!=null and subSystem!=''">and li.sub_system = #{subSystem}</if>
<if test="subCode!=null and subCode!=''">and li.sub_code = #{subCode}</if>
<if test="addressCode!=null and addressCode!=''">and li.address_code = #{addressCode}</if>
......
<?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.devplatform.admin.modules.liresource.dao.LiRoomDao">
<!-- Result Map -->
<resultMap id="BaseResultMap" type="com.devplatform.admin.modules.liresource.bean.LiRoom">
<result column="id" property="id"/>
<result column="station_id" property="stationId"/>
<result column="map_id" property="mapId"/>
<result column="name" property="name"/>
<result column="code" property="code"/>
<result column="create_user_id" property="createUserId"/>
<result column="create_time" property="createTime"/>
<result column="update_user_id" property="updateUserId"/>
<result column="update_time" property="updateTime"/>
<result column="deleted" property="deleted"/>
<result column="sys_sign" property="sysSign"/>
<result column="byx1" property="byx1"/>
<result column="byx2" property="byx2"/>
<result column="byx3" property="byx3"/>
</resultMap>
<!-- li_room table all fields -->
<sql id="Base_Column_List">
id,station_id,map_id,name,code,create_user_id,create_time,update_user_id,update_time,deleted,sys_sign,byx1,byx2,byx3
</sql>
<!-- 公共查询条件 -->
<sql id="Example_Where_Clause">
where t.deleted=0
<if test="id!=null and id!=''">and t.id = #{id}</if>
<if test="stationId!=null and stationId!=''">and t.station_id = #{stationId}</if>
<if test="mapId!=null and mapId!=''">and t.map_id = #{mapId}</if>
<if test="name!=null and name!=''">and t.name = #{name}</if>
<if test="code!=null and code!=''">and t.code = #{code}</if>
<if test="createUserId!=null and createUserId!=''">and t.create_user_id = #{createUserId}</if>
<if test="createTime!=null ">and t.create_time = #{createTime}</if>
<if test="updateUserId!=null and updateUserId!=''">and t.update_user_id = #{updateUserId}</if>
<if test="updateTime!=null ">and t.update_time = #{updateTime}</if>
<if test="deleted!=null ">and t.deleted = #{deleted}</if>
<if test="sysSign!=null and sysSign!=''">and t.sys_sign = #{sysSign}</if>
<if test="byx1!=null and byx1!=''">and t.byx1 = #{byx1}</if>
<if test="byx2!=null and byx2!=''">and t.byx2 = #{byx2}</if>
<if test="byx3!=null and byx3!=''">and t.byx3 = #{byx3}</if>
</sql>
<select id="queryPageByCount" parameterType="Object" resultType="java.lang.Integer">
select count(1) from li_room t
<include refid="Example_Where_Clause"/>
</select>
<select id="queryPageList" parameterType="Object" resultMap="BaseResultMap">
select t.* from li_room t
<include refid="Example_Where_Clause"/>
<if test="pager.orderCondition != null and pager.orderCondition != ''">
${pager.orderCondition}
</if>
<if test="pager.mysqlQueryCondition != null and pager.mysqlQueryCondition != ''">
${pager.mysqlQueryCondition}
</if>
</select>
</mapper>
<?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.devplatform.admin.modules.sys.dao.SysThresholdDao">
<!-- Result Map -->
<resultMap id="BaseResultMap" type="com.devplatform.admin.modules.sys.bean.SysThreshold">
<result column="id" property="id"/>
<result column="dic_id" property="dicId"/>
<result column="type" property="type"/>
<result column="remark" property="remark"/>
<result column="min_value" property="minValue"/>
<result column="max_value" property="maxValue"/>
<result column="introduction" property="introduction"/>
<result column="status" property="status"/>
<result column="create_user_id" property="createUserId"/>
<result column="create_time" property="createTime"/>
<result column="update_user_id" property="updateUserId"/>
<result column="update_time" property="updateTime"/>
<result column="deleted" property="deleted"/>
<result column="sys_sign" property="sysSign"/>
<result column="station_id" property="stationId"/>
<result column="byx1" property="byx1"/>
<result column="byx2" property="byx2"/>
<result column="byx3" property="byx3"/>
</resultMap>
<!-- sys_threshold table all fields -->
<sql id="Base_Column_List">
id,dic_id,type,remark,min_value,max_value,introduction,status,create_user_id,create_time,update_user_id,update_time,deleted,sys_sign,station_id,byx1,byx2,byx3
</sql>
<!-- 公共查询条件 -->
<sql id="Example_Where_Clause">
where t.deleted=0
<if test="id!=null and id!=''">and t.id = #{id}</if>
<if test="dicId!=null and dicId!=''">and t.dic_id = #{dicId}</if>
<if test="type!=null ">and t.type = #{type}</if>
<if test="remark!=null and remark!=''">and t.remark = #{remark}</if>
<if test="minValue!=null and minValue!=''">and t.min_value = #{minValue}</if>
<if test="maxValue!=null and maxValue!=''">and t.max_value = #{maxValue}</if>
<if test="introduction!=null and introduction!=''">and t.introduction = #{introduction}</if>
<if test="status!=null ">and t.status = #{status}</if>
<if test="createUserId!=null and createUserId!=''">and t.create_user_id = #{createUserId}</if>
<if test="createTime!=null ">and t.create_time = #{createTime}</if>
<if test="updateUserId!=null and updateUserId!=''">and t.update_user_id = #{updateUserId}</if>
<if test="updateTime!=null ">and t.update_time = #{updateTime}</if>
<if test="deleted!=null ">and t.deleted = #{deleted}</if>
<if test="sysSign!=null and sysSign!=''">and t.sys_sign = #{sysSign}</if>
<if test="stationId!=null and stationId!=''">and t.station_id = #{stationId}</if>
<if test="byx1!=null and byx1!=''">and t.byx1 = #{byx1}</if>
<if test="byx2!=null and byx2!=''">and t.byx2 = #{byx2}</if>
<if test="byx3!=null and byx3!=''">and t.byx3 = #{byx3}</if>
</sql>
<select id="queryPageByCount" parameterType="Object" resultType="java.lang.Integer">
select count(1) from sys_threshold t
<include refid="Example_Where_Clause"/>
</select>
<select id="queryPageList" parameterType="Object" resultMap="BaseResultMap">
select t.* from sys_threshold t
<include refid="Example_Where_Clause"/>
<if test="pager.orderCondition != null and pager.orderCondition != ''">
${pager.orderCondition}
</if>
<if test="pager.mysqlQueryCondition != null and pager.mysqlQueryCondition != ''">
${pager.mysqlQueryCondition}
</if>
</select>
</mapper>
......@@ -7,43 +7,24 @@ import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@ApiModel(value="${bean.tableRemark}对象",description="${bean.tableRemark}对象")
@TableName("${bean.tableName}")
public class ${bean.className} implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
<#list bean.fields as field>
<#if field.fieldJavaName == "id">
/** ${field.fieldRemark} */
@ApiModelProperty(value="主键ID",name="${field.fieldJavaName}")
@TableId
/**
* ${field.fieldRemark}
*/
private ${field.fieldJavaType} ${field.fieldJavaName};
<#else >
/** ${field.fieldRemark} */
@ApiModelProperty(value="${field.fieldRemark}",name="${field.fieldJavaName}")
/**
* ${field.fieldRemark}
*/
private ${field.fieldJavaType} ${field.fieldJavaName};
</#if>
</#list>
<#list bean.fields as field>
/**
* ${field.fieldRemark}的getter方法
*/
public ${field.fieldJavaType} ${field.getMethodName}(){
return ${field.fieldJavaName};
}
/**
* ${field.fieldRemark}的setter方法
*/
public void ${field.setMethodName}(${field.fieldJavaType} ${field.fieldJavaName}){
this.${field.fieldJavaName} = ${field.fieldJavaName};
}
</#list>
}
......@@ -38,8 +38,6 @@ import com.devplatform.common.util.R;
import com.devplatform.common.util.StringUtil;
/**
* @author Administrator
* ${bean.tableRemark}的Controller
* <br>
* <b>功能:</b>${bean.className}Controller<br>
* @author 代码生成器产生
......@@ -49,22 +47,41 @@ import com.devplatform.common.util.StringUtil;
@RequestMapping("/${bean.lowerName}")
public class ${bean.className}Controller extends AbstractController{
@Autowired
private ${bean.className}Service ${bean.lowerName}Service;
private ${bean.className}Service ${bean.lowerName}Service;
/**
* 列表页面列表数据获取
* @param model 承接对象
* @param params 承接对象
* @return
*/
@ApiOperation(value="根据条件获取${bean.tableRemark}分页数据列表", notes="根据条件获取${bean.tableRemark}分页数据列表")
@ApiImplicitParam(name = "model", value = "参数", required = true, dataType = "${bean.className}Model")
@ApiOperation(value="根据条件获取${bean.tableRemark}分页数据列表", notes="根据条件获取${bean.tableRemark}分页数据列表")
@ApiImplicitParam(name = "params", value = "参数", required = true, dataType = "Map<String, Object>")
@PostMapping("/list")
public R list(@RequestBody ${bean.className}Model model) {
public R list(@RequestParam Map<String, Object> params) {
//分页查询
PageUtils page = ${bean.lowerName}Service.queryPage(params,null);
//返回分页结果
return R.ok().put("page", page);
}
/**
* 列表页面列表数据获取
* @param model 承接对象
* @return
*/
@ApiOperation(value="根据条件获取${bean.tableRemark}分页数据列表", notes="根据条件获取${bean.tableRemark}分页数据列表")
@ApiImplicitParam(name = "model", value = "参数", required = true, dataType = "${bean.className}Model")
@PostMapping("/pageList")
public R pageList(@RequestBody ${bean.className}Model model) {
//如果model参数中没有设置排序方式,则默认以创建时间倒序排列
if(StringUtil.isEmpty(model.getSort())){
model.setSort("create_time desc");
}
//按条件查询分页数据
List<${bean.className}> list = ${bean.lowerName}Service.queryPageList(model);
return R.ok().put("page", getMyPage(list, model));
//将查询结果中数据和数量封装起来做为接口返回值
return R.ok().put("page", getMyPage(list,model));
}
/**
......@@ -79,7 +96,6 @@ public class ${bean.className}Controller extends AbstractController{
ValidatorUtils.validateEntity(bean);
bean.setCreateUserId(getUserId());
bean.setCreateTime(new Date());
bean.setSysSign(getUser().getSysSystem().getCode());
${bean.lowerName}Service.save(bean);
return R.ok();
}
......@@ -94,7 +110,8 @@ public class ${bean.className}Controller extends AbstractController{
@PostMapping("/update")
public R update(@RequestBody @ApiParam(value="${bean.tableRemark}实体对象", required = true)${bean.className} bean) {
ValidatorUtils.validateEntity(bean);
bean.setSysSign(getUser().getSysSystem().getCode());
bean.setUpdateUserId(getUserId());
bean.setUpdateTime(new Date());
${bean.lowerName}Service.update(bean,
new QueryWrapper<${bean.className}>().eq(StringUtil.checkNotNull(bean.getId()),"id", bean.getId()));
return R.ok();
......@@ -113,14 +130,13 @@ public class ${bean.className}Controller extends AbstractController{
return R.ok().put("bean", bean);
}
/**
* 根据ID获取${bean.tableRemark}对象
* @param id[] ${bean.tableRemark}对象主键数组
* @param ids ${bean.tableRemark}对象主键数组
* @return
*/
@SysLog("删除${bean.tableRemark}")
@SysLog("删除${bean.tableRemark}数据")
@ApiOperation(value="根据ID批量删除${bean.tableRemark}数据", notes="根据ID批量删除${bean.tableRemark}数据")
@ApiImplicitParam(name = "ids", value = "主键数组", required = true, dataType = "String")
@PostMapping("/delete")
......@@ -129,4 +145,21 @@ public class ${bean.className}Controller extends AbstractController{
return R.ok();
}
/**
* 逻辑删除
* 根据ID删除${bean.tableRemark}对象
* @param ids ${bean.tableRemark}对象主键数组
* @return
*/
@SysLog("删除${bean.tableRemark}数据")
@ApiOperation(value="根据ID批量删除${bean.tableRemark}数据", notes="根据ID批量删除${bean.tableRemark}数据")
@ApiImplicitParam(name = "ids", value = "主键数组", required = true, dataType = "String[]")
@PostMapping("/deleteByFlag")
public R deleteByFlag(@RequestBody String[] ids) {
//根据id数组删除
${bean.lowerName}Service.deleteByFlagByIds(ids, getUserId());
//返回成功
return R.ok();
}
}
......@@ -17,7 +17,7 @@ import java.util.List;
public interface ${bean.className}Dao extends MyBaseMapper<${bean.className}> {
/**
* 查询设备报警类型分页数量
* 查询分页数量
* @param model
* @return
*/
......
......@@ -15,22 +15,19 @@
<!-- 公共查询条件 -->
<sql id="Example_Where_Clause">
where deleted=0
where t.deleted=0
<#list bean.fields as field>
<if test="${field.fieldJavaName}!=null <#if field.fieldType=="varchar">and ${field.fieldJavaName}!=''</#if>">and ${field.fieldName} = _#_{${field.fieldJavaName}}</if>
<if test="${field.fieldJavaName}!=null <#if field.fieldType=="varchar">and ${field.fieldJavaName}!=''</#if>">and t.${field.fieldName} = _#_{${field.fieldJavaName}}</if>
</#list>
</sql>
<select id="queryPageByCount" parameterType="Object" resultType="java.lang.Integer">
select count(1)
from ${bean.tableName}
select count(1) from ${bean.tableName} t
<include refid="Example_Where_Clause"/>
</select>
<select id="queryPageList" parameterType="Object" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from ${bean.tableName}
select t.* from ${bean.tableName} t
<include refid="Example_Where_Clause"/>
<if test="pager.orderCondition != null and pager.orderCondition != ''">
_$_{pager.orderCondition}
......@@ -40,7 +37,6 @@
</if>
</select>
</mapper>
package ${bean.pacageName}${bean.modulesName}.model;
import com.devplatform.admin.common.model.BaseModel;
import lombok.Data;
/**
* ${bean.tableRemark}的Model
* <br>
* @author 代码生成器产生
*/
@Data
public class ${bean.className}Model extends BaseModel {
<#list bean.fields as field>
/**
* ${field.fieldRemark}
*/
/** ${field.fieldRemark} */
private ${field.fieldJavaType} ${field.fieldJavaName};
</#list>
<#list bean.fields as field>
/**
* ${field.fieldRemark}的getter方法
*/
public ${field.fieldJavaType} ${field.getMethodName}(){
return ${field.fieldJavaName};
}
/**
* ${field.fieldRemark}的setter方法
*/
public void ${field.setMethodName}(${field.fieldJavaType} ${field.fieldJavaName}){
this.${field.fieldJavaName} = ${field.fieldJavaName};
}
</#list>
}
......@@ -20,6 +20,14 @@ public interface ${bean.className}Service extends MyBaseService<${bean.className
* @param model
* @return
*/
public List<${bean.className}> queryPageList(${bean.className}Model model);
List<${bean.className}> queryPageList(${bean.className}Model model);
/**
* 根据ID删除${bean.tableRemark}对象
* @param ids
* @param userId
* @return void
*/
void deleteByFlagByIds(String[] ids, String userId);
}
......@@ -8,6 +8,8 @@ import ${bean.pacageName}${bean.modulesName}.dao.${bean.className}Dao;
import ${bean.pacageName}${bean.modulesName}.service.${bean.className}Service;
import com.devplatform.common.service.impl.MyBaseServiceImpl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
......@@ -25,4 +27,23 @@ public class ${bean.className}ServiceImpl extends MyBaseServiceImpl<${bean.class
model.getPager().setRowCount(rowCount);
return baseMapper.queryPageList(model);
}
@Override
public void deleteByFlagByIds(String[] ids, String userId){
//用来暂存所有要删除的对象
List<${bean.className}> beans = new ArrayList<${bean.className}>();
//遍历ids数组
for(String id: ids){
${bean.className} temp = new ${bean.className}();
temp.setId(id);
//将数据标记为删除
temp.setDeleted(1);
temp.setUpdateUserId(userId);
temp.setUpdateTime(new Date());
//将要删除的对象存放在list中
beans.add(temp);
}
//调用批量更新操作
updateBatchById(beans);
}
}
......@@ -60,10 +60,10 @@
<artifactId>ffmpeg-platform</artifactId>
<version>4.2.2-1.5.3</version>
</dependency>
<!--rabbitmq依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<!-- &lt;!&ndash;rabbitmq依赖&ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-amqp</artifactId>-->
<!-- </dependency>-->
</dependencies>
</project>
......@@ -9,11 +9,6 @@ import com.devplatform.equipment.modules.listation.bean.LiStation;
import com.devplatform.equipment.modules.listation.service.LiStationService;
import com.devplatform.equipment.modules.sys.bean.SysSystem;
import com.devplatform.equipment.modules.sys.service.SysSystemService;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
......@@ -24,6 +19,10 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* springboot启动类
*
......@@ -41,8 +40,6 @@ public class EquipmentApplication {
public static void main(String[] args) {
SpringApplication.run(EquipmentApplication.class, args);
// handleMqInit();
// sendMsg();
}
private static void handleMqInit() {
......@@ -86,25 +83,4 @@ public class EquipmentApplication {
}
}
}
private static void sendMsg() {
EwarningService ewarningService = (EwarningService) SpringContextUtil.getBean(EwarningService.class);
SysSystemService sysSystemService = (SysSystemService) SpringContextUtil.getBean(SysSystemService.class);
SysSystem sysSystem = sysSystemService.getById(Constants.STRING_1);
//如果是站点,判断是否需要发送断开连接的信息
if (Constants.STRING_1.equals(sysSystem.getType())) {
Map<String, Object> map = ewarningService.getOneArUpConfig(sysSystem.getCode());
if (map != null && !map.isEmpty()) {
Map<String, String> postParam = new HashMap<>(10);
String stationId = (String) map.get("station_id");
String path = (String) map.get("path");
postParam.put("id", stationId);
postParam.put("addressCode", sysSystem.getByx2());
//状态,0=断开连接,1=故障恢复
postParam.put("state", "1");
TestClient.uploadText(path + Constants.HTTP_NOTICE, postParam);
}
}
}
}
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