liujie
2 天以前 09d4077e7343fa3105ae1bed901c0f10027f97b4
ruoyi-system/src/main/resources/mapper/system/TCrmChangePointsMapper.xml
@@ -24,5 +24,162 @@
    <sql id="Base_Column_List">
        id, branch_salesperson_id,procurement_id,exchange_id, user_type, change_type,change_reason, change_value, remarks, create_time, update_time, create_by, update_by, disabled
    </sql>
    <select id="pageListBranch" resultType="com.ruoyi.system.vo.TCrmChangePointsVO">
        select
            tccp.id, tccp.branch_salesperson_id,tccp.procurement_id,tccp.exchange_id, tccp.user_type, tccp.change_type,
            tccp.change_reason, tccp.change_value, tccp.remarks, tccp.create_time, tccp.update_time, tccp.create_by,
            tccp.update_by, tccp.disabled,tcb.branch_name as branchName
        from t_crm_change_points tccp
        left join t_crm_branch tcb on tcb.id = tccp.branch_salesperson_id
        <where>
            <if test="query.branchName != null and query.branchName != ''">
                and tcb.branch_name like concat('%',#{query.branchName},'%')
            </if>
            <if test="query.changeType != null">
                and tccp.change_type = #{query.changeType}
            </if>
            <if test="query.changeReason != null">
                and tccp.change_reason = #{query.changeReason}
            </if>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                AND tccp.create_time &gt;= #{query.startTime}
                AND tccp.create_time &lt;= #{query.endTime}
            </if>
            AND tccp.user_type = 1
            AND tccp.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
        ORDER BY tccp.create_time DESC
    </select>
    <select id="pageListSalesperson" resultType="com.ruoyi.system.vo.TCrmChangePointsVO">
        select
            tccp.id, tccp.branch_salesperson_id,tccp.procurement_id,tccp.exchange_id, tccp.user_type, tccp.change_type,
            tccp.change_reason, tccp.change_value, tccp.remarks, tccp.create_time, tccp.update_time, tccp.create_by,
            tccp.update_by, tccp.disabled,tcs.salesperson_name as salespersonName
        from t_crm_change_points tccp
        left join t_crm_salesperson tcs on tcs.id = tccp.branch_salesperson_id
        <where>
            <if test="query.salespersonName != null and query.salespersonName != ''">
                and tcs.salesperson_name like concat('%',#{query.salespersonName},'%')
            </if>
            <if test="query.changeType != null">
                and tccp.change_type = #{query.changeType}
            </if>
            <if test="query.changeReason != null">
                and tccp.change_reason = #{query.changeReason}
            </if>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                AND tccp.create_time &gt;= #{query.startTime}
                AND tccp.create_time &lt;= #{query.endTime}
            </if>
            AND tccp.user_type = 2
            AND tccp.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
        ORDER BY tccp.create_time DESC
    </select>
    <select id="pageListClinic" resultType="com.ruoyi.system.vo.TCrmChangePointsVO">
        select
            tccp.id, tccp.branch_salesperson_id,tccp.procurement_id,tccp.exchange_id, tccp.user_type, tccp.change_type,
            tccp.change_reason, tccp.change_value, tccp.remarks, tccp.create_time, tccp.update_time, tccp.create_by,
            tccp.update_by, tccp.disabled,tcc.clinic_name as clinicName
        from t_crm_change_points tccp
        left join t_crm_clinic tcc on tcc.id = tccp.branch_salesperson_id
        <where>
            <if test="query.clinicName != null and query.clinicName != ''">
                and tcc.clinic_name like concat('%',#{query.clinicName},'%')
            </if>
            <if test="query.changeType != null">
                and tccp.change_type = #{query.changeType}
            </if>
            <if test="query.changeReason != null">
                and tccp.change_reason = #{query.changeReason}
            </if>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                AND tccp.create_time &gt;= #{query.startTime}
                AND tccp.create_time &lt;= #{query.endTime}
            </if>
            AND tccp.user_type = 3
            AND tccp.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
        ORDER BY tccp.create_time DESC
    </select>
    <select id="pageListBranchExport" resultType="com.ruoyi.system.export.TCrmChangePointsBranchExport">
        select
        tccp.id, tccp.branch_salesperson_id,tccp.procurement_id,tccp.exchange_id, tccp.user_type, tccp.change_type,
        tccp.change_reason, tccp.change_value, tccp.remarks, tccp.create_time, tccp.update_time, tccp.create_by,
        tccp.update_by, tccp.disabled,tcb.branch_name as branchName
        from t_crm_change_points tccp
        left join t_crm_branch tcb on tcb.id = tccp.branch_salesperson_id
        <where>
            <if test="query.branchName != null and query.branchName != ''">
                and tcb.branch_name like concat('%',#{query.branchName},'%')
            </if>
            <if test="query.changeType != null">
                and tccp.change_type = #{query.changeType}
            </if>
            <if test="query.changeReason != null">
                and tccp.change_reason = #{query.changeReason}
            </if>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                AND tccp.create_time &gt;= #{query.startTime}
                AND tccp.create_time &lt;= #{query.endTime}
            </if>
            AND tccp.user_type = 1
            AND tccp.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
        ORDER BY tccp.create_time DESC
    </select>
    <select id="pageListSalespersonExport"
            resultType="com.ruoyi.system.export.TCrmChangePointsSalespersonExport">
        select
        tccp.id, tccp.branch_salesperson_id,tccp.procurement_id,tccp.exchange_id, tccp.user_type, tccp.change_type,
        tccp.change_reason, tccp.change_value, tccp.remarks, tccp.create_time, tccp.update_time, tccp.create_by,
        tccp.update_by, tccp.disabled,tcs.salesperson_name as salespersonName
        from t_crm_change_points tccp
        left join t_crm_salesperson tcs on tcs.id = tccp.branch_salesperson_id
        <where>
            <if test="query.salespersonName != null and query.salespersonName != ''">
                and tcs.salesperson_name like concat('%',#{query.salespersonName},'%')
            </if>
            <if test="query.changeType != null">
                and tccp.change_type = #{query.changeType}
            </if>
            <if test="query.changeReason != null">
                and tccp.change_reason = #{query.changeReason}
            </if>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                AND tccp.create_time &gt;= #{query.startTime}
                AND tccp.create_time &lt;= #{query.endTime}
            </if>
            AND tccp.user_type = 2
            AND tccp.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
        ORDER BY tccp.create_time DESC
    </select>
    <select id="pageListClinicExport" resultType="com.ruoyi.system.export.TCrmChangePointsClinicExport">
        select
        tccp.id, tccp.branch_salesperson_id,tccp.procurement_id,tccp.exchange_id, tccp.user_type, tccp.change_type,
        tccp.change_reason, tccp.change_value, tccp.remarks, tccp.create_time, tccp.update_time, tccp.create_by,
        tccp.update_by, tccp.disabled,tcc.clinic_name as clinicName
        from t_crm_change_points tccp
        left join t_crm_clinic tcc on tcc.id = tccp.branch_salesperson_id
        <where>
            <if test="query.clinicName != null and query.clinicName != ''">
                and tcc.clinic_name like concat('%',#{query.clinicName},'%')
            </if>
            <if test="query.changeType != null">
                and tccp.change_type = #{query.changeType}
            </if>
            <if test="query.changeReason != null">
                and tccp.change_reason = #{query.changeReason}
            </if>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                AND tccp.create_time &gt;= #{query.startTime}
                AND tccp.create_time &lt;= #{query.endTime}
            </if>
            AND tccp.user_type = 3
            AND tccp.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
        ORDER BY tccp.create_time DESC
    </select>
</mapper>