| | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.exception.JeecgBootException; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.system.entity.BaseFactory; |
| | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param BaseFactory |
| | | * @param baseFactory |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "设备车间管理-添加") |
| | | @ApiOperation(value = "设备车间管理-添加", notes = "设备车间管理-添加") |
| | | @PostMapping(value = "/add") |
| | | public Result<BaseFactory> add(@RequestBody BaseFactory BaseFactory) { |
| | | public Result<?> add(@RequestBody BaseFactory baseFactory) { |
| | | Result<BaseFactory> result = new Result<>(); |
| | | try { |
| | | BaseFactoryService.saveBaseFactoryData(BaseFactory); |
| | | QueryWrapper<BaseFactory> baseFactoryQueryWrapper = new QueryWrapper<>(); |
| | | baseFactoryQueryWrapper.eq(StrUtil.isNotEmpty(baseFactory.getFactoryCode()), "factory_code", baseFactory.getFactoryCode()); |
| | | baseFactoryQueryWrapper.eq("del_flag", CommonConstant.DEL_FLAG_0.toString()); |
| | | if (BaseFactoryService.getOne(baseFactoryQueryWrapper) != null) { |
| | | return Result.error("机构编码已存在"); |
| | | } |
| | | BaseFactoryService.saveBaseFactoryData(baseFactory); |
| | | result.success("添加成功!"); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |