Compare commits
2 Commits
master
...
origin/fea
Author | SHA1 | Date |
---|---|---|
|
6b62133e5c | 4 years ago |
|
bbff7e5303 | 4 years ago |
8 changed files with 680 additions and 0 deletions
@ -0,0 +1,94 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.security.controller; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.elink.esua.epdc.dto.MonitoringDTO; |
||||
|
import com.elink.esua.epdc.modules.security.excel.MonitoringExcel; |
||||
|
import com.elink.esua.epdc.modules.security.service.MonitoringService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 监控设备表 |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2021-09-08 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("monitoring") |
||||
|
public class MonitoringController { |
||||
|
|
||||
|
@Autowired |
||||
|
private MonitoringService monitoringService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<MonitoringDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<MonitoringDTO> page = monitoringService.page(params); |
||||
|
return new Result<PageData<MonitoringDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<MonitoringDTO> get(@PathVariable("id") String id){ |
||||
|
MonitoringDTO data = monitoringService.get(id); |
||||
|
return new Result<MonitoringDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody MonitoringDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
monitoringService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody MonitoringDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
monitoringService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
monitoringService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<MonitoringDTO> list = monitoringService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, MonitoringExcel.class); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,41 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.security.dao; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
||||
|
import com.elink.esua.epdc.dto.MonitoringDTO; |
||||
|
import com.elink.esua.epdc.modules.security.entity.MonitoringEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 监控设备表 |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2021-09-08 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface MonitoringDao extends BaseDao<MonitoringEntity> { |
||||
|
|
||||
|
List<MonitoringDTO> getPageList(Map<String, Object> params); |
||||
|
|
||||
|
MonitoringDTO selectDetailById(@Param("id") String id); |
||||
|
} |
@ -0,0 +1,110 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.security.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
|
||||
|
/** |
||||
|
* 监控设备表 |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2021-09-08 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("epdc_monitoring") |
||||
|
public class MonitoringEntity extends BaseEpdcEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 设备别名 |
||||
|
*/ |
||||
|
private String equipmentAlias; |
||||
|
|
||||
|
/** |
||||
|
* 第三方设备编码 |
||||
|
*/ |
||||
|
private String deviceCode; |
||||
|
|
||||
|
/** |
||||
|
* 第三方设备名称 |
||||
|
*/ |
||||
|
private String deviceName; |
||||
|
|
||||
|
/** |
||||
|
* 重点监控设备标识:0否1是 |
||||
|
*/ |
||||
|
private String keyFalg; |
||||
|
|
||||
|
/** |
||||
|
* 位置 |
||||
|
*/ |
||||
|
private String address; |
||||
|
|
||||
|
/** |
||||
|
* 经度 |
||||
|
*/ |
||||
|
private BigDecimal longitude; |
||||
|
|
||||
|
/** |
||||
|
* 纬度 |
||||
|
*/ |
||||
|
private BigDecimal latitude; |
||||
|
|
||||
|
/** |
||||
|
* 状态:0正常 1故障 |
||||
|
*/ |
||||
|
private String state; |
||||
|
|
||||
|
/** |
||||
|
* 部门ID |
||||
|
*/ |
||||
|
private String deptId; |
||||
|
|
||||
|
/** |
||||
|
* 部门名称 |
||||
|
*/ |
||||
|
private String deptName; |
||||
|
|
||||
|
/** |
||||
|
* 所有部门ID |
||||
|
*/ |
||||
|
private String allDeptIds; |
||||
|
|
||||
|
/** |
||||
|
* 所有部门名称 |
||||
|
*/ |
||||
|
private String allDeptNames; |
||||
|
|
||||
|
/** |
||||
|
* 父所有部门 |
||||
|
*/ |
||||
|
private String parentDeptIds; |
||||
|
|
||||
|
/** |
||||
|
* 父所有部门 |
||||
|
*/ |
||||
|
private String parentDeptNames; |
||||
|
|
||||
|
} |
@ -0,0 +1,99 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.security.excel; |
||||
|
|
||||
|
import cn.afterturn.easypoi.excel.annotation.Excel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 监控设备表 |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2021-09-08 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class MonitoringExcel { |
||||
|
|
||||
|
@Excel(name = "id") |
||||
|
private String id; |
||||
|
|
||||
|
@Excel(name = "设备别名") |
||||
|
private String equipmentAlias; |
||||
|
|
||||
|
@Excel(name = "第三方设备编码") |
||||
|
private String deviceCode; |
||||
|
|
||||
|
@Excel(name = "第三方设备名称") |
||||
|
private String deviceName; |
||||
|
|
||||
|
@Excel(name = "重点监控设备标识:0否1是") |
||||
|
private String keyFalg; |
||||
|
|
||||
|
@Excel(name = "位置") |
||||
|
private String address; |
||||
|
|
||||
|
@Excel(name = "经度") |
||||
|
private BigDecimal longitude; |
||||
|
|
||||
|
@Excel(name = "纬度") |
||||
|
private BigDecimal latitude; |
||||
|
|
||||
|
@Excel(name = "状态:0正常 1故障") |
||||
|
private String state; |
||||
|
|
||||
|
@Excel(name = "部门ID") |
||||
|
private String deptId; |
||||
|
|
||||
|
@Excel(name = "部门名称") |
||||
|
private String deptName; |
||||
|
|
||||
|
@Excel(name = "所有部门ID") |
||||
|
private String allDeptIds; |
||||
|
|
||||
|
@Excel(name = "所有部门名称") |
||||
|
private String allDeptNames; |
||||
|
|
||||
|
@Excel(name = "父所有部门") |
||||
|
private String parentDeptIds; |
||||
|
|
||||
|
@Excel(name = "父所有部门") |
||||
|
private String parentDeptNames; |
||||
|
|
||||
|
@Excel(name = "删除标识 0-否,1-是") |
||||
|
private String delFlag; |
||||
|
|
||||
|
@Excel(name = "乐观锁") |
||||
|
private Integer revision; |
||||
|
|
||||
|
@Excel(name = "创建人") |
||||
|
private String createdBy; |
||||
|
|
||||
|
@Excel(name = "创建时间") |
||||
|
private Date createdTime; |
||||
|
|
||||
|
@Excel(name = "更新人") |
||||
|
private String updatedBy; |
||||
|
|
||||
|
@Excel(name = "更新时间") |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,47 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.security.redis; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* 监控设备表 |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2021-09-08 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class MonitoringRedis { |
||||
|
@Autowired |
||||
|
private RedisUtils redisUtils; |
||||
|
|
||||
|
public void delete(Object[] ids) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void set(){ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public String get(String id){ |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,95 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.security.service; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.dto.MonitoringDTO; |
||||
|
import com.elink.esua.epdc.modules.security.entity.MonitoringEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 监控设备表 |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2021-09-08 |
||||
|
*/ |
||||
|
public interface MonitoringService extends BaseService<MonitoringEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<MonitoringDTO> |
||||
|
* @author generator |
||||
|
* @date 2021-09-08 |
||||
|
*/ |
||||
|
PageData<MonitoringDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<MonitoringDTO> |
||||
|
* @author generator |
||||
|
* @date 2021-09-08 |
||||
|
*/ |
||||
|
List<MonitoringDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return MonitoringDTO |
||||
|
* @author generator |
||||
|
* @date 2021-09-08 |
||||
|
*/ |
||||
|
MonitoringDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2021-09-08 |
||||
|
*/ |
||||
|
void save(MonitoringDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2021-09-08 |
||||
|
*/ |
||||
|
void update(MonitoringDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2021-09-08 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
} |
@ -0,0 +1,137 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.security.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.MonitoringDTO; |
||||
|
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; |
||||
|
import com.elink.esua.epdc.modules.feign.AdminFeignClient; |
||||
|
import com.elink.esua.epdc.modules.security.dao.MonitoringDao; |
||||
|
import com.elink.esua.epdc.modules.security.entity.MonitoringEntity; |
||||
|
import com.elink.esua.epdc.modules.security.redis.MonitoringRedis; |
||||
|
import com.elink.esua.epdc.modules.security.service.MonitoringService; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 监控设备表 |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2021-09-08 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class MonitoringServiceImpl extends BaseServiceImpl<MonitoringDao, MonitoringEntity> implements MonitoringService { |
||||
|
|
||||
|
@Autowired |
||||
|
private MonitoringRedis monitoringRedis; |
||||
|
|
||||
|
@Autowired |
||||
|
private AdminFeignClient adminFeignClient; |
||||
|
|
||||
|
@Override |
||||
|
public PageData<MonitoringDTO> page(Map<String, Object> params) { |
||||
|
// IPage<MonitoringEntity> page = baseDao.selectPage(
|
||||
|
// getPage(params, FieldConstant.CREATED_TIME, false),
|
||||
|
// getWrapper(params)
|
||||
|
// );
|
||||
|
// return getPageData(page, MonitoringDTO.class);
|
||||
|
IPage<MonitoringDTO> page = getPage(params); |
||||
|
List<MonitoringDTO> list = baseDao.getPageList(params); |
||||
|
return new PageData<>(list, page.getTotal()); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<MonitoringDTO> list(Map<String, Object> params) { |
||||
|
List<MonitoringEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, MonitoringDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<MonitoringEntity> getWrapper(Map<String, Object> params){ |
||||
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<MonitoringEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
|
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public MonitoringDTO get(String id) { |
||||
|
MonitoringDTO result = baseDao.selectDetailById(id); |
||||
|
result.setAllDeptIdsShow(Arrays.asList(result.getAllDeptIds().split(","))); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(MonitoringDTO dto) { |
||||
|
MonitoringEntity entity = ConvertUtils.sourceToTarget(dto, MonitoringEntity.class); |
||||
|
Result<ParentAndAllDeptDTO> parentResult = adminFeignClient.getParentAndAllDept(dto.getDeptId()); |
||||
|
if (!parentResult.success() || parentResult.getData() == null) { |
||||
|
throw new RenException("获取部门信息失败"); |
||||
|
} else { |
||||
|
ParentAndAllDeptDTO deptDTO = parentResult.getData(); |
||||
|
entity.setDeptName(deptDTO.getGrid()); |
||||
|
entity.setAllDeptIds(deptDTO.getAllDeptIds()); |
||||
|
entity.setAllDeptNames(deptDTO.getAllDeptNames()); |
||||
|
entity.setParentDeptIds(deptDTO.getParentDeptIds()); |
||||
|
entity.setParentDeptNames(deptDTO.getParentDeptNames()); |
||||
|
} |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(MonitoringDTO dto) { |
||||
|
MonitoringEntity entity = ConvertUtils.sourceToTarget(dto, MonitoringEntity.class); |
||||
|
Result<ParentAndAllDeptDTO> parentResult = adminFeignClient.getParentAndAllDept(dto.getDeptId()); |
||||
|
if (!parentResult.success() || parentResult.getData() == null) { |
||||
|
throw new RenException("获取部门信息失败"); |
||||
|
} else { |
||||
|
ParentAndAllDeptDTO deptDTO = parentResult.getData(); |
||||
|
entity.setDeptName(deptDTO.getGrid()); |
||||
|
entity.setAllDeptIds(deptDTO.getAllDeptIds()); |
||||
|
entity.setAllDeptNames(deptDTO.getAllDeptNames()); |
||||
|
entity.setParentDeptIds(deptDTO.getParentDeptIds()); |
||||
|
entity.setParentDeptNames(deptDTO.getParentDeptNames()); |
||||
|
} |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,57 @@ |
|||||
|
<?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.elink.esua.epdc.modules.security.dao.MonitoringDao"> |
||||
|
|
||||
|
<resultMap type="com.elink.esua.epdc.modules.security.entity.MonitoringEntity" id="monitoringMap"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="equipmentAlias" column="EQUIPMENT_ALIAS"/> |
||||
|
<result property="deviceCode" column="DEVICE_CODE"/> |
||||
|
<result property="deviceName" column="DEVICE_NAME"/> |
||||
|
<result property="keyFalg" column="KEY_FALG"/> |
||||
|
<result property="address" column="ADDRESS"/> |
||||
|
<result property="longitude" column="LONGITUDE"/> |
||||
|
<result property="latitude" column="LATITUDE"/> |
||||
|
<result property="state" column="STATE"/> |
||||
|
<result property="deptId" column="DEPT_ID"/> |
||||
|
<result property="deptName" column="DEPT_NAME"/> |
||||
|
<result property="allDeptIds" column="ALL_DEPT_IDS"/> |
||||
|
<result property="allDeptNames" column="ALL_DEPT_NAMES"/> |
||||
|
<result property="parentDeptIds" column="PARENT_DEPT_IDS"/> |
||||
|
<result property="parentDeptNames" column="PARENT_DEPT_NAMES"/> |
||||
|
<result property="delFlag" column="DEL_FLAG"/> |
||||
|
<result property="revision" column="REVISION"/> |
||||
|
<result property="createdBy" column="CREATED_BY"/> |
||||
|
<result property="createdTime" column="CREATED_TIME"/> |
||||
|
<result property="updatedBy" column="UPDATED_BY"/> |
||||
|
<result property="updatedTime" column="UPDATED_TIME"/> |
||||
|
</resultMap> |
||||
|
<select id="getPageList" resultType="com.elink.esua.epdc.dto.MonitoringDTO"> |
||||
|
SELECT *, |
||||
|
CASE state |
||||
|
WHEN '0' THEN '正常' |
||||
|
WHEN '1' THEN '故障' |
||||
|
else '' |
||||
|
end as stateName |
||||
|
FROM `epdc_monitoring` |
||||
|
where DEL_FLAG='0' |
||||
|
<if test="address != null and address != ''"> |
||||
|
and address like '%${address}%' |
||||
|
</if> |
||||
|
<if test="state != null and state != ''"> |
||||
|
and state =#{state} |
||||
|
</if> |
||||
|
<if test="deptId != null and deptId != ''"> |
||||
|
and FIND_IN_SET(#{deptId},ALL_DEPT_IDS) |
||||
|
</if> |
||||
|
order by CREATED_TIME desc |
||||
|
</select> |
||||
|
<select id="selectDetailById" resultType="com.elink.esua.epdc.dto.MonitoringDTO"> |
||||
|
select * |
||||
|
from epdc_monitoring |
||||
|
where DEL_FLAG='0' |
||||
|
and id=#{id} |
||||
|
</select> |
||||
|
|
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue