package com.hssx.cloudmodel.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.hssx.cloudmodel.entity.Mould; import com.hssx.cloudmodel.entity.User; import com.hssx.cloudmodel.service.MouldService; import com.hssx.cloudmodel.service.UserService; import com.hssx.cloudmodel.util.HttpRespMsg; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; /** * @author 吴涛涛 * @since 2019-07-30 */ @Controller @RequestMapping("/mould") public class MouldController { @Autowired private MouldService mouldService; @Autowired private UserService userService; /** * 添加/修改模具设备 * 添加参数:equipmentId 设备id, modelNo 模具编号 * 修改参数:id 模具id, modelName 模具名称,settingLife 使用年限, initialModulus 初始模次 equipmentId 设备id, * produceCompanyId 生产方公司id,ocCycle 每模平均周期,rfid rfid码,area 工厂地址,factoryId 工厂id,factoryName 工厂名称 * belongCompanyId 所属公司id ,equipmentName 设备名称 * @return */ @ApiOperation("添加/修改模具") @RequestMapping("/addOrUpdate") @ResponseBody public HttpRespMsg addOrUpdate(Mould mould, String token) { HttpRespMsg msg = new HttpRespMsg(); QueryWrapper qw = new QueryWrapper<>(); qw.eq("head_imgurl",token); User user = userService.getOne(qw); msg = mouldService.addAndUpdateMould(mould,user); return msg; } }