Commit f091f694 by 阮思源

加内部接口

parent ff1648f3
......@@ -244,4 +244,11 @@ public interface BookService {
@RequestMapping(value = "/getBaseAndAuthStatus", method = RequestMethod.GET)
ResponseEntity<ResponseDto<BookInfoAndAuthStatusDTO>> getBaseAndAuthStatus(@RequestParam(value = "bookId") Long bookId, @RequestParam(value = "channelId") Long channelId,@RequestParam(value = "adviserId") Long adviserId)
throws BizException;
@ApiOperation("根据书名或isbn编号查询书")
@RequestMapping(value = "/getIdsByNameOrISBN", method = RequestMethod.GET)
ResponseEntity<ResponseDto<List<Long>>> getIdsByNameOrISBN(
@RequestParam(value = "keyword") String keyword,
@RequestParam(value = "adviserId") Long adviserId
) throws BizException;
}
......@@ -553,4 +553,9 @@ public interface BookBiz {
* 获取图书基本信息与授权状态
*/
BookInfoAndAuthStatusDTO getBaseAndAuthStatus(Long bookId, Long channelId, Long adviserId);
/**
* 根据书名或ISBN编号获取书id集合
*/
List<Long> getIdsByNameOrISBN(String keyword, Long adviserId);
}
......@@ -1677,4 +1677,31 @@ public class BookBizImpl implements BookBiz {
bookInfoAndAuthStatusDTO.setIsDelete(bookAdviser == null ? BookStatusEnum.BookDeleteStatus.DELETE.value : bookAdviser.getIsDelete());
return bookInfoAndAuthStatusDTO;
}
@ParamLog("根据书名或ISBN编号获取书id集合")
@Override
public List<Long> getIdsByNameOrISBN(String keyword, Long adviserId) {
LOGGER.info("【书籍顾问】根据书名或ISBN编号获取书id集合,<START>.[keyword|adviserId]=" + keyword + "|" + adviserId);
if (StringUtil.isEmpty(keyword)) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "请输入关键词");
}
if (adviserId == null) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "请输入编辑ID");
}
List<Long> bookIds ;
try {
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("keyword", keyword);
paramMap.put("adviserId", adviserId);
bookIds = bookDao.getIdsByNameOrISBN(paramMap);
if (bookIds == null) {
bookIds = Lists.newArrayList();
}
} catch (Exception e) {
LOGGER.error("【书籍-顾问】根据书名或ISBN编号获取书id集合,<ERROR>.[getIdsByNameOrISBN]:" + e.getMessage(), e);
throw BizException.DB_SELECT_IS_FAIL;
}
LOGGER.info("【书籍顾问】根据书名或ISBN编号获取书id集合,<END>");
return bookIds;
}
}
......@@ -305,4 +305,9 @@ public interface BookDao extends BaseDao<Book> {
* @return
*/
List<BookDto> listBookGroup4Adviser(Map<String, Object> paramMap);
/**
* 根据书名或ISBN获取书id
*/
List<Long> getIdsByNameOrISBN(Map<String,Object> paramMap);
}
......@@ -290,4 +290,9 @@ public class BookDaoImpl extends BaseDaoImpl<Book> implements BookDao {
public List<BookDto> listBookGroup4Adviser(Map<String, Object> paramMap) {
return super.getSqlSession().selectList(getStatement("listBookGroup4Adviser"),paramMap);
}
@Override
public List<Long> getIdsByNameOrISBN(Map<String, Object> paramMap) {
return super.getSqlSession().selectList(super.getStatement("getIdsByNameOrISBN"), paramMap);
}
}
......@@ -14,6 +14,7 @@ import com.pcloud.book.book.service.BookService;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.ResponseHandleUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -190,4 +191,14 @@ public class BookServiceImpl implements BookService {
@RequestParam("adviserId") Long adviserId) throws BizException {
return ResponseHandleUtil.toResponse(bookBiz.getBaseAndAuthStatus(bookId, channelId, adviserId));
}
@ApiOperation("根据书名或isbn编号查询书")
@RequestMapping(value = "/getIdsByNameOrISBN", method = RequestMethod.GET)
@Override
public ResponseEntity<ResponseDto<List<Long>>> getIdsByNameOrISBN(
@RequestParam(value = "keyword") String keyword,
@RequestParam(value = "adviserId") Long adviserId
) throws BizException {
return ResponseHandleUtil.toResponse(bookBiz.getIdsByNameOrISBN(keyword, adviserId));
}
}
......@@ -1669,4 +1669,17 @@
A.LAST_MODIFIED_DATE DESC , A.BOOK_ADVISER_ID DESC
</select>
<!-- 根据名称或ISBN获取ID -->
<select id="getIdsByNameOrISBN" resultType="long" parameterType="map">
SELECT
A.BOOK_ID
FROM
BOOK_ADVISER A
INNER JOIN
BOOK B
ON
A.BOOK_ID = B.BOOK_ID AND A.ADVISER_ID = #{adviserId} AND A.IS_DELETE = 0 AND B.IS_DELETE = 0
WHERE
B.BOOK_NAME LIKE CONCAT('%',#{keyword},'%') or B.ISBN LIKE CONCAT('%',#{keyword},'%')
</select>
</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