Commit 2d5fcb6b by 田超

Merge branch 'feature/1003176' into 'master'

feat: [1003176] 策划部管理新增数据筛选与自定义标签

See merge request rays/pcloud-book!810
parents 80b1026e 491da427
...@@ -263,4 +263,10 @@ public interface BookService { ...@@ -263,4 +263,10 @@ public interface BookService {
ResponseEntity<ResponseDto<List<Long>>> getBookIdsByIsbn( ResponseEntity<ResponseDto<List<Long>>> getBookIdsByIsbn(
@RequestParam(value = "isbn") String isbn @RequestParam(value = "isbn") String isbn
) throws BizException; ) throws BizException;
@ApiOperation("获取书刊标签")
@RequestMapping(value = "/getLabelMapByIds", method = RequestMethod.POST)
ResponseEntity<ResponseDto<Map<Long, String>>> getLabelMapByIds(
@RequestBody List<Long> labelIds
) throws BizException;
} }
...@@ -663,4 +663,6 @@ public interface BookBiz { ...@@ -663,4 +663,6 @@ public interface BookBiz {
* * @param null * * @param null
*/ */
PageBeanNew<BookDto> getAdviserBooks4Applet(BookSearchParamVO bookSearchParamVO); PageBeanNew<BookDto> getAdviserBooks4Applet(BookSearchParamVO bookSearchParamVO);
Map<Integer,List<BookLabel>> getBookLabels4Erp();
} }
...@@ -4,6 +4,9 @@ import com.pcloud.book.book.entity.BookLabel; ...@@ -4,6 +4,9 @@ import com.pcloud.book.book.entity.BookLabel;
import com.pcloud.book.book.vo.BookLabelVO; import com.pcloud.book.book.vo.BookLabelVO;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import java.util.List;
import java.util.Map;
public interface BookLabelBiz { public interface BookLabelBiz {
/** /**
...@@ -52,4 +55,6 @@ public interface BookLabelBiz { ...@@ -52,4 +55,6 @@ public interface BookLabelBiz {
*/ */
PageBeanNew<BookLabelVO> listApplyBookLabel(Integer labelType, Integer currentPage, Integer numPerPage, PageBeanNew<BookLabelVO> listApplyBookLabel(Integer labelType, Integer currentPage, Integer numPerPage,
String name, String startTime, String endTime, Integer auditState); String name, String startTime, String endTime, Integer auditState);
Map<Long,String> getLabelMapByIds(List<Long> labelIds);
} }
...@@ -2411,4 +2411,15 @@ public class BookBizImpl implements BookBiz { ...@@ -2411,4 +2411,15 @@ public class BookBizImpl implements BookBiz {
PageBeanNew<BookDto> page = new PageBeanNew<>(currentPage, numPerPage, (int) esPage.getTotalElements(), bookDtos); PageBeanNew<BookDto> page = new PageBeanNew<>(currentPage, numPerPage, (int) esPage.getTotalElements(), bookDtos);
return page; return page;
} }
@ParamLog("获取书籍标签")
@Override
public Map<Integer, List<BookLabel>> getBookLabels4Erp() {
Map<Integer, List<BookLabel>> map = new HashMap<>();
List<BookLabel> bookLabels = bookLabelDao.getAll(0L);
if (!ListUtils.isEmpty(bookLabels)) {
map = bookLabels.stream().collect(Collectors.groupingBy(BookLabel::getType));
}
return map;
}
} }
...@@ -138,4 +138,17 @@ public class BookLabelBizImpl implements BookLabelBiz { ...@@ -138,4 +138,17 @@ public class BookLabelBizImpl implements BookLabelBiz {
} }
return pageBeanNew; return pageBeanNew;
} }
@Override
public Map<Long, String> getLabelMapByIds(List<Long> labelIds) {
if(ListUtils.isEmpty(labelIds)){
return new HashMap<>();
}
List<BookLabel> labelList = bookLabelDao.getByLabelIds(new ArrayList<>(labelIds));
if(ListUtils.isEmpty(labelList)){
return new HashMap<>();
}
Map<Long, String> map = labelList.stream().collect(Collectors.toMap(a -> a.getId(), a -> a.getName(), (k1, k2) -> (k2)));
return map;
}
} }
...@@ -14,6 +14,8 @@ public interface BookLabelDao extends BaseDao<BookLabel> { ...@@ -14,6 +14,8 @@ public interface BookLabelDao extends BaseDao<BookLabel> {
Map<Long,BookLabel> getMapByIds(List<Long> list); Map<Long,BookLabel> getMapByIds(List<Long> list);
List<BookLabel> getByLabelIds(List<Long> list);
Long getByNameType(String name,Integer type); Long getByNameType(String name,Integer type);
Integer getMaxSeqByType(Integer type); Integer getMaxSeqByType(Integer type);
......
...@@ -36,6 +36,11 @@ public class BookLabelDaoImpl extends BaseDaoImpl<BookLabel> implements BookLabe ...@@ -36,6 +36,11 @@ public class BookLabelDaoImpl extends BaseDaoImpl<BookLabel> implements BookLabe
} }
@Override @Override
public List<BookLabel> getByLabelIds(List<Long> list) {
return super.getSqlSession().selectList(super.getStatement("getByLabelIds"), list);
}
@Override
public Long getByNameType(String name, Integer type) { public Long getByNameType(String name, Integer type) {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("name", name); map.put("name", name);
......
...@@ -1079,4 +1079,10 @@ public class BookFacadeImpl implements BookFacade { ...@@ -1079,4 +1079,10 @@ public class BookFacadeImpl implements BookFacade {
return new ResponseDto<>(bookBiz.getAdviserBooks4Applet(bookSearchParamVO)); return new ResponseDto<>(bookBiz.getAdviserBooks4Applet(bookSearchParamVO));
} }
@GetMapping("getBookLabels4Erp")
public ResponseDto<?> getBookLabels4Erp(
@RequestHeader("token") String token
) throws BizException, PermissionException {
return new ResponseDto<>(bookBiz.getBookLabels4Erp());
}
} }
\ No newline at end of file
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
package com.pcloud.book.book.service.impl; package com.pcloud.book.book.service.impl;
import com.pcloud.book.book.biz.BookBiz; import com.pcloud.book.book.biz.BookBiz;
import com.pcloud.book.book.biz.BookLabelBiz;
import com.pcloud.book.book.dto.BookAdviserUpdateTimeDTO; import com.pcloud.book.book.dto.BookAdviserUpdateTimeDTO;
import com.pcloud.book.book.dto.BookDetialDTO; import com.pcloud.book.book.dto.BookDetialDTO;
import com.pcloud.book.book.dto.BookDto; import com.pcloud.book.book.dto.BookDto;
...@@ -40,6 +41,8 @@ public class BookServiceImpl implements BookService { ...@@ -40,6 +41,8 @@ public class BookServiceImpl implements BookService {
@Autowired @Autowired
private BookBiz bookBiz; private BookBiz bookBiz;
@Autowired
private BookLabelBiz bookLabelBiz;
/** /**
* 获取书籍信息 * 获取书籍信息
...@@ -218,4 +221,10 @@ public class BookServiceImpl implements BookService { ...@@ -218,4 +221,10 @@ public class BookServiceImpl implements BookService {
@RequestParam(value = "isbn") String isbn) throws BizException { @RequestParam(value = "isbn") String isbn) throws BizException {
return ResponseHandleUtil.toResponse(bookBiz.getBookIdsByIsbn(isbn)); return ResponseHandleUtil.toResponse(bookBiz.getBookIdsByIsbn(isbn));
} }
@Override
@RequestMapping(value = "/getLabelMapByIds", method = RequestMethod.POST)
public ResponseEntity<ResponseDto<Map<Long, String>>> getLabelMapByIds(@RequestBody List<Long> labelIds) throws BizException {
return ResponseHandleUtil.toResponse(bookLabelBiz.getLabelMapByIds(labelIds));
}
} }
...@@ -89,6 +89,15 @@ ...@@ -89,6 +89,15 @@
</foreach> </foreach>
</select> </select>
<select id="getByLabelIds" parameterType="list" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from book_label
where id in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="getByNameType" resultType="long" parameterType="map"> <select id="getByNameType" resultType="long" parameterType="map">
SELECT id FROM book_label SELECT id FROM book_label
WHERE `name`= #{name} WHERE `name`= #{name}
......
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