<?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.yonge.cooleshow.biz.dal.dao.AuditReasonDao">
	<resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.AuditReason">
            <result column="id_" property="id" />
	        <result column="name_" property="name" />
	        <result column="type_" property="type" />
	        <result column="del_flag_" property="delFlag" />
	        <result column="create_time_" property="createTime" />
	        <result column="update_time_" property="updateTime" />
	        <result column="update_by_" property="updateBy" />
	        <result column="create_by_" property="createBy" />
		</resultMap>  
    
    <!-- 表字段 -->
    <sql id="baseColumns">
         t.id_ as id
        , t.name_ as name
        , t.type_ as type
        , t.del_flag_ as delFlag
        , t.create_time_ as createTime
        , t.update_time_ as updateTime
        , t.update_by_ as updateBy
        , t.create_by_ as createBy
        </sql> 
    
    <select id="detail" resultType="com.yonge.cooleshow.biz.dal.vo.AuditReasonVo">
        SELECT
            <include refid="baseColumns"/>
        FROM audit_reason t
        where t.id_ = #{id}
    </select>
    
    <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.vo.AuditReasonVo">
		SELECT         
        	<include refid="baseColumns" />
        ,su.username_ as updateName
		FROM audit_reason t
        left join sys_user su on su.id_ = t.update_by_
        <where>
            t.del_flag_ = 0
            <if test="param.type != null and param.type != ''">
                and t.type_ = #{param.type}
            </if>
            <if test="param.search != null and param.search != ''">
                and t.name_ like concat('%', #{param.search},'%')
            </if>
        </where>
	</select>
</mapper>