CertDictMapper.xml 1.58 KB
<?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.subsidy.mapper.CertDictMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.subsidy.model.CertDictDO">
        <id column="id" property="id" />
        <result column="create_date" property="createDate" />
        <result column="update_date" property="updateDate" />
        <result column="cert_name" property="certName" />
        <result column="price" property="price" />
        <result column="cover_page" property="coverPage" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        create_date,
        update_date,
        id, cert_name, price, cover_page, end_date
    </sql>

    <select id="getAllCerts" resultType="com.subsidy.vo.cert.GetAllCertsVO">
        SELECT DISTINCT
            t.*
        FROM
            cert_dict t
            LEFT JOIN cert_type_mapping t2 ON t.id = t2.cert_id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            <if test="typeId != null and typeId != ''">
                and t2.type_id = #{typeId}
            </if>
            <if test="certName != null and certName != ''">
                and t.cert_name  like concat('%',#{certName} ,'%')
            </if>
    </select>

    <select id="getAllCertsWithoutType" resultType="com.subsidy.vo.cert.GetAllCertsWithoutTypeVO">
        select id,cert_name from cert_dict t where t.delete_date is null
    </select>
</mapper>