*/
package org.sonar.db.rule;
-import java.sql.Timestamp;
import java.util.List;
-import javax.annotation.Nullable;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.ResultHandler;
import org.sonar.api.rule.RuleKey;
void update(RuleDto rule);
- void batchInsert(RuleDto rule);
-
void insert(RuleDto rule);
- List<RuleParamDto> selectAllParams();
-
List<RuleParamDto> selectParamsByRuleIds(@Param("ruleIds") List<Integer> ruleIds);
List<RuleParamDto> selectParamsByRuleKey(RuleKey ruleKey);
List<RuleParamDto> selectParamsByRuleKeys(@Param("ruleKeys") List<RuleKey> ruleKeys);
- RuleParamDto selectParamByRuleAndKey(@Param("ruleId") Integer ruleId, @Param("key") String key);
-
void insertParameter(RuleParamDto param);
void updateParameter(RuleParamDto param);
void deleteParameter(Integer paramId);
-
- List<RuleDto> selectAfterDate(@Nullable @Param("date") Timestamp timestamp);
}
from rules r
</select>
- <select id="selectAfterDate" resultType="Rule" fetchSize="${_scrollFetchSize}" resultSetType="FORWARD_ONLY">
- select
- <include refid="selectColumns"/>
- from rules r
- <where>
- <if test="date != null">
- r.updated_at IS NULL or r.updated_at >= #{date}
- </if>
- </where>
- </select>
-
<select id="selectEnabledAndNonManual" resultType="Rule">
select
<include refid="selectColumns"/>
#{noteUpdatedAt}, #{createdAt}, #{updatedAt})
</insert>
- <insert id="batchInsert" parameterType="Rule" useGeneratedKeys="false">
- insert into rules
- <include refid="insertColumns"/>
- values (#{ruleKey,jdbcType=VARCHAR}, #{repositoryKey,jdbcType=VARCHAR}, #{description,jdbcType=CLOB},
- #{descriptionFormat,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
- #{configKey,jdbcType=VARCHAR},
- #{severity,jdbcType=INTEGER}, #{isTemplate,jdbcType=BOOLEAN}, #{language,jdbcType=VARCHAR},
- #{templateId,jdbcType=INTEGER},
- #{remediationFunction,jdbcType=VARCHAR}, #{defaultRemediationFunction,jdbcType=VARCHAR},
- #{remediationCoefficient,jdbcType=VARCHAR}, #{defaultRemediationCoefficient,jdbcType=VARCHAR},
- #{remediationOffset,jdbcType=VARCHAR}, #{defaultRemediationOffset,jdbcType=VARCHAR},
- #{effortToFixDescription}, #{tagsField}, #{systemTagsField}, #{noteData}, #{noteUserLogin}, #{noteCreatedAt},
- #{noteUpdatedAt,jdbcType=TIMESTAMP},
- #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT}
- )
- </insert>
-
<delete id="deleteParams" parameterType="Integer">
delete from active_rule_parameters where rules_parameter_id=#{id}
</delete>
p.description as "description"
</sql>
- <select id="selectAllParams" resultType="RuleParam">
- select
- <include refid="paramColumns"/>
- from rules_parameters p
- </select>
-
<select id="selectParamsByRuleIds" resultType="RuleParam">
SELECT
<include refid="paramColumns"/>
</foreach>
</select>
- <select id="selectParamByRuleAndKey" resultType="RuleParam">
- SELECT
- <include refid="paramColumns"/>
- FROM rules_parameters p
- WHERE p.rule_id=#{ruleId} AND p.name=#{key}
- </select>
-
<delete id="deleteParameter" parameterType="Integer">
delete from rules_parameters where id=#{id}
</delete>