<?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.ruoyi.excel.wecom.mapper.CorpInfoMapper">

    <resultMap id="CorpInfoResult" type="com.ruoyi.excel.wecom.domain.CorpInfo">
        <id property="id" column="id"/>
        <result property="corpId" column="corp_id"/>
        <result property="secret" column="secret"/>
        <result property="name" column="name"/>
    </resultMap>

    <!-- 查询企业信息列表 -->
    <select id="selectCorpInfoList" parameterType="com.ruoyi.excel.wecom.domain.CorpInfo" resultMap="CorpInfoResult">
        SELECT id, corp_id, secret, name
        FROM corp_info
        <where>
            <if test="corpId != null and corpId != ''">
                AND corp_id = #{corpId}
            </if>
            <if test="name != null and name != ''">
                AND name LIKE CONCAT('%', #{name}, '%')
            </if>
        </where>
        ORDER BY id DESC
    </select>

    <!-- 根据企业ID查询企业信息 -->
    <select id="selectCorpInfoByCorpId" parameterType="String" resultMap="CorpInfoResult">
        SELECT id, corp_id, secret, name
        FROM corp_info
        WHERE corp_id = #{corpId}
        LIMIT 1
    </select>

</mapper>
