Java Code Examples for org.apache.ibatis.annotations.Select

The following examples show how to use org.apache.ibatis.annotations.Select. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hmdm-server   Source File: ApplicationMapper.java    License: Apache License 2.0 6 votes vote down vote up
@Select({"SELECT configurationApplications.id       AS id, " +
        "       configurations.id                  AS configurationId, " +
        "       configurations.name                AS configurationName, " +
        "       configurations.customerId          AS customerId, " +
        "       applications.id                    AS applicationId, " +
        "       applications.name                  AS applicationName, " +
        "       COALESCE(configurationApplications.showIcon, applications.showIcon) AS showIcon, " +
        "       applications.id                    AS applicationVersionId, " +
        "       applications.id                    AS versionText, " +
        "       configurationApplications.remove   AS remove, " +
        "       configurationApplications.action   AS action " +
        "FROM configurations " +
        "INNER JOIN applicationVersions ON applicationVersions.id = #{id} " +
        "INNER JOIN applications ON applications.id = applicationVersions.applicationId " +
        "LEFT JOIN configurationApplications ON configurations.id = configurationApplications.configurationId AND configurationApplications.applicationVersionId = applicationVersions.id " +
        "WHERE configurations.customerId = #{customerId} " +
        "ORDER BY LOWER(configurations.name)"})
List<ApplicationVersionConfigurationLink> getApplicationVersionConfigurationsWithCandidates(
        @Param("customerId") Integer customerId, @Param("id") Integer applicationVersionId
);
 
Example 2
Source Project: sds   Source File: PointReturnValueDao.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 通过降级点来查询
 *
 * @param point
 * @return
 */
@Select("select * from point_return_value where app_group_name = #{appGroupName} and app_name = #{appName}  " +
        "and point = #{point}")
@Results({
        @Result(property = "id", column = "id"),
        @Result(property = "appGroupName", column = "app_group_name"),
        @Result(property = "appName", column = "app_name"),
        @Result(property = "point", column = "point"),
        @Result(property = "returnValueStr", column = "return_value_str"),
        @Result(property = "operatorName", column = "operator_name"),
        @Result(property = "operatorEmail", column = "operator_email"),
        @Result(property = "creatorName", column = "creator_name"),
        @Result(property = "creatorEmail", column = "creator_email"),
        @Result(property = "modifiedTime", column = "modify_time"),
        @Result(property = "createTime", column = "create_time")
})
PointReturnValueDO queryByPoint(@Param("appGroupName") String appGroupName, @Param("appName") String appName,
                                @Param("point") String point);
 
Example 3
Source Project: sds   Source File: SdsSchemeDao.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 通过应用组名称来查询
 *
 * @param appGroupName
 * @param appName
 * @param sdsSchemeName
 * @return
 */
@Select("select * from sds_scheme where app_group_name = #{appGroupName} " +
        " and app_name = #{appName} " +
        " and sds_scheme_name = #{sdsSchemeName} " +
        " order by modify_time desc ")
@Results({
        @Result(property = "id", column = "id"),
        @Result(property = "appGroupName", column = "app_group_name"),
        @Result(property = "appName", column = "app_name"),
        @Result(property = "sdsSchemeName", column = "sds_scheme_name"),
        @Result(property = "operatorName", column = "operator_name"),
        @Result(property = "operatorEmail", column = "operator_email"),
        @Result(property = "modifiedTime", column = "modify_time"),
        @Result(property = "createTime", column = "create_time")
})
SdsSchemeDO queryByGroupName(@Param("appGroupName") String appGroupName, @Param("appName") String appName,
                                 @Param("sdsSchemeName") String sdsSchemeName);
 
Example 4
Source Project: hmdm-server   Source File: ConfigurationFileMapper.java    License: Apache License 2.0 6 votes vote down vote up
@Select("SELECT c.name " +
        "FROM configurationFiles cf " +
        "INNER JOIN configurations c ON c.id = cf.configurationId " +
        "INNER JOIN uploadedFiles uf ON uf.id = cf.fileId " +
        "WHERE c.customerId = #{customerId} " +
        "AND uf.filePath = #{fileName}")
