123456789101112131415161718192021222324252627282930313233 |
- -- select count(*) from (
- select t.*,
- IFNULL(pr.`reportery`,0) reporteryQ
- from (
- SELECT
- CONCAT('uploads/thumbnail/',ep.`picpath`,'/',ep.`newpicname`) picpath,
- CONCAT('uploads/image/',ep.`picpath`,'/',ep.`newpicname`) srcpath,
- b.`brandName`,
- c.`id`,c.`brand`,c.`brandId`,c.`partCode`,c.`partId`,c.`partName`,c.`pastureId`,c.`pastureName`,
- c.`specification`,c.`unit`,
- TRIM(TRAILING '.' FROM (TRIM(TRAILING '0' FROM c.`price`))) price
- FROM
- contract c
- LEFT JOIN brand b ON b.id = c.brandId
- LEFT JOIN bigcontract bc ON bc.id = c.bigId
- LEFT JOIN bigcontract bc2 ON bc2.contractCode = left(bc.contractCode,12)
- join pasture_bigcontract pbt on pbt.bigcontract_id =bc2.id
- LEFT JOIN parts ps ON ps.id = c.partId
- LEFT JOIN eq_pic ep ON ep.id = ps.picpath
- WHERE
- bc.`providerId` = '2808'
- AND c.enable = 1
- -- AND (bc.`stopTime`>=DATE_FORMAT(NOW(),'%Y-%m-%d') and bc.statue=1 and bc.SHStatus = 7 )
- -- AND if(''='' ,bc.SHStatus = 7,c.`partCode` = '' OR c.`partName` ='' OR c.`specification` ='' )
- and (bc.pastureId='631' or '631'='' or pbt.pasture_id = '631' )
- -- limit 10
- )t
- left join
- (
- select reportery,contractId from part_repertory pr2 left join warehouse w on pr2.locationId =w.id
- where pr2.pastureId ='631' or (pr2.pastureId =18 and w.pastureId = '631')
- ) pr ON pr.`contractId` = t.`id`
- )a
|