<?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.chinaweal.aiccs.aiccs.annual.mapper.EPubObjectionMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.chinaweal.aiccs.aiccs.annual.entity.EPubObjection">
        <id column="OBJID" property="objid" />
        <result column="ENTNAME" property="entname" />
        <result column="USERID" property="userid" />
        <result column="PRIPID" property="pripid" />
        <result column="UNISCID" property="uniscid" />
        <result column="REGNO" property="regno" />
        <result column="REGORG" property="regorg" />
        <result column="REGORG_CN" property="regorgCn" />
        <result column="OBJECTION_MODULE_ID" property="objectionModuleId" />
        <result column="OBJECTION_MODULE" property="objectionModule" />
        <result column="OBJECTION_NAME" property="objectionName" />
        <result column="OBJECTION_VALUE" property="objectionValue" />
        <result column="OBJECTION_DETAIL" property="objectionDetail" />
        <result column="OBJECTION_TIME" property="objectionTime" />
        <result column="USER_NAME" property="userName" />
        <result column="USER_CARD" property="userCard" />
        <result column="USER_MOBILE" property="userMobile" />
        <result column="USER_EMAIL" property="userEmail" />
        <result column="USER_ADDR" property="userAddr" />
        <result column="DISPOSE" property="dispose" />
        <result column="RESULT" property="result" />
        <result column="RESULT_TIME" property="resultTime" />
        <result column="ACCEPT_UNIT" property="acceptUnit" />
        <result column="ACCEPT_UNIT_CN" property="acceptUnitCn" />
        <result column="OBJ_NODENUM" property="objNodenum" />
        <result column="S_EXT_FROMNODE" property="sExtFromnode" />
        <result column="S_EXT_DATATIME" property="sExtDatatime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        OBJID, ENTNAME, USERID, PRIPID, UNISCID, REGNO, REGORG, REGORG_CN, OBJECTION_MODULE_ID, OBJECTION_MODULE, OBJECTION_NAME, OBJECTION_VALUE, OBJECTION_DETAIL, OBJECTION_TIME, USER_NAME, USER_CARD, USER_MOBILE, USER_EMAIL, USER_ADDR, DISPOSE, RESULT, RESULT_TIME, ACCEPT_UNIT, ACCEPT_UNIT_CN, OBJ_NODENUM, S_EXT_FROMNODE, S_EXT_DATATIME
    </sql>

    <select id="selectEPubObjectionPage" resultMap="BaseResultMap">
        SELECT * FROM crgs.e_pub_objection epo
        WHERE 1=1
        <if test="params != null">
            <if test="params.UNISCID != null and params.searchName != ''">
                AND UNISCID = #{params.UNISCID}
            </if>
            <if test="params.REGNO != null and params.REGNO != ''">
                AND REGNO = #{params.REGNO}
            </if>
            <if test="params.entname != null and params.entname != ''">
                AND entname like concat('%',#{params.entname}, '%')
            </if>
            <if test="params.DISPOSE != null and params.DISPOSE != ''">
                AND DISPOSE = #{params.DISPOSE}
            </if>
            <if test="params.REGORG != null and params.REGORG != ''">
                AND REGORG = #{params.REGORG}
            </if>
            <if test="params.OBJECTION_TIME_start != null and params.OBJECTION_TIME_start != ''">
                and date_format(OBJECTION_TIME, '%Y-%m-%d') &gt;= #{params.OBJECTION_TIME_start}
            </if>
            <if test="params.OBJECTION_TIME_end != null and params.OBJECTION_TIME_end != ''">
                and date_format(OBJECTION_TIME, '%Y-%m-%d') &lt;= #{params.OBJECTION_TIME_end}
            </if>
        </if>
        order by OBJECTION_TIME desc
    </select>

</mapper>