List<String> getUsingConfigurations(@Param("customerId") int customerId, @Param("fileName") String fileName);
 
Example 5
Source Project: sds   Source File: HeartbeatDao.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 按条件查询心跳数据
 *
 * @param appGroupName
 * @param appName
 * @param point
 * @param startTime
 * @param endTime
 * @return
 */
@Select("select * from heartbeat where app_group_name = #{appGroupName} " +
        " and app_name = #{appName} " +
        " and point = #{point} " +
        " and statistics_cycle_time >= #{startTime}" +
        " and statistics_cycle_time <= #{endTime}")
@Results({
        @Result(property = "id", column = "id"),
        @Result(property = "appGroupName", column = "app_group_name"),
        @Result(property = "appName", column = "app_name"),
        @Result(property = "point", column = "point"),
        @Result(property = "downgradeNum", column = "downgrade_num"),
        @Result(property = "visitNum", column = "visit_num"),
        @Result(property = "exceptionNum", column = "exception_num"),
        @Result(property = "timeoutNum", column = "timeout_num"),
        @Result(property = "maxConcurrentNum", column = "max_concurrent_num"),
        @Result(property = "appIp", column = "app_ip"),
        @Result(property = "statisticsCycleTime", column = "statistics_cycle_time")
})
List<HeartbeatDO> queryHeartbeatList(@Param("appGroupName") String appGroupName, @Param("appName") String appName,
                                     @Param("point") String point, @Param("startTime") Date startTime, @Param(
                                             "endTime") Date endTime);
 
Example 6
Source Project: hmdm-server   Source File: ApplicationMapper.java    License: Apache License 2.0 6 votes vote down vote up
@Select({"SELECT configurationApplications.id       AS id, " +
        "       configurations.id                  AS configurationId, " +
        "       configurations.name                AS configurationName, " +
        "       configurations.customerId          AS customerId, " +
        "       applications.id                    AS applicationId, " +
        "       applications.name                  AS applicationName, " +
        "       COALESCE(configurationApplications.showIcon, applications.showIcon) AS showIcon, " +
        "       configurationApplications.remove   AS remove, " +
        "       latestAppVersion.version   AS latestVersionText, " +
        "       currentAppVersion.version   AS currentVersionText, " +
        "       (configurationApplications.configurationId IS NOT NULL AND applications.latestVersion <> configurationApplications.applicationVersionId) AS outdated, " +
        "       configurationApplications.action AS action " +
        "FROM configurations " +
        "         LEFT JOIN applications ON applications.id = #{id} " +
        "         INNER JOIN applicationVersions AS latestAppVersion ON latestAppVersion.applicationId = applications.id AND latestAppVersion.id=applications.latestversion " +
        "         LEFT JOIN configurationApplications ON configurations.id = configurationApplications.configurationId AND " +
        "                                                applications.id = configurationApplications.applicationId " +
        "         LEFT JOIN applicationVersions AS currentAppVersion ON currentAppVersion.applicationId = applications.id AND currentAppVersion.id=configurationApplications.applicationVersionId " +
        "WHERE configurations.customerId = #{customerId} " +
        "ORDER BY LOWER(configurations.name)"})
List<ApplicationConfigurationLink> getApplicationConfigurations(@Param("customerId") Integer customerId,
                                                                @Param("id") Integer applicationId);
 
Example 7
Source Project: software-demo   Source File: MaterialsSellMapper.java    License: MIT License 5 votes vote down vote up
/**
 * 根据年份和物料id获取进出仓记录
 */
@Select("SELECT materialsSell.id as id,materials.materialsName as materialsName,materialsSellDetail.total as total,materialsSell.type as type,DATE(materialsSell.date) as date,user.username as username "
		+ "FROM materialsSell,materialsSellDetail,user,materials "
		+ "WHERE "
		+ "materialsSell.id = materialsSellDetail.materialsSellId "
		+ "AND materialsSell.userId = user.id "
		+ "AND materials.id = materialsSellDetail.materialsId "
		+ "AND YEAR(materialsSell.date) = #{year} "
		+ "AND materials.id = #{materialsId}")
