Commit df83eb49 authored by luben's avatar luben

Merge branch 'dev-lb' into 'dev'

Dev lb

See merge request !150
parents caebb5a4 cbaf1eaa
Pipeline #143431 passed with stages
in 7 minutes and 8 seconds
package com.ruoyi.web.controller.other;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.system.domain.other.MapEntity;
import com.ruoyi.system.service.other.MapEntityService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/map")
@Api(tags = "地图")
public class MapEntityController extends BaseController {
@Autowired
private MapEntityService mapEntityService;
@RequestMapping(value = "/getAllMapEntities",method = RequestMethod.GET)
@ResponseBody
public List<MapEntity> getAllMapEntities() {
return mapEntityService.getAllMapEntities();
}
@RequestMapping(value = "/getMapEntityById",method = RequestMethod.GET)
@ResponseBody
public MapEntity getMapEntityById(@RequestParam(name = "id") String id) {
return mapEntityService.getMapEntityById(id);
}
@RequestMapping(value = "/addMapEntity",method = RequestMethod.POST)
@ResponseBody
public MapEntity addMapEntityById(@RequestBody MapEntity mapEntity) {
return mapEntityService.addMapEntityById(mapEntity);
}
@RequestMapping(value = "/updateMapEntity",method = RequestMethod.POST)
@ResponseBody
public MapEntity updateMapEntity(@RequestBody MapEntity mapEntity) {
return mapEntityService.updateMapEntity(mapEntity.getId(), mapEntity);
}
@RequestMapping(value = "/deleteMapEntity",method = RequestMethod.DELETE)
@ResponseBody
public void deleteMapEntity(@RequestParam(name = "id") String id) {
mapEntityService.deleteMapEntity(id);
}
}
package com.ruoyi.system.domain.other;
public class MapEntity {
private String id;
// 类型
private String type;
// 上级主体
private String parentEntity;
// 主体编码
private String entityCode;
// 主体名称
private String entityName;
// 二维码
private String qrCode;
// 主体范围
private String entityScope;
// 坐标地址
private String coordinateAddress;
// 是否有效
private int isValid;
// 主体层级
private int entityLevel;
// Getters 和 Setters 方法
public String getId() { return id; }
public void setId(String id) { this.id = id; }
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getParentEntity() {
return parentEntity;
}
public void setParentEntity(String parentEntity) {
this.parentEntity = parentEntity;
}
public String getEntityCode() {
return entityCode;
}
public void setEntityCode(String entityCode) {
this.entityCode = entityCode;
}
public String getEntityName() {
return entityName;
}
public void setEntityName(String entityName) {
this.entityName = entityName;
}
public String getQrCode() {
return qrCode;
}
public void setQrCode(String qrCode) {
this.qrCode = qrCode;
}
public String getEntityScope() {
return entityScope;
}
public void setEntityScope(String entityScope) {
this.entityScope = entityScope;
}
public String getCoordinateAddress() {
return coordinateAddress;
}
public void setCoordinateAddress(String coordinateAddress) {
this.coordinateAddress = coordinateAddress;
}
public int isValid() {
return isValid;
}
public void setValid(int valid) {
isValid = valid;
}
public int getEntityLevel() {
return entityLevel;
}
public void setEntityLevel(int entityLevel) {
this.entityLevel = entityLevel;
}
}
\ No newline at end of file
package com.ruoyi.system.mapper.other;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.domain.other.MapEntity;
import java.util.List;
public interface MapEntityMapper extends BaseMapper<MapEntity> {
}
package com.ruoyi.system.service.other;
import com.ruoyi.system.domain.other.MapEntity;
import java.util.List;
public interface MapEntityService {
// 获取所有实体
List<MapEntity> getAllMapEntities();
// 根据 ID 获取实体
MapEntity getMapEntityById(String id);
// 更新实体
MapEntity updateMapEntity(String id, MapEntity mapEntity);
// 删除实体
void deleteMapEntity(String id);
MapEntity addMapEntityById(MapEntity mapEntity);
}
\ No newline at end of file
package com.ruoyi.system.service.other.impl;
import cn.hutool.core.lang.UUID;
import com.ruoyi.system.domain.other.MapEntity;
import com.ruoyi.system.mapper.other.MapEntityMapper;
import com.ruoyi.system.service.other.MapEntityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class MapEntityServiceImpl implements MapEntityService {
@Autowired
private MapEntityMapper mapEntityMapper;
@Override
public List<MapEntity> getAllMapEntities() {
return mapEntityMapper.selectList(null);
}
@Override
public MapEntity getMapEntityById(String id) {
return mapEntityMapper.selectById(id);
}
@Override
public MapEntity updateMapEntity(String id, MapEntity mapEntity) {
mapEntity.setId(id);
mapEntityMapper.updateById(mapEntity);
return mapEntity;
}
@Override
public void deleteMapEntity(String id) {
mapEntityMapper.deleteById(id);
}
@Override
public MapEntity addMapEntityById(MapEntity mapEntity) {
mapEntity.setId(UUID.randomUUID().toString());
mapEntityMapper.insert(mapEntity);
return mapEntity;
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.other.MapEntityMapper">
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment