89 lines
3.0 KiB
XML
89 lines
3.0 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="sgis.surveysystem.mapper.SurveyMapper">
|
|
|
|
<resultMap id="surveyResultMap" type="sgis.surveysystem.domain.Survey">
|
|
<id property="surveyId" column="survey_id"/>
|
|
<result property="surveyTitle" column="survey_title"/>
|
|
<result property="surveyDescription" column="survey_description"/>
|
|
<result property="createdAt" column="created_at"/>
|
|
<result property="updatedAt" column="updated_at"/>
|
|
<result property="isActive" column="is_active"/>
|
|
<result property="startDate" column="start_date"/>
|
|
<result property="endDate" column="end_date"/>
|
|
</resultMap>
|
|
|
|
<insert id="insertSurvey" parameterType="sgis.surveysystem.domain.Survey">
|
|
INSERT INTO tb_surveys (
|
|
survey_id,
|
|
survey_title,
|
|
survey_description,
|
|
created_at,
|
|
updated_at,
|
|
is_active,
|
|
start_date,
|
|
end_date
|
|
) VALUES (
|
|
CAST(#{surveyId, jdbcType=OTHER} AS uuid),
|
|
#{surveyTitle},
|
|
#{surveyDescription},
|
|
#{createdAt},
|
|
#{updatedAt},
|
|
#{isActive},
|
|
#{startDate},
|
|
#{endDate}
|
|
)
|
|
</insert>
|
|
|
|
<select id="findAllSurveys" resultMap="surveyResultMap">
|
|
SELECT
|
|
survey_id,
|
|
survey_title,
|
|
survey_description,
|
|
created_at,
|
|
updated_at,
|
|
is_active,
|
|
start_date,
|
|
end_date
|
|
FROM tb_surveys
|
|
</select>
|
|
|
|
<select id="findSurveyById" resultMap="surveyResultMap">
|
|
SELECT
|
|
survey_id,
|
|
survey_description,
|
|
survey_title,
|
|
created_at,
|
|
updated_at,
|
|
is_active,
|
|
start_date,
|
|
end_date
|
|
FROM tb_surveys
|
|
WHERE survey_id = CAST(#{surveyId, jdbcType=OTHER} AS uuid) <!-- 이 부분을 수정했습니다. -->
|
|
</select>
|
|
|
|
<update id="updateSurvey" parameterType="sgis.surveysystem.domain.Survey">
|
|
UPDATE tb_surveys
|
|
SET
|
|
survey_title = #{surveyTitle},
|
|
survey_description = #{surveyDescription},
|
|
updated_at = #{updatedAt},
|
|
is_active = #{isActive},
|
|
start_date = #{startDate},
|
|
end_date = #{endDate}
|
|
WHERE survey_id = CAST(#{surveyId, jdbcType=OTHER} AS uuid) <!-- 이 부분도 일관성을 위해 수정합니다. -->
|
|
</update>
|
|
|
|
<update id="updateSurveyStatus">
|
|
UPDATE tb_surveys
|
|
SET
|
|
is_active = #{isActive},
|
|
updated_at = NOW()
|
|
WHERE survey_id = CAST(#{surveyId, jdbcType=OTHER} AS uuid) <!-- 이 부분도 일관성을 위해 수정합니다. -->
|
|
</update>
|
|
|
|
<delete id="deleteSurvey">
|
|
DELETE FROM tb_surveys
|
|
WHERE survey_id = CAST(#{surveyId, jdbcType=OTHER} AS uuid) <!-- 이 부분도 일관성을 위해 수정합니다. -->
|
|
</delete>
|
|
</mapper> |