Commit d171aed5 authored by co_dengxiongwen's avatar co_dengxiongwen

tj

parent 49cd2919
package com.devplatform.admin.modules.event.bean;
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 com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* @author dxw
*/
@Data
@ApiModel(value="报警类型表对象",description="报警类型表对象")
@TableName("link_event")
......
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;
}
......@@ -8,7 +8,6 @@ import com.devplatform.admin.common.annotation.SysLogMethod;
import com.devplatform.admin.common.utils.AbstractController;
import com.devplatform.admin.common.utils.Constants;
import com.devplatform.admin.modules.liresource.bean.*;
import com.devplatform.admin.modules.liresource.model.LiLineModel;
import com.devplatform.admin.modules.liresource.model.LiResourceModel;
import com.devplatform.admin.modules.liresource.model.LiStationMapModel;
import com.devplatform.admin.modules.liresource.model.LiStationModel;
......@@ -50,9 +49,6 @@ public class LiResourceController extends AbstractController {
private SysDictionaryService sysDictionaryService;
@Autowired
private LiResourceCameraService liResourceCameraService;
@Autowired
private LiRoomService liRoomService;
/**
* 列表页面列表数据获取
......@@ -423,17 +419,16 @@ public class LiResourceController extends AbstractController {
} else {
tree = getAllTreeList(model);
}
return R.ok().put("tree", tree);
return R.ok().put("nodes", tree);
}
private List<Map<String, Object>> getAllTreeList(LiResourceModel model) {
List<Map<String, Object>> tree = new ArrayList<>();
Map<String, Object> root = new HashMap<>(5);
root.put("name", "资源点列表");
root.put("id", "0");
root.put("level", 1);
LiLineModel lineModel = new LiLineModel();
List<LiLine> lineList = liLineService.getTreeList(lineModel);
// root.put("name", "资源点列表");
// root.put("id", "0");
// root.put("level", 1);
LiStationModel stationModel = new LiStationModel();
List<LiStation> stationList = liStationService.getTreeList(stationModel);
......@@ -441,9 +436,6 @@ public class LiResourceController extends AbstractController {
LiStationMapModel mapModel = new LiStationMapModel();
List<LiStationMap> mapList = liStationMapService.getTreeList(mapModel);
//查询所有的场景
List<LiRoom> roomList = liRoomService.list(new LambdaQueryWrapper<LiRoom>().eq(LiRoom::getDeleted, Constants.INT_0));
// 查询子系统字典项
List<SysDictionary> dicList = sysDictionaryService.queryByPid(Constants.SUB_SYSTEM_ID, model.getStationId());
......@@ -451,87 +443,65 @@ public class LiResourceController extends AbstractController {
List<LiResource> resourceList = liResourceService.getTreeList(model);
List<Map<String, Object>> childrenRoot = new ArrayList<>();
if (lineList != null && lineList.size() > 0) {
lineList.forEach((liLine) -> {
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(liLine), Map.class);
map.put("level", 2);
List<Map<String, Object>> childrenLine = new ArrayList<>();
stationList.forEach((liStation) -> {
Map<String, Object> mapStation = JSONObject.parseObject(JSONObject.toJSONString(liStation), Map.class);
mapStation.put("name", liStation.getStationName());
mapStation.put("level", 3);
List<Map<String, Object>> nodes = new ArrayList<>();
for (LiStationMap liStationMap : mapList) {
Map<String, Object> mapStationMap = JSONObject.parseObject(JSONObject.toJSONString(liStationMap), Map.class);
mapStationMap.put("key", UUID.randomUUID());
mapStationMap.put("level", 4);
List<Map<String, Object>> childrenStationMap = new ArrayList<>();
Iterator<LiRoom> iteratorRoom = roomList.iterator();
while (iteratorRoom.hasNext()) {
LiRoom liRoom = iteratorRoom.next();
if (liStationMap.getId().equals(liRoom.getMapId())) {
Map<String, Object> liRoomMap = JSONObject.parseObject(JSONObject.toJSONString(liRoom), Map.class);
liRoomMap.put("key", UUID.randomUUID());
liRoomMap.put("level", 5);
List<Map<String, Object>> childrenRoom = new ArrayList<>();
for (SysDictionary dic : dicList) {
Map<String, Object> mapDic = JSONObject.parseObject(JSONObject.toJSONString(dic), Map.class);
// 两个id拼接保证id的唯一性
mapDic.put("id", liStationMap.getId() + dic.getId());
mapDic.put("code", dic.getValue());
mapDic.put("stationId", liStationMap.getStationId());
mapDic.put("tierId", liStationMap.getId());
mapDic.put("key", UUID.randomUUID());
mapDic.put("level", 6);
List<Map<String, Object>> childrenDic = new ArrayList<>();
Iterator<LiResource> iterator = resourceList.iterator();
while (iterator.hasNext()) {
LiResource resource = iterator.next();
if (dic.getValue().equals(resource.getSubCode()) && liStationMap.getId().equals(resource.getTierId())
&& liRoom.getId().equals(resource.getRoomId())) {
Map<String, Object> mapResource = JSONObject.parseObject(JSONObject.toJSONString(resource), Map.class);
mapResource.put("cameraIds", resource.getCameraIds());
mapResource.put("cameraNames", resource.getCameraNames());
mapResource.put("level", 7);
mapResource.put("active", false);
mapResource.put("cameraChange", false);
// 拖拽的唯一标识
mapResource.put("key", resource.getId());
childrenDic.add(mapResource);
iterator.remove();
}
mapDic.put("children", childrenDic);
/** 如果该子系统下无资源点,不展示*/
if (childrenDic != null && childrenDic.size() > 0) {
childrenRoom.add(mapDic);
}
}
}
liRoomMap.put("children", childrenRoom);
childrenStationMap.add(liRoomMap);
iteratorRoom.remove();
}
}
mapStationMap.put("children", childrenStationMap);
if (liStationMap.getStationId().equals(liStation.getId())) {
nodes.add(mapStationMap);
stationList.forEach((liStation) -> {
Map<String, Object> mapStation = JSONObject.parseObject(JSONObject.toJSONString(liStation), Map.class);
mapStation.put("name", liStation.getStationName());
mapStation.put("key", UUID.randomUUID());
mapStation.put("level", 3);
List<Map<String, Object>> nodes = new ArrayList<>();
for (LiStationMap liStationMap : mapList) {
Map<String, Object> mapStationMap = JSONObject.parseObject(JSONObject.toJSONString(liStationMap), Map.class);
mapStationMap.put("key", UUID.randomUUID());
mapStationMap.put("level", 4);
List<Map<String, Object>> childrenStationMap = new ArrayList<>();
for (SysDictionary dic : dicList) {
Map<String, Object> mapDic = JSONObject.parseObject(JSONObject.toJSONString(dic), Map.class);
// 两个id拼接保证id的唯一性
mapDic.put("id", liStationMap.getId() + dic.getId());
mapDic.put("code", dic.getValue());
mapDic.put("stationId", liStationMap.getStationId());
mapDic.put("tierId", liStationMap.getId());
mapDic.put("key", UUID.randomUUID());
mapDic.put("level", 5);
List<Map<String, Object>> childrenDic = new ArrayList<>();
Iterator<LiResource> iterator = resourceList.iterator();
while (iterator.hasNext()) {
LiResource resource = iterator.next();
if (dic.getValue().equals(resource.getSubCode()) && liStationMap.getId().equals(resource.getTierId())) {
Map<String, Object> mapResource = JSONObject.parseObject(JSONObject.toJSONString(resource), Map.class);
mapResource.put("cameraIds", resource.getCameraIds());
mapResource.put("cameraNames", resource.getCameraNames());
mapResource.put("level", 6);
mapResource.put("active", false);
mapResource.put("cameraChange", false);
// 拖拽的唯一标识
mapResource.put("key", resource.getId());
childrenDic.add(mapResource);
iterator.remove();
}
}
mapStation.put("children", nodes);
if (liLine.getId().equals(liStation.getLineId())) {
childrenLine.add(mapStation);
mapDic.put("children", childrenDic);
/** 如果该子系统下无资源点,不展示*/
if (childrenDic != null && childrenDic.size() > 0) {
childrenStationMap.add(mapDic);
}
});
map.put("children", childrenLine);
childrenRoot.add(map);
});
}
}
mapStationMap.put("children", childrenStationMap);
if (liStationMap.getStationId().equals(liStation.getId())) {
nodes.add(mapStationMap);
}
}
mapStation.put("children", nodes);
childrenRoot.add(mapStation);
});
root.put("children", childrenRoot);
tree.add(root);
return tree;
......@@ -550,10 +520,6 @@ public class LiResourceController extends AbstractController {
mapModel.setStationId(model.getStationId());
List<LiStationMap> list = liStationMapService.getTreeList(mapModel);
//查询该站点下所有的场景
List<LiRoom> roomList = liRoomService.list(new LambdaQueryWrapper<LiRoom>().eq(LiRoom::getDeleted, Constants.INT_0)
.eq(LiRoom::getStationId, model.getStationId()));
// 查询子系统字典项
List<SysDictionary> dicList = new ArrayList<>();
dicList = sysDictionaryService.queryByPid(Constants.SUB_SYSTEM_ID, model.getStationId());
......@@ -568,53 +534,39 @@ public class LiResourceController extends AbstractController {
mapStationMap.put("level", 4);
List<Map<String, Object>> childrenStationMap = new ArrayList<>();
Iterator<LiRoom> iteratorRoom = roomList.iterator();
while (iteratorRoom.hasNext()) {
LiRoom liRoom = iteratorRoom.next();
if (liStationMap.getId().equals(liRoom.getMapId())) {
Map<String, Object> liRoomMap = JSONObject.parseObject(JSONObject.toJSONString(liRoom), Map.class);
liRoomMap.put("key", UUID.randomUUID());
liRoomMap.put("level", 5);
List<Map<String, Object>> childrenRoom = new ArrayList<>();
for (SysDictionary dic : dicList) {
Map<String, Object> mapDic = JSONObject.parseObject(JSONObject.toJSONString(dic), Map.class);
// 两个id拼接保证id的唯一性
mapDic.put("id", liStationMap.getId() + dic.getId());
mapDic.put("code", dic.getValue());
mapDic.put("stationId", liStationMap.getStationId());
mapDic.put("tierId", liStationMap.getId());
mapDic.put("key", UUID.randomUUID());
mapDic.put("level", 6);
List<Map<String, Object>> childrenDic = new ArrayList<>();
Iterator<LiResource> iterator = resourceList.iterator();
while (iterator.hasNext()) {
LiResource resource = iterator.next();
if (dic.getValue().equals(resource.getSubCode()) && liStationMap.getId().equals(resource.getTierId())
&& liRoom.getId().equals(resource.getRoomId())) {
Map<String, Object> mapResource = JSONObject.parseObject(JSONObject.toJSONString(resource), Map.class);
mapResource.put("cameraIds", resource.getCameraIds());
mapResource.put("cameraNames", resource.getCameraNames());
mapResource.put("level", 7);
mapResource.put("active", false);
mapResource.put("cameraChange", false);
// 拖拽的唯一标识
mapResource.put("key", resource.getId());
childrenDic.add(mapResource);
iterator.remove();
}
mapDic.put("children", childrenDic);
/** 如果该子系统下无资源点,不展示*/
if (childrenDic != null && childrenDic.size() > 0) {
childrenRoom.add(mapDic);
}
}
for (SysDictionary dic : dicList) {
Map<String, Object> mapDic = JSONObject.parseObject(JSONObject.toJSONString(dic), Map.class);
// 两个id拼接保证id的唯一性
mapDic.put("id", liStationMap.getId() + dic.getId());
mapDic.put("code", dic.getValue());
mapDic.put("stationId", liStationMap.getStationId());
mapDic.put("tierId", liStationMap.getId());
mapDic.put("key", UUID.randomUUID());
mapDic.put("level", 5);
List<Map<String, Object>> childrenDic = new ArrayList<>();
Iterator<LiResource> iterator = resourceList.iterator();
while (iterator.hasNext()) {
LiResource resource = iterator.next();
if (dic.getValue().equals(resource.getSubCode()) && liStationMap.getId().equals(resource.getTierId())) {
Map<String, Object> mapResource = JSONObject.parseObject(JSONObject.toJSONString(resource), Map.class);
mapResource.put("cameraIds", resource.getCameraIds());
mapResource.put("cameraNames", resource.getCameraNames());
mapResource.put("level", 6);
mapResource.put("active", false);
mapResource.put("cameraChange", false);
// 拖拽的唯一标识
mapResource.put("key", resource.getId());
childrenDic.add(mapResource);
iterator.remove();
}
liRoomMap.put("children", childrenRoom);
childrenStationMap.add(liRoomMap);
iteratorRoom.remove();
}
mapDic.put("children", childrenDic);
/** 如果该子系统下无资源点,不展示*/
if (childrenDic != null && childrenDic.size() > 0) {
childrenStationMap.add(mapDic);
}
}
mapStationMap.put("children", childrenStationMap);
......
package com.devplatform.admin.modules.liresource.controller;
import com.alibaba.fastjson.JSONObject;
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.modules.liresource.bean.LiResourceIcon;
import com.devplatform.admin.modules.liresource.model.LiResourceIconModel;
import com.devplatform.admin.modules.liresource.service.LiResourceIconService;
import com.devplatform.common.base.annotation.SysLog;
import com.devplatform.common.base.validator.ValidatorUtils;
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.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
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.RestController;
/**
* @author Administrator
*/
@Api(tags = {"资源点图标表接口"})
@RestController
@RequestMapping("/liResourceIcon")
public class LiResourceIconController extends AbstractController {
@Autowired private LiResourceIconService liResourceIconService;
/**
* 列表页面列表数据获取
*
* @param model 承接对象
* @return
*/
@ApiOperation(value = "根据条件获取资源点图标表分页数据列表", notes = "根据条件获取资源点图标表分页数据列表")
@ApiImplicitParam(
name = "params",
value = "参数",
required = true,
dataType = "LiResourceIconModel")
@PostMapping("/list")
public R list(@RequestBody LiResourceIconModel model) {
if (StringUtils.isBlank(model.getSort())) {
model.setSort("order_num");
model.setOrder("ASC");
}
List<LiResourceIcon> list = liResourceIconService.queryPageByList(model);
return R.ok().put("page", getMyPage(list, model));
}
/**
* 添加
*
* @param bean 资源点图标表对象
* @return
*/
@SysLog("添加资源点图标表")
@SysLogMethod(operation = "新增", blockName = "资源点图标表", detail = "新增资源点图标表数据")
@ApiOperation(value = "新增资源点图标表数据", notes = "新增资源点图标表数据")
@PostMapping("/save")
public R save(@RequestBody @ApiParam(value = "资源点图标表实体对象", required = true) LiResourceIcon bean) {
bean.setSysSign(getUser().getSysSystem().getCode());
ValidatorUtils.validateEntity(bean);
liResourceIconService.save(bean);
return R.ok();
}
/**
* 修改
*
* @param bean 资源点图标表对象
* @return
*/
@SysLog("修改资源点图标表")
@SysLogMethod(operation = "修改", blockName = "资源点图标表", detail = "修改资源点图标表数据")
@ApiOperation(value = "修改资源点图标表数据", notes = "修改资源点图标表数据")
@PostMapping("/update")
public R update(
@RequestBody @ApiParam(value = "资源点图标表实体对象", required = true) LiResourceIcon bean) {
ValidatorUtils.validateEntity(bean);
bean.setSysSign(getUser().getSysSystem().getCode());
liResourceIconService.update(
bean,
new QueryWrapper<LiResourceIcon>()
.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) {
LiResourceIcon bean = liResourceIconService.getById(id);
return R.ok().put("bean", bean);
}
/**
* 根据ID获取资源点图标表对象
*
* @param ids 资源点图标表对象主键数组
* @return
*/
@SysLog("删除资源点图标表")
@SysLogMethod(operation = "删除", blockName = "资源点图标表", detail = "删除资源点图标表数据")
@ApiOperation(value = "根据ID批量删除资源点图标表数据", notes = "根据ID批量删除资源点图标表数据")
@ApiImplicitParam(name = "ids", value = "主键数组", required = true, dataType = "String")
@PostMapping("/delete")
public R delete(@RequestBody String[] ids) {
liResourceIconService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
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.dao;
import com.devplatform.admin.modules.liresource.bean.LiResourceIcon;
import com.devplatform.admin.modules.liresource.model.LiResourceIconModel;
import com.devplatform.common.dao.MyBaseMapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
/**
* LiResourceIcon Mapper 用于资源点图标表的数据库操作
*
* @author Administrator
*/
@Mapper
@Repository
public interface LiResourceIconDao extends MyBaseMapper<LiResourceIcon> {
/**
* 查询资源点图标数量
*
* @param model
* @return
*/
Integer queryPageByCount(LiResourceIconModel model);
/**
* 查询资源点图标分页数据
*
* @param model
* @return
*/
List<LiResourceIcon> queryPageByList(LiResourceIconModel model);
/**
* 获取资源点图标数据
*
* @param model
* @return
*/
List<LiResourceIcon> queryIconList(LiResourceIconModel model);
/**
* 获取资源点图标类型
*
* @param model
* @return
*/
List<LiResourceIcon> queryIconTypeList(LiResourceIconModel model);
}
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;
/**
* 资源点图标表的Model <br>
*
* @author 代码生成器产生
*/
public class LiResourceIconModel extends BaseModel {
/** 主键*/
private java.lang.String id;
/** 图标类型(1默认)*/
private Integer type;
/** 图标类型名称*/
private String typeName;
/** 图标尺寸(1小,2中,3大)*/
private Integer size;
/** 图标路径*/
private java.lang.String path;
/** 名称*/
private java.lang.String name;
/** 排序值*/
private Integer orderNum;
/** 是否删除(0未删除,1已删除)*/
private Integer deleted;
/** 站点id*/
private java.lang.String stationId;
public String getStationId() {
return stationId;
}
public void setStationId(String stationId) {
this.stationId = stationId;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public Integer getOrderNum() {
return orderNum;
}
public void setOrderNum(Integer orderNum) {
this.orderNum = orderNum;
}
/** 主键的getter方法 */
public java.lang.String getId() {
return id;
}
/** 主键的setter方法 */
public void setId(java.lang.String id) {
this.id = id;
}
/** 图标类型(1默认)的getter方法 */
public Integer getType() {
return type;
}
/** 图标类型(1默认)的setter方法 */
public void setType(Integer type) {
this.type = type;
}
/** 图标尺寸(1小,2中,3大)的getter方法 */
public Integer getSize() {
return size;
}
/** 图标尺寸(1小,2中,3大)的setter方法 */
public void setSize(Integer size) {
this.size = size;
}
/** 图标路径的getter方法 */
public java.lang.String getPath() {
return path;
}
/** 图标路径的setter方法 */
public void setPath(java.lang.String path) {
this.path = path;
}
/** 名称的getter方法 */
public java.lang.String getName() {
return name;
}
/** 名称的setter方法 */
public void setName(java.lang.String name) {
this.name = name;
}
/** 是否删除(0未删除,1已删除)的getter方法 */
public Integer getDeleted() {
return deleted;
}
/** 是否删除(0未删除,1已删除)的setter方法 */
public void setDeleted(Integer deleted) {
this.deleted = deleted;
}
}
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.admin.modules.liresource.bean.LiResourceIcon;
import com.devplatform.admin.modules.liresource.model.LiResourceIconModel;
import com.devplatform.common.service.MyBaseService;
import java.util.List;
/**
* 资源点图标表的service接口 <br>
* <b>功能:</b>LiResourceIconService<br>
*
* @author 代码生成器产生
*/
public interface LiResourceIconService extends MyBaseService<LiResourceIcon> {
/**
* 查询资源点图标分页数据
*
* @param model
* @return
*/
List<LiResourceIcon> queryPageByList(LiResourceIconModel model);
/**
* 获取资源点图标数据
*
* @param model
* @return
*/
List<LiResourceIcon> queryIconList(LiResourceIconModel model);
/**
* 获取资源点图标类型
*
* @param model
* @return
*/
List<LiResourceIcon> queryIconTypeList(LiResourceIconModel model);
}
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 com.devplatform.admin.modules.liresource.bean.LiResourceIcon;
import com.devplatform.admin.modules.liresource.dao.LiResourceIconDao;
import com.devplatform.admin.modules.liresource.model.LiResourceIconModel;
import com.devplatform.admin.modules.liresource.service.LiResourceIconService;
import com.devplatform.common.service.impl.MyBaseServiceImpl;
import java.util.List;
import org.springframework.stereotype.Service;
/**
* 资源点图标表的service接口实现类 <br>
* <b>功能:</b>LiResourceIconServiceImpl<br>
*
* @author 代码生成器产生
*/
@Service("liResourceIconService")
public class LiResourceIconServiceImpl extends MyBaseServiceImpl<LiResourceIconDao, LiResourceIcon>
implements LiResourceIconService {
@Override
public List<LiResourceIcon> queryPageByList(LiResourceIconModel model) {
Integer rowCount = baseMapper.queryPageByCount(model);
model.getPager().setRowCount(rowCount);
return baseMapper.queryPageByList(model);
}
@Override
public List<LiResourceIcon> queryIconList(LiResourceIconModel model) {
return baseMapper.queryIconList(model);
}
@Override
public List<LiResourceIcon> queryIconTypeList(LiResourceIconModel model) {
return baseMapper.queryIconTypeList(model);
}
}
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);
}
}
<?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.LiResourceIconDao">
<!-- Result Map -->
<resultMap id="BaseResultMap" type="com.devplatform.admin.modules.liresource.bean.LiResourceIcon">
<result column="id" property="id"/>
<result column="type" property="type"/>
<result column="type_name" property="typeName"/>
<result column="size" property="size"/>
<result column="path" property="path"/>
<result column="name" property="name"/>
<result column="order_num" property="orderNum"/>
<result column="deleted" property="deleted"/>
<result column="station_id" property="stationId"/>
<result column="sys_sign" property="sysSign"/>
</resultMap>
<!-- li_resource_icon table all fields -->
<sql id="Base_Column_List">
id,type,type_name,size,path,name,order_num,deleted,station_id,sys_sign
</sql>
<!-- 公共查询条件 -->
<sql id="Example_Where_Clause">
where deleted=0
<if test="id!=null and id!=''">and id = #{id}</if>
<if test="type!=null ">and type = #{type}</if>
<if test="typeName!=null and typeName!='' ">and type_name = #{typeName}</if>
<if test="size!=null ">and size = #{size}</if>
<if test="path!=null and path!=''">and path = #{path}</if>
<if test="name!=null and name!=''">and name = #{name}</if>
<if test="orderNum!=null ">and order_num = #{orderNum}</if>
<if test="deleted!=null ">and deleted = #{deleted}</if>
<if test="stationId!=null and stationId!='' ">and station_id = #{stationId}</if>
<if test="sysSign!=null and sysSign!='' ">and sys_sign = #{sysSign}</if>
</sql>
<!--查询总数-->
<select id="queryPageByCount" parameterType="Object" resultType="java.lang.Integer">
select count(1) from li_resource_icon
<include refid="Example_Where_Clause"></include>
</select>
<select id="queryPageByList" parameterType="Object" resultMap="BaseResultMap">
select * from li_resource_icon
<include refid="Example_Where_Clause"></include>
<if test="pager.orderCondition != null and pager.orderCondition != ''">
${pager.orderCondition}
</if>
<if test="pager.mysqlQueryCondition != null and pager.mysqlQueryCondition != ''">
${pager.mysqlQueryCondition}
</if>
</select>
<select id="queryIconList" parameterType="Object" resultMap="BaseResultMap">
select * from li_resource_icon
<include refid="Example_Where_Clause"></include>
order by type, order_num
</select>
<select id="queryIconTypeList" parameterType="Object" resultMap="BaseResultMap">
select type,type_name from li_resource_icon
<include refid="Example_Where_Clause"></include>
group by type
order by type
</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.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>
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