/** * @Title: delGoodsList @Description: TODO(删除货物档案信息) * * @param @param gradeIds * @param @return 设定文件 * @return Object 返回类型 * @throws */ @Transactional(readOnly = false) @MethodLog(opera = "GoodsList_del") public Object delGoodsList(List<String> goodsId) { JqReturnJson returnResult = new JqReturnJson(); // 构建返回结果,默认结果为false int count = 0; if (goodsId.size() > 0) { GoodsListExample goodsListExample = new GoodsListExample(); goodsListExample.createCriteria().andGoodsIdIn(goodsId); count = goodsListMapper.deleteByExample(goodsListExample); if (count > 0) { returnResult.setSuccess(true); returnResult.setMsg("成功删除了【 " + count + " 】条货物档案信息"); } else { returnResult.setMsg("发生未知错误,货物档案信息删除失败"); } } return returnResult; }
/** * @Title: listAsGrid @Description: TODO(获取所有货物档案信息) * * @param @param pager * @param @return 设定文件 * @return Object 返回类型 * @throws */ public Object listAsGrid(JqPager jqPager, GoodsListQueryDTO goodsListQueryDTO) { JqGridReturn returnResult = new JqGridReturn(); GoodsListExample goodsListExample = new GoodsListExample(); Criteria queryCriteria = goodsListExample.createCriteria(); goodsListQueryDTO.setQueryCondition(queryCriteria); if (null != jqPager.getPage() && null != jqPager.getRows()) { // 设置排序信息 goodsListExample.setLimitStart((jqPager.getPage() - 1) * jqPager.getRows()); goodsListExample.setLimitEnd(jqPager.getRows()); } if (StringUtils.isNotBlank(jqPager.getSort()) && StringUtils.isNotBlank(jqPager.getOrder())) { // 设置排序信息 goodsListExample.setOrderByClause(jqPager.getOrderBy("temp_goods_list_")); } List<GoodsList> goodsList = goodsListMapper.selectByExample(goodsListExample); // 查询所有会员列表 int total = goodsListMapper.countByExample(goodsListExample); // 查询总页数 returnResult.setRows(goodsList); returnResult.setTotal(total); return returnResult; // 返回ExtGrid表 }
/** * @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; }
/** * @Title: listPartGoodsList @Description: TODO(获取仓库下的所有货物档案信息) * * @param @param pager * @param @return 设定文件 * @return Object 返回类型 * @throws */ public Object listPartGoodsList(String warehouseTypeId) { GoodsListExample goodsListExample = new GoodsListExample(); goodsListExample.createCriteria().andWarehouseTypeIdEqualTo(warehouseTypeId); List<GoodsList> list = goodsListMapper.selectByExample(goodsListExample); return JackJson.fromObjectToJson(list); }