gql.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819
  1. const create_user = `
  2. mutation createuser($email: String, $updatedAt: String, $password: String, $telephone: String, $username: String, $createdAt: String, $openid: String, $id: ID!, $userData_id: ID) {
  3. createuser: create_user(email: $email updatedAt: $updatedAt password: $password telephone: $telephone username: $username createdAt: $createdAt openid: $openid id: $id userData_id: $userData_id) {
  4. result
  5. user {
  6. email
  7. updatedAt
  8. password
  9. telephone
  10. username
  11. createdAt
  12. openid
  13. id
  14. }
  15. }
  16. }
  17. `
  18. const find_user_by_openid = `
  19. query userbyprops($openid: String) {
  20. userbyprops: user_by_props(openid: $openid) {
  21. id
  22. }
  23. }
  24. `
  25. const category_by_props = `
  26. query categorybyprops($sort_by: category_sort_by, $limit: Int, $status: String) {
  27. categorybyprops: category_by_props(sort_by: $sort_by limit: $limit status: $status) {
  28. id
  29. text:name
  30. icon:img
  31. status
  32. }
  33. }
  34. `
  35. const update_category = `
  36. mutation updatecategory($id: ID, $img: String, $order: Int, $status: String, $updatedAt: String) {
  37. updatecategory: update_category(id: $id img: $img order: $order status: $status updatedAt: $updatedAt) {
  38. result
  39. category {
  40. id
  41. name
  42. img
  43. order
  44. status
  45. createdAt
  46. updatedAt
  47. }
  48. }
  49. }
  50. `
  51. const delete_category = `
  52. mutation deletecategory($id: ID) {
  53. deletecategory: delete_category(id: $id)
  54. }
  55. `
  56. const create_category = `
  57. mutation createcategory($id: ID!, $name: String, $img: String, $order: Int, $status: String, $createdAt: String, $updatedAt: String) {
  58. createcategory: create_category(id: $id name: $name img: $img order: $order status: $status createdAt: $createdAt updatedAt: $updatedAt) {
  59. result
  60. category {
  61. id
  62. name
  63. img
  64. order
  65. status
  66. createdAt
  67. updatedAt
  68. }
  69. }
  70. }
  71. `
  72. const productbyprops = `
  73. query productbyprops($recommend: Int, $where: product_filter, $sort_by: product_sort_by, $limit: Int, $unit: String, $order_by: OrderBy, $name: String, $filter: Filter, $status: String, $price: Float, $category_id: ID, $img: String, $stock: Int, $skip: Int) {
  74. productbyprops: product_by_props(recommend: $recommend where: $where sort_by: $sort_by limit: $limit unit: $unit order_by: $order_by name: $name filter: $filter status: $status price: $price category_id: $category_id img: $img stock: $stock skip: $skip) {
  75. recommend
  76. category_id{
  77. id
  78. name
  79. }
  80. updatedAt
  81. unit
  82. name
  83. createdAt
  84. status
  85. id
  86. intro
  87. price
  88. img
  89. stock
  90. discountRate
  91. }
  92. }
  93. `
  94. const productAndSpec_by_id = `
  95. query productbyid($id: ID) {
  96. productbyid: product_by_id(id: $id) {
  97. category_id{
  98. id
  99. }
  100. updatedAt
  101. unit
  102. name
  103. createdAt
  104. status
  105. id
  106. intro
  107. price
  108. img
  109. stock
  110. discountRate
  111. }
  112. spec: specificationStock_by_props(product_id: $id ) {
  113. id
  114. color
  115. size
  116. slideImg
  117. detailImg
  118. stock
  119. status
  120. }
  121. }
  122. `
  123. const create_userCart = `
  124. mutation createuserCart($id: ID!, $user_id: ID, $product_id: ID, $specificationStock_id: ID, $count: Int, $createdAt: String, $updatedAt: String) {
  125. createuserCart: create_userCart(id: $id user_id: $user_id product_id: $product_id specificationStock_id: $specificationStock_id count: $count createdAt: $createdAt updatedAt: $updatedAt) {
  126. result
  127. userCart {
  128. id
  129. user_id {
  130. id
  131. }
  132. product_id {
  133. recommend
  134. unit
  135. name
  136. status
  137. id
  138. intro
  139. price
  140. img
  141. stock
  142. discountRate
  143. }
  144. specificationStock_id {
  145. id
  146. color
  147. size
  148. stock
  149. status
  150. }
  151. count
  152. createdAt
  153. updatedAt
  154. }
  155. }
  156. }
  157. `
  158. const cart_by_userid = `
  159. query findUserCart($user_id:ID){
  160. cartList:userCart_by_props(user_id:$user_id){
  161. count
  162. createdAt
  163. id
  164. product_id{
  165. id
  166. img
  167. intro
  168. name
  169. price
  170. status
  171. stock
  172. unit
  173. discountRate
  174. }
  175. specificationStock_id{
  176. id
  177. color
  178. size
  179. stock
  180. status
  181. }
  182. }
  183. }
  184. `
  185. const update_userCart = `
  186. mutation updateuserCart($id: ID, $specificationStock_id: ID, $count: Int, $updatedAt: String, $where: userCart_filter) {
  187. updateuserCart: update_userCart(id: $id specificationStock_id: $specificationStock_id count: $count updatedAt: $updatedAt where: $where) {
  188. result
  189. userCart {
  190. id
  191. product_id {
  192. id
  193. }
  194. specificationStock_id {
  195. updatedAt
  196. color
  197. size
  198. slideImg
  199. status
  200. id
  201. detailImg
  202. stock
  203. }
  204. count
  205. createdAt
  206. updatedAt
  207. }
  208. }
  209. }
  210. `
  211. const delete_userCart_by_id = `
  212. mutation delete_userCart($id: [String]) {
  213. delete_userCart(where: {
  214. id: {
  215. _in: $id
  216. }
  217. })
  218. }
  219. `
  220. const create_update_userAddress = `
  221. mutation createuserAddress( $id: ID!, $address: String, $updatedAt: String, $telephone: String, $default: Int, $city: String, $username: String, $postcode: String, $createdAt: String, $deletedAt: String, $user_id: ID, $area: String, $province: String,
  222. $updateID: ID!, $updateDefault: Int, $newUpdatedAt: String) {
  223. createuserAddress: create_userAddress(id: $id address: $address updatedAt: $updatedAt telephone: $telephone default: $default city: $city username: $username postcode: $postcode createdAt: $createdAt deletedAt: $deletedAt user_id: $user_id area: $area province: $province) {
  224. result
  225. userAddress {
  226. address
  227. updatedAt
  228. telephone
  229. default
  230. city
  231. username
  232. postcode
  233. createdAt
  234. deletedAt
  235. id
  236. area
  237. province
  238. }
  239. }
  240. updateuserAddress: update_userAddress(id: $updateID default: $updateDefault updatedAt: $createdAt) {
  241. result
  242. userAddress {
  243. address
  244. updatedAt
  245. telephone
  246. default
  247. city
  248. username
  249. postcode
  250. createdAt
  251. deletedAt
  252. id
  253. area
  254. province
  255. }
  256. }
  257. }
  258. `
  259. const update_userAddress = `
  260. mutation updateuserAddress($id: ID, $address: String, $updatedAt: String, $where: userAddress_filter, $telephone: String, $default: Int, $city: String, $username: String, $postcode: String, $createdAt: String, $deletedAt: String, $user_id: ID, $area: String, $province: String,
  261. $updateID: ID!, $updateDefault: Int, $newUpdatedAt: String) {
  262. updateAddress: update_userAddress(id: $id address: $address updatedAt: $updatedAt where: $where telephone: $telephone default: $default city: $city username: $username postcode: $postcode createdAt: $createdAt deletedAt: $deletedAt user_id: $user_id area: $area province: $province) {
  263. result
  264. userAddress {
  265. address
  266. updatedAt
  267. telephone
  268. default
  269. city
  270. username
  271. postcode
  272. createdAt
  273. deletedAt
  274. id
  275. area
  276. province
  277. }
  278. }
  279. updateuserAddress: update_userAddress(id: $updateID default: $updateDefault updatedAt: $createdAt) {
  280. result
  281. userAddress {
  282. address
  283. updatedAt
  284. telephone
  285. default
  286. city
  287. username
  288. postcode
  289. createdAt
  290. deletedAt
  291. id
  292. area
  293. province
  294. }
  295. }
  296. }
  297. `
  298. const userAddressbyprops = `
  299. query userAddressbyprops($user_id: ID) {
  300. userAddressbyprops: userAddress_by_props(user_id: $user_id) {
  301. address
  302. updatedAt
  303. telephone
  304. default
  305. city
  306. username
  307. postcode
  308. createdAt
  309. deletedAt
  310. id
  311. user_id {
  312. email
  313. telephone
  314. username
  315. openid
  316. id
  317. }
  318. area
  319. province
  320. }
  321. }
  322. `
  323. const user_default_address = `
  324. query user_default_address($user_id: ID, $default: Int) {
  325. defaultAddress: userAddress_by_props(user_id: $user_id default: $default) {
  326. id
  327. default
  328. username
  329. telephone
  330. province
  331. area
  332. city
  333. address
  334. user_id {
  335. openid
  336. id
  337. }
  338. }
  339. }
  340. `
  341. const delete_address = `
  342. mutation deleteuserAddress($id: ID) {
  343. deleteuserAddress: delete_userAddress(id: $id)
  344. }
  345. `
  346. const orderbyprops = `
  347. query orderbyprops($updatedAt: String, $orderLogistics_id: ID, $orderTotalPay: Float, $createdAt: String, $orderStatus: String, $userAddress_id: ID, $count: Int, $user_id: ID, $productTotalPay: Float, $orderPay_id: ID) {
  348. orderbyprops: order_by_props(updatedAt: $updatedAt orderLogistics_id: $orderLogistics_id orderTotalPay: $orderTotalPay createdAt: $createdAt orderStatus: $orderStatus userAddress_id: $userAddress_id count: $count user_id: $user_id productTotalPay: $productTotalPay orderPay_id: $orderPay_id) {
  349. updatedAt
  350. orderLogistics_id {
  351. deliveryTime
  352. serviceStore
  353. updatedAt
  354. logisticsFee
  355. expressId
  356. createdAt
  357. consigneeTel
  358. id
  359. expressName
  360. consignAddress
  361. LogisticsStatus
  362. consigneeName
  363. }
  364. orderTotalPay
  365. createdAt
  366. orderStatus
  367. userAddress_id {
  368. address
  369. updatedAt
  370. telephone
  371. default
  372. city
  373. username
  374. postcode
  375. createdAt
  376. deletedAt
  377. id
  378. area
  379. province
  380. }
  381. id
  382. count
  383. productTotalPay
  384. orderPay_id {
  385. updatedAt
  386. tradeNo
  387. transactionId
  388. time
  389. createdAt
  390. openid
  391. id
  392. totalFee
  393. cashFee
  394. }
  395. }
  396. }
  397. `
  398. const order_by_id = `
  399. query orderbyid($id: ID) {
  400. orderbyid: order_by_id(id: $id) {
  401. remark
  402. updatedAt
  403. orderLogistics_id {
  404. deliveryTime
  405. serviceStore
  406. updatedAt
  407. logisticsFee
  408. expressId
  409. createdAt
  410. consigneeTel
  411. id
  412. expressName
  413. consignAddress
  414. LogisticsStatus
  415. consigneeName
  416. }
  417. orderTotalPay
  418. createdAt
  419. orderStatus
  420. userAddress_id {
  421. address
  422. updatedAt
  423. telephone
  424. default
  425. city
  426. username
  427. postcode
  428. createdAt
  429. deletedAt
  430. id
  431. area
  432. province
  433. }
  434. id
  435. count
  436. user_id {
  437. email
  438. updatedAt
  439. password
  440. telephone
  441. username
  442. createdAt
  443. openid
  444. id
  445. }
  446. productTotalPay
  447. orderPay_id {
  448. updatedAt
  449. tradeNo
  450. transactionId
  451. time
  452. createdAt
  453. openid
  454. id
  455. totalFee
  456. cashFee
  457. }
  458. }
  459. }
  460. `
  461. const update_order = `
  462. mutation updateorder($id: ID, $updatedAt: String, $orderStatus: String, $orderPay_id: ID) {
  463. updateorder: update_order(id: $id updatedAt: $updatedAt orderStatus: $orderStatus count: $count orderPay_id: $orderPay_id) {
  464. result
  465. order {
  466. remark
  467. updatedAt
  468. orderTotalPay
  469. createdAt
  470. orderStatus
  471. id
  472. count
  473. productTotalPay
  474. }
  475. }
  476. }
  477. `
  478. const orderProduct_by_props = `
  479. query orderProductbyprops($order_id: ID) {
  480. orderProductbyprops: orderProduct_by_props(order_id: $order_id) {
  481. updatedAt
  482. productColor
  483. unit
  484. product_id {
  485. updatedAt
  486. unit
  487. name
  488. createdAt
  489. status
  490. id
  491. intro
  492. price
  493. img
  494. stock
  495. discountRate
  496. }
  497. productSize
  498. orderPay
  499. createdAt
  500. productImg
  501. productName
  502. productPrice
  503. id
  504. count
  505. productPay
  506. }
  507. }
  508. `
  509. const create_order = `
  510. mutation createorder($remark: String, $updatedAt: String, $orderLogistics_id: ID, $orderTotalPay: Float, $createdAt: String, $orderStatus: String, $userAddress_id: ID, $id: ID!, $count: Int, $user_id: ID, $productTotalPay: Float, $orderPay_id: ID,
  511. $deliveryTime: String, $serviceStore: String, $logisticsFee: Float, $expressId: String, $order_id: ID, $consigneeTel: String, $orderLogisticsId: ID!, $expressName: String, $consignAddress: String, $LogisticsStatus: String, $consigneeName: String
  512. $deleteId: [String]) {
  513. createorder: create_order(remark: $remark updatedAt: $updatedAt orderLogistics_id: $orderLogistics_id orderTotalPay: $orderTotalPay createdAt: $createdAt orderStatus: $orderStatus userAddress_id: $userAddress_id id: $id count: $count user_id: $user_id productTotalPay: $productTotalPay orderPay_id: $orderPay_id) {
  514. result
  515. order {
  516. remark
  517. updatedAt
  518. orderLogistics_id {
  519. deliveryTime
  520. serviceStore
  521. updatedAt
  522. logisticsFee
  523. expressId
  524. createdAt
  525. consigneeTel
  526. id
  527. expressName
  528. consignAddress
  529. LogisticsStatus
  530. consigneeName
  531. }
  532. orderTotalPay
  533. createdAt
  534. orderStatus
  535. userAddress_id {
  536. address
  537. updatedAt
  538. telephone
  539. default
  540. city
  541. username
  542. postcode
  543. createdAt
  544. deletedAt
  545. id
  546. area
  547. province
  548. }
  549. id
  550. count
  551. productTotalPay
  552. orderPay_id {
  553. updatedAt
  554. tradeNo
  555. transactionId
  556. time
  557. createdAt
  558. openid
  559. id
  560. totalFee
  561. cashFee
  562. }
  563. }
  564. }
  565. createorderLogistics: create_orderLogistics(deliveryTime: $deliveryTime serviceStore: $serviceStore updatedAt: $updatedAt logisticsFee: $logisticsFee expressId: $expressId createdAt: $createdAt order_id: $order_id consigneeTel: $consigneeTel id: $orderLogisticsId expressName: $expressName consignAddress: $consignAddress LogisticsStatus: $LogisticsStatus user_id: $user_id consigneeName: $consigneeName) {
  566. result
  567. orderLogistics {
  568. deliveryTime
  569. serviceStore
  570. updatedAt
  571. logisticsFee
  572. expressId
  573. createdAt
  574. order_id {
  575. remark
  576. updatedAt
  577. orderTotalPay
  578. createdAt
  579. orderStatus
  580. id
  581. count
  582. productTotalPay
  583. }
  584. consigneeTel
  585. id
  586. expressName
  587. consignAddress
  588. LogisticsStatus
  589. user_id {
  590. email
  591. updatedAt
  592. password
  593. telephone
  594. username
  595. createdAt
  596. openid
  597. id
  598. }
  599. consigneeName
  600. }
  601. }
  602. delete_userCart(where: {
  603. id: {
  604. _in: $deleteId
  605. }
  606. })
  607. }
  608. `
  609. const create_order_product = `
  610. mutation createorderProduct($updatedAt: String, $productColor: String, $unit: String, $product_id: ID, $productSize: String, $orderPay: Float, $createdAt: String, $productImg: String, $productName: String, $specificationStock_id: ID, $order_id: ID, $productPrice: Float, $id: ID!, $count: Int, $productPay: Float, $user_id: ID, $orderPay_id: ID) {
  611. createorderProduct: create_orderProduct(updatedAt: $updatedAt productColor: $productColor unit: $unit product_id: $product_id productSize: $productSize orderPay: $orderPay createdAt: $createdAt productImg: $productImg productName: $productName specificationStock_id: $specificationStock_id order_id: $order_id productPrice: $productPrice id: $id count: $count productPay: $productPay user_id: $user_id orderPay_id: $orderPay_id) {
  612. result
  613. orderProduct {
  614. updatedAt
  615. productColor
  616. unit
  617. productSize
  618. orderPay
  619. createdAt
  620. productImg
  621. productName
  622. productPrice
  623. id
  624. count
  625. productPay
  626. }
  627. }
  628. }
  629. `
  630. const shop_by_props = `
  631. query shopbyprops($limit: Int) {
  632. shopbyprops: shop_by_props(limit: $limit) {
  633. description
  634. address
  635. updatedAt
  636. telephone
  637. name
  638. createdAt
  639. status
  640. id
  641. slideshow
  642. notice
  643. intro
  644. img
  645. }
  646. }
  647. `
  648. const update_shop = `
  649. mutation updateshop($description: String, $address: String, $updatedAt: String, $where: shop_filter, $telephone: String, $name: String, $createdAt: String, $status: String, $id: ID, $slideshow: String, $notice: String, $intro: String, $img: String) {
  650. updateshop: update_shop(id: $id description: $description address: $address updatedAt: $updatedAt where: $where telephone: $telephone name: $name createdAt: $createdAt status: $status slideshow: $slideshow notice: $notice intro: $intro img: $img) {
  651. result
  652. shop {
  653. description
  654. address
  655. updatedAt
  656. telephone
  657. name
  658. createdAt
  659. status
  660. id
  661. slideshow
  662. notice
  663. intro
  664. img
  665. }
  666. }
  667. }
  668. `
  669. const create_shop = `
  670. mutation createshop($description: String, $address: String, $updatedAt: String, $telephone: String, $name: String, $createdAt: String, $status: String, $id: ID!, $slideshow: String, $notice: String, $intro: String, $img: String) {
  671. createshop: create_shop(description: $description address: $address updatedAt: $updatedAt telephone: $telephone name: $name createdAt: $createdAt status: $status id: $id slideshow: $slideshow notice: $notice intro: $intro img: $img) {
  672. result
  673. shop {
  674. description
  675. address
  676. updatedAt
  677. telephone
  678. name
  679. createdAt
  680. status
  681. id
  682. slideshow
  683. notice
  684. intro
  685. img
  686. }
  687. }
  688. }
  689. `
  690. const create_product = `
  691. mutation createproduct($recommend: Int, $updatedAt: String, $unit: String, $name: String, $createdAt: String, $status: String, $id: ID!, $intro: String, $discountRate: Float, $price: Float, $category_id: ID, $img: String, $stock: Int) {
  692. createproduct: create_product(recommend: $recommend updatedAt: $updatedAt unit: $unit name: $name createdAt: $createdAt status: $status id: $id intro: $intro discountRate: $discountRate price: $price category_id: $category_id img: $img stock: $stock) {
  693. result
  694. product {
  695. recommend
  696. updatedAt
  697. unit
  698. name
  699. createdAt
  700. status
  701. id
  702. intro
  703. discountRate
  704. price
  705. img
  706. stock
  707. }
  708. }
  709. }
  710. `
  711. const update_product = `
  712. mutation updateproduct($id: ID, $recommend: Int, $updatedAt: String, $where: product_filter, $unit: String, $name: String, $createdAt: String, $status: String, $intro: String, $discountRate: Float, $price: Float, $category_id: ID, $img: String, $stock: Int) {
  713. updateproduct: update_product(id: $id recommend: $recommend updatedAt: $updatedAt where: $where unit: $unit name: $name createdAt: $createdAt status: $status intro: $intro discountRate: $discountRate price: $price category_id: $category_id img: $img stock: $stock) {
  714. result
  715. product {
  716. recommend
  717. updatedAt
  718. unit
  719. name
  720. createdAt
  721. status
  722. id
  723. intro
  724. discountRate
  725. price
  726. img
  727. stock
  728. }
  729. }
  730. }
  731. `
  732. const delete_product_by_id = `
  733. mutation deleteproduct($id: ID) {
  734. deleteproduct: delete_product(id: $id)
  735. }
  736. `
  737. export {
  738. create_user,
  739. find_user_by_openid,
  740. category_by_props,
  741. update_category,
  742. delete_category,
  743. create_category,
  744. productbyprops,
  745. productAndSpec_by_id,
  746. create_userCart,
  747. cart_by_userid,
  748. update_userCart,
  749. delete_userCart_by_id,
  750. create_update_userAddress,
  751. update_userAddress,
  752. userAddressbyprops,
  753. user_default_address,
  754. delete_address,
  755. orderbyprops,
  756. order_by_id,
  757. update_order,
  758. orderProduct_by_props,
  759. create_order,
  760. create_order_product,
  761. shop_by_props,
  762. create_shop,
  763. update_shop,
  764. create_product,
  765. update_product,
  766. delete_product_by_id
  767. }