public List<InOutDataVo> getBillDateByYearAndMaterial(@Param("materialsId") String materialsId, @Param("year") String year);
 
Example 8
Source Project: sds   Source File: SdsSchemeDao.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 查询所有降级预案
 *
 * @param appGroupName
 * @param appName
 * @return
 */
@Select("select * from sds_scheme where app_group_name = #{appGroupName} and app_name = #{appName} order by "
        + "modify_time desc ")
@Results({
        @Result(property = "id", column = "id"),
        @Result(property = "appGroupName", column = "app_group_name"),
        @Result(property = "appName", column = "app_name"),
        @Result(property = "sdsSchemeName", column = "sds_scheme_name"),
        @Result(property = "operatorName", column = "operator_name"),
        @Result(property = "operatorEmail", column = "operator_email"),
        @Result(property = "modifiedTime", column = "modify_time"),
        @Result(property = "createTime", column = "create_time")
})
List<SdsSchemeDO> queryAllSdsScheme(@Param("appGroupName") String appGroupName,
                                            @Param("appName") String appName);
 
Example 9
Source Project: light-reading-cloud   Source File: BookChapterMapper.java    License: MIT License 5 votes vote down vote up
/**
 * 查询下一章节ID
 * @param bookId
 * @param currentSortNumber
 * @return
 */
@Select("select id from book_chapter  " +
        " where book_id=#{bookId} " +
        " and sort_number > #{currentSortNumber} " +
        " order by sort_number asc limit 1")
Integer selectNextChapterId(@Param("bookId") Integer bookId,
                            @Param("currentSortNumber") Integer currentSortNumber);
 
Example 10
Source Project: hmdm-server   Source File: ApplicationMapper.java    License: Apache License 2.0 5 votes vote down vote up
@Select({"SELECT COUNT(*) AS cnt " +
        "FROM applications " +
        "INNER JOIN customers ON customers.id = applications.customerId " +
        "INNER JOIN applicationVersions ON applicationVersions.id = applications.latestVersion " +
        "WHERE (applications.customerId = #{customerId})" +
        "AND (applicationVersions.url=#{url}) "})
long countAllApplicationsByUrl(@Param("customerId") int customerId, @Param("url") String url);
 
Example 11
Source Project: hmdm-server   Source File: ApplicationMapper.java    License: Apache License 2.0 5 votes vote down vote up
@Select({SELECT_BY_VERSION_BASE +
        "WHERE (customerId = #{customerId} OR customers.master = TRUE )" +
        "AND pkg = #{pkg} " +
        "AND applicationVersions.version=#{version}"})
List<Application> findByPackageIdAndVersion(@Param("customerId") int customerId,
                                            @Param("pkg") String pkg,
                                            @Param("version") String version);
 
Example 12
Source Project: Spring-Boot-Book   Source File: UserMapper.java    License: Apache License 2.0 4 votes vote down vote up
@Select("select * from user where id =#{id}")
User findById(@Param("id") String id);
 
Example 13
Source Project: ddd-cargo   Source File: CargoMapper.java    License: MIT License 4 votes vote down vote up
@Select("SELECT * FROM cargo WHERE id = #{id}")
CargoDO find(@Param("id") String id);
 
Example 14
Source Project: hmdm-server   Source File: PluginMapper.java    License: Apache License 2.0 4 votes vote down vote up
@Select("SELECT customerId, pluginId FROM pluginsDisabled ORDER BY customerId, pluginId")
List<DisabledPlugin> getDisabledPluginsForAllCustomers();
 
Example 15
Source Project: supplierShop   Source File: StoreCouponMapper.java    License: MIT License 4 votes vote down vote up
@Select("<script>select s.id,c.money,c.name,c.condition,c.use_end_time as useEndTime from store_coupon_list s left join store_coupon c " +
        "on s.cid=c.id where s.uid=#{userId} and s.status=0" +
        " <if test='orderTotalPrice > 0'>and c.condition <![CDATA[<= ]]> #{orderTotalPrice}</if>" +
        " and c.use_start_time <![CDATA[<= ]]> now() and c.use_end_time <![CDATA[>= ]]> now()</script>")
