Blame view

CertMemberMappingMapper.xml 3.51 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
<?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.CertMemberMappingMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.subsidy.model.CertMemberMappingDO">
        <id column="id" property="id" />
        <result column="create_date" property="createDate" />
        <result column="update_date" property="updateDate" />
        <result column="delete_date" property="deleteDate" />
        <result column="member_id" property="memberId" />
        <result column="cert_id" property="certId" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        create_date,
        update_date,
        delete_date,
        id, member_id, cert_id
    </sql>

    <select id="signManagement" resultType="com.subsidy.vo.cert.SignManagementVO">
        SELECT
        t.id as certId,
        t4.id,
        t4.create_date,
        t.cert_name,
        t.price,
        t6.user_name,
        t5.company_name,
        t4.`status`
        FROM
        cert_dict t
        LEFT JOIN (
        SELECT DISTINCT
        t.id,
        t.cert_id,
        t.member_id,
        t.create_date,
        t.`status`
        FROM
        cert_member_mapping t
        LEFT JOIN cert_type_mapping t3 ON t.cert_id = t3.cert_id
        WHERE
        t.delete_date IS NULL
        AND t3.delete_date IS NULL
        <if test="status != null and status != ''">
            AND t.`status` = #{status}
        </if>
        <if test=" typeId != null and typeId != ''">
            AND t3.type_id = #{typeId}
        </if>
        <if test=" certId != null and certId != ''">
            AND t.cert_id = #{certId}
        </if>
        <if test="startDate != null and start != ''">
            and DATE_FORMAT(t.create_date ,'%Y-%m-%d')>= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
        </if>
        <if test="endDate != null and endDate != ''">
            and DATE_FORMAT(t.create_date ,'%Y-%m-%d')&lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
        </if>
        ) t4 ON t.id = t4.cert_id
        LEFT JOIN member t6 ON t4.member_id = t6.id
        LEFT JOIN company_dict t5 ON t6.company_id = t5.id
        WHERE
        t.delete_date IS NULL
        AND t5.delete_date IS NULL
        AND t6.delete_date IS NULL
        <if test="item != null and item != ''">
            AND (t.cert_name LIKE concat('%',#{item} ,'%')
            AND t5.company_name  LIKE  concat('%',#{item} ,'%'))
        </if>

    </select>

    <select id="getList"  resultType="com.subsidy.vo.cert.GetListVO">
        SELECT
            t.id,
            t2.cert_name,
            t2.id AS cert_id,
            t2.cover_page,
            t.create_date
        FROM
            cert_member_mapping t
            LEFT JOIN cert_dict t2 ON t.cert_id = t2.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            and t.member_id = #{memberId}
            <if test="status != null and status !=''">
                and t.status = #{status}
            </if>
    </select>

    <select id="getSignInfo" resultType="com.subsidy.vo.cert.GetSignInfoVO">
        SELECT
            t2.user_name,
            t.order_no
        FROM
            cert_member_mapping t
            LEFT JOIN member t2 ON t.member_id = t2.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            and t.cert_id =#{certId}
            and t.member_id = #{memberId}
    </select>
</mapper>