科大接口分开

master
jiakun.lin 4 years ago
parent 7d251fcfb3
commit a8212f1a66
  1. 40
      src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java
  2. 13
      src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java
  3. 42
      src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java

@ -202,6 +202,46 @@ public class ProjectManagementController {
}
/**
* 页面查询,排除练习 --- 科大分开接口
* <p>
*
* @param systemId
* @return
*/
@ApiOperation(value = "项目列表(排除练习)--科大分开接口", notes = "项目列表(用于创建实验,排除练习项目)")
@GetMapping("/KDqueryManagements")
Response KDqueryManagements(
@ApiParam(name = "systemId", value = "系统id", required = true) @RequestParam(required = false) Integer systemId,
@ApiParam(name = "userId", value = "用户id", required = true) @RequestParam(required = false) Integer userId,
@ApiParam(name = "pageNo", value = "第几页,页码", required = true) @RequestParam Integer pageNo,
@ApiParam(name = "pageSize", value = "每页展示的数据条数", required = true) @RequestParam Integer pageSize,
@ApiParam(name = "projectName", value = "项目名称", required = false) @RequestParam(required = false) String projectName) {
Response resp = new Response();
ProjectManagement vo = new ProjectManagement();
if (null != systemId) {
vo.setSystemId(systemId);
}
if (null != userId) {
vo.setUserId(userId);
}
if (org.apache.commons.lang3.StringUtils.equals("", projectName)) {
projectName = null;
}
HashMap<String, Object> ret = service.KDqueryManagements(vo, pageNo, pageSize);
int status = (int) ret.get("retcode");
if (status == 200) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
return resp;
}
/**
* 批量删除
*

@ -66,6 +66,7 @@ public interface ProjectManagementMapper {
// "</script>"})
// List<ProjectManagement> queryManagements(ProjectManagement management);
//科大分开接口
@Select({"<script>",
"select * from hr_project_management where enable = 0",//(roleId NOT LIKE '%3%' AND isdel = 0 AND projectPermissions != 0)",
"<if test='userId==null'>AND founder != 14 AND isdel = 0 AND projectPermissions != 0</if>",
@ -75,6 +76,18 @@ public interface ProjectManagementMapper {
" <if test='queryName!=null'> and projectName LIKE '%' #{queryName} '%'</if>",
" ORDER BY creationTime desc",
"</script>"})
List<ProjectManagement> KDqueryManagementsExportTest(ProjectManagement management);
@Select({"<script>",
"select * from hr_project_management where enable = 0",//(roleId NOT LIKE '%3%' AND isdel = 0 AND projectPermissions != 0)",
"<if test='userId==null'>AND roleId NOT LIKE '%3%' AND isdel = 0 AND projectPermissions != 0</if>",
" <if test='userId!=null'>AND ((roleId NOT LIKE '%3%' AND isdel = 0 AND projectPermissions != 0) OR ( isdel = 0 AND projectPermissions != 0 AND userId = #{userId} ))</if>",//教师端,一开始进入项目管理,看见自己创建的和其他人看见的
" <if test='systemId!=null'> and systemId=#{systemId}</if>",
" <if test='queryName!=null'> and projectName LIKE '%' #{queryName} '%'</if>",
" ORDER BY creationTime desc",
"</script>"})
List<ProjectManagement> queryManagementsExportTest(ProjectManagement management);

@ -105,6 +105,48 @@ public class ProjectManagementService {
}
return resp;
}
/**
* 条件查询 ---- 科大分开接口
*
* @param vo
* @return
*/
public HashMap<String, Object> KDqueryManagements(ProjectManagement vo, Integer pageNo, Integer pageSize) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
//获取用户的角色信息
String roleId = mapper.queryRoleId(vo.getUserId());
if (null != roleId) {
//角色不对(学生没有权限)
if ("4".equals(roleId)) {
resp.put("retcode", 300);
resp.put("retvalue", "抱歉,您的权限不能访问该地址!");
return resp;
}
//角色等于管理员或者超级管理员
else if ("1".equals(roleId)) {
vo.setUserId(null);
}
}
PageHelper.startPage(pageNo, pageSize);
//条件查询
List<ProjectManagement> list = mapper.KDqueryManagementsExportTest(vo);
PageInfo<ProjectManagement> info = new PageInfo<ProjectManagement>(list);
resp.put("retvalue", new PageResult(info.getTotal(), list));
resp.put("retcode", 200);
} catch (Exception e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Inquiry Failed");
return resp;
}
return resp;
}
/**
* 分页查询+条件查询
*

Loading…
Cancel
Save