/** * @Title: editGoodsList @Description: TODO(修改货物档案信息) * * @param @param suppliersIndustry * @param @return 设定文件 * @return Object 返回类型 * @throws */ @Transactional(readOnly = false) @MethodLog(opera = "GoodsList_edit") public Object editGoodsList(GoodsList goodsList) { Subject pricipalSubject = SecurityUtils.getSubject(); User pricipalUser = (User) pricipalSubject.getPrincipal(); JqReturnJson returnResult = new JqReturnJson(); // 构建返回结果,默认结果为false int count = 0; goodsList.setUpdater(pricipalUser.getUserCnName()); goodsList.setUpdateTime(new Date()); count = goodsListMapper.updateByPrimaryKeySelective(goodsList); if (count == 1) { returnResult.setSuccess(true); returnResult.setMsg("【" + goodsList.getGoodsName() + "】货物档案信息已保存"); } else { returnResult.setMsg("发生未知错误,货物档案信息保存失败"); } return returnResult; }
/** * @Title: addGoodsList @Description: TODO(新增货物档案信息) * * @param @param suppliersGrade * @param @return 设定文件 * @return Object 返回类型 * @throws */ @Transactional(readOnly = false) @MethodLog(opera = "GoodsList_add") public Object addGoodsList(GoodsList goodsList) { Subject pricipalSubject = SecurityUtils.getSubject(); User pricipalUser = (User) pricipalSubject.getPrincipal(); JqReturnJson returnResult = new JqReturnJson(); // 构建返回结果,默认结果为false GoodsListExample goodsListExample = new GoodsListExample(); int count = 0; // 防止货物档案名称重复 goodsListExample.createCriteria().andGoodsNameEqualTo(goodsList.getGoodsName()); count = goodsListMapper.countByExample(goodsListExample); if (count > 0) { returnResult.setMsg("货物档案信息重复,请重新填写!"); returnResult.setSuccess(false); return returnResult; } // 随机号生成 SimpleDateFormat SF = new SimpleDateFormat("yyyy-MM-DD-HHmmss"); goodsList.setGoodsId(RandomGUID.getRandomGUID()); goodsList.setGoodsCode("GD_" + SF.format(new Date())); goodsList.setSpecification("SP_" + SF.format(new Date())); goodsList.setAuditor("超级管理员"); goodsList.setAuditState("pass"); goodsList.setAuditTime(new Date()); goodsList.setEnabled("enable"); goodsList.setGoodsTypeId(goodsList.getGoodsSortId()); goodsList.setCreater(pricipalUser.getUserCnName()); goodsList.setCreateTime(new Date()); goodsList.setUpdater(pricipalUser.getUserCnName()); goodsList.setUpdateTime(new Date()); count = goodsListMapper.insert(goodsList); if (count == 1) { returnResult.setSuccess(true); returnResult.setMsg("【" + goodsList.getGoodsName() + "】 货物档案信息信息已保存"); } else { returnResult.setMsg("发生未知错误,货物档案信息保存失败"); } return returnResult; }