<?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="com.hotent.uc.dao.PropertiesDao">
	<resultMap id="BaseResultMap" type="com.hotent.uc.model.Properties">
		<id property="id" column="ID_" jdbcType="VARCHAR"/>
		<result property="name" column="NAME_" jdbcType="VARCHAR"/>
		<result property="code" column="CODE_" jdbcType="VARCHAR"/>
		<result property="group" column="GROUP_" jdbcType="VARCHAR"/>
		<result property="value" column="VALUE_" jdbcType="VARCHAR"/>
		<result property="encrypt" column="ENCRYPT_" jdbcType="NUMERIC"/>
		<result property="description" column="DESCRIPTION_" jdbcType="VARCHAR"/>
		<result property="updateTime" column="UPDATE_TIME_" jdbcType="TIMESTAMP"/>
		<result property="isDelete" column="IS_DELE_" jdbcType="VARCHAR"/>
		<result property="version" column="VERSION_" jdbcType="NUMERIC"/>
		<result property="createBy" column="create_by_" jdbcType="VARCHAR"/>
		<result property="createTime" column="create_time_" jdbcType="TIMESTAMP"/>
		<result property="createOrgId" column="create_org_id_" jdbcType="VARCHAR"/>
		<result property="updateBy" column="update_by_" jdbcType="VARCHAR"/>
	</resultMap>
	
	<parameterMap id="Properties" type="com.hotent.uc.model.Properties" />

	<sql id="Base_Column_List">
		ID_,NAME_,CODE_,GROUP_,VALUE_,ENCRYPT_,create_time_,DESCRIPTION_,UPDATE_TIME_,IS_DELE_,VERSION_
	</sql>
	
	
	<delete id="removePhysical" >
		DELETE FROM UC_PROPERTIES WHERE IS_DELE_=1
	</delete>
	
	<select id="getGroups" resultType="java.lang.String">
		SELECT distinct GROUP_ FROM UC_PROPERTIES WHERE IS_DELE_!=1
	</select>
	
	<select id="isExist" resultType="java.lang.Integer">
		SELECT count(1) FROM UC_PROPERTIES where CODE_=#{code} AND IS_DELE_!=1
		<if test="id!=null">
			and ID_ !=#{id}
		</if>
	</select>
	
	<select id="getByCode"   parameterType="java.lang.String" resultMap="BaseResultMap">
		SELECT <include refid="Base_Column_List" /> FROM UC_PROPERTIES 
		WHERE 
		CODE_=#{code} AND IS_DELE_!=1
	</select>
</mapper>