添加mapper注释
This commit is contained in:
@@ -2,18 +2,46 @@ package com.labelsys.backend.mapper;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.labelsys.backend.entity.AnnotationResult;
|
import com.labelsys.backend.entity.AnnotationResult;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标注结果数据访问层
|
||||||
|
*
|
||||||
|
* 继承 BaseMapper<AnnotationResult>,提供标注结果表的基础 CRUD 操作,
|
||||||
|
* 并扩展自定义的查询和更新方法。
|
||||||
|
*/
|
||||||
public interface AnnotationResultMapper extends BaseMapper<AnnotationResult> {
|
public interface AnnotationResultMapper extends BaseMapper<AnnotationResult> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID和公司ID查询活跃的标注结果
|
||||||
|
*
|
||||||
|
* @param id 结果ID
|
||||||
|
* @param companyId 公司ID
|
||||||
|
* @return 标注结果信息,不存在或已归档返回 null
|
||||||
|
*/
|
||||||
AnnotationResult findActiveByIdAndCompanyId(@Param("id") Long id, @Param("companyId") Long companyId);
|
AnnotationResult findActiveByIdAndCompanyId(@Param("id") Long id, @Param("companyId") Long companyId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标记标注结果为已归档
|
||||||
|
*
|
||||||
|
* @param id 结果ID
|
||||||
|
* @param companyId 公司ID
|
||||||
|
* @param reviewerId 审核人ID
|
||||||
|
* @return 更新影响的行数
|
||||||
|
*/
|
||||||
int markArchived(@Param("id") Long id,
|
int markArchived(@Param("id") Long id,
|
||||||
@Param("companyId") Long companyId,
|
@Param("companyId") Long companyId,
|
||||||
@Param("reviewerId") Long reviewerId);
|
@Param("reviewerId") Long reviewerId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标记标注结果为已审核并归档
|
||||||
|
*
|
||||||
|
* @param id 结果ID
|
||||||
|
* @param companyId 公司ID
|
||||||
|
* @param reviewerId 审核人ID
|
||||||
|
* @return 更新影响的行数
|
||||||
|
*/
|
||||||
int markReviewedAndArchived(@Param("id") Long id,
|
int markReviewedAndArchived(@Param("id") Long id,
|
||||||
@Param("companyId") Long companyId,
|
@Param("companyId") Long companyId,
|
||||||
@Param("reviewerId") Long reviewerId);
|
@Param("reviewerId") Long reviewerId);
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,20 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.labelsys.backend.entity.AnnotationTask;
|
import com.labelsys.backend.entity.AnnotationTask;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标注任务数据访问层
|
||||||
|
*
|
||||||
|
* 继承 BaseMapper<AnnotationTask>,提供标注任务表的基础 CRUD 操作,
|
||||||
|
* 并扩展自定义的查询方法。
|
||||||
|
*/
|
||||||
public interface AnnotationTaskMapper extends BaseMapper<AnnotationTask> {
|
public interface AnnotationTaskMapper extends BaseMapper<AnnotationTask> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID和公司ID查询标注任务
|
||||||
|
*
|
||||||
|
* @param id 任务ID
|
||||||
|
* @param companyId 公司ID
|
||||||
|
* @return 标注任务信息,不存在返回 null
|
||||||
|
*/
|
||||||
AnnotationTask findByIdAndCompanyId(@Param("id") Long id, @Param("companyId") Long companyId);
|
AnnotationTask findByIdAndCompanyId(@Param("id") Long id, @Param("companyId") Long companyId);
|
||||||
}
|
}
|
||||||
@@ -5,11 +5,35 @@ import com.labelsys.backend.entity.AnnotationTaskResource;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标注任务资源关联数据访问层
|
||||||
|
*
|
||||||
|
* 继承 BaseMapper<AnnotationTaskResource>,提供标注任务资源关联表的基础 CRUD 操作,
|
||||||
|
* 并扩展自定义的查询和删除方法。
|
||||||
|
*/
|
||||||
public interface AnnotationTaskResourceMapper extends BaseMapper<AnnotationTaskResource> {
|
public interface AnnotationTaskResourceMapper extends BaseMapper<AnnotationTaskResource> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据任务ID查询关联的资源ID列表
|
||||||
|
*
|
||||||
|
* @param taskId 任务ID
|
||||||
|
* @return 资源ID列表
|
||||||
|
*/
|
||||||
List<Long> listResourceIdsByTaskId(@Param("taskId") Long taskId);
|
List<Long> listResourceIdsByTaskId(@Param("taskId") Long taskId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据任务ID删除关联的资源记录
|
||||||
|
*
|
||||||
|
* @param taskId 任务ID
|
||||||
|
* @return 删除影响的行数
|
||||||
|
*/
|
||||||
int deleteByTaskId(@Param("taskId") Long taskId);
|
int deleteByTaskId(@Param("taskId") Long taskId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计资源被任务关联的数量
|
||||||
|
*
|
||||||
|
* @param resourceId 资源ID
|
||||||
|
* @return 关联数量
|
||||||
|
*/
|
||||||
int countByResourceId(@Param("resourceId") Long resourceId);
|
int countByResourceId(@Param("resourceId") Long resourceId);
|
||||||
}
|
}
|
||||||
@@ -5,9 +5,28 @@ import com.labelsys.backend.entity.ImageBboxAnnotation;
|
|||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图像边界框标注数据访问层
|
||||||
|
*
|
||||||
|
* 继承 BaseMapper<ImageBboxAnnotation>,提供图像边界框标注表的基础 CRUD 操作,
|
||||||
|
* 并扩展自定义的查询和删除方法。
|
||||||
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ImageBboxAnnotationMapper extends BaseMapper<ImageBboxAnnotation> {
|
public interface ImageBboxAnnotationMapper extends BaseMapper<ImageBboxAnnotation> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据资源ID查询图像边界框标注
|
||||||
|
*
|
||||||
|
* @param resourceId 资源ID
|
||||||
|
* @return 图像边界框标注,不存在返回 null
|
||||||
|
*/
|
||||||
ImageBboxAnnotation selectByResourceId(@Param("resourceId") Long resourceId);
|
ImageBboxAnnotation selectByResourceId(@Param("resourceId") Long resourceId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据资源ID删除图像边界框标注
|
||||||
|
*
|
||||||
|
* @param resourceId 资源ID
|
||||||
|
* @return 删除影响的行数
|
||||||
|
*/
|
||||||
int deleteByResourceId(@Param("resourceId") Long resourceId);
|
int deleteByResourceId(@Param("resourceId") Long resourceId);
|
||||||
}
|
}
|
||||||
@@ -5,9 +5,29 @@ import com.labelsys.backend.entity.SourceResource;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 源资源数据访问层
|
||||||
|
*
|
||||||
|
* 继承 BaseMapper<SourceResource>,提供源资源表的基础 CRUD 操作,
|
||||||
|
* 并扩展自定义的查询方法。
|
||||||
|
*/
|
||||||
public interface SourceResourceMapper extends BaseMapper<SourceResource> {
|
public interface SourceResourceMapper extends BaseMapper<SourceResource> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据公司ID和资源ID列表查询资源
|
||||||
|
*
|
||||||
|
* @param companyId 公司ID
|
||||||
|
* @param resourceIds 资源ID列表
|
||||||
|
* @return 资源列表
|
||||||
|
*/
|
||||||
List<SourceResource> selectByCompanyIdAndIds(@Param("companyId") Long companyId, @Param("resourceIds") List<Long> resourceIds);
|
List<SourceResource> selectByCompanyIdAndIds(@Param("companyId") Long companyId, @Param("resourceIds") List<Long> resourceIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据公司ID和资源名称查询资源
|
||||||
|
*
|
||||||
|
* @param companyId 公司ID
|
||||||
|
* @param resourceName 资源名称
|
||||||
|
* @return 资源信息,不存在返回 null
|
||||||
|
*/
|
||||||
SourceResource selectByCompanyIdAndResourceName(@Param("companyId") Long companyId, @Param("resourceName") String resourceName);
|
SourceResource selectByCompanyIdAndResourceName(@Param("companyId") Long companyId, @Param("resourceName") String resourceName);
|
||||||
}
|
}
|
||||||
@@ -6,13 +6,41 @@ import com.labelsys.backend.enums.CompanyStatus;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司数据访问层
|
||||||
|
*
|
||||||
|
* 继承 BaseMapper<SysCompany>,提供公司表的基础 CRUD 操作,
|
||||||
|
* 并扩展自定义的查询和更新方法。
|
||||||
|
*/
|
||||||
public interface SysCompanyMapper extends BaseMapper<SysCompany> {
|
public interface SysCompanyMapper extends BaseMapper<SysCompany> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据公司编码查询公司
|
||||||
|
*
|
||||||
|
* @param companyCode 公司编码
|
||||||
|
* @return 公司信息,不存在返回 null
|
||||||
|
*/
|
||||||
SysCompany findByCompanyCode(@Param("companyCode") String companyCode);
|
SysCompany findByCompanyCode(@Param("companyCode") String companyCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据手机号查询已启用的公司列表
|
||||||
|
*
|
||||||
|
* @param phone 手机号
|
||||||
|
* @return 已启用的公司列表
|
||||||
|
*/
|
||||||
List<SysCompany> findEnabledCompaniesByPhone(@Param("phone") String phone);
|
List<SysCompany> findEnabledCompaniesByPhone(@Param("phone") String phone);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新公司状态
|
||||||
|
*
|
||||||
|
* @param id 公司ID
|
||||||
|
* @param status 公司状态
|
||||||
|
* @return 更新影响的行数
|
||||||
|
*/
|
||||||
int updateStatus(@Param("id") Long id, @Param("status") CompanyStatus status);
|
int updateStatus(@Param("id") Long id, @Param("status") CompanyStatus status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除所有公司(测试用)
|
||||||
|
*/
|
||||||
void deleteAll();
|
void deleteAll();
|
||||||
}
|
}
|
||||||
@@ -4,11 +4,32 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||||||
import com.labelsys.backend.entity.SysConfig;
|
import com.labelsys.backend.entity.SysConfig;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统配置数据访问层
|
||||||
|
*
|
||||||
|
* 继承 BaseMapper<SysConfig>,提供系统配置表的基础 CRUD 操作,
|
||||||
|
* 并扩展自定义的查询方法。
|
||||||
|
*/
|
||||||
public interface SysConfigMapper extends BaseMapper<SysConfig> {
|
public interface SysConfigMapper extends BaseMapper<SysConfig> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据公司ID和配置名称查询配置
|
||||||
|
*
|
||||||
|
* @param companyId 公司ID
|
||||||
|
* @param configName 配置名称
|
||||||
|
* @return 配置信息,不存在返回 null
|
||||||
|
*/
|
||||||
SysConfig findByCompanyIdAndConfigName(@Param("companyId") Long companyId, @Param("configName") String configName);
|
SysConfig findByCompanyIdAndConfigName(@Param("companyId") Long companyId, @Param("configName") String configName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据公司ID、配置名称和类型查询配置
|
||||||
|
*
|
||||||
|
* @param companyId 公司ID
|
||||||
|
* @param configName 配置名称
|
||||||
|
* @param configType 配置类型
|
||||||
|
* @return 配置信息,不存在返回 null
|
||||||
|
*/
|
||||||
SysConfig findByCompanyIdAndConfigNameAndType(@Param("companyId") Long companyId,
|
SysConfig findByCompanyIdAndConfigNameAndType(@Param("companyId") Long companyId,
|
||||||
@Param("configName") String configName,
|
@Param("configName") String configName,
|
||||||
@Param("configType") String configType);
|
@Param("configType") String configType);
|
||||||
}
|
}
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package com.labelsys.backend.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.labelsys.backend.entity.SysMenu;
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
|
||||||
|
|
||||||
List<SysMenu> listCurrentMenus(@Param("companyId") Long companyId, @Param("visiblePositions") List<String> visiblePositions);
|
|
||||||
}
|
|
||||||
@@ -8,23 +8,85 @@ import com.labelsys.backend.enums.UserStatus;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户数据访问层
|
||||||
|
*
|
||||||
|
* 继承 BaseMapper<SysUser>,提供用户表的基础 CRUD 操作,
|
||||||
|
* 并扩展自定义的查询和更新方法。
|
||||||
|
*/
|
||||||
public interface SysUserMapper extends BaseMapper<SysUser> {
|
public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID和公司ID查询用户
|
||||||
|
*
|
||||||
|
* @param id 用户ID
|
||||||
|
* @param companyId 公司ID
|
||||||
|
* @return 用户信息,不存在返回 null
|
||||||
|
*/
|
||||||
SysUser findByIdAndCompanyId(@Param("id") Long id, @Param("companyId") Long companyId);
|
SysUser findByIdAndCompanyId(@Param("id") Long id, @Param("companyId") Long companyId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据公司ID和手机号查询用户
|
||||||
|
*
|
||||||
|
* @param companyId 公司ID
|
||||||
|
* @param phone 手机号
|
||||||
|
* @return 用户信息,不存在返回 null
|
||||||
|
*/
|
||||||
SysUser findByCompanyIdAndPhone(@Param("companyId") Long companyId, @Param("phone") String phone);
|
SysUser findByCompanyIdAndPhone(@Param("companyId") Long companyId, @Param("phone") String phone);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询公司管理员列表
|
||||||
|
*
|
||||||
|
* @param companyId 公司ID
|
||||||
|
* @return 管理员用户列表
|
||||||
|
*/
|
||||||
List<SysUser> listCompanyAdmins(@Param("companyId") Long companyId);
|
List<SysUser> listCompanyAdmins(@Param("companyId") Long companyId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新用户密码
|
||||||
|
*
|
||||||
|
* @param id 用户ID
|
||||||
|
* @param companyId 公司ID
|
||||||
|
* @param passwordHash 加密后的密码
|
||||||
|
* @param mustChangePassword 是否强制修改密码
|
||||||
|
* @return 更新影响的行数
|
||||||
|
*/
|
||||||
int updatePassword(@Param("id") Long id, @Param("companyId") Long companyId,
|
int updatePassword(@Param("id") Long id, @Param("companyId") Long companyId,
|
||||||
@Param("passwordHash") String passwordHash, @Param("mustChangePassword") boolean mustChangePassword);
|
@Param("passwordHash") String passwordHash, @Param("mustChangePassword") boolean mustChangePassword);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新用户角色和岗位
|
||||||
|
*
|
||||||
|
* @param id 用户ID
|
||||||
|
* @param companyId 公司ID
|
||||||
|
* @param role 角色
|
||||||
|
* @param position 岗位
|
||||||
|
* @return 更新影响的行数
|
||||||
|
*/
|
||||||
int updateAssignment(@Param("id") Long id, @Param("companyId") Long companyId, @Param("role") UserRole role,
|
int updateAssignment(@Param("id") Long id, @Param("companyId") Long companyId, @Param("role") UserRole role,
|
||||||
@Param("position") UserPosition position);
|
@Param("position") UserPosition position);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新用户状态
|
||||||
|
*
|
||||||
|
* @param id 用户ID
|
||||||
|
* @param companyId 公司ID
|
||||||
|
* @param status 用户状态
|
||||||
|
* @return 更新影响的行数
|
||||||
|
*/
|
||||||
int updateStatus(@Param("id") Long id, @Param("companyId") Long companyId, @Param("status") UserStatus status);
|
int updateStatus(@Param("id") Long id, @Param("companyId") Long companyId, @Param("status") UserStatus status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 增加会话版本号
|
||||||
|
*
|
||||||
|
* @param id 用户ID
|
||||||
|
* @param companyId 公司ID
|
||||||
|
* @return 更新影响的行数
|
||||||
|
*/
|
||||||
int bumpSessionVersion(@Param("id") Long id, @Param("companyId") Long companyId);
|
int bumpSessionVersion(@Param("id") Long id, @Param("companyId") Long companyId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除所有用户(测试用)
|
||||||
|
*/
|
||||||
void deleteAll();
|
void deleteAll();
|
||||||
}
|
}
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package com.labelsys.backend.service;
|
|
||||||
|
|
||||||
import com.labelsys.backend.context.LoginUser;
|
|
||||||
import com.labelsys.backend.dto.response.MenuResponse;
|
|
||||||
import com.labelsys.backend.mapper.SysMenuMapper;
|
|
||||||
import java.util.List;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class MenuService {
|
|
||||||
|
|
||||||
private final SysMenuMapper sysMenuMapper;
|
|
||||||
|
|
||||||
public List<MenuResponse> listCurrentMenus(LoginUser currentUser) {
|
|
||||||
List<String> visiblePositions = java.util.Arrays.stream(com.labelsys.backend.enums.UserPosition.values())
|
|
||||||
.filter(position -> currentUser.position().canAccess(position))
|
|
||||||
.map(Enum::name)
|
|
||||||
.toList();
|
|
||||||
return sysMenuMapper.listCurrentMenus(currentUser.companyId(), visiblePositions)
|
|
||||||
.stream()
|
|
||||||
.map(MenuResponse::from)
|
|
||||||
.toList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.labelsys.backend.mapper.SysMenuMapper">
|
|
||||||
<resultMap id="SysMenuResultMap" type="com.labelsys.backend.entity.SysMenu">
|
|
||||||
<id column="id" property="id"/>
|
|
||||||
<result column="company_id" property="companyId"/>
|
|
||||||
<result column="menu_code" property="menuCode"/>
|
|
||||||
<result column="menu_name" property="menuName"/>
|
|
||||||
<result column="path" property="path"/>
|
|
||||||
<result column="visible_positions" property="visiblePositions"/>
|
|
||||||
<result column="sort_order" property="sortOrder"/>
|
|
||||||
<result column="created_at" property="createdAt"/>
|
|
||||||
<result column="updated_at" property="updatedAt"/>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<select id="listCurrentMenus" resultMap="SysMenuResultMap">
|
|
||||||
select m.id, m.company_id, m.menu_code, m.menu_name, m.path, m.visible_positions, m.sort_order, m.created_at, m.updated_at
|
|
||||||
from sys_menu m
|
|
||||||
where m.company_id = #{companyId}
|
|
||||||
and (
|
|
||||||
<foreach collection="visiblePositions" item="positionCode" separator=" or ">
|
|
||||||
concat(',', m.visible_positions, ',') like concat('%,', #{positionCode}, ',%')
|
|
||||||
</foreach>
|
|
||||||
)
|
|
||||||
order by m.sort_order, m.id
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
||||||
Reference in New Issue
Block a user