/** * @Title: editParClientLevel @Description: TODO(修改客户等级信息) * * @param @param parClientLevel * @param @return 设定文件 * @return Object 返回类型 * @throws */ @Transactional(readOnly = false) @MethodLog(opera = "ClientLevelList_edit") public Object editParClientLevel(ParClientLevel parClientLevel) { Subject pricipalSubject = SecurityUtils.getSubject(); User pricipalUser = (User) pricipalSubject.getPrincipal(); JqReturnJson returnResult = new JqReturnJson(); // 构建返回结果,默认结果为false ParClientLevelExample parClientLevelExample = new ParClientLevelExample(); int count = 0; // 防止客户等级名称重复 parClientLevelExample .createCriteria() .andClientLevelNameEqualTo(parClientLevel.getClientLevelName()) .andClientLevelIdNotEqualTo(parClientLevel.getClientLevelId()); count = parClientLevelMapper.countByExample(parClientLevelExample); if (count > 0) { returnResult.setMsg("客户等级名称重复"); return returnResult; } // 更新更新人和更新时间 parClientLevel.setUpdater(pricipalUser.getUserCnName()); parClientLevel.setUpdateTime(new Date()); count = parClientLevelMapper.updateByPrimaryKeySelective(parClientLevel); if (count == 1) { returnResult.setSuccess(true); returnResult.setMsg("[" + parClientLevel.getClientLevelName() + "] 客户等级信息已保存"); } else { returnResult.setMsg("发生未知错误,客户等级信息保存失败"); } return returnResult; }
/** * @Title: listAsGrid @Description: TODO(获取所有客户等级信息) * * @param @param jqPager ParClientLevelQueryDTO clientLevelQueryDTO * @param @return 设定文件 * @return Object 返回类型 * @throws */ public Object listAsGrid(JqPager jqPager, ParClientLevelQueryDTO clientLevelQueryDTO) { JqGridReturn returnResult = new JqGridReturn(); ParClientLevelExample parClientLevelExample = new ParClientLevelExample(); Criteria queryCriteria = parClientLevelExample.createCriteria(); clientLevelQueryDTO.setQueryCondition(queryCriteria); if (null != jqPager.getPage() && null != jqPager.getRows()) { // 设置排序信息 parClientLevelExample.setLimitStart((jqPager.getPage() - 1) * jqPager.getRows()); parClientLevelExample.setLimitEnd(jqPager.getRows()); } if (StringUtils.isNotBlank(jqPager.getSort()) && StringUtils.isNotBlank(jqPager.getOrder())) { // 设置排序信息 parClientLevelExample.setOrderByClause(jqPager.getOrderBy("temp_par_client_level_")); } List<ParClientLevel> parClientLevelList = parClientLevelMapper.selectByExample(parClientLevelExample); // 查询所有客户等级列表 int total = parClientLevelMapper.countByExample(parClientLevelExample); // 查询总页数 returnResult.setRows(parClientLevelList); returnResult.setTotal(total); return returnResult; // 返回ExtGrid表 }