????

Your IP : 3.16.125.156


Current Path : C:/inetpub/vhost/binhdinhinvest.gdtvietnam.com/api/dist/xtdt/service/
Upload File :
Current File : C:/inetpub/vhost/binhdinhinvest.gdtvietnam.com/api/dist/xtdt/service/map-client.service.js

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MapClientService = void 0;
const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm");
const typeorm_2 = require("typeorm");
let MapClientService = class MapClientService {
    constructor(entity) {
        this.entity = entity;
        this.PATTERN = /[^\p{L}\p{Nd}]+/gu;
    }
    search(params) {
        var _a;
        const { q = '', dv, kc, db, lv, dtt, dtf, px, qh, skip, limit, adv, tt } = params;
        const split = (_a = q === null || q === void 0 ? void 0 : q.split(this.PATTERN)) === null || _a === void 0 ? void 0 : _a.filter(f => f);
        const s = split.length > 1 ? `NEAR((${split.join(',')}), 5, FALSE)` : `"${split[0] || ''}*"`;
        if (!+adv)
            return this.entity.query('EXEC sp_MapQuickSearch @0, @1, @2', [s, skip, limit]);
        return this.entity.query('EXEC dbo.sp_MapAdvancedSearch @0,@1,@2,@3,@4,@5,@6,@7,@8,@9,@10,@11', [s, kc, dv, lv, db, dtf, dtt, px, qh, tt, skip, limit]);
    }
    searchDetail(params) {
        const { id, dv, kc, lv, dtt, dtf, skip, limit, type } = params;
        if (type)
            return this.entity.query('EXEC dbo.sp_SearchQhsddRanh @0,@1,@2,@3,@4,@5,@6,@7', [id, kc, dv, lv, dtt, dtf, skip, limit]);
    }
};
MapClientService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectEntityManager)()),
    __metadata("design:paramtypes", [typeorm_2.EntityManager])
], MapClientService);
exports.MapClientService = MapClientService;