Blame view

CertMemberMappingMapper.xml 5.72 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
<?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,
涂亚平 committed
83 84
            t.create_date,
            t.status
涂亚平 committed
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
        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,
涂亚平 committed
100 101 102
            t.order_no,
            t.status,
            t3.cert_name
涂亚平 committed
103 104 105
        FROM
            cert_member_mapping t
            LEFT JOIN member t2 ON t.member_id = t2.id
涂亚平 committed
106
            left join cert_dict t3 on t.cert_id = t3.id
涂亚平 committed
107 108 109 110 111 112
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            and t.cert_id =#{certId}
            and t.member_id = #{memberId}
    </select>
涂亚平 committed
113 114 115 116 117 118 119 120 121 122 123

    <select id="memberCertStatus" resultType="integer">
       SELECT
            count( 1 )
        FROM
            cert_member_mapping t
        WHERE
            t.delete_date IS NULL
            AND t.member_id = #{memberId}
            AND t.cert_id = #{certId}
            AND (
涂亚平 committed
124
                t.`status` = "已报名"
涂亚平 committed
125 126 127
            OR t.`status` = "等待支付"
            OR t.`status` = "有效订单")
    </select>
涂亚平 committed
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177

    <select id="certTypeSignStatus" resultType="com.subsidy.vo.cert.CertSignStatusVO">
        SELECT DISTINCT
            t.id,
            t.cert_name,
            t.cover_page,
            t.price,
            t.scribe_price,
            t4.`status`
        FROM
            cert_dict t
            LEFT JOIN cert_type_mapping t2 ON t.id = t2.cert_id
            LEFT JOIN cert_member_mapping t4 ON t.id = t4.cert_id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t4.delete_date IS NULL
            AND t4.member_id = #{memberId}
            AND t2.type_id = #{typeId}
    </select>

    <select id="certSignInfo" resultType="com.subsidy.vo.cert.CertSignInfoVO">
            SELECT
                t.id,
                t1.user_name,
                t2.company_name,
                t1.telephone,
                t1.id_card,
                t.STATUS,
                t3.price,
                t3.scribe_price,
                t.commit_price
            FROM
                cert_member_mapping t
            LEFT JOIN member t1 ON t.member_id = t1.id
            LEFT JOIN company_dict t2 ON t1.company_id = t2.id
            LEFT JOIN cert_dict t3 ON t.cert_id = t.id
            WHERE
            t.delete_date IS NULL
            AND t1.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t3.delete_date IS NULL
            and t.cert_id = #{certId}
            <if test="status != null and status != ''">
                and t.status = #{status}
            </if>
            <if test="userName != null and userName != ''">
                and t1.user_name like concat('%',#{userName} ,'%')
            </if>
    </select>
涂亚平 committed
178
</mapper>