List<CouponDTO> couponList(@Param("userId") int userId,
                           @Param("orderTotalPrice") double orderTotalPrice);
 
Example 16
Source Project: supplierShop   Source File: StoreSpecGoodsPriceMapper.java    License: MIT License 4 votes vote down vote up
@Select("select GROUP_CONCAT(`key` ORDER BY store_count desc SEPARATOR '_') as keystr" +
        " from store_spec_goods_price where goods_id=#{goodsId}")
String goodsSpecKey(int goodsId);
 
Example 17
Source Project: supplierShop   Source File: StoreSpecGoodsPriceMapper.java    License: MIT License 4 votes vote down vote up
@Select("<script> SELECT a.name,b.id,b.spec_id as specId,b.item FROM store_spec AS a " +
        "INNER JOIN store_spec_item AS b ON a.id = b.spec_id " +
        "WHERE b.id IN " +
        "<foreach item='item' index='index' collection='list' open='(' separator=',' close=')'> #{item} </foreach>" +
        "ORDER BY b.id </script>")
List<ItemDTO> goodsSpec(List<String> keys);
 
Example 18
Source Project: springboot-music   Source File: IUserMapper.java    License: MIT License 4 votes vote down vote up
@Select("select user_id from user where user_name=#{user_name} and user_password=#{user_password}")
public String getUserById(@Param("user_name") String user_name, @Param("user_password") String user_password);
 
Example 19
Source Project: pre   Source File: SysUserRoleMapper.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Select("SELECT r.role_name,ur.role_id \n" +
        "FROM (sys_role r LEFT JOIN sys_user_role ur ON r.role_id = ur.role_id ) \n" +
        "LEFT JOIN sys_user u ON u.user_id = ur.user_id WHERE u.user_id = #{userId}")
List<SysUserRole> selectUserRoleListByUserId(Integer userId);
 
Example 20
Source Project: java_study   Source File: AccountDao.java    License: Apache License 2.0 4 votes vote down vote up
@Select("select *from account")
public List<Account> findAll();
 
Example 21
Source Project: springboot-music   Source File: IUserMapper.java    License: MIT License 4 votes vote down vote up
@Select("select user_name from user where user_name=#{user_name}")
public String rearchUserName(@Param("user_name") String user_name);
 
Example 22
Source Project: hmdm-server   Source File: CustomerMapper.java    License: Apache License 2.0 4 votes vote down vote up
@Select("SELECT EXISTS (SELECT 1 FROM customers WHERE id > 1 LIMIT 1)")
boolean isMultiTenant();
 
Example 23
Source Project: yshopmall   Source File: MenuMapper.java    License: Apache License 2.0 4 votes vote down vote up
@Select("<script>select m.* from menu m LEFT OUTER JOIN roles_menus t on m.id= t.menu_id LEFT OUTER JOIN role r on r.id = t.role_id where m.type!=2 and  r.id in <foreach collection=\"roleIds\" index=\"index\" item=\"item\" open=\"(\" separator=\",\" close=\")\">#{item}</foreach> order by m.sort asc</script>")
List<Menu> selectListByRoles(@Param("roleIds") List<Long> roleIds);
 
Example 24
Source Project: springboot-music   Source File: IMyMusicMapper.java    License: MIT License 4 votes vote down vote up
@Select("select user_name from user where user_name=#{user_name} and user_password=#{user_password}")
public String login(@Param("user_name") String user_name, @Param("user_password") String user_password);
 
Example 25
Source Project: owlaser-paclist   Source File: PacDao.java    License: MIT License 4 votes vote down vote up
@Select("SELECT DISTINCT parent_artifactid FROM maven_childNodes WHERE parent_artifactid = #{artifact_id} AND parent_groupid = #{group_id}")
public String getParentArtifactId(@Param("artifact_id")String artifact_id, @Param("group_id")String group_id);
 
Example 26
Source Project: sds   Source File: PointStrategyDao.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * 分页查询降级点策略
 *
 * @param appGroupName
 * @param appName
 * @param point
 * @param sdsSchemeName
 * @param start
 * @param size
 * @return
 */
@Select("<script> select * from point_strategy " +
        "<where> " +
        " <if test='appGroupName != null and appGroupName.length > 0'> and app_group_name = #{appGroupName} </if>" +
        " <if test='appName != null and appName.length > 0'> and app_name = #{appName} </if> " +
        " <if test='sdsSchemeName != null and sdsSchemeName.length > 0'> and sds_scheme_name = "
        + "#{sdsSchemeName} </if>" +
        " <if test='point != null and point.length > 0'> and point like concat('%', #{point}, '%') </if> " +
        "</where>" +
        " order by modify_time desc " +
        " limit #{start}, #{size} </script>")
@Results({
        @Result(property = "id", column = "id"),
        @Result(property = "appGroupName", column = "app_group_name"),
        @Result(property = "appName", column = "app_name"),
        @Result(property = "point", column = "point"),
        @Result(property = "sdsSchemeName", column = "sds_scheme_name"),
        @Result(property = "visitThreshold", column = "visit_threshold"),
        @Result(property = "concurrentThreshold", column = "concurrent_threshold"),
        @Result(property = "exceptionThreshold", column = "exception_threshold"),
        @Result(property = "exceptionRateThreshold", column = "exception_rate_threshold"),
        @Result(property = "exceptionRateStart", column = "exception_rate_start"),
        @Result(property = "timeoutThreshold", column = "timeout_threshold"),
        @Result(property = "timeoutCountThreshold", column = "timeout_count_threshold"),
        @Result(property = "tokenBucketGeneratedTokensInSecond", column =
                "token_bucket_generated_tokens_in_second"),
        @Result(property = "tokenBucketSize", column = "token_bucket_size"),
        @Result(property = "delayTime", column = "delay_time"),
        @Result(property = "retryInterval", column = "retry_interval"),
        @Result(property = "downgradeRate", column = "downgrade_rate"),
        @Result(property = "pressureTestDowngrade", column = "pressure_test_downgrade"),
        @Result(property = "status", column = "status"),
        @Result(property = "operatorName", column = "operator_name"),
        @Result(property = "operatorEmail", column = "operator_email"),
        @Result(property = "creatorName", column = "creator_name"),
        @Result(property = "creatorEmail", column = "creator_email"),
        @Result(property = "modifiedTime", column = "modify_time"),
        @Result(property = "createTime", column = "create_time")
})
List<PointStrategyDO> queryPointStrategyByPage(@Param("appGroupName") String appGroupName,
                                               @Param("appName") String appName, @Param("point") String point,
                                               @Param("sdsSchemeName") String sdsSchemeName, @Param(
                                                       "start") Integer start, @Param("size") Integer size);
 
Example 27
Source Project: RCT   Source File: SlowlogMapper.java    License: Apache License 2.0 4 votes vote down vote up
@Select("select id from slowlog where pid = #{pid}")
public Long getSlowlogByPid(Long pid);
 
Example 28
Source Project: Moss   Source File: AppMapper.java    License: Apache License 2.0 4 votes vote down vote up
@Select("SELECT Count(*) FROM t_app a where a.is_deleted=0 and a.framework_verison=#{version}")
int totalUseFrameworkConut(@Param("version") int version);
 
Example 29
Source Project: hmdm-server   Source File: NotificationMapper.java    License: Apache License 2.0 4 votes vote down vote up
@Select("SELECT status FROM pendingPushes WHERE messageId = #{messageId}")
Integer getDeliveryStatus(@Param("messageId") int messageId);
 
Example 30
Source Project: spring-boot-demo   Source File: RoleMapper.java    License: MIT License 4 votes vote down vote up
@Select("SELECT A.id,A.name FROM role A LEFT JOIN user_role B ON A.id=B.role_id WHERE B.user_id=${userId}")
List<Role> getRolesByUserId(@Param("userId") Long userId);