<?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="zoneDomainSqlMapper">
	<sql id="base_column">
		id,zone_id as zoneId,domain,status
	</sql>

	<insert id="addZoneDomain" parameterType="com.cloudcross.ssp.model.ZoneDomain" >
		insert into t_zone_domain(zone_id ,domain,supdated,status)
		values(#{zoneId},#{domain},#{supdated},#{status})
	</insert>
	
	
	<select id="findAllDomain" parameterType="long" resultType="com.cloudcross.ssp.model.ZoneDomain">
		select <include refid="base_column"/> from t_zone_domain where zone_id = #{zoneId} and t_zone_domain.status = 0
	</select>
	
	<update id="deleteZoneDomain" parameterType="com.cloudcross.ssp.model.Zone">
		update t_zone_domain set status=-1,supdated=#{supdated} where status=0 and zone_id = #{id}
	</update>
	
	<update id="editZoneDomain" parameterType="com.cloudcross.ssp.model.ZoneDomain">
		update t_zone_domain set  domain=#{domain} ,supdated=#{supdated} where zone_id = #{zone_id}
	</update>
	
	<select id="selectById"  parameterType="int" resultType="com.cloudcross.ssp.model.ZoneDomain">
		select <include refid="base_column" /> from t_zone_domain 
	<where> zone_id = #{id} 
		and
		t_zone_domain.status = 0
	</where>
	</select>
	
</mapper>