我的订阅-表头排序
This commit is contained in:
+7
-6
@@ -56,15 +56,16 @@
|
||||
</if>
|
||||
<if test="params.orderByField == 'serial_number' or params.orderByField == 'title'">
|
||||
order by CONVERT( ${params.orderByField} USING gbk) COLLATE gbk_chinese_ci
|
||||
<if test="params.orderBy != null and params.orderBy != ''">
|
||||
${params.orderBy}
|
||||
</if>
|
||||
|
||||
</if>
|
||||
<if test="params.orderByField == 'create_time'">
|
||||
order by occ.create_time
|
||||
<if test="params.orderBy != null and params.orderBy != ''">
|
||||
${params.orderBy}
|
||||
</if>
|
||||
</if>
|
||||
<if test="params.orderBy == 1">
|
||||
asc
|
||||
</if>
|
||||
<if test="params.orderBy == 2">
|
||||
desc
|
||||
</if>
|
||||
<if test="params.orderByField == null or params.orderByField == ''">
|
||||
order by occ.create_time desc
|
||||
|
||||
+8
-6
@@ -228,25 +228,27 @@ public class OnlCgformCollectionServiceImpl extends ServiceImpl<OnlCgformCollect
|
||||
|
||||
@Override
|
||||
public IPage<OnlCgformCollection> queryPageList(Map<String, Object> params) {
|
||||
// params.put("orderByField","serial_number");
|
||||
// params.put("orderBy","1");
|
||||
Integer pageNo = Integer.parseInt(params.get("pageNo").toString());
|
||||
Integer pageSize = Integer.parseInt(params.get("pageSize").toString());
|
||||
IPage page = new Page(pageNo, pageSize);
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
params.put("createBy",sysUser.getUsername());
|
||||
IPage result = onlCgformCollectionMapper.queryPageList(page,params);
|
||||
result = stateSort(params,pageNo,pageSize,result);
|
||||
//表头排序(状态单独处理)
|
||||
if(ObjectUtils.isNotEmpty(params.get("orderByField")) && "state".equals((String) params.get("orderByField"))){
|
||||
List<Map<String, Object>> infoList = onlCgformCollectionMapper.infoList(params);
|
||||
result = stateSort(params,pageNo,pageSize,result,infoList);
|
||||
}
|
||||
List<Map<String,Object>> records = result.getRecords();
|
||||
dataDispose(records,params);
|
||||
return result;
|
||||
}
|
||||
private IPage stateSort(Map<String, Object> parameter, int pageNo, int pageSize, IPage infoPage) {
|
||||
// parameter.put("orderByField","state");
|
||||
// parameter.put("orderBy","1");
|
||||
public IPage stateSort(Map<String, Object> parameter, int pageNo, int pageSize, IPage infoPage,List<Map<String, Object>> infoList) {
|
||||
List<Map<String,Object>> list = new LinkedList<>();
|
||||
//状态排序,需要特殊处理 现行,即将实施,草稿,被替代,废止
|
||||
if(ObjectUtils.isNotEmpty(parameter.get("orderByField")) && "state".equals((String) parameter.get("orderByField"))){
|
||||
List<Map<String, Object>> infoList = onlCgformCollectionMapper.infoList(parameter);
|
||||
|
||||
List<Map<String, Object>> active = infoList.stream()
|
||||
.filter(e -> LawsStateEnum.ACTIVE.getValue().equals(e.get("state"))).collect(Collectors.toList());
|
||||
List<Map<String, Object>> theUpcoming = infoList.stream()
|
||||
|
||||
+4
-1
@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.modules.subscribe.entity.OnlCgformSubscribe;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -21,4 +21,7 @@ public interface OnlCgformSubscribeMapper extends BaseMapper<OnlCgformSubscribe>
|
||||
List<OnlCgformSubscribe> queryListByDocumentId(@Param("document_id") String document_id);
|
||||
|
||||
IPage queryPageList(IPage page, @Param("params") Map<String,Object> params);
|
||||
|
||||
List<Map<String,Object>> infoList(@Param("params") Map<String,Object> params);
|
||||
|
||||
}
|
||||
|
||||
+62
-2
@@ -48,7 +48,67 @@
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
|
||||
<if test="params.state != null and params.state != '' ">
|
||||
and bdl.state in
|
||||
<foreach collection="params.state.split(',')" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="params.orderByField == 'serial_number' or params.orderByField == 'title'">
|
||||
order by CONVERT( ${params.orderByField} USING gbk) COLLATE gbk_chinese_ci
|
||||
</if>
|
||||
<if test="params.orderByField == 'create_time'">
|
||||
order by ocs.create_time
|
||||
</if>
|
||||
<if test="params.orderBy == 1">
|
||||
asc
|
||||
</if>
|
||||
<if test="params.orderBy == 2">
|
||||
desc
|
||||
</if>
|
||||
<if test="params.orderByField == null or params.orderByField == ''">
|
||||
order by ocs.create_time desc
|
||||
</if>
|
||||
</select>
|
||||
<select id="infoList" parameterType="java.util.Map" resultType="hashmap">
|
||||
select
|
||||
ocs.id,
|
||||
ocs.create_time as createTime,
|
||||
ocs.create_by as createBy,
|
||||
bdl.serial_number as serialNumber,
|
||||
bdl.title,
|
||||
bdl.state,
|
||||
ocs.document_id as documentId
|
||||
from
|
||||
onl_cgform_subscribe ocs
|
||||
right join
|
||||
buss_document_library bdl on ocs.document_id = bdl.id
|
||||
where ocs.create_by = #{params.createBy}
|
||||
<if test="params.serialNumber != null and params.serialNumber != ''">
|
||||
<!--搜索条件:编号;包含%,单独搜索-->
|
||||
<choose>
|
||||
<when test='params.serialNumber != null and params.serialNumber != "" and params.serialNumber.contains("%")'>
|
||||
and bdl.serial_number like '%1%%' escape '1'
|
||||
</when>
|
||||
<otherwise>
|
||||
and bdl.serial_number like concat(concat('%',#{params.serialNumber}),'%')
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
<if test="params.title != null and params.title != ''">
|
||||
<!--搜索条件:标题;包含%,单独搜索-->
|
||||
<choose>
|
||||
<when test='params.title != null and params.title != "" and params.title.contains("%")'>
|
||||
and bdl.title like '%1%%' escape '1'
|
||||
</when>
|
||||
<otherwise>
|
||||
and bdl.title like concat(concat('%',#{params.title}),'%')
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
<if test="params.state != null and params.state != '' ">
|
||||
and bdl.state in
|
||||
<foreach collection="params.state.split(',')" index="index" item="item" open="(" separator="," close=")">
|
||||
@@ -57,4 +117,4 @@
|
||||
</if>
|
||||
order by ocs.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
+12
-1
@@ -10,6 +10,7 @@ import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
|
||||
import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl;
|
||||
import com.jero.modules.collection.service.impl.OnlCgformCollectionServiceImpl;
|
||||
import com.jero.modules.ocr.util.LineHumpUtil;
|
||||
import com.jero.modules.subscribe.entity.OnlCgformSubscribe;
|
||||
import com.jero.modules.subscribe.mapper.OnlCgformSubscribeMapper;
|
||||
@@ -17,6 +18,7 @@ import com.jero.modules.subscribe.service.IOnlCgformSubscribeService;
|
||||
import com.jero.modules.system.entity.SysDictItem;
|
||||
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -40,6 +42,8 @@ public class OnlCgformSubscribeServiceImpl extends ServiceImpl<OnlCgformSubscrib
|
||||
private OnlCgformSubscribeMapper onlCgformSubscribeMapper;
|
||||
@Autowired
|
||||
private SysDictItemServiceImpl sysDictItemServiceImpl;
|
||||
@Autowired
|
||||
private OnlCgformCollectionServiceImpl onlCgformCollectionService;
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
@@ -203,12 +207,19 @@ public class OnlCgformSubscribeServiceImpl extends ServiceImpl<OnlCgformSubscrib
|
||||
|
||||
@Override
|
||||
public IPage<OnlCgformSubscribe> queryPageList(Map<String,Object> params) {
|
||||
// params.put("orderByField","title");
|
||||
// params.put("orderBy","1");
|
||||
Integer pageNo = Integer.parseInt(params.get("pageNo").toString());
|
||||
Integer pageSize = Integer.parseInt(params.get("pageSize").toString());
|
||||
IPage page = new Page(pageNo, pageSize);
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
params.put("createBy",sysUser.getUsername());
|
||||
IPage result = onlCgformSubscribeMapper.queryPageList(page,params);
|
||||
//表头排序(状态单独处理)
|
||||
if(ObjectUtils.isNotEmpty(params.get("orderByField")) && "state".equals((String) params.get("orderByField"))){
|
||||
List<Map<String, Object>> mapList = onlCgformSubscribeMapper.infoList(params);
|
||||
result = onlCgformCollectionService.stateSort(params,pageNo,pageSize,result,mapList);
|
||||
}
|
||||
List<Map<String,Object>> records = result.getRecords();
|
||||
dataDispose(records,params);
|
||||
return result;
|
||||
@@ -271,4 +282,4 @@ public class OnlCgformSubscribeServiceImpl extends ServiceImpl<OnlCgformSubscrib
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user