feat:增加标注分组
This commit is contained in:
parent
d4253be537
commit
435ed1c62f
|
|
@ -61,7 +61,7 @@ public class AirlineMarkerGroupController extends BaseController {
|
|||
group.setUpdateBy(SecurityUtils.getUserId().toString());
|
||||
AirlineMarkerGroupDTO dto = AirlineMarkerGroupControllerConvert.to(group);
|
||||
if (iAirlineMarkerGroupService.checkGroupNameUnique(dto)) {
|
||||
return error("新增分组'" + group.getGroupName() + "'失败,分组名称已存在");
|
||||
return error("新增分组'" + group.getName() + "'失败,分组名称已存在");
|
||||
}
|
||||
return toAjax(iAirlineMarkerGroupService.insertGroup(dto));
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ public class AirlineMarkerGroupController extends BaseController {
|
|||
group.setUpdateBy(SecurityUtils.getUserId().toString());
|
||||
AirlineMarkerGroupDTO dto = AirlineMarkerGroupControllerConvert.to(group);
|
||||
if (iAirlineMarkerGroupService.checkGroupNameUnique(dto)) {
|
||||
return error("修改分组'" + group.getGroupName() + "'失败,分组名称已存在");
|
||||
return error("修改分组'" + group.getName() + "'失败,分组名称已存在");
|
||||
}
|
||||
return toAjax(iAirlineMarkerGroupService.updateGroup(dto));
|
||||
}
|
||||
|
|
@ -83,10 +83,10 @@ public class AirlineMarkerGroupController extends BaseController {
|
|||
/**
|
||||
* 删除分组
|
||||
*/
|
||||
@DeleteMapping("/delete/{groupId}")
|
||||
@DeleteMapping("/delete/{id}")
|
||||
@Operation(summary = "删除分组")
|
||||
public AjaxResult removeByQueryParam(@PathVariable Long groupId) {
|
||||
return toAjax(iAirlineMarkerGroupService.deleteGroupById(groupId));
|
||||
public AjaxResult removeByQueryParam(@PathVariable Long id) {
|
||||
return toAjax(iAirlineMarkerGroupService.deleteGroupById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -101,10 +101,10 @@ public class AirlineMarkerGroupController extends BaseController {
|
|||
/**
|
||||
* 根据ID查询分组
|
||||
*/
|
||||
@GetMapping("/get/{groupId}")
|
||||
@GetMapping("/get/{id}")
|
||||
@Operation(summary = "根据ID查询分组")
|
||||
public AjaxResult getInfo(@PathVariable Long groupId) {
|
||||
AirlineMarkerGroupDTO dto = iAirlineMarkerGroupService.selectGroupById(groupId);
|
||||
public AjaxResult getInfo(@PathVariable Long id) {
|
||||
AirlineMarkerGroupDTO dto = iAirlineMarkerGroupService.selectGroupById(id);
|
||||
AirlineMarkerGroupVO result = AirlineMarkerGroupControllerConvert.from(dto);
|
||||
return success(result);
|
||||
}
|
||||
|
|
@ -112,12 +112,12 @@ public class AirlineMarkerGroupController extends BaseController {
|
|||
/**
|
||||
* 在指定分组下新增标注
|
||||
*/
|
||||
@PostMapping("/addMarker/{groupId}")
|
||||
@PostMapping("/addMarker/{id}")
|
||||
@Operation(summary = "在指定分组下新增标注")
|
||||
public AjaxResult addMarker(@PathVariable Long groupId, @Validated @RequestBody AirlineMarkerVO marker) {
|
||||
public AjaxResult addMarker(@PathVariable Long id, @Validated @RequestBody AirlineMarkerVO marker) {
|
||||
marker.setCreateBy(SecurityUtils.getUserId().toString());
|
||||
marker.setUpdateBy(SecurityUtils.getUserId().toString());
|
||||
AirlineMarkerDTO dto = AirlineMarkerControllerConvert.to(marker);
|
||||
return toAjax(iAirlineMarkerGroupService.insertMarkerWithGroup(groupId, dto));
|
||||
return toAjax(iAirlineMarkerGroupService.insertMarkerWithGroup(id, dto));
|
||||
}
|
||||
}
|
||||
|
|
@ -32,7 +32,7 @@ public interface IAirlineMarkerGroupDomain {
|
|||
|
||||
List<AirlineMarkerGroup> selectGroupList(AirlineMarkerGroup model);
|
||||
|
||||
AirlineMarkerGroup selectGroupById(Long groupId);
|
||||
AirlineMarkerGroup selectGroupById(Long id);
|
||||
|
||||
List<AirlineMarker> selectMarkerListByUserId(AirlineMarker model);
|
||||
}
|
||||
|
|
@ -56,8 +56,8 @@ public class AirlineMarkerGroupDomainImpl implements IAirlineMarkerGroupDomain {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AirlineMarkerGroup selectGroupById(Long groupId) {
|
||||
AirlineMarkerGroupEntity entity = airlineMarkerGroupMapper.selectGroupById(groupId);
|
||||
public AirlineMarkerGroup selectGroupById(Long id) {
|
||||
AirlineMarkerGroupEntity entity = airlineMarkerGroupMapper.selectGroupById(id);
|
||||
return AirlineMarkerGroupDomainConvert.from(entity);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ public class AirlineMarkerGroup extends ExBaseEntity {
|
|||
/**
|
||||
* 分组ID
|
||||
*/
|
||||
private Long groupId;
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
*/
|
||||
private String groupName;
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 组关联的标注
|
||||
|
|
@ -39,8 +39,8 @@ public class AirlineMarkerGroup extends ExBaseEntity {
|
|||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("groupId", getGroupId())
|
||||
.append("groupName", getGroupName())
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("markerCount", getMarkerCount())
|
||||
.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,5 +21,5 @@ public interface AirlineMarkerGroupMapper {
|
|||
|
||||
List<AirlineMarkerGroupEntity> selectGroupList(AirlineMarkerGroupEntity entity);
|
||||
|
||||
AirlineMarkerGroupEntity selectGroupById(Long groupId);
|
||||
AirlineMarkerGroupEntity selectGroupById(Long id);
|
||||
}
|
||||
|
|
@ -17,18 +17,18 @@ public class AirlineMarkerGroupEntity extends ExBaseEntity {
|
|||
/**
|
||||
* 分组ID
|
||||
*/
|
||||
private Long groupId;
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
*/
|
||||
private String groupName;
|
||||
private String name;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("groupId", getGroupId())
|
||||
.append("groupName", getGroupName())
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -14,10 +14,10 @@ public interface IAirlineMarkerGroupService {
|
|||
|
||||
/**
|
||||
* 删除分组(软删除)
|
||||
* @param groupId 分组ID
|
||||
* @param id 分组ID
|
||||
* @return 删除结果
|
||||
*/
|
||||
int deleteGroupById(Long groupId);
|
||||
int deleteGroupById(Long id);
|
||||
|
||||
/**
|
||||
* 检查分组名称是否唯一
|
||||
|
|
@ -49,18 +49,18 @@ public interface IAirlineMarkerGroupService {
|
|||
|
||||
/**
|
||||
* 根据ID查询分组
|
||||
* @param groupId 分组ID
|
||||
* @param id 分组ID
|
||||
* @return 分组信息
|
||||
*/
|
||||
AirlineMarkerGroupDTO selectGroupById(Long groupId);
|
||||
AirlineMarkerGroupDTO selectGroupById(Long id);
|
||||
|
||||
/**
|
||||
* 在指定分组下新增标注
|
||||
* @param groupId 分组ID
|
||||
* @param id 分组ID
|
||||
* @param marker 标注信息
|
||||
* @return 新增结果
|
||||
*/
|
||||
int insertMarkerWithGroup(Long groupId, AirlineMarkerDTO marker);
|
||||
int insertMarkerWithGroup(Long id, AirlineMarkerDTO marker);
|
||||
|
||||
/**
|
||||
* 批量删除分组
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ public class AirlineMarkerGroupDTO extends BaseEntity {
|
|||
/**
|
||||
* 分组ID
|
||||
*/
|
||||
private Long groupId;
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
*/
|
||||
private String groupName;
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 组关联的标注
|
||||
|
|
@ -39,8 +39,8 @@ public class AirlineMarkerGroupDTO extends BaseEntity {
|
|||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("groupId", getGroupId())
|
||||
.append("groupName", getGroupName())
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("markerCount", getMarkerCount())
|
||||
.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ public class AirlineMarkerGroupServiceImpl implements IAirlineMarkerGroupService
|
|||
private IAirlineMarkerDomain iAirlineMarkerDomain;
|
||||
|
||||
@Override
|
||||
public int deleteGroupById(Long groupId) {
|
||||
public int deleteGroupById(Long id) {
|
||||
AirlineMarkerGroup model = new AirlineMarkerGroup();
|
||||
model.setGroupId(groupId);
|
||||
model.setId(id);
|
||||
model.setDeletedBy(SecurityUtils.getUserId().toString());
|
||||
return iAirlineMarkerGroupDomain.deleteGroup(model);
|
||||
}
|
||||
|
|
@ -70,13 +70,13 @@ public class AirlineMarkerGroupServiceImpl implements IAirlineMarkerGroupService
|
|||
}
|
||||
|
||||
@Override
|
||||
public AirlineMarkerGroupDTO selectGroupById(Long groupId) {
|
||||
AirlineMarkerGroup model = iAirlineMarkerGroupDomain.selectGroupById(groupId);
|
||||
public AirlineMarkerGroupDTO selectGroupById(Long id) {
|
||||
AirlineMarkerGroup model = iAirlineMarkerGroupDomain.selectGroupById(id);
|
||||
return AirlineMarkerGroupServiceConvert.from(model);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertMarkerWithGroup(Long groupId, AirlineMarkerDTO marker) {
|
||||
public int insertMarkerWithGroup(Long id, AirlineMarkerDTO marker) {
|
||||
// 先插入标注
|
||||
marker.setCreateBy(SecurityUtils.getUserId().toString());
|
||||
marker.setUpdateBy(SecurityUtils.getUserId().toString());
|
||||
|
|
@ -96,8 +96,8 @@ public class AirlineMarkerGroupServiceImpl implements IAirlineMarkerGroupService
|
|||
}
|
||||
|
||||
int deletedCount = 0;
|
||||
for (Long groupId : groupIds) {
|
||||
int result = deleteGroupById(groupId);
|
||||
for (Long id : groupIds) {
|
||||
int result = deleteGroupById(id);
|
||||
if (result > 0) {
|
||||
deletedCount++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
-- 创建标注分组表
|
||||
CREATE TABLE IF NOT EXISTS airline_marker_group (
|
||||
group_id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '分组ID',
|
||||
group_name VARCHAR(255) NOT NULL COMMENT '分组名称',
|
||||
id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '分组ID',
|
||||
name VARCHAR(255) NOT NULL COMMENT '分组名称',
|
||||
del_flag BIGINT(20) DEFAULT 0 COMMENT '删除标识,0.未删除(默认);1,已删除',
|
||||
deleted_by VARCHAR(64) DEFAULT '' COMMENT '删除者',
|
||||
deleted_time DATETIME COMMENT '删除时间',
|
||||
|
|
@ -10,7 +10,7 @@ CREATE TABLE IF NOT EXISTS airline_marker_group (
|
|||
update_by VARCHAR(64) DEFAULT '' COMMENT '更新者',
|
||||
update_time DATETIME COMMENT '更新时间',
|
||||
remark VARCHAR(500) DEFAULT NULL COMMENT '备注',
|
||||
PRIMARY KEY (group_id)
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='标注分组表';
|
||||
|
||||
-- 修改标注分组明细表,将 group_id 改为关联标注分组表(如果需要数据迁移,需要先迁移数据)
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<!-- 结果映射 -->
|
||||
<resultMap id="AirlineMarkerGroupResult" type="com.ruoyi.airline.mapper.entity.AirlineMarkerGroupEntity">
|
||||
<id property="groupId" column="group_id" />
|
||||
<result property="groupName" column="group_name" />
|
||||
<id property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
|
|
@ -20,10 +20,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<!-- 检查分组名称是否唯一 -->
|
||||
<select id="checkGroupNameUnique" parameterType="com.ruoyi.airline.mapper.entity.AirlineMarkerGroupEntity" resultType="java.lang.Integer">
|
||||
select count(1) from airline_marker_group
|
||||
where group_name = #{groupName}
|
||||
where name = #{name}
|
||||
and del_flag = 0
|
||||
<if test="groupId != null">
|
||||
and group_id != #{groupId}
|
||||
<if test="id != null">
|
||||
and id != #{id}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
|
@ -33,43 +33,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
set del_flag = 1,
|
||||
deleted_by = #{deletedBy},
|
||||
deleted_time = now()
|
||||
where group_id = #{groupId}
|
||||
where id = #{id}
|
||||
and del_flag = 0
|
||||
</update>
|
||||
|
||||
<!-- 更新分组 -->
|
||||
<update id="updateGroup" parameterType="com.ruoyi.airline.mapper.entity.AirlineMarkerGroupEntity">
|
||||
update airline_marker_group
|
||||
set group_name = #{groupName},
|
||||
set name = #{name},
|
||||
update_by = #{updateBy},
|
||||
update_time = now()
|
||||
where group_id = #{groupId}
|
||||
where id = #{id}
|
||||
and del_flag = 0
|
||||
</update>
|
||||
|
||||
<!-- 插入分组 -->
|
||||
<insert id="insertGroup" parameterType="com.ruoyi.airline.mapper.entity.AirlineMarkerGroupEntity">
|
||||
insert into airline_marker_group (group_name, create_by, create_time, update_by, update_time, del_flag)
|
||||
values (#{groupName}, #{createBy}, now(), #{updateBy}, now(), 0)
|
||||
insert into airline_marker_group (name, create_by, create_time, update_by, update_time, del_flag)
|
||||
values (#{name}, #{createBy}, now(), #{updateBy}, now(), 0)
|
||||
</insert>
|
||||
|
||||
<!-- 查询分组列表 -->
|
||||
<select id="selectGroupList" parameterType="com.ruoyi.airline.mapper.entity.AirlineMarkerGroupEntity" resultMap="AirlineMarkerGroupResult">
|
||||
select group_id, group_name, create_by, create_time, update_by, update_time, del_flag, deleted_by, deleted_time
|
||||
select id, name, create_by, create_time, update_by, update_time, del_flag, deleted_by, deleted_time
|
||||
from airline_marker_group
|
||||
<where>
|
||||
del_flag = 0
|
||||
<if test="groupName != null and groupName != ''">
|
||||
and group_name like concat('%', #{groupName}, '%')
|
||||
<if test="name != null and name != ''">
|
||||
and name like concat('%', #{name}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 根据ID查询分组 -->
|
||||
<select id="selectGroupById" parameterType="java.lang.Long" resultMap="AirlineMarkerGroupResult">
|
||||
select group_id, group_name, create_by, create_time, update_by, update_time, del_flag, deleted_by, deleted_time
|
||||
select id, name, create_by, create_time, update_by, update_time, del_flag, deleted_by, deleted_time
|
||||
from airline_marker_group
|
||||
where group_id = #{groupId}
|
||||
where id = #{id}
|
||||
and del_flag = 0
|
||||
</select>
|
||||
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select distinct am.id, am.marker_name, am.marker_type, am.status, am.color, am.icon, am.font_size, am.coordinates, am.description, am.create_by, am.create_time, am.update_by, am.update_time, am.remark
|
||||
from airline_marker am
|
||||
left join airline_marker_group_info amgi on am.id = amgi.marker_id
|
||||
left join airline_marker_group amg on amgi.group_id = amg.group_id
|
||||
left join airline_marker_group amg on amgi.group_id = amg.id
|
||||
<where>
|
||||
amgi.del_flag = 0
|
||||
and (amg.del_flag = 0 or amg.del_flag is null)
|
||||
|
|
@ -144,7 +144,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select distinct am.id, am.marker_name, am.marker_type, am.status, am.color, am.icon, am.font_size, am.coordinates, am.description, am.create_by, am.create_time, am.update_by, am.update_time, am.remark
|
||||
from airline_marker am
|
||||
inner join airline_marker_group_info amgi on am.id = amgi.marker_id
|
||||
left join airline_marker_group amg on amgi.group_id = amg.group_id
|
||||
left join airline_marker_group amg on amgi.group_id = amg.id
|
||||
<where>
|
||||
amgi.del_flag = 0
|
||||
and amgi.deleted_by is null
|
||||
|
|
|
|||
Loading…
Reference in New Issue