Merge branch 'dev' of http://blit.7drlb.com:8888/r/moral into dev
13 files added
19 files modified
| | |
| | | import com.moral.util.PageResult; |
| | | |
| | | @Slf4j |
| | | @Api(tags = {"组"}) |
| | | @Api(tags = {"组管理"}) |
| | | @RestController |
| | | @RequestMapping("/group") |
| | | public class GroupController { |
| | |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/log") |
| | | @Api(tags = "日志") |
| | | @Api(tags = "日志管理") |
| | | public class LogController { |
| | | |
| | | @Autowired |
| | |
| | | import com.moral.util.TokenUtils; |
| | | |
| | | @Slf4j |
| | | @Api(tags = {"菜单"}) |
| | | @Api(tags = {"菜单管理"}) |
| | | @RestController |
| | | @RequestMapping("/menu") |
| | | public class MenuController { |
| | |
| | | import com.moral.util.PageResult; |
| | | |
| | | @Slf4j |
| | | @Api(tags = {"用户"}) |
| | | @Api(tags = {"用户管理"}) |
| | | @RestController |
| | | @RequestMapping("/user") |
| | | public class UserController { |
| | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | |
| | | /** |
| | | * 渠道 |
| | | */ |
| | | private Integer channel; |
| | | private String channelKey; |
| | | |
| | | /** |
| | | * 组织Id |
| | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | |
| | | package com.moral.api.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | |
| | | Map<String, Object> currentUserInfo = (Map<String, Object>) TokenUtils.getUserInfoByToken(token); |
| | | Map<String, Object> orgInfo = (Map<String, Object>) currentUserInfo.get("organization"); |
| | | UpdateWrapper<GroupMenu> deleteWrapper = new UpdateWrapper<>(); |
| | | deleteWrapper.eq("group_id", groupId).eq("channel", Constants.WEB_CHANNEL); |
| | | deleteWrapper.eq("group_id", groupId).eq("channel_key", Constants.WEB_CHANNEL); |
| | | groupMenuMapper.delete(deleteWrapper); |
| | | List<String> menus = new ArrayList<>(); |
| | | if (menuIds != null && !menuIds.isEmpty()) { |
| | |
| | | GroupMenu groupMenu = new GroupMenu(); |
| | | groupMenu.setGroupId(groupId); |
| | | groupMenu.setMenuId(menuId); |
| | | groupMenu.setChannel(Constants.WEB_CHANNEL); |
| | | groupMenu.setChannelKey(Constants.WEB_CHANNEL); |
| | | groupMenu.setOrganizationId((Integer) orgInfo.get("id")); |
| | | groupMenuMapper.insert(groupMenu); |
| | | }); |
| | |
| | | <id column="id" property="id" /> |
| | | <result column="group_id" property="groupId" /> |
| | | <result column="menu_id" property="menuId" /> |
| | | <result column="channel" property="channel" /> |
| | | <result column="channel_key" property="channelKey" /> |
| | | <result column="organization_id" property="organizationId" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | |
| | | |
| | | <select id="selectUserMenu" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"></include> |
| | | <include refid="Base_Column_List"/> |
| | | FROM `user_group` ug,`group_menu` gm,`menu` m |
| | | WHERE ug.user_id = #{userId} |
| | | AND ug.group_id = gm.group_id |
| | | AND gm.menu_id = m.id |
| | | AND ug.is_delete = 0 |
| | | AND gm.is_delete = 0 |
| | | AND gm.channel = 1 |
| | | AND gm.channel_key = 1 |
| | | AND m.is_delete = 0 |
| | | </select> |
| | | |
| | | <select id="selectOrganizationMenu" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"></include> |
| | | <include refid="Base_Column_List"/> |
| | | FROM `menu` m, `organization_menu` om |
| | | WHERE om.organization_id = #{orgId} |
| | | AND m.id = om.menu_id |
| | | AND om.channel = 1 |
| | | AND om.channel_key = 1 |
| | | AND om.menu_id = m.id |
| | | AND om.is_delete = 0 |
| | | AND m.is_delete = 0 |
| | |
| | | /* |
| | | * 网页端渠道 |
| | | * */ |
| | | public static final Integer WEB_CHANNEL = 1; |
| | | public static final String WEB_CHANNEL = "1"; |
| | | |
| | | /* |
| | | * 登陆操作类型 |
| | |
| | | SENSOR_KEY_IS_USED(-35, "因子编码已被使用"), |
| | | ORGANIZATION_USER_NOT_EXIST(-36,"组织账号不存在"), |
| | | SENSOR_IS_NOT_EXIST(-37, "因子不存在"), |
| | | UNIT_CONVERSION_EXIST(-38,"换算公式已经存在") |
| | | UNIT_CONVERSION_EXIST(-38,"换算公式已经存在"), |
| | | MONITOR_POINT_IS_EXIST(-39,"站点已存在"), |
| | | MONITOR_POINT_IS_NOT_EXIST(-40,"站点不存在") |
| | | ; |
| | | private final Integer code; |
| | | private final String msg; |
New file |
| | |
| | | package com.moral.api.controller; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.moral.api.entity.Device; |
| | | import com.moral.api.entity.ManageAccount; |
| | | import com.moral.api.entity.Organization; |
| | | import com.moral.api.entity.User; |
| | | import com.moral.api.pojo.vo.device.DeviceVO; |
| | | import com.moral.api.service.DeviceService; |
| | | import com.moral.api.service.OrganizationService; |
| | | import com.moral.constant.ResultMessage; |
| | | import com.moral.util.PageResult; |
| | | |
| | | @Slf4j |
| | | @Api(tags = {"设备管理"}) |
| | | @RestController |
| | | @RequestMapping(value = "/device") |
| | | public class DeviceController { |
| | | |
| | | @Autowired |
| | | private DeviceService deviceService; |
| | | |
| | | @Autowired |
| | | private OrganizationService organizationService; |
| | | |
| | | @ApiOperation(value = "添加设备", notes = "添加设备") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String") |
| | | }) |
| | | @RequestMapping(value = "insert", method = RequestMethod.POST) |
| | | public ResultMessage insert(@RequestBody Device device) { |
| | | deviceService.insert(device); |
| | | return ResultMessage.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "维护人列表", notes = "维护人列表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String") |
| | | }) |
| | | @RequestMapping(value = "operators", method = RequestMethod.GET) |
| | | public ResultMessage selectOperators() { |
| | | List<ManageAccount> operators = deviceService.selectAllOperator(); |
| | | return ResultMessage.ok(operators); |
| | | } |
| | | |
| | | @ApiOperation(value = "型号列表", notes = "型号列表") |
| | | @RequestMapping(value = "versions", method = RequestMethod.GET) |
| | | public ResultMessage selectVersions() { |
| | | return null; |
| | | } |
| | | |
| | | @ApiOperation(value = "组织列表", notes = "组织列表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String") |
| | | }) |
| | | @RequestMapping(value = "organizations", method = RequestMethod.GET) |
| | | public ResultMessage selectOrganizations() { |
| | | List<Organization> organizations = deviceService.selectAllOrganization(); |
| | | return ResultMessage.ok(organizations); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页设备列表", notes = "分页设备列表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "page", value = "当前页", required = false, paramType = "query", dataType = "Integer"), |
| | | @ApiImplicitParam(name = "size", value = "每页条数", required = false, paramType = "query", dataType = "Integer"), |
| | | @ApiImplicitParam(name = "order", value = "排序字段", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "orderType", value = "排序类型,升序:0,降序:1", defaultValue = "0", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String"), |
| | | @ApiImplicitParam(name = "organizationName", value = "组织模糊查询", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "monitorPointName", value = "站点模糊查询", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "deviceName", value = "设备名称模糊查询", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "mac", value = "mac模糊查询", required = false, paramType = "query", dataType = "String"), |
| | | }) |
| | | @RequestMapping(value = "select", method = RequestMethod.POST) |
| | | public ResultMessage select(@RequestBody Map<String, Object> parameters) { |
| | | Page<DeviceVO> userPage = deviceService.selectDevices(parameters); |
| | | PageResult<DeviceVO> pageResult = new PageResult<>( |
| | | userPage.getTotal(), userPage.getPages(), userPage.getRecords() |
| | | ); |
| | | return ResultMessage.ok(pageResult); |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.moral.api.entity.MonitorPoint; |
| | | import com.moral.api.entity.Sensor; |
| | | import com.moral.api.service.MonitorPointService; |
| | | import com.moral.api.service.SensorService; |
| | | import com.moral.constant.ResponseCodeEnum; |
| | | import com.moral.constant.ResultMessage; |
| | | import com.moral.util.WebUtils; |
| | | import io.swagger.annotations.Api; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | @Api(tags = {"站点"}) |
| | | @RestController |
| | | @RequestMapping("/monitorPoint") |
| | | public class MonitorPointController { |
| | | |
| | | @Autowired |
| | | private MonitorPointService monitorPointService; |
| | | |
| | | @Autowired |
| | | private SensorService sensorService; |
| | | |
| | | @RequestMapping(value = "insertOneMonitorPoint", method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public ResultMessage insertOneMonitorPoint(@RequestBody Map<String, Object> parameters,HttpServletRequest request) { |
| | | MonitorPoint monitorPoint = JSON.parseObject(JSON.toJSONString(parameters), MonitorPoint.class); |
| | | Map<String,Object> resultMap = monitorPointService.insertMonitorPoint(monitorPoint); |
| | | String msg = resultMap.get("msg").toString(); |
| | | int code = Integer.parseInt(resultMap.get("code").toString()); |
| | | if (code == 0){ |
| | | return ResultMessage.ok(msg); |
| | | } |
| | | return ResultMessage.fail(Integer.parseInt(resultMap.get("code").toString()),resultMap.get("msg").toString()); |
| | | //return null; |
| | | } |
| | | |
| | | @RequestMapping(value = "updateMonitorPoint", method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public ResultMessage updateMonitorPoint(@RequestBody Map<String, Object> parameters,HttpServletRequest request) { |
| | | Map<String,Object> resultMap = monitorPointService.updateMonitorPoint(parameters); |
| | | String msg = resultMap.get("msg").toString(); |
| | | int code = Integer.parseInt(resultMap.get("code").toString()); |
| | | if (code == 0){ |
| | | return ResultMessage.ok(msg); |
| | | } |
| | | return ResultMessage.fail(Integer.parseInt(resultMap.get("code").toString()),resultMap.get("msg").toString()); |
| | | } |
| | | |
| | | @RequestMapping(value = "getAllMonitorPoint", method = RequestMethod.GET) |
| | | @ResponseBody |
| | | public ResultMessage getAllMonitorPoint(HttpServletRequest request) { |
| | | Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null); |
| | | Map<String,Object> resultMap = monitorPointService.getAllMonitorPoint(parameters); |
| | | if (!resultMap.containsKey("code")){ |
| | | return ResultMessage.ok(resultMap); |
| | | } |
| | | return ResultMessage.fail(Integer.parseInt(resultMap.get("code").toString()),resultMap.get("msg").toString()); |
| | | } |
| | | |
| | | @RequestMapping(value = "deleteMonitorPoint", method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public ResultMessage deleteMonitorPoint(@RequestBody Map<String, Object> parameters,HttpServletRequest request) { |
| | | if (!parameters.containsKey("id")){ |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | } |
| | | Map<String,Object> resultMap = monitorPointService.deleteMonitorPoint(parameters); |
| | | String msg = resultMap.get("msg").toString(); |
| | | int code = Integer.parseInt(resultMap.get("code").toString()); |
| | | if (code == 0){ |
| | | return ResultMessage.ok(msg); |
| | | } |
| | | return ResultMessage.fail(Integer.parseInt(resultMap.get("code").toString()),resultMap.get("msg").toString()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.api.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 设备表 |
| | | * </p> |
| | | * |
| | | * @author moral |
| | | * @since 2021-05-11 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class Device extends Model<Device> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 设备名称 |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * mac号 |
| | | */ |
| | | private String mac; |
| | | |
| | | /** |
| | | * 设备地址 |
| | | */ |
| | | private String address; |
| | | |
| | | /** |
| | | * 经度 |
| | | */ |
| | | private Double longitude; |
| | | |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | private Double latitude; |
| | | |
| | | /** |
| | | * 设备状态,与字典表关联 |
| | | */ |
| | | private String state; |
| | | |
| | | /** |
| | | * 维护人id,多个逗号隔开,来源于manage_account |
| | | */ |
| | | private String operateIds; |
| | | |
| | | /** |
| | | * 站点id |
| | | */ |
| | | private Integer monitorPointId; |
| | | |
| | | /** |
| | | * 组织id |
| | | */ |
| | | private Integer organizationId; |
| | | |
| | | /** |
| | | * 设备型号id |
| | | */ |
| | | private Integer deviceVersionId; |
| | | |
| | | /** |
| | | * 行业,与字典表关联 |
| | | */ |
| | | private String profession; |
| | | |
| | | /** |
| | | * 设备工艺,1:烟道;2:厂界;3:车间,基本数据在字典表 |
| | | */ |
| | | private String tech; |
| | | |
| | | /** |
| | | * 设备检测器,与字典表关联 |
| | | */ |
| | | private String detector; |
| | | |
| | | /** |
| | | * 采购商,与字典表关联 |
| | | */ |
| | | private String purchaser; |
| | | |
| | | /** |
| | | * 创建(生产)时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 安装时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date installTime; |
| | | |
| | | /** |
| | | * 逻辑删除,0:不删除;1:删除 |
| | | */ |
| | | private String isDelete; |
| | | |
| | | /** |
| | | * 设备工艺扩展字段 |
| | | */ |
| | | private String extend; |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | |
| | | private Integer menuId; |
| | | |
| | | /** |
| | | * 渠道字典键 |
| | | * 渠道 |
| | | */ |
| | | private String channelKey; |
| | | |
| | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | |
| | | /** |
New file |
| | |
| | | package com.moral.api.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author moral |
| | | * @since 2021-05-12 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class MonitorPoint extends Model<MonitorPoint> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 序号 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 站点名 |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 经度 |
| | | */ |
| | | private Double longitude; |
| | | |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | private Double latitude; |
| | | |
| | | /** |
| | | * 省编码 |
| | | */ |
| | | private Integer provinceCode; |
| | | |
| | | /** |
| | | * 地级市编码 |
| | | */ |
| | | private Integer cityCode; |
| | | |
| | | /** |
| | | * 县/区/县级市 |
| | | */ |
| | | private Integer areaCode; |
| | | |
| | | /** |
| | | * 具体地址 |
| | | */ |
| | | private String address; |
| | | |
| | | /** |
| | | * 组织id |
| | | */ |
| | | private Integer organizationId; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 是否已删除 |
| | | */ |
| | | private String isDelete; |
| | | |
| | | /** |
| | | * 描述 |
| | | */ |
| | | @TableField(value = "`desc`") |
| | | private String desc; |
| | | |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.time.LocalDateTime; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | |
| | | /** |
| | | * 密码 |
| | | */ |
| | | @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) |
| | | private String password; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 过期时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date expireTime; |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.io.Serializable; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | |
| | | /** |
| | | * 操作时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | |
New file |
| | |
| | | package com.moral.api.mapper; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.moral.api.entity.Device; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.moral.api.pojo.vo.device.DeviceVO; |
| | | |
| | | /** |
| | | * <p> |
| | | * 设备表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author moral |
| | | * @since 2021-05-11 |
| | | */ |
| | | public interface DeviceMapper extends BaseMapper<Device> { |
| | | |
| | | IPage<DeviceVO> selectAllDeviceInfo(Page<DeviceVO> page, @Param("ew") QueryWrapper<DeviceVO> queryWrapper); |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.mapper; |
| | | |
| | | import com.moral.api.entity.MonitorPoint; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author moral |
| | | * @since 2021-05-12 |
| | | */ |
| | | public interface MonitorPointMapper extends BaseMapper<MonitorPoint> { |
| | | |
| | | void updateMonitorPoint(Map map); |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.pojo.vo.device; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.moral.api.entity.Device; |
| | | import com.moral.api.entity.ManageAccount; |
| | | import com.moral.api.entity.Organization; |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class DeviceVO extends Device { |
| | | |
| | | /* |
| | | * 行业 |
| | | * */ |
| | | private String professionName; |
| | | |
| | | /* |
| | | * 组织 |
| | | * */ |
| | | private Organization organization; |
| | | |
| | | /* |
| | | * 维护人 |
| | | * */ |
| | | private List<ManageAccount> operators; |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.moral.api.entity.Device; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.moral.api.entity.ManageAccount; |
| | | import com.moral.api.entity.Organization; |
| | | import com.moral.api.pojo.vo.device.DeviceVO; |
| | | |
| | | /** |
| | | * <p> |
| | | * 设备表 服务类 |
| | | * </p> |
| | | * |
| | | * @author moral |
| | | * @since 2021-05-11 |
| | | */ |
| | | public interface DeviceService extends IService<Device> { |
| | | |
| | | void insert(Device device); |
| | | |
| | | List<ManageAccount> selectAllOperator(); |
| | | |
| | | List<Organization> selectAllOrganization(); |
| | | |
| | | Page<DeviceVO> selectDevices(Map<String, Object> parameters); |
| | | } |
New file |
| | |
| | | package com.moral.api.service; |
| | | |
| | | import com.moral.api.entity.MonitorPoint; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author moral |
| | | * @since 2021-05-12 |
| | | */ |
| | | @Transactional |
| | | public interface MonitorPointService extends IService<MonitorPoint> { |
| | | |
| | | @Transactional |
| | | Map<String,Object> insertMonitorPoint(MonitorPoint monitorPoint); |
| | | |
| | | Map<String,Object> getAllMonitorPoint(Map map); |
| | | |
| | | @Transactional |
| | | Map<String,Object> updateMonitorPoint(Map<String,Object> updateMap); |
| | | |
| | | @Transactional |
| | | Map<String,Object> deleteMonitorPoint(Map map); |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.moral.api.entity.Device; |
| | | import com.moral.api.entity.ManageAccount; |
| | | import com.moral.api.entity.Organization; |
| | | import com.moral.api.entity.User; |
| | | import com.moral.api.mapper.DeviceMapper; |
| | | import com.moral.api.mapper.ManageAccountMapper; |
| | | import com.moral.api.mapper.OrganizationMapper; |
| | | import com.moral.api.pojo.vo.device.DeviceVO; |
| | | import com.moral.api.service.DeviceService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.moral.constant.Constants; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 设备表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author moral |
| | | * @since 2021-05-11 |
| | | */ |
| | | @Service |
| | | public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> implements DeviceService { |
| | | |
| | | @Autowired |
| | | private DeviceMapper deviceMapper; |
| | | |
| | | @Autowired |
| | | private ManageAccountMapper manageAccountMapper; |
| | | |
| | | @Autowired |
| | | private OrganizationMapper organizationMapper; |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void insert(Device device) { |
| | | deviceMapper.insert(device); |
| | | } |
| | | |
| | | @Override |
| | | public List<ManageAccount> selectAllOperator() { |
| | | QueryWrapper<ManageAccount> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select("id", "user_name").eq("is_delete", Constants.NOT_DELETE); |
| | | return manageAccountMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<Organization> selectAllOrganization() { |
| | | QueryWrapper<Organization> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select("id", "name").ge("expire_time", new Date()).eq("is_delete", Constants.NOT_DELETE); |
| | | return organizationMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public Page<DeviceVO> selectDevices(Map<String, Object> parameters) { |
| | | QueryWrapper<DeviceVO> queryWrapper = new QueryWrapper<>(); |
| | | Integer page = (Integer) parameters.get("page"); |
| | | Integer size = (Integer) parameters.get("size"); |
| | | Page<DeviceVO> pageData = new Page<>(page, size); |
| | | deviceMapper.selectAllDeviceInfo(pageData, queryWrapper); |
| | | return pageData; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.api.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.moral.api.entity.MonitorPoint; |
| | | import com.moral.api.entity.Organization; |
| | | import com.moral.api.mapper.MonitorPointMapper; |
| | | import com.moral.api.mapper.OrganizationMapper; |
| | | import com.moral.api.service.MonitorPointService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.moral.api.util.LogUtils; |
| | | import com.moral.constant.Constants; |
| | | import com.moral.constant.ResponseCodeEnum; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author moral |
| | | * @since 2021-05-12 |
| | | */ |
| | | @Service |
| | | @Transactional |
| | | public class MonitorPointServiceImpl extends ServiceImpl<MonitorPointMapper, MonitorPoint> implements MonitorPointService { |
| | | |
| | | @Autowired(required = false) |
| | | private MonitorPointMapper monitorPointMapper; |
| | | |
| | | @Autowired(required = false) |
| | | private OrganizationMapper organizationMapper; |
| | | |
| | | @Autowired |
| | | LogUtils logUtils; |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Map<String, Object> insertMonitorPoint(MonitorPoint monitorPoint) { |
| | | Map resultMap = new HashMap(); |
| | | if (monitorPoint.getName()==null){ |
| | | resultMap.put("code",ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | return resultMap; |
| | | } |
| | | QueryWrapper<MonitorPoint> wapper_name = new QueryWrapper<>(); |
| | | wapper_name.eq("name",monitorPoint.getName()); |
| | | wapper_name.eq("is_delete",Constants.NOT_DELETE); |
| | | if(monitorPointMapper.selectOne(wapper_name)!=null){ |
| | | resultMap.put("code",ResponseCodeEnum.MONITOR_POINT_IS_EXIST.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.MONITOR_POINT_IS_EXIST.getMsg()); |
| | | return resultMap; |
| | | } |
| | | if (monitorPoint.getOrganizationId()!=null){ |
| | | QueryWrapper<Organization> wapper_org = new QueryWrapper<>(); |
| | | wapper_org.eq("id",monitorPoint.getOrganizationId()); |
| | | wapper_org.eq("is_delete",Constants.NOT_DELETE); |
| | | if (organizationMapper.selectOne(wapper_org)==null){ |
| | | resultMap.put("code",ResponseCodeEnum.ORGANIZATION_NOT_EXIST.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.ORGANIZATION_NOT_EXIST.getMsg()); |
| | | return resultMap; |
| | | } |
| | | } |
| | | monitorPointMapper.insert(monitorPoint); |
| | | //操作插入日志 |
| | | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
| | | String content = "添加了站点:"+monitorPoint.getName()+";"; |
| | | logUtils.saveOperationForManage(request,content,Constants.INSERT_OPERATE_TYPE); |
| | | resultMap.put("code",ResponseCodeEnum.SUCCESS.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.SUCCESS.getMsg()); |
| | | return resultMap; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getAllMonitorPoint(Map map) { |
| | | Map<String,Object> resultMap = new HashMap<>(); |
| | | if (!map.containsKey("current")||!map.containsKey("size")||!map.containsKey("orderType")){ |
| | | resultMap.put("code",ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | return resultMap; |
| | | } |
| | | int current = Integer.parseInt(map.get("current").toString()); |
| | | int size = Integer.parseInt(map.get("size").toString()); |
| | | Page<MonitorPoint> page = new Page(current,size); |
| | | QueryWrapper<MonitorPoint> wrapper = new QueryWrapper(); |
| | | wrapper.eq("is_delete",0); |
| | | String orderType = map.get("orderType").toString(); |
| | | if (orderType.equals(Constants.ORDER_ASC)){ |
| | | wrapper.orderByAsc("create_time"); |
| | | }else { |
| | | wrapper.orderByDesc("create_time"); |
| | | } |
| | | Page resultPage = monitorPointMapper.selectPage(page,wrapper); |
| | | List<MonitorPoint> monitorPoints = resultPage.getRecords(); |
| | | SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | List<Map<String,Object>> monitorPointtList = new ArrayList<>(); |
| | | for (MonitorPoint monitorPoint:monitorPoints) { |
| | | Map monitorPointMap = JSON.parseObject(JSON.toJSONString(monitorPoint),Map.class); |
| | | String createTime = SDF.format(monitorPoint.getCreateTime()); |
| | | String updateTime = SDF.format(monitorPoint.getUpdateTime()); |
| | | monitorPointMap.put("createTime",createTime); |
| | | monitorPointMap.put("updateTime",updateTime); |
| | | monitorPointMap.put("key",monitorPoint.getId()); |
| | | monitorPointtList.add(monitorPointMap); |
| | | } |
| | | resultMap.put("manageRoles",monitorPointtList); |
| | | int totalNumber = monitorPoints.size(); |
| | | resultMap.put("totalNumber",totalNumber); |
| | | resultMap.put("current",current); |
| | | int totalPageNumber = totalNumber/size; |
| | | if(totalNumber%size != 0){ |
| | | totalPageNumber += 1; |
| | | } |
| | | resultMap.put("totalPageNumber",totalPageNumber); |
| | | return resultMap; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Map<String, Object> updateMonitorPoint(Map<String,Object> updateMap) { |
| | | Map resultMap = new HashMap(); |
| | | if(!updateMap.containsKey("id")){ |
| | | resultMap.put("code",ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | return resultMap; |
| | | } |
| | | if (updateMap.containsKey("name")){ |
| | | if (updateMap.get("name")==null||updateMap.get("name")==""){ |
| | | resultMap.put("code",ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | return resultMap; |
| | | } |
| | | QueryWrapper<MonitorPoint> wapper_name = new QueryWrapper<>(); |
| | | wapper_name.eq("name",updateMap.get("name")); |
| | | wapper_name.eq("is_delete",Constants.NOT_DELETE); |
| | | MonitorPoint monitorPoint_name = monitorPointMapper.selectOne(wapper_name); |
| | | if(monitorPoint_name!=null&&!monitorPoint_name.getId().toString().equals(updateMap.get("id").toString())){ |
| | | resultMap.put("code",ResponseCodeEnum.MONITOR_POINT_IS_EXIST.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.MONITOR_POINT_IS_EXIST.getMsg()); |
| | | return resultMap; |
| | | } |
| | | } |
| | | QueryWrapper<MonitorPoint> wapper_id = new QueryWrapper<>(); |
| | | wapper_id.eq("id",updateMap.get("id")); |
| | | wapper_id.eq("is_delete",Constants.NOT_DELETE); |
| | | MonitorPoint oldMonitorPoint = monitorPointMapper.selectOne(wapper_id); |
| | | if (oldMonitorPoint==null){ |
| | | resultMap.put("code",ResponseCodeEnum.MONITOR_POINT_IS_NOT_EXIST.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.MONITOR_POINT_IS_NOT_EXIST.getMsg()); |
| | | return resultMap; |
| | | } |
| | | monitorPointMapper.updateMonitorPoint(updateMap); |
| | | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
| | | String content = "修改了站点:"+oldMonitorPoint.getName()+";"; |
| | | for (Object key:updateMap.keySet()) { |
| | | if (key.toString().equals("name")){ |
| | | content = content+"站点名称:"+oldMonitorPoint.getName()+"->"+updateMap.get(key)+";"; |
| | | } |
| | | if (key.toString().equals("longitude")){ |
| | | content = content+"经度:"+oldMonitorPoint.getLongitude()+"->"+updateMap.get(key)+";"; |
| | | } |
| | | if (key.toString().equals("latitude")){ |
| | | content = content+"纬度:"+oldMonitorPoint.getLatitude()+"->"+updateMap.get(key)+";"; |
| | | } |
| | | if (key.toString().equals("province_code")){ |
| | | content = content+"省份编码:"+oldMonitorPoint.getProvinceCode()+"->"+updateMap.get(key)+";"; |
| | | } |
| | | if (key.toString().equals("city_code")){ |
| | | content = content+"地级市编码:"+oldMonitorPoint.getCityCode()+"->"+updateMap.get(key)+";"; |
| | | } |
| | | if (key.toString().equals("area_code")){ |
| | | content = content+"县/区/县级市:"+oldMonitorPoint.getAreaCode()+"->"+updateMap.get(key)+";"; |
| | | } |
| | | if (key.toString().equals("address")){ |
| | | content = content+"地址:"+oldMonitorPoint.getAddress()+"->"+updateMap.get(key)+";"; |
| | | } |
| | | if (key.toString().equals("organization_id")){ |
| | | content = content+"组织id:"+oldMonitorPoint.getOrganizationId()+"->"+updateMap.get(key)+";"; |
| | | } |
| | | if (key.toString().equals("desc")){ |
| | | content = content+"描述:"+oldMonitorPoint.getDesc()+"->"+updateMap.get(key)+";"; |
| | | } |
| | | } |
| | | logUtils.saveOperationForManage(request,content,Constants.UPDATE_OPERATE_TYPE); |
| | | resultMap.put("code",ResponseCodeEnum.SUCCESS.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.SUCCESS.getMsg()); |
| | | return resultMap; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Map<String, Object> deleteMonitorPoint(Map map) { |
| | | Map resultMap = new HashMap(); |
| | | QueryWrapper<MonitorPoint> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("id",map.get("id")); |
| | | wrapper.eq("is_delete","0"); |
| | | MonitorPoint monitorPoint = monitorPointMapper.selectOne(wrapper); |
| | | if(ObjectUtils.isEmpty(monitorPoint)){ |
| | | resultMap.put("code",ResponseCodeEnum.MONITOR_POINT_IS_NOT_EXIST.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.MONITOR_POINT_IS_NOT_EXIST.getMsg()); |
| | | return resultMap; |
| | | } |
| | | MonitorPoint deleteMonitorPoint = new MonitorPoint(); |
| | | deleteMonitorPoint.setIsDelete("1"); |
| | | monitorPointMapper.update(deleteMonitorPoint,wrapper); |
| | | //操作插入日志 |
| | | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
| | | String content = "删除了站点:"+monitorPoint.getName()+";"; |
| | | logUtils.saveOperationForManage(request,content,Constants.DELETE_OPERATE_TYPE); |
| | | resultMap.put("code",ResponseCodeEnum.SUCCESS.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.SUCCESS.getMsg()); |
| | | return resultMap; |
| | | } |
| | | } |
| | |
| | | Page resultPage = sensorMapper.selectPage(page,wrapper); |
| | | List<Sensor> sensors = resultPage.getRecords(); |
| | | SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | List<Map<String,Object>> sensotList = new ArrayList<>(); |
| | | List<Map<String,Object>> sensorList = new ArrayList<>(); |
| | | for (Sensor sensor:sensors) { |
| | | Map manageRoleMap = JSON.parseObject(JSON.toJSONString(sensor),Map.class); |
| | | Map sensorMap = JSON.parseObject(JSON.toJSONString(sensor),Map.class); |
| | | String createTime = SDF.format(sensor.getCreateTime()); |
| | | String updateTime = SDF.format(sensor.getUpdateTime()); |
| | | manageRoleMap.put("createTime",createTime); |
| | | manageRoleMap.put("updateTime",updateTime); |
| | | manageRoleMap.put("key",sensor.getId()); |
| | | sensotList.add(manageRoleMap); |
| | | sensorMap.put("createTime",createTime); |
| | | sensorMap.put("updateTime",updateTime); |
| | | sensorMap.put("key",sensor.getId()); |
| | | sensorList.add(sensorMap); |
| | | } |
| | | resultMap.put("manageRoles",sensotList); |
| | | resultMap.put("manageRoles",sensorList); |
| | | int totalNumber = sensors.size(); |
| | | resultMap.put("totalNumber",totalNumber); |
| | | resultMap.put("current",current); |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.moral.api.mapper.DeviceMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.moral.api.entity.Device"> |
| | | <id column="id" property="id"/> |
| | | <result column="name" property="name"/> |
| | | <result column="mac" property="mac"/> |
| | | <result column="address" property="address"/> |
| | | <result column="longitude" property="longitude"/> |
| | | <result column="latitude" property="latitude"/> |
| | | <result column="state" property="state"/> |
| | | <result column="operate_ids" property="operateIds"/> |
| | | <result column="monitor_point_id" property="monitorPointId"/> |
| | | <result column="organization_id" property="organizationId"/> |
| | | <result column="device_version_id" property="deviceVersionId"/> |
| | | <result column="profession" property="profession"/> |
| | | <result column="tech" property="tech"/> |
| | | <result column="detector" property="detector"/> |
| | | <result column="purchaser" property="purchaser"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | <result column="install_time" property="installTime"/> |
| | | <result column="is_delete" property="isDelete"/> |
| | | <result column="extend" property="extend"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="resultMap" type="com.moral.api.pojo.vo.device.DeviceVO" extends="BaseResultMap"> |
| | | <result column="profession_name" property="professionName"/> |
| | | <association property="organization" javaType="com.moral.api.entity.Organization"> |
| | | <result column="org_id" property="id"/> |
| | | <result column="org_name" property="name"/> |
| | | </association> |
| | | <!--设备维护人--> |
| | | <collection property="operators" ofType="com.moral.api.entity.ManageAccount"> |
| | | <id column="operate_id" property="id" jdbcType="INTEGER"/> |
| | | <result column="operate_name" property="userName" jdbcType="VARCHAR"/> |
| | | </collection> |
| | | </resultMap> |
| | | |
| | | <select id="selectAllDeviceInfo" resultMap="resultMap"> |
| | | SELECT d.id, |
| | | d.`name`, |
| | | d.mac, |
| | | d.address, |
| | | d.longitude, |
| | | d.latitude, |
| | | d.operate_ids, |
| | | d.organization_id, |
| | | d.monitor_point_id, |
| | | d.organization_id, |
| | | d.device_version_id, |
| | | d.profession profession, |
| | | o.id org_id, |
| | | o.`name` org_name, |
| | | ma.id operate_id, |
| | | ma.user_name operate_name, |
| | | sd.dataValue profession_name |
| | | FROM `device` d |
| | | LEFT JOIN `organization` o |
| | | ON d.organization_id = o.id |
| | | LEFT JOIN `manage_account` ma |
| | | ON FIND_IN_SET( |
| | | ma.id, (SELECT operate_ids FROM device) |
| | | ) |
| | | LEFT JOIN |
| | | ( |
| | | SELECT sdt.`name`, sdd.dataKey, sdd.dataValue |
| | | FROM sys_dict_type sdt, |
| | | sys_dict_data sdd |
| | | WHERE sdt.id = sdd.dict_type_id |
| | | ) sd |
| | | on sd.`name` = 'profession' |
| | | and d.profession = sd.dataKey |
| | | AND d.is_delete = 0 |
| | | ${ew.customSqlSegment} |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.moral.api.mapper.GroupMenuMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.moral.api.entity.GroupMenu"> |
| | | <id column="id" property="id" /> |
| | | <result column="group_id" property="groupId" /> |
| | | <result column="menu_id" property="menuId" /> |
| | | <result column="channel" property="channel" /> |
| | | <result column="organization_id" property="organizationId" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="is_delete" property="isDelete" /> |
| | | </resultMap> |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.moral.api.entity.GroupMenu"> |
| | | <id column="id" property="id"/> |
| | | <result column="group_id" property="groupId"/> |
| | | <result column="menu_id" property="menuId"/> |
| | | <result column="channel_key" property="channelKey"/> |
| | | <result column="organization_id" property="organizationId"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | <result column="is_delete" property="isDelete"/> |
| | | </resultMap> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.moral.api.mapper.MonitorPointMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.moral.api.entity.MonitorPoint"> |
| | | <id column="id" property="id" /> |
| | | <result column="name" property="name" /> |
| | | <result column="longitude" property="longitude" /> |
| | | <result column="latitude" property="latitude" /> |
| | | <result column="province_code" property="provinceCode" /> |
| | | <result column="city_code" property="cityCode" /> |
| | | <result column="area_code" property="areaCode" /> |
| | | <result column="address" property="address" /> |
| | | <result column="organization_id" property="organizationId" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="is_delete" property="isDelete" /> |
| | | <result column="desc" property="desc" /> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | mp.id,mp.name,mp.longitude,mp.latitude,mp.province_code,mp.city_code,mp.area_code,mp.address,mp.organization_id,mp.create_time,mp.update_time,mp.is_delete,mp.desc |
| | | </sql> |
| | | |
| | | <update id="updateMonitorPoint" parameterType="java.util.Map"> |
| | | update monitor_point |
| | | <set> |
| | | <if test="name != null"> |
| | | name = #{name}, |
| | | </if> |
| | | <if test="longitude != null"> |
| | | longitude = #{longitude}, |
| | | </if> |
| | | <if test="latitude != null"> |
| | | latitude = #{latitude}, |
| | | </if> |
| | | <if test="province_code != null"> |
| | | province_code = #{province_code}, |
| | | </if> |
| | | <if test="city_code != null"> |
| | | city_code = #{city_code}, |
| | | </if> |
| | | <if test="area_code != null"> |
| | | area_code = #{area_code}, |
| | | </if> |
| | | <if test="address != null"> |
| | | address = #{address}, |
| | | </if> |
| | | <if test="organization_id != null"> |
| | | organization_id = #{organization_id}, |
| | | </if> |
| | | <if test="desc != null"> |
| | | `desc` = #{desc}, |
| | | </if> |
| | | <if test="isDelete != null"> |
| | | is_delete = #{isDelete}, |
| | | </if> |
| | | </set> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | </mapper> |