<?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.BizAnnualDissentInfoMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.chinaweal.aiccs.aiccs.annual.entity.BizAnnualDissentInfo">
        <id column="uid" property="uid" />
        <result column="bizseq" property="bizseq" />
        <result column="info_id" property="infoId" />
        <result column="pripid" property="pripid" />
        <result column="entname" property="entname" />
        <result column="uniscid" property="uniscid" />
        <result column="reg_no" property="regNo" />
        <result column="final_feedback" property="finalFeedback" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="creator_id" property="creatorId" />
        <result column="state" property="state" />
        <result column="unit" property="unit" />
        <result column="unit_cn" property="unitCn" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        uid, bizseq, info_id, pripid, entname, uniscid, reg_no, final_feedback, create_time, update_time, creator_id, state, unit, unit_cn
    </sql>

    <select id="queryByinfoId" resultMap="BaseResultMap">
        select * from aiccs.biz_annual_dissent_info badi where info_id = #{infoId}
        and state = '1'
        union
        select * from aiccs.biz_annual_dissent_info badi where info_id = #{infoId}
        and state = '2'
    </select>

    <select id="queryByBizseq" resultMap="BaseResultMap">
        select * from aiccs.biz_annual_dissent_info badi where bizseq = #{bizseq}
        and state = '1'
        union
        select * from aiccs.biz_annual_dissent_info badi where bizseq = #{bizseq}
        and state = '2'
    </select>
</mapper>
