All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mybatis.uudb-common.xml Maven / Gradle / Ivy

There is a newer version: 2.10.3
Show newest version
<?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="eu.unicore.xuudb.server.db.UudbClassicMapper">

	<select id="getRecord" resultType="LoginData">
		select * from UUDB_CLASSIC WHERE gcid = #{param1} AND token = #{param2} 
	</select>

	<select id="queryRecords" resultType="LoginData">
		select * from UUDB_CLASSIC
		<include refid="whereStatement"/>
	</select>

	<select id="listGcids" resultType="String">
		select gcid from UUDB_CLASSIC
	</select>
	
	<insert id="insertRecord">
		INSERT INTO UUDB_CLASSIC (gcid, xlogin, token, role, projects) 
		VALUES (#{gcid}, #{xlogin}, #{token}, #{role}, #{projects})
	</insert>

	<update id="updateRecord">
		UPDATE UUDB_CLASSIC
		<set>
      		<if test="param3.gcid != null">		gcid=#{param3.gcid},		</if>
      		<if test="param3.xlogin != null">	xlogin=#{param3.xlogin},	</if>
      		<if test="param3.role != null">		role=#{param3.role},		</if>
      		<if test="param3.projects != null">	projects=#{param3.projects},</if>
      		<if test="param3.token != null">	token=#{param3.token},		</if>
      	</set>
      	<where>
      		<if test="param1 != null">	gcid = #{param1}	</if>
      		AND token = #{param2}
      	</where>		
	</update>
	
	<delete id="removeRecords">
		DELETE FROM UUDB_CLASSIC
		<include refid="whereStatement"/> 
	</delete>
	
	<!-- reusable -->
	<sql id="whereStatement">
		<where> 
			<if test="gcid != null">	gcid = #{gcid}			</if> 
			<if test="xlogin != null">	AND xlogin = #{xlogin} 	</if>
			<if test="role != null">	AND role = #{role}		</if>
			<if test="token != null">	AND token = #{token}	</if>
			<if test="projects != null">AND projects = #{projects}</if>
		</where>	
	</sql>

</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy