Commit 975a9716 by tyfanchz

广告获取接口增加条件查询

1 parent cf2301bb
......@@ -10,9 +10,10 @@ public interface AdMgrService {
* 获取广告管理列表分页信息
*
* @param page 分页查询参数
* @param ad
* @return R对象
*/
R getAdMgrList(Page page);
R getAdMgrList(Page page, PlatformAd ad);
/**
* 插入广告信息
......
package cn.com.glsx.openplatform.mapper;
import java.util.List;
import cn.com.glsx.openplatform.model.PlatformAd;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.List;
/**
* <p>Description:
* <p>Project: shop
......@@ -17,9 +16,9 @@ import java.util.List;
@Mapper
public interface PlatformAdMapper extends OreMapper<PlatformAd> {
List<PlatformAd> getAdMgrList();
List<PlatformAd> getAdMgrList(PlatformAd ad);
int updateById(@Param("id") int id, @Param("status") int status);
int updateByAdId(PlatformAd ad);
}
\ No newline at end of file
}
package cn.com.glsx.openplatform.service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import cn.com.glsx.openplatform.mapper.PlatformAdMapper;
import cn.com.glsx.openplatform.model.PlatformAd;
import cn.com.glsx.openplatform.vo.R;
......@@ -10,10 +13,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@Service
public class AdMgrServiceImpl implements AdMgrService {
/**
......@@ -25,10 +24,13 @@ public class AdMgrServiceImpl implements AdMgrService {
private PlatformAdMapper adMapper;
@Override
public R getAdMgrList(Page page) {
public R getAdMgrList(Page page, PlatformAd ad) {
//PageHelper注入分页和要分页的查询之前不能有其它查询,不然分页到第一个查询上面
PageHelper.startPage(page.getPageNumber(), page.getPageSize(), true);
List<PlatformAd> adMgrList = adMapper.getAdMgrList();
if (page.getPageNumber() > 0 && page.getPageSize() > 0) {
PageHelper.startPage(page.getPageNumber(), page.getPageSize(),
true);
}
List<PlatformAd> adMgrList = adMapper.getAdMgrList(ad);
return R.ok().putPageData((com.github.pagehelper.Page<PlatformAd>) adMgrList);
}
......
......@@ -33,19 +33,24 @@
<select id="getAdMgrList" resultMap="BaseResultMap">
select
id,
title,
image,
`position`,
interface_type,
interface_url,
`status`,
create_time,
update_time,
create_by,
update_by,
remark
id,
title,
image,
`position`,
interface_type,
interface_url,
`status`,
create_time,
update_time,
create_by,
update_by,
remark
from t_platform_ad
<where>
<if test="status != null">
and status = #{status,jdbcType=INTEGER}
</if>
</where>
</select>
<update id="updateByAdId" parameterType="cn.com.glsx.openplatform.model.PlatformAd">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!