feat:优化字段
This commit is contained in:
parent
0f0ad750b3
commit
eee07c4590
|
|
@ -56,10 +56,10 @@ public class AirlineFileGroupController extends BaseController {
|
|||
* 根据分组编号获取详细信息
|
||||
*/
|
||||
// @RequiresPermissions("airline:group:query")
|
||||
@GetMapping(value = "/{groupId}")
|
||||
@GetMapping(value = "/{id}")
|
||||
@Operation(summary = "根据分组ID 获取分组详情信息")
|
||||
public AjaxResult getInfo(@PathVariable("groupId") Long groupId) {
|
||||
return success(iAirlineFileGroupService.selectAirLineListsByGroupId(SecurityUtils.getUserId(), groupId));
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(iAirlineFileGroupService.selectAirLineListsByGroupId(SecurityUtils.getUserId(), id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -73,7 +73,7 @@ public class AirlineFileGroupController extends BaseController {
|
|||
group.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
||||
AirlineFileGroupDTO dto = AirlineFileGroupControllerConvert.to(group);
|
||||
if (iAirlineFileGroupService.checkGroupNameUnique(dto)) {
|
||||
return error("新增分组'" + group.getGroupName() + "'失败,分组名称已存在");
|
||||
return error("新增分组'" + group.getName() + "'失败,分组名称已存在");
|
||||
}
|
||||
return toAjax(iAirlineFileGroupService.insertGroup(dto));
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ public class AirlineFileGroupController extends BaseController {
|
|||
group.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
||||
AirlineFileGroupDTO dto = AirlineFileGroupControllerConvert.to(group);
|
||||
if (iAirlineFileGroupService.checkGroupNameUnique(dto)) {
|
||||
return error("修改分组'" + group.getGroupName() + "'失败,分组名称已存在");
|
||||
return error("修改分组'" + group.getName() + "'失败,分组名称已存在");
|
||||
}
|
||||
return toAjax(iAirlineFileGroupService.updateGroup(dto));
|
||||
}
|
||||
|
|
@ -99,10 +99,10 @@ public class AirlineFileGroupController extends BaseController {
|
|||
*/
|
||||
// @RequiresPermissions("airline:group:remove")
|
||||
// @Log(title = "删除分组", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/delete/{groupId}")
|
||||
@DeleteMapping("/delete/{id}")
|
||||
@Operation(summary = "删除分组")
|
||||
public AjaxResult removeByQueryParam(@PathVariable("groupId") Long groupId) {
|
||||
return toAjax(iAirlineFileGroupService.deletegroupById(SecurityUtils.getUserId(), groupId));
|
||||
public AjaxResult removeByQueryParam(@PathVariable("id") Long id) {
|
||||
return toAjax(iAirlineFileGroupService.deletegroupById(SecurityUtils.getUserId(), id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
|||
@Data
|
||||
public class AirlineFileGroup extends ExBaseEntity {
|
||||
/**
|
||||
* 用户ID
|
||||
* 分组ID
|
||||
*/
|
||||
private Long groupId;
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
*/
|
||||
private String groupName;
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 航线数量
|
||||
|
|
@ -34,8 +34,8 @@ public class AirlineFileGroup 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("airlineCount", getAirlineCount())
|
||||
.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,14 +15,14 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
|||
@Data
|
||||
public class AirlineFileGroupEntity extends ExBaseEntity {
|
||||
/**
|
||||
* 用户ID
|
||||
* 分组ID
|
||||
*/
|
||||
private Long groupId;
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
*/
|
||||
private String groupName;
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 航线数量
|
||||
|
|
@ -33,8 +33,8 @@ public class AirlineFileGroupEntity 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())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import java.util.List;
|
|||
*/
|
||||
public interface IAirlineFileGroupService {
|
||||
|
||||
int deletegroupById(Long userId, Long groupId);
|
||||
int deletegroupById(Long userId, Long id);
|
||||
|
||||
/**
|
||||
* 检查名称是否已经存在
|
||||
|
|
@ -27,7 +27,7 @@ public interface IAirlineFileGroupService {
|
|||
|
||||
List<AirlineFileGroupDTO> selectGroupList(AirlineFileGroupDTO dto);
|
||||
|
||||
AirlineFileGroupDTO selectAirLineListsByGroupId(Long userId, Long groupId);
|
||||
AirlineFileGroupDTO selectAirLineListsByGroupId(Long userId, Long id);
|
||||
|
||||
List<AirlineFileDTO> selectAirlineListByUserId(AirlineFileDTO dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@ import java.util.List;
|
|||
@Data
|
||||
public class AirlineFileGroupDTO extends BaseEntity {
|
||||
/**
|
||||
* 用户ID
|
||||
* 分组ID
|
||||
*/
|
||||
private Long groupId;
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
*/
|
||||
private String groupName;
|
||||
private String name;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -40,8 +40,8 @@ public class AirlineFileGroupDTO 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())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,16 +42,16 @@ public class AirlineFileServiceGroupImpl implements IAirlineFileGroupService {
|
|||
private IAirlineFileDomain iAirlineFileDomain;
|
||||
|
||||
@Override
|
||||
public int deletegroupById(Long userId, Long groupId) {
|
||||
public int deletegroupById(Long userId, Long id) {
|
||||
// 1、删除航线信息
|
||||
AirlineFileGroupInfoDTO dto = new AirlineFileGroupInfoDTO();
|
||||
dto.setGroupId(groupId);
|
||||
dto.setGroupId(id);
|
||||
AirlineFileGroupInfo model = AirlineFileGroupInfoServiceConvert.to(dto);
|
||||
iAirlineFileGroupInfoDomain.deleteGroupInfo(model);
|
||||
|
||||
// 2、删除分组
|
||||
AirlineFileGroup model2 = new AirlineFileGroup();
|
||||
model2.setGroupId(groupId);
|
||||
model2.setId(id);
|
||||
model2.setCreateBy(String.valueOf(userId));
|
||||
return iAirlineFileGroupDomain.deletegroup(model2);
|
||||
|
||||
|
|
@ -93,15 +93,15 @@ public class AirlineFileServiceGroupImpl implements IAirlineFileGroupService {
|
|||
/**
|
||||
* 根据分组ID 查询 分组下所有的 航线文件。
|
||||
*
|
||||
* @param groupId 分组id
|
||||
* @param id 分组id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AirlineFileGroupDTO selectAirLineListsByGroupId(Long userId, Long groupId) {
|
||||
public AirlineFileGroupDTO selectAirLineListsByGroupId(Long userId, Long id) {
|
||||
AirlineFileGroupDTO dto = new AirlineFileGroupDTO();
|
||||
dto.setCreateBy(String.valueOf(userId));
|
||||
dto.setGroupId(groupId);
|
||||
List<AirlineFileGroupInfo> airlineFileGroupInfoDTOS = iAirlineFileGroupInfoDomain.selectGroupInfoListById(groupId);
|
||||
dto.setId(id);
|
||||
List<AirlineFileGroupInfo> airlineFileGroupInfoDTOS = iAirlineFileGroupInfoDomain.selectGroupInfoListById(id);
|
||||
if (!CollectionUtils.isEmpty(airlineFileGroupInfoDTOS)) {
|
||||
List<Long> ids = airlineFileGroupInfoDTOS.stream().map(AirlineFileGroupInfo::getAirlineId).toList();
|
||||
List<AirlineFile> airlineFileDTOS = iAirlineFileDomain.selectFileListByIds(ids);
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ CREATE TABLE IF NOT EXISTS airline_file (
|
|||
|
||||
-- 创建航线分组表
|
||||
CREATE TABLE IF NOT EXISTS airline_file_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 '删除时间',
|
||||
|
|
@ -35,7 +35,7 @@ CREATE TABLE IF NOT EXISTS airline_file_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='航线分组表';
|
||||
|
||||
-- 创建航线分组明细表
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<!-- 结果映射 -->
|
||||
<resultMap id="AirlineFileGroupResult" type="com.ruoyi.airline.mapper.entity.AirlineFileGroupEntity">
|
||||
<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" />
|
||||
|
|
@ -35,8 +35,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="groupName" column="group_name" />
|
||||
<result property="groupId" column="group_id" />
|
||||
<result property="groupName" column="name" />
|
||||
<result property="groupId" column="id" />
|
||||
<result property="userId" column="user_id" />
|
||||
</resultMap>
|
||||
|
||||
|
|
@ -44,10 +44,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<!-- 检查分组名称是否唯一 -->
|
||||
<select id="checkgroupNameUnique" parameterType="com.ruoyi.airline.mapper.entity.AirlineFileGroupEntity" resultType="java.lang.Integer">
|
||||
select count(1) from airline_file_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>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
and create_by = #{createBy}
|
||||
|
|
@ -60,7 +60,7 @@ 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}
|
||||
<if test="createBy != null and createBy != ''">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
|
|
@ -69,10 +69,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<!-- 更新分组 -->
|
||||
<update id="updateGroup" parameterType="com.ruoyi.airline.mapper.entity.AirlineFileGroupEntity">
|
||||
update airline_file_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
|
||||
<if test="createBy != null and createBy != ''">
|
||||
and create_by = #{createBy}
|
||||
|
|
@ -81,15 +81,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<!-- 插入分组 -->
|
||||
<insert id="insertGroup" parameterType="com.ruoyi.airline.mapper.entity.AirlineFileGroupEntity">
|
||||
insert into airline_file_group (group_name, create_by, create_time, update_by, update_time, del_flag)
|
||||
values (#{groupName}, #{createBy}, now(), #{updateBy}, now(), 0)
|
||||
insert into airline_file_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.AirlineFileGroupEntity" resultMap="AirlineFileGroupResult">
|
||||
select
|
||||
afg.group_id,
|
||||
afg.group_name,
|
||||
afg.id,
|
||||
afg.name,
|
||||
afg.create_by,
|
||||
afg.create_time,
|
||||
afg.update_by,
|
||||
|
|
@ -105,11 +105,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
inner join airline_file af on afgi.airline_id = af.id
|
||||
WHERE afgi.del_flag = 0
|
||||
group by afgi.group_id
|
||||
) airline_count on afg.group_id = airline_count.group_id
|
||||
) airline_count on afg.id = airline_count.group_id
|
||||
<where>
|
||||
afg.del_flag = 0
|
||||
<if test="groupName != null and groupName != ''">
|
||||
and afg.group_name like concat('%', #{groupName}, '%')
|
||||
<if test="name != null and name != ''">
|
||||
and afg.name like concat('%', #{name}, '%')
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
and afg.create_by = #{createBy}
|
||||
|
|
@ -121,10 +121,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectAirlineListByUserId" parameterType="com.ruoyi.airline.mapper.entity.AirlineFileEntity" resultMap="AirlineFileResult">
|
||||
select
|
||||
af.*,
|
||||
afg.group_name
|
||||
afg.name
|
||||
from airline_file af
|
||||
left join airline_file_group_info afgi on af.id = afgi.airline_id and afgi.del_flag = 0
|
||||
left join airline_file_group afg on afgi.group_id = afg.group_id and afg.del_flag = 0
|
||||
left join airline_file_group afg on afgi.group_id = afg.id and afg.del_flag = 0
|
||||
<where>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
and afg.create_by = #{createBy}
|
||||
|
|
|
|||
Loading…
Reference in New Issue