123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace app\service;
- use app\model\InputUse;
- use think\facade\Db;
- class InputuseService
- {
- public static function getInputUseList($page,$qydm){
- $res["row"] =(new InputUse)
- ->where("t_input_use.qydm",$qydm)
- ->field('t_input_use.*,t_enterprises.enterprises_name, t_product_batch.batch_id,t_product.product_name')
- ->page($page["page"],$page["size"])
- ->leftJoin("t_enterprises","t_enterprises.qydm=t_input_use.qydm")
- ->leftJoin("t_product_batch","t_product_batch.batch_id=t_input_use.sydx")
- ->leftJoin("t_product","t_product_batch.product_id=t_product.id")
- ->select();
- $res["count"]= (new InputUse)->where($qydm=="qydm")->count();
- return $res;
- }
- public static function getInputUseById($id){
- return Db::name("input_use")
- ->where("t_input_use.qydm",getQydm())
- ->where("t_input_use.id",$id)
- ->field('t_input_use.*,t_enterprises.enterprises_name, t_product_batch.batch_id,t_product.product_name')
- ->leftJoin("t_enterprises","t_enterprises.qydm=t_input_use.qydm")
- ->leftJoin("t_product_batch","t_product_batch.batch_id=t_input_use.sydx")
- ->leftJoin("t_product","t_product_batch.product_id=t_product.id")
- ->select();
- }
- public static function addInputUse($info){
- return (new InputUse)->save($info);
- }
- public static function editInputUse($info,$id){
- return InputUse::update($info,["id"=>$id]);
- }
- public static function delInputUse($id){
- return InputUse::destroy($id);
- }
- }
|