<?xml version="1.0" encoding="UTF-8" ?>    
<!DOCTYPE mapper    
PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"    
"http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">

<mapper namespace="com.platform.dao.VolumeDao">
	<resultMap id="getEntityByText" type="com.platform.entities.VolumeInitEntity">
		<id property="id" column="id" javaType="int" jdbcType="INTEGER" />
		<result property="name" column="name" javaType="string"
			jdbcType="VARCHAR" />
		<result property="ip" column="ip" javaType="string"
			jdbcType="VARCHAR" />
		<result property="path" column="path" javaType="string"
		jdbcType="VARCHAR" />
		<result property="mark" column="mark" javaType="string"
		jdbcType="VARCHAR" />
	</resultMap>
	
	<!-- 获取数据全部记录信息 -->
	<select id="findAll" resultType="com.platform.entities.VolumeInitEntity">
		SELECT
		 id,name,ip,path,mark
		FROM 
			volume_info
		ORDER BY id
	</select>
	
	<update id="update" parameterType="com.platform.entities.VolumeInitEntity">
		UPDATE
		volume_info
		<set >
			<trim suffixOverrides=",">
				<if test="name != null and name != ''">
					name= #{name},
				</if>
				<if test="ip != null and ip != ''">
					ip= #{ip},
				</if>
				<if test="path != null and path != ''">
					path= #{path},
				</if>
				<if test="mark != null and mark != ''">
					mark= #{mark},
				</if>
			</trim>
		</set>
		<where>
			id = #{id}
		</where>
	</update>
	
	<insert id="save" parameterType="com.platform.entities.VolumeInitEntity">
		INSERT INTO
		volume_info(
		<trim suffixOverrides=",">
			<if test="name != null and name != ''">
				name,
			</if>
			<if test="ip != null and ip != ''">
				ip,
			</if>
			<if test="path != null and path != ''">
				path,
			</if>
			<if test="mark != null and mark != ''">
				mark,
			</if>
		</trim>
		)
		VALUES(
		<trim suffixOverrides=",">
			<if test="name != null and name != ''">
				#{name},
			</if>
			<if test="ip != null and ip != ''">
				#{ip},
			</if>
			<if test="path != null and path != ''">
				#{path},
			</if>
			<if test="mark != null and mark != ''">
				#{mark},
			</if>
		</trim>
		)
	</insert>
	
	<delete id="remove" parameterType="java.lang.String">
		DELETE FROM
			volume_info 
		WHERE
			name = #{name}
	</delete>

</mapper>  