无关风月
2024-08-07 b43a5e690e89b57482a70352561478e363112ed7
ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCarController.java
@@ -602,29 +602,26 @@
    }
    @RequestMapping(value = "/updateAuth")
    @ResponseBody
    public Object updateAuth(TCar tCar,String zcModel,@RequestParam String serverBox) {
    public Object updateAuth(TCar tCar,String zcModel,String xjModel,@RequestParam String serverBox) {
        //添加经营业务
        if(tCar.getAuthState()==2){
            //删除业务
            tCarServiceService.delete(new EntityWrapper<TCarService>().eq("carId",tCar.getId()));
            //添加经营业务
            String[] serverArray = serverBox.split(",");
            for (int i=0;i<serverArray.length;i++){
                TCarService tCarService = tCarServiceService.selectOne(new EntityWrapper<TCarService>().eq("carId", tCar.getId()).eq("type", Integer.valueOf(serverArray[i])));
                if(null == tCarService){
                    tCarService = new TCarService();
                    tCarService.setCarId(tCar.getId());
                    tCarService.setType(Integer.valueOf(serverArray[i]));
                    if (1 == tCarService.getType()){
                        tCarService.setServerCarModelId(Integer.valueOf(zcModel));
                    }
                    tCarServiceService.insert(tCarService);
                }else{
                    if (1 == tCarService.getType()){
                        tCarService.setServerCarModelId(Integer.valueOf(zcModel));
                    }
                    tCarServiceService.updateById(tCarService);
                TCarService service = new TCarService();
                service.setCarId(tCar.getId());
                service.setType(Integer.valueOf(serverArray[i]));
                if (1 == service.getType()){
                    service.setServerCarModelId(Integer.valueOf(zcModel));
                }else if (4 == service.getType()){
                    service.setServerCarModelId(Integer.valueOf(xjModel));
                }
                tCarServiceService.insert(service);
            }
        }
        tCarService.updateById(tCar);
        tCar = tCarService.selectById(tCar.getId());