smartGeoinfoOriginal/target/classes/egovframework/mapper/sgis/surveysystem/RespondentMapper.xml

66 lines
2.2 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.RespondentMapper">
<resultMap id="respondentResultMap" type="sgis.surveysystem.domain.Respondent">
<id property="respondentId" column="respondent_id"/>
<result property="userId" column="user_id"/>
<result property="ipAddress" column="ip_address"/>
<result property="responseStartAt" column="response_start_at"/>
<result property="responseEndAt" column="response_end_at"/>
</resultMap>
<insert id="insertRespondent" parameterType="sgis.surveysystem.domain.Respondent">
INSERT INTO tb_respondents (
respondent_id,
user_id,
ip_address,
response_start_at,
response_end_at
) VALUES (
#{respondentId, jdbcType=OTHER},
#{userId},
#{ipAddress, jdbcType=OTHER},
#{responseStartAt},
#{responseEndAt}
)
</insert>
<select id="findRespondentById" resultMap="respondentResultMap">
SELECT
respondent_id,
user_id,
ip_address,
response_start_at,
response_end_at
FROM tb_respondents
WHERE respondent_id = #{respondentId, jdbcType=OTHER}
</select>
<select id="findRespondentByUserId" resultMap="respondentResultMap">
SELECT
respondent_id,
user_id,
ip_address,
response_start_at,
response_end_at
FROM tb_respondents
WHERE user_id = #{userId}
LIMIT 1
</select>
<update id="updateRespondent" parameterType="sgis.surveysystem.domain.Respondent">
UPDATE tb_respondents
SET
user_id = #{userId},
ip_address = #{ipAddress, jdbcType=OTHER},
response_start_at = #{responseStartAt},
response_end_at = #{responseEndAt}
WHERE respondent_id = #{respondentId, jdbcType=OTHER}
</update>
<delete id="deleteRespondent">
DELETE FROM tb_respondents
WHERE respondent_id = #{respondentId, jdbcType=OTHER}
</delete>
</mapper>