InputuseService.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace app\service;
  3. use app\model\InputUse;
  4. use think\facade\Db;
  5. class InputuseService
  6. {
  7. public static function getInputUseList($page,$qydm){
  8. $res["row"] =(new InputUse)
  9. ->where("t_input_use.qydm",$qydm)
  10. ->field('t_input_use.*,t_enterprises.enterprises_name, t_product_batch.batch_id,t_product.product_name')
  11. ->page($page["page"],$page["size"])
  12. ->leftJoin("t_enterprises","t_enterprises.qydm=t_input_use.qydm")
  13. ->leftJoin("t_product_batch","t_product_batch.batch_id=t_input_use.sydx")
  14. ->leftJoin("t_product","t_product_batch.product_id=t_product.id")
  15. ->select();
  16. $res["count"]= (new InputUse)->where($qydm=="qydm")->count();
  17. return $res;
  18. }
  19. public static function getInputUseById($id){
  20. return Db::name("input_use")
  21. ->where("t_input_use.qydm",getQydm())
  22. ->where("t_input_use.id",$id)
  23. ->field('t_input_use.*,t_enterprises.enterprises_name, t_product_batch.batch_id,t_product.product_name')
  24. ->leftJoin("t_enterprises","t_enterprises.qydm=t_input_use.qydm")
  25. ->leftJoin("t_product_batch","t_product_batch.batch_id=t_input_use.sydx")
  26. ->leftJoin("t_product","t_product_batch.product_id=t_product.id")
  27. ->select();
  28. }
  29. public static function addInputUse($info){
  30. return (new InputUse)->save($info);
  31. }
  32. public static function editInputUse($info,$id){
  33. return InputUse::update($info,["id"=>$id]);
  34. }
  35. public static function delInputUse($id){
  36. return InputUse::destroy($id);
  37. }
  38. }