前端:H5 首页增加 Banner 列表

This commit is contained in:
YunaiV
2019-03-31 00:48:28 +08:00
parent 23acc40d8d
commit 1fd9ab2a18
15 changed files with 160 additions and 43 deletions

View File

@@ -11,6 +11,8 @@ public interface BannerMapper {
BannerDO selectById(@Param("id") Integer id);
List<BannerDO> selectListByStatus(@Param("status") Integer status);
List<BannerDO> selectListByTitleLike(@Param("title") String title,
@Param("offset") Integer offset,
@Param("limit") Integer limit);

View File

@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示
@com.alibaba.dubbo.config.annotation.Service(validation = "true")
@@ -27,6 +28,12 @@ public class BannerServiceImpl implements BannerService {
@Autowired
private BannerMapper bannerMapper;
@Override
public CommonResult<List<BannerBO>> getBannerListByStatus(Integer status) {
List<BannerDO> banners = bannerMapper.selectListByStatus(status);
return CommonResult.success(BannerConvert.INSTANCE.convertToBO(banners));
}
@Override
public CommonResult<BannerPageBO> getBannerPage(BannerPageDTO bannerPageDTO) {
BannerPageBO bannerPageBO = new BannerPageBO();

View File

@@ -32,6 +32,18 @@
AND deleted = 0
</select>
<select id="selectListByStatus" parameterType="Integer" resultType="BannerDO">
SELECT
<include refid="FIELDS" />
FROM banner
<where>
<if test="status != null">
status = #{status}
</if>
AND deleted = 0
</where>
</select>
<select id="selectListByTitleLike" resultType="BannerDO">
SELECT
<include refid="FIELDS" />