<commit_before>package org.openlmis.rnr.repository.mapper;


import org.apache.ibatis.annotations.*;
import org.openlmis.rnr.domain.RegimenLineItem;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface RegimenLineItemMapper {

  @Insert({"INSERT INTO regimen_line_items(code, name, regimenDisplayOrder, regimenCategory, regimenCategoryDisplayOrder, rnrId) values " +
    "(#{code}, #{name}, #{regimenDisplayOrder}, #{category.name}, #{category.displayOrder}, #{rnrId})"})
  @Options(useGeneratedKeys = true)
  public void insert(RegimenLineItem regimenLineItem);

  @Select("SELECT * FROM regimen_line_items WHERE rnrId = #{rnrId}")
  @Results(value = {
    @Result(property = "id", column = "id"),
    @Result(property = "code", column = "code"),
    @Result(property = "name", column = "name"),
    @Result(property = "patientsOnTreatment", column = "patientsOnTreatment"),
    @Result(property = "patientsToInitiateTreatment", column = "patientsToInitiateTreatment"),
    @Result(property = "remarks", column = "remarks"),
    @Result(property = "patientsStoppedTreatment", column = "patientsStoppedTreatment"),
    @Result(property = "regimenDisplayOrder", column = "regimenDisplayOrder"),
    @Result(property = "category.name", column = "regimenCategory"),
    @Result(property = "category.displayOrder", column = "regimenCategoryDisplayOrder"),<commit_msg>|#837|+Sriram| Fixed the issue of regimen line items not getting sorted on disply order<commit_after>package org.openlmis.rnr.repository.mapper;


import org.apache.ibatis.annotations.*;
import org.openlmis.rnr.domain.RegimenLineItem;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface RegimenLineItemMapper {

  @Insert({"INSERT INTO regimen_line_items(code, name, regimenDisplayOrder, regimenCategory, regimenCategoryDisplayOrder, rnrId) values " +
    "(#{code}, #{name}, #{regimenDisplayOrder}, #{category.name}, #{category.displayOrder}, #{rnrId})"})
  @Options(useGeneratedKeys = true)
  public void insert(RegimenLineItem regimenLineItem);

  @Select("SELECT * FROM regimen_line_items WHERE rnrId = #{rnrId} ORDER BY regimenDisplayOrder")
  @Results(value = {
    @Result(property = "id", column = "id"),
    @Result(property = "code", column = "code"),
    @Result(property = "name", column = "name"),
    @Result(property = "patientsOnTreatment", column = "patientsOnTreatment"),
    @Result(property = "patientsToInitiateTreatment", column = "patientsToInitiateTreatment"),
    @Result(property = "remarks", column = "remarks"),
    @Result(property = "patientsStoppedTreatment", column = "patientsStoppedTreatment"),
    @Result(property = "regimenDisplayOrder", column = "regimenDisplayOrder"),
    @Result(property = "category.name", column = "regimenCategory"),
    @Result(property = "category.displayOrder", column = "regimenCategoryDisplayOrder"),
{'fraction_non_alphanumeric': 0.1415899010576595, 'fraction_numerical': 0.0010235414534288639, 'mean_word_length': 6.385390428211587, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5568282', 'n_tokens_mistral': 887, 'n_tokens_neox': 832, 'n_words': 179}