Commit 36e1e758 by 朱亚洁

feat:[1004898]书刊封面根据科目标签选择封面

parent f3e3af0a
...@@ -26,4 +26,5 @@ public class BookCoverDTO extends BaseEntity { ...@@ -26,4 +26,5 @@ public class BookCoverDTO extends BaseEntity {
private Date updateTime; private Date updateTime;
private Long bookLabelId;
} }
...@@ -11,7 +11,7 @@ public interface BookCoverBiz { ...@@ -11,7 +11,7 @@ public interface BookCoverBiz {
/** /**
*查询封面 *查询封面
*/ */
PageBeanNew<BookCoverDTO> getCoverByTempletId(Long templetId, Integer currentPage, Integer perpageNumber); PageBeanNew<BookCoverDTO> getCoverByTempletId(Long templetId, Integer currentPage, Integer perpageNumber, Long bookLabelId);
/** /**
* 新增封面 * 新增封面
......
...@@ -40,7 +40,7 @@ public class BookCoverBizimpl implements BookCoverBiz { ...@@ -40,7 +40,7 @@ public class BookCoverBizimpl implements BookCoverBiz {
* 查询封面 * 查询封面
*/ */
@Override @Override
public PageBeanNew<BookCoverDTO> getCoverByTempletId(Long templetId, Integer currentPage, Integer perpageNumber) { public PageBeanNew<BookCoverDTO> getCoverByTempletId(Long templetId, Integer currentPage, Integer perpageNumber, Long bookLabelId) {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
...@@ -50,7 +50,13 @@ public class BookCoverBizimpl implements BookCoverBiz { ...@@ -50,7 +50,13 @@ public class BookCoverBizimpl implements BookCoverBiz {
PageParam pageParam = new PageParam(currentPage, perpageNumber); PageParam pageParam = new PageParam(currentPage, perpageNumber);
PageBeanNew<BookCoverDTO> pageBeanNew = bookCoverDao.listPageNew(pageParam, paramMap, "selectByTempletId"); PageBeanNew<BookCoverDTO> pageBeanNew;
if (null != templetId && null != bookLabelId) {
paramMap.put("bookLabelId", bookLabelId);
pageBeanNew = bookCoverDao.listPageNew(pageParam, paramMap, "selectByTempletIdAndLabel");
} else {
pageBeanNew = bookCoverDao.listPageNew(pageParam, paramMap, "selectByTempletId");
}
if (CollUtil.isEmpty(pageBeanNew.getRecordList())) { if (CollUtil.isEmpty(pageBeanNew.getRecordList())) {
return pageBeanNew; return pageBeanNew;
} }
......
...@@ -28,9 +28,10 @@ public class BookCoverFacade { ...@@ -28,9 +28,10 @@ public class BookCoverFacade {
@RequestHeader("token") String token, @RequestHeader("token") String token,
@RequestParam(value = "templetId", required = false) Long templetId, @RequestParam(value = "templetId", required = false) Long templetId,
@RequestParam(value = "currentPage") Integer currentPage, @RequestParam(value = "currentPage") Integer currentPage,
@RequestParam(value = "numPerPage") Integer numPerPage) { @RequestParam(value = "numPerPage") Integer numPerPage,
@RequestParam(value = "bookLabelId", required = false) Long bookLabelId) {
SessionUtil.getVlaue(token, SessionUtil.USER_ID); SessionUtil.getVlaue(token, SessionUtil.USER_ID);
return new ResponseDto<>(bookCoverBiz.getCoverByTempletId(templetId, currentPage, numPerPage)); return new ResponseDto<>(bookCoverBiz.getCoverByTempletId(templetId, currentPage, numPerPage, bookLabelId));
} }
@ApiOperation("添加封面") @ApiOperation("添加封面")
......
...@@ -1678,7 +1678,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz { ...@@ -1678,7 +1678,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
} else { } else {
return false; return false;
} }
Integer openRays = null == resourcePage ? 0 : resourcePage.getOpenRays(); Integer openRays = (null == resourcePage || null == resourcePage.getOpenRays()) ? 0 : resourcePage.getOpenRays();
return openRays > 0 ? true : false; return openRays > 0 ? true : false;
} }
......
...@@ -9,23 +9,26 @@ ...@@ -9,23 +9,26 @@
<result column="COVER_IMG" property="coverImg" jdbcType="VARCHAR" /> <result column="COVER_IMG" property="coverImg" jdbcType="VARCHAR" />
<result column="CREATED_Time" property="createdTime" jdbcType="TIMESTAMP" /> <result column="CREATED_Time" property="createdTime" jdbcType="TIMESTAMP" />
<result column="UPDATE_TIME" property="updateTime" jdbcType="TIMESTAMP" /> <result column="UPDATE_TIME" property="updateTime" jdbcType="TIMESTAMP" />
<result column="book_label_id" property="bookLabelId" jdbcType="BIGINT" />
</resultMap> </resultMap>
<select id="selectAllCover" resultMap="BaseResultMap"> <select id="selectAllCover" resultMap="BaseResultMap">
select select
COVER_ID,TEMPLET_ID,TEMPLET_NAME,COVER_IMG,UPDATE_TIME,CREATED_Time COVER_ID,TEMPLET_ID,TEMPLET_NAME,COVER_IMG,UPDATE_TIME,CREATED_Time, book_label_id
from from
book_cover book_cover
</select> </select>
<select id="selectByTempletId" parameterType="map" resultMap="BaseResultMap"> <select id="selectByTempletId" parameterType="map" resultMap="BaseResultMap">
select select
COVER_ID,TEMPLET_ID,TEMPLET_NAME,COVER_IMG,UPDATE_TIME,CREATED_Time COVER_ID,TEMPLET_ID,TEMPLET_NAME,COVER_IMG,UPDATE_TIME,CREATED_Time, book_label_id
from from
book_cover book_cover
where 1=1
<if test="templetId != null" > <if test="templetId != null" >
where TEMPLET_ID = #{templetId} AND TEMPLET_ID = #{templetId}
</if> </if>
and book_label_id IS NULL
</select> </select>
<insert id="insert" parameterType="com.pcloud.book.book.dto.BookCoverDTO" useGeneratedKeys="true" keyProperty="COVER_ID" > <insert id="insert" parameterType="com.pcloud.book.book.dto.BookCoverDTO" useGeneratedKeys="true" keyProperty="COVER_ID" >
...@@ -73,5 +76,21 @@ ...@@ -73,5 +76,21 @@
COVER_ID=#{coverId} COVER_ID=#{coverId}
</update> </update>
<select id="selectByTempletIdAndLabel" parameterType="map" resultMap="BaseResultMap">
SELECT
COVER_ID,
TEMPLET_ID,
TEMPLET_NAME,
COVER_IMG,
UPDATE_TIME,
CREATED_Time,
book_label_id
FROM
book_cover
WHERE
TEMPLET_ID = #{templetId}
AND (book_label_id = #{bookLabelId} OR book_label_id IS NULL)
ORDER BY book_label_id DESC
</select>
</mapper> </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