查询逻辑更改
Some checks failed
JslGroup/JslDeveloper/JSL_OrganizeInternalOA/pipeline/head There was a failure building this commit
Some checks failed
JslGroup/JslDeveloper/JSL_OrganizeInternalOA/pipeline/head There was a failure building this commit
This commit is contained in:
parent
fb9820be31
commit
5075426bcf
|
@ -128,12 +128,16 @@ public class ProjectDAO {
|
|||
public List<ProjectDO> get(Long userId,Integer listAll,List<String> tags,List<Integer> isFinish) {
|
||||
log.info("\t> 执行 DAO 层 ProjectDAO.get 方法");
|
||||
log.info("\t\t> 从 MySQL 获取数据");
|
||||
if(tags != null && !tags.isEmpty()){
|
||||
log.info("tags");
|
||||
return projectMapper.getByTags(userId,tags,isFinish);
|
||||
}
|
||||
|
||||
if(isFinish != null && !isFinish.isEmpty()){
|
||||
log.info("finish");
|
||||
return projectMapper.getByIsfinish(userId,isFinish);
|
||||
}
|
||||
if(tags != null && !tags.isEmpty()){
|
||||
return projectMapper.getByTags(userId,tags);
|
||||
}
|
||||
|
||||
if(listAll == 0) {
|
||||
return projectMapper.get(userId);
|
||||
}else {
|
||||
|
@ -144,12 +148,14 @@ public class ProjectDAO {
|
|||
public List<ProjectDO> workget(Long userId, Integer listAll, List<String> tags, List<Integer> isFinish, Integer is) {
|
||||
log.info("\t> 执行 DAO 层 ProjectDAO.workget 方法");
|
||||
log.info("\t\t> 从 MySQL 获取数据");
|
||||
if(tags != null && !tags.isEmpty()){
|
||||
return projectMapper.workgetByTags(userId,tags,is,isFinish);
|
||||
}
|
||||
|
||||
if(isFinish != null && !isFinish.isEmpty()){
|
||||
return projectMapper.workgetByIsfinish(userId,isFinish,is);
|
||||
}
|
||||
if(tags != null && !tags.isEmpty()){
|
||||
return projectMapper.workgetByTags(userId,tags,is);
|
||||
}
|
||||
|
||||
if(listAll == 0) {
|
||||
return projectMapper.workget(userId,is);
|
||||
}else {
|
||||
|
@ -220,12 +226,14 @@ public class ProjectDAO {
|
|||
|
||||
public List<ProjectDO> tget(Integer id,List<Integer> isFinish,List<String> tags) {
|
||||
log.info("DAO层");
|
||||
|
||||
if(tags != null && !tags.isEmpty()){
|
||||
return projectMapper.tgetBytags(tags,isFinish);
|
||||
}
|
||||
|
||||
if(isFinish != null && !isFinish.isEmpty()){
|
||||
return projectMapper.tgetByIsfinish(isFinish);
|
||||
}
|
||||
if(tags != null && !tags.isEmpty()){
|
||||
return projectMapper.tgetBytags(tags);
|
||||
}
|
||||
|
||||
return projectMapper.tget(id);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public interface ProjectMapper {
|
|||
//@Select("select * from organize_oa.oa_project where is_finish=#{isFinish} and is_delete=false and principal_id=#{userId}")
|
||||
List<ProjectDO>getByIsfinish(Long userId,List<Integer> isFinish);
|
||||
|
||||
List<ProjectDO>getByTags(Long userId,List<String> tags);
|
||||
List<ProjectDO>getByTags(Long userId,List<String> tags,List<Integer> isFinish);
|
||||
|
||||
@Select("select * from organize_oa.oa_project where is_delete=false and status=1 and principal_id=#{userId}")
|
||||
List<ProjectDO> get(Long userId);
|
||||
|
@ -88,7 +88,7 @@ public interface ProjectMapper {
|
|||
//@Select("select * from organize_oa.oa_project_work where is_finish=#{isFinish} and is_delete=false and principal_id =#{userId}")
|
||||
List<ProjectDO> workgetByIsfinish(Long userId, List<Integer> isFinish, Integer is);
|
||||
|
||||
List<ProjectDO> workgetByTags(Long userId, List<String> tags, Integer is);
|
||||
List<ProjectDO> workgetByTags(Long userId, List<String> tags, Integer is,List<Integer> isFinish);
|
||||
|
||||
//@Select("select * from organize_oa.oa_project where id in(select project_id from " +
|
||||
//"organize_oa.oa_project_work where is_delete=false and status =1 and principal_id=#{userId} and type=0)")
|
||||
|
@ -102,5 +102,5 @@ public interface ProjectMapper {
|
|||
|
||||
List<ProjectDO> tgetByIsfinish(List<Integer> isFinish);
|
||||
|
||||
List<ProjectDO> tgetBytags(List<String> tags);
|
||||
List<ProjectDO> tgetBytags(List<String> tags,List<Integer> isFinish);
|
||||
}
|
||||
|
|
|
@ -64,13 +64,14 @@ public class ProjectServiceImpl implements ProjectService {
|
|||
@Override
|
||||
public BaseResponse tget(Integer id, List<String> tags, List<Integer> isFinish) {
|
||||
log.info("\t> 执行 Service 层 ProjectService.tget 方法");
|
||||
//根据状态查询
|
||||
if (isFinish != null && !isFinish.isEmpty()) {
|
||||
//根据标签查询
|
||||
if (tags != null && !tags.isEmpty()) {
|
||||
List<ProjectDO> projectDOList = projectDAO.tget(id,isFinish,tags);
|
||||
return ResultUtil.success(projectDOList);
|
||||
}
|
||||
//根据标签查询
|
||||
if (tags != null && !tags.isEmpty()) {
|
||||
|
||||
//根据状态查询
|
||||
if (isFinish != null && !isFinish.isEmpty()) {
|
||||
List<ProjectDO> projectDOList = projectDAO.tget(id,isFinish,tags);
|
||||
return ResultUtil.success(projectDOList);
|
||||
}
|
||||
|
@ -245,17 +246,19 @@ public class ProjectServiceImpl implements ProjectService {
|
|||
|
||||
//获取用户
|
||||
Long userId = Processing.getAuthHeaderToUserId(request);
|
||||
//根据状态查询
|
||||
if (isFinish != null && !isFinish.isEmpty()) {
|
||||
List<ProjectDO> projectDOList = projectDAO.get(userId, listAll, tags, isFinish);
|
||||
return ResultUtil.success(projectDOList);
|
||||
}
|
||||
//根据标签查询
|
||||
if (tags != null && !tags.isEmpty()) {
|
||||
List<ProjectDO> projectDOList = projectDAO.get(userId, listAll, tags, isFinish);
|
||||
return ResultUtil.success(projectDOList);
|
||||
}
|
||||
|
||||
//根据状态查询
|
||||
if (isFinish != null && !isFinish.isEmpty()) {
|
||||
List<ProjectDO> projectDOList = projectDAO.get(userId, listAll, tags, isFinish);
|
||||
return ResultUtil.success(projectDOList);
|
||||
}
|
||||
|
||||
|
||||
//判断是否是老师(项目负责人)
|
||||
if (listAll != null && Processing.checkUserIsTeacher(request, roleMapper)) {
|
||||
List<ProjectDO> projectDOList = projectDAO.get(userId, listAll, tags, isFinish);
|
||||
|
@ -274,17 +277,20 @@ public class ProjectServiceImpl implements ProjectService {
|
|||
|
||||
//获取用户
|
||||
Long userId = Processing.getAuthHeaderToUserId(request);
|
||||
//根据状态查询
|
||||
if (isFinish != null && !isFinish.isEmpty()) {
|
||||
List<ProjectDO> projectDOList = projectDAO.workget(userId, listAll, tags, isFinish,is);
|
||||
return ResultUtil.success(projectDOList);
|
||||
}
|
||||
|
||||
//根据标签查询
|
||||
if (tags != null && !tags.isEmpty()) {
|
||||
List<ProjectDO> projectDOList = projectDAO.workget(userId, listAll, tags, isFinish,is);
|
||||
return ResultUtil.success(projectDOList);
|
||||
}
|
||||
|
||||
//根据状态查询
|
||||
if (isFinish != null && !isFinish.isEmpty()) {
|
||||
List<ProjectDO> projectDOList = projectDAO.workget(userId, listAll, tags, isFinish,is);
|
||||
return ResultUtil.success(projectDOList);
|
||||
}
|
||||
|
||||
|
||||
//判断是否是老师(项目负责人)
|
||||
if (listAll != null && Processing.checkUserIsTeacher(request, roleMapper)) {
|
||||
List<ProjectDO> projectDOList = projectDAO.workget(userId, listAll, tags, isFinish,is);
|
||||
|
|
|
@ -48,12 +48,22 @@
|
|||
</update>
|
||||
|
||||
<select id="getByTags" resultType="com.jsl.oa.model.doData.ProjectDO">
|
||||
select * from organize_oa.oa_project where is_delete=false and principal_id=#{userId} and status=1 and
|
||||
<foreach collection="tags" item="tag" separator=",'%') or json_extract(tags,'$.tags')like concat('%',"
|
||||
open="json_extract(tags,'$.tags')like concat('%',"
|
||||
close=",'%')">
|
||||
#{tag}
|
||||
</foreach>
|
||||
<if test="tags != null">
|
||||
select * from organize_oa.oa_project where is_delete=false and principal_id=#{userId} and status=1 and
|
||||
|
||||
<if test="isFinish != null and isFinish.size() > 0">
|
||||
is_finish in
|
||||
<foreach collection="isFinish" item="Finish" separator="," open="(" close=") and">
|
||||
#{Finish}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<foreach collection="tags" item="tag" separator=",'%') or json_extract(tags,'$.tags')like concat('%',"
|
||||
open="(json_extract(tags,'$.tags')like concat('%',"
|
||||
close=",'%'))">
|
||||
#{tag}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getByIsfinish" resultType="com.jsl.oa.model.doData.ProjectDO">
|
||||
|
@ -71,8 +81,14 @@
|
|||
(principal_id = #{userId} and is_delete=false) or
|
||||
</if>
|
||||
id in(select project_id from organize_oa.oa_project_work
|
||||
where is_delete=false and (principal_id=#{userId} ) and project_id in(
|
||||
select id from organize_oa.oa_project where
|
||||
where is_delete=false and (principal_id=#{userId} ) and
|
||||
<if test="isFinish != null and isFinish.size() > 0">
|
||||
is_finish in
|
||||
<foreach collection="isFinish" item="Finish" separator="," open="(" close=") and">
|
||||
#{Finish}
|
||||
</foreach>
|
||||
</if>
|
||||
project_id in(select id from organize_oa.oa_project where
|
||||
<foreach collection="tags" item="tag" separator=",'%') or json_extract(tags,'$.tags')like concat('%',"
|
||||
open="json_extract(tags,'$.tags')like concat('%',"
|
||||
close=",'%')))">
|
||||
|
@ -115,9 +131,16 @@
|
|||
|
||||
<select id="tgetBytags" resultType="com.jsl.oa.model.doData.ProjectDO">
|
||||
select * from organize_oa.oa_project where is_delete=false and status=1 and
|
||||
<if test="isFinish != null and isFinish.size() > 0">
|
||||
is_finish in
|
||||
<foreach collection="isFinish" item="Finish" separator="," open="(" close=") and">
|
||||
#{Finish}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<foreach collection="tags" item="tag" separator=",'%') or json_extract(tags,'$.tags')like concat('%',"
|
||||
open="json_extract(tags,'$.tags')like concat('%',"
|
||||
close=",'%')">
|
||||
open="(json_extract(tags,'$.tags')like concat('%',"
|
||||
close=",'%'))">
|
||||
#{tag}
|
||||
</foreach>
|
||||
</select>
|
||||
|
|
Loading…
Reference in New Issue
Block a user