*/
package org.sonar.db.qualityprofile;
-import java.sql.Timestamp;
import java.util.List;
import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
import org.apache.ibatis.annotations.Param;
public interface ActiveRuleMapper {
List<ActiveRuleParamDto> selectParamsByActiveRuleIds(@Param("ids") List<Integer> ids);
- List<ActiveRuleParamDto> selectParamsByProfileKey(String profileKey);
-
List<ActiveRuleParamDto> selectAllParams();
-
- List<ActiveRuleDto> selectAfterDate(@Nullable Timestamp date);
}
LEFT JOIN rules_profiles profile_parent ON profile_parent.kee=qp.parent_kee
</sql>
- <select id="selectAfterDate" parameterType="Date" resultType="ActiveRule"
- fetchSize="${_scrollFetchSize}" resultSetType="FORWARD_ONLY">
- select
- <include refid="activeRuleKeyColumns"/>
- from active_rules a
- <include refid="activeRuleKeyJoin"/>
- <where>
- <if test="date != null">
- a.updated_at IS NULL or a.updated_at >= #{date}
- </if>
- </where>
- </select>
-
<insert id="insert" parameterType="ActiveRule" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
INSERT INTO active_rules (profile_id, rule_id, failure_level, inheritance, created_at, updated_at)
VALUES (#{profileId}, #{ruleId}, #{severity}, #{inheritance}, #{createdAt}, #{updatedAt})
</where>
</select>
- <select id="selectParamsByProfileKey" parameterType="string" resultType="ActiveRuleParam">
- select
- <include refid="activeRuleParamColumns"/>
- from active_rule_parameters p
- inner join active_rules ar on ar.id=p.active_rule_id
- inner join rules_profiles rp on rp.id=ar.profile_id
- where rp.kee=#{id}
- </select>
-
<select id="selectAllParams" resultType="ActiveRuleParam">
select
<include refid="activeRuleParamColumns"/>