use of com.itrus.portal.db.ProjectExample in project portal by ixinportal.
the class AdminController method list.
// 列表所有信息
@RequestMapping(produces = "text/html")
public String list(@Valid Admin admin, @RequestParam(value = "project", required = false) Long project, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
uiModel.addAttribute("project", project);
uiModel.addAttribute("adminRole", admin.getAdminRole());
uiModel.addAttribute("status", admin.getStatus());
uiModel.addAttribute("account", admin.getAccount());
uiModel.addAttribute("name", admin.getName());
// page,size
if (page == null || page < 1)
page = 1;
if (size == null || size < 1)
size = 10;
AdminExample adminex = new AdminExample();
AdminExample.Criteria criteria = adminex.or();
if (project != null && project > 0)
criteria.andProjectEqualTo(project);
if (admin.getAdminRole() != null && admin.getAdminRole() > 0) {
criteria.andAdminRoleEqualTo(admin.getAdminRole());
}
if (admin.getStatus() != null && admin.getStatus().length() > 0)
criteria.andStatusEqualTo(admin.getStatus());
if (admin.getAccount() != null && admin.getAccount().length() > 0)
criteria.andAccountLike("%" + admin.getAccount() + "%");
if (admin.getName() != null && admin.getName().length() > 0)
criteria.andNameLike("%" + admin.getName() + "%");
// count,pages
Integer count = sqlSession.selectOne("com.itrus.portal.db.AdminMapper.countByExample", adminex);
uiModel.addAttribute("count", count);
uiModel.addAttribute("pages", (count + size - 1) / size);
// page, size
if (page > 1 && size * (page - 1) >= count) {
page = (count + size - 1) / size;
}
uiModel.addAttribute("page", page);
uiModel.addAttribute("size", size);
// query data
Integer offset = size * (page - 1);
adminex.setOffset(offset);
adminex.setLimit(size);
List<Admin> adminall = sqlSession.selectList("com.itrus.portal.db.AdminMapper.selectByExample", adminex);
List<Admin> adminList = new ArrayList<Admin>();
boolean flag = false;
for (Admin admini : adminall) {
if (admini.getProjects().contains(",")) {
String[] strs = admini.getProjects().split(",");
for (String s : strs) {
if (s.equals("0")) {
// 包含所有项目
flag = true;
break;
} else {
flag = false;
}
}
}
String projectName = getProjectNameByAdminId(admini.getId());
admini.setProjects(projectName);
if (flag)
admini.setProjects("所有项目");
adminList.add(admini);
flag = false;
}
uiModel.addAttribute("admins", adminList);
// itemcount
uiModel.addAttribute("itemcount", adminall.size());
Map<Long, Admin> adminmap = sqlSession.selectMap("com.itrus.portal.db.AdminMapper.selectByExample", adminex, "id");
for (Long adminid : adminmap.keySet()) adminmap.get(adminid).setPassword(null);
uiModel.addAttribute("adminmap", adminmap);
ProjectExample projectex = new ProjectExample();
Map projectmap = sqlSession.selectMap("com.itrus.portal.db.ProjectMapper.selectByExample", projectex, "id");
uiModel.addAttribute("projectmap", projectmap);
List projects = sqlSession.selectList("com.itrus.portal.db.ProjectMapper.selectByExample", projectex);
uiModel.addAttribute("projects", projects);
Map adminroles = sqlSession.selectMap("com.itrus.portal.db.AdminRoleMapper.selectByExample", "id");
uiModel.addAttribute("adminroles", adminroles);
return "admins/list";
}
use of com.itrus.portal.db.ProjectExample in project portal by ixinportal.
the class AdminController method createForm.
// 返回新建页面
@RequestMapping(params = "form", produces = "text/html")
public String createForm(@RequestParam(value = "project", required = false) Long project, HttpServletRequest request, Model uiModel) {
uiModel.addAttribute("project", project);
ProjectExample projectex = new ProjectExample();
List projects = sqlSession.selectList("com.itrus.portal.db.ProjectMapper.selectByExample", projectex);
List adminroles = sqlSession.selectList("com.itrus.portal.db.AdminRoleMapper.selectByExample");
uiModel.addAttribute("adminroles", adminroles);
uiModel.addAttribute("projects", projects);
return "admins/create";
}
use of com.itrus.portal.db.ProjectExample in project portal by ixinportal.
the class ExtraBillServiceImpl method getProjectMapByEnterpriseId.
/**
* 根据企业id查询增值订单表中对应的projectMap
*
* @param enterprise
* @return
*/
public Map<Long, Project> getProjectMapByEnterpriseId(Long enterprise) {
Map<Long, Project> projectMap = new HashMap<Long, Project>();
List<Long> projectIds = sqlSession.selectList("com.itrus.portal.db.ExtraBillMapper.selectProjectsByEnterprise", enterprise);
if (null != projectIds && !projectIds.isEmpty()) {
ProjectExample projectExample = new ProjectExample();
ProjectExample.Criteria criteria = projectExample.or();
criteria.andIdIn(projectIds);
projectMap = sqlSession.selectMap("com.itrus.portal.db.ProjectMapper.selectByExample", projectExample, "id");
}
return projectMap;
}
use of com.itrus.portal.db.ProjectExample in project portal by ixinportal.
the class BillServiceImpl method getProjectMapByBills.
/**
* 根据订单list查找出对应的projectMap
*
* @param bills
* @return
*/
public Map<Long, Project> getProjectMapByBills(List<Bill> bills) {
Map<Long, Project> projectMap = new HashMap<Long, Project>();
List<Long> projectIds = new ArrayList<Long>();
for (Bill bill : bills) {
projectIds.add(bill.getProject());
}
if (!projectIds.isEmpty()) {
ProjectExample projectExample = new ProjectExample();
ProjectExample.Criteria criteria = projectExample.or();
criteria.andIdIn(projectIds);
projectMap = sqlSession.selectMap("com.itrus.portal.db.ProjectMapper.selectByExample", projectExample, "id");
}
return projectMap;
}
use of com.itrus.portal.db.ProjectExample in project portal by ixinportal.
the class BillServiceImpl method getProjectMapByUserInfoId.
/**
* 根据用户id查找订单表中对应的projectMap
*
* @param userInfo
* @return
*/
public Map<Long, Project> getProjectMapByUserInfoId(Long userInfo) {
Map<Long, Project> projectMap = new HashMap<Long, Project>();
List<Long> projectIds = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectProjectsByUserInfo", userInfo);
if (null != projectIds && !projectIds.isEmpty()) {
ProjectExample projectExample = new ProjectExample();
ProjectExample.Criteria criteria = projectExample.or();
criteria.andIdIn(projectIds);
projectMap = sqlSession.selectMap("com.itrus.portal.db.ProjectMapper.selectByExample", projectExample, "id");
}
return projectMap;
}
Aggregations