Commit 6d03e00c by 阮思源

增加分类拖动排序,分类上限修改为40

parent 42fae701
......@@ -179,4 +179,8 @@ public interface BookGroupClassifyBiz {
*/
PageBeanNew<ClassifyLearningReportDto> listClassifyForLearningReport(Integer currentPage, Integer numPerPage, String keyword, Long partyId);
/**
* 拖动排序
*/
void dragSortClassify(List<Long> classifyIds);
}
......@@ -132,7 +132,7 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
if (!CollectionUtils.isEmpty(statistic) && null != statistic.get(addClassifyVO.getBookGroupId())) {
classifyCount = statistic.get(addClassifyVO.getBookGroupId()).getClassifyCount();
}
if (classifyCount >= 10) {
if (classifyCount >= 40) {
throw new BookBizException(BookBizException.ERROR, "分类数量超出限制");
}
if (addClassifyVO.getPrice() == null) {
......@@ -964,4 +964,14 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
}
@ParamLog("拖动排序")
@Transactional(rollbackFor = Exception.class)
@Override
public void dragSortClassify(List<Long> classifyIds) {
if (ListUtils.isEmpty(classifyIds)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数为空!");
}
bookGroupClassifyDao.dragSortClassify(classifyIds);
}
}
......@@ -236,4 +236,8 @@ public interface BookGroupClassifyDao extends BaseDao<BookGroupClassify> {
*/
void updateHasOpenLearningReport(Long classifyId, Boolean hasOpenLearningReport, Long partyId);
/**
* 拖动排序
*/
void dragSortClassify(List<Long> classifyIds);
}
......@@ -206,4 +206,11 @@ public class BookGroupClassifyDaoImpl extends BaseDaoImpl<BookGroupClassify> imp
this.getSqlSession().update(this.getStatement("updateHasOpenLearningReport"), paramMap);
}
@Override
public void dragSortClassify(List<Long> classifyIds) {
Map<String, Object> paramMap = new HashMap();
paramMap.put("classifyIds", classifyIds);
this.getSqlSession().update(this.getStatement("dragSortClassify"), paramMap);
}
}
......@@ -172,4 +172,11 @@ public interface BookGroupClassifyFacade {
@RequestParam(value = "keyword", required = false) @ApiParam("关键词") String keyword
) throws BizException, PermissionException;
@ApiOperation("拖动排序")
@PostMapping("dragSortClassify")
ResponseDto<?> dragSortClassify(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestBody List<Long> classifyIds
) throws BizException, PermissionException;
}
......@@ -184,4 +184,16 @@ public class BookGroupClassifyFacadeImpl implements BookGroupClassifyFacade {
return new ResponseDto<>(bookGroupClassifyBiz.listClassifyForLearningReport(currentPage,numPerPage,keyword,partyId));
}
@ApiOperation("拖动排序")
@PostMapping("dragSortClassify")
@Override
public ResponseDto<?> dragSortClassify(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestBody List<Long> classifyIds
) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
bookGroupClassifyBiz.dragSortClassify(classifyIds);
return new ResponseDto<>();
}
}
......@@ -823,4 +823,19 @@
group by c.id
order by c.id desc
</select>
<!--拖动排序-->
<update id="dragSortClassify" parameterType="map">
update book_group_classify
set rank = case
<foreach collection="classifyIds" index="index" item="classifyId">
when id = #{classifyId} then #{index} + 1
</foreach>
end,
update_time = now()
where id in
<foreach collection="classifyIds" item="classifyId" separator="," open="(" close=")">
#{classifyId}
</foreach>
</update>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment