<?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.MatrixColDefDao">
	<resultMap id="MatrixColDef" type="com.hotent.uc.model.MatrixColDef">
		<id property="id" column="ID_" jdbcType="VARCHAR"/>
		<result property="matrixId" column="MATRIX_ID_" jdbcType="VARCHAR"/>
		<result property="code" column="CODE_" jdbcType="VARCHAR"/>
		<result property="name" column="NAME_" jdbcType="VARCHAR"/>
		<result property="status" column="STATUS_" jdbcType="NUMERIC"/>
		<result property="colType" column="COL_TYPE_" jdbcType="NUMERIC"/>
		<result property="selectType" column="SELECT_TYPE_" jdbcType="NUMERIC"/>
		<result property="ctrlType" column="CTRL_TYPE_" jdbcType="VARCHAR"/>
		<result property="queryAlias" column="QUERY_ALIAS_" jdbcType="VARCHAR"/>
		<result property="colConfig" column="COL_CONFIG_" jdbcType="VARCHAR"/>
		<result property="isDele" column="IS_DELE_" 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"/>
		<result property="updateTime" column="UPDATE_TIME_" jdbcType="TIMESTAMP"/>
		<result property="tenantId" column="TENANT_ID_" jdbcType="VARCHAR"/>
		<result property="sn" column="SN_" jdbcType="NUMERIC"/>
		
		<result property="bindKey" column="BIND_KEY_" jdbcType="VARCHAR"/>
		<result property="bindValue" column="BIND_VALUE_" jdbcType="VARCHAR"/>
		<result property="searchField" column="SEARCH_FIELD_" jdbcType="VARCHAR"/>
	</resultMap>
	
	<select id="getColList" parameterType="java.util.Map" resultMap="MatrixColDef">
		 SELECT * FROM uc_matrix_col_def
		 WHERE
		 COL_TYPE_ = #{colType}
		 AND 
		 MATRIX_ID_	=#{matrixId} 
		 AND
		 IS_DELE_ = 0
		 ORDER BY SN_ 
	</select>
	
	<select id="getColAllList" parameterType="java.util.Map" resultMap="MatrixColDef">
		 SELECT * FROM uc_matrix_col_def
		 WHERE
		 COL_TYPE_ = #{colType}
		 AND 
		 MATRIX_ID_	=#{matrixId} 
		 ORDER BY SN_ 
	</select>
	
	<select id="getByCode" parameterType="java.util.Map" resultMap="MatrixColDef">
		 SELECT * FROM uc_matrix_col_def
		 WHERE
		 COL_TYPE_ = #{colType}
		 AND 
		 MATRIX_ID_	=#{matrixId}
		 AND
		 lower(CODE_) = lower(#{code})
	</select>
	
	<update id="updateStatus" parameterType="java.util.Map">
		UPDATE uc_matrix_col_def SET 
		STATUS_ = #{status}
		WHERE
		ID_ IN 
		<foreach collection="ids" item="item" open="(" close=")" separator=",">
			#{item}
		</foreach>
	</update>
</mapper>