<commit_before>package cz.wicketstuff.examples.spring.persistence.mybatis.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.mapping.StatementType;
import org.springframework.stereotype.Repository;

import cz.wicketstuff.examples.spring.core.domain.Task;
import cz.wicketstuff.examples.spring.core.domain.TaskExt;

/**
 * @author <NAME> (strma17)
 *
 */
@Repository
public interface TaskDao {
	
	@Select("SELECT t.* FROM task t WHERE t.task_group_id = #{taskGroupId} ORDER BY t.created")
	@ResultMap("task")
	List<Task> selectAll(long taskGroupId);

	@Select("SELECT tg.*, t.id as t_id, t.name as t_name, t.created as t_created, t.uuid as t_uuid FROM task_group tg LEFT JOIN task t ON (t.task_group_id = tg.id) ORDER BY tg.created")
	@ResultMap("taskExt")
	List<TaskExt> selectAllExt();

	@Insert("INSERT INTO task (name, created, uuid, status) VALUES (#{name}, #{created}, #{uuidString}, #{status})")
	@SelectKey(
			before = false, 
			keyColumn = "id", 
			keyProperty = "id", 
			resultType = Long.class, 
			statement = "SELECT LAST_INSERT_ID()", 
			statementType = StatementType.STATEMENT)
	long insert(Task task);
	
	@Update("UPDATE task_group SET name = #{name}, status = #{status} WHERE id = #{id}")
	long update(Task task);
	
	@Delete("DELETE FROM task WHERE id = #{taskId}")
	long delete(long id);<commit_msg>Fix task dao bug<commit_after>package cz.wicketstuff.examples.spring.persistence.mybatis.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.mapping.StatementType;
import org.springframework.stereotype.Repository;

import cz.wicketstuff.examples.spring.core.domain.Task;
import cz.wicketstuff.examples.spring.core.domain.TaskExt;

/**
 * @author <NAME> (strma17)
 *
 */
@Repository
public interface TaskDao {
	
	@Select("SELECT t.* FROM task t WHERE t.task_group_id = #{taskGroupId} ORDER BY t.created")
	@ResultMap("task")
	List<Task> selectAll(long taskGroupId);

	@Select("SELECT tg.*, t.id as t_id, t.name as t_name, t.created as t_created, t.uuid as t_uuid FROM task_group tg LEFT JOIN task t ON (t.task_group_id = tg.id) ORDER BY tg.created")
	@ResultMap("taskExt")
	List<TaskExt> selectAllExt();

	@Insert("INSERT INTO task (name, created, uuid, status, task_group_id) VALUES (#{name}, #{created}, #{uuidString}, #{status}, #{taskGroup.id})")
	@SelectKey(
			before = false, 
			keyColumn = "id", 
			keyProperty = "id", 
			resultType = Long.class, 
			statement = "SELECT LAST_INSERT_ID()", 
			statementType = StatementType.STATEMENT)
	long insert(Task task);
	
	@Update("UPDATE task_group SET name = #{name}, status = #{status} WHERE id = #{id}")
	long update(Task task);
	
	@Delete("DELETE FROM task WHERE id = #{taskId}")
	long delete(long id);
{'fraction_non_alphanumeric': 0.13839975285758419, 'fraction_numerical': 0.001235712079085573, 'mean_word_length': 5.144212523719165, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '7397934', 'n_tokens_mistral': 1123, 'n_tokens_neox': 1080, 'n_words': 258}