<?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="userGroupSqlMapper">
	
	<sql id="base_column">
		account_id as id,
		account_type as userGroupType,
		account_name as userGroup,
		active as status
	</sql>
	
	<insert id="addUserGroup" parameterType="com.cloudcross.ssp.model.UserGroup" useGeneratedKeys="true"
		keyProperty="id">
		insert into rv_accounts(account_type,account_name) values(#{userGroupType},#{userGroup});
	</insert>
	
	<select id="findUserGroupById" parameterType="long" resultType="com.cloudcross.ssp.model.UserGroup">
	    select
	    <include refid="base_column" />
	    from rv_accounts
	    <where>
	    	account_id = #{id}
	    </where>
	</select>
</mapper>