导购接口
parent
3e88c52d7e
commit
7402914fb2
@ -0,0 +1,62 @@
|
||||
package com.kiisoo.ic.promotion.controller;
|
||||
|
||||
import com.kiisoo.ic.activity.entity.PmnPromotionSrc;
|
||||
import com.kiisoo.ic.common.BaseController;
|
||||
import com.kiisoo.ic.promotion.service.PromotionSrcService;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 推广源管理c
|
||||
* @Auther: yaoyao.zhu
|
||||
* @Date: 2020/5/22
|
||||
* @Version: v1
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/promotion")
|
||||
@Slf4j
|
||||
@ApiModel("推广源管理")
|
||||
public class PromotionSrcController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private PromotionSrcService promotionSrcService;
|
||||
|
||||
@ApiModelProperty(value = "通过查询店铺推广导购信息", required = true)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "instanceId", value = "活动id", dataType = "int", paramType = "form"),
|
||||
@ApiImplicitParam(name = "storeId", value = "店铺id", dataType = "int", paramType = "form"),
|
||||
@ApiImplicitParam(name = "pageNum", value = "页码", dataType = "int", paramType = "form"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "分页size", dataType = "int", paramType = "form"),
|
||||
})
|
||||
@RequestMapping(value = "/list/staff", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Map<String, Object> staff(@RequestParam(value = "instanceId") Long instanceId,
|
||||
@RequestParam(value = "storeId") Long storeId,
|
||||
@RequestParam("pageNum") int pageNum,
|
||||
@RequestParam("pageSize") int pageSize) {
|
||||
try {
|
||||
Map<String, Object> map = promotionSrcService.listStaff(instanceId, storeId, pageNum, pageSize);
|
||||
return data(map);
|
||||
} catch (Exception e) {
|
||||
log.error("查询失败", e);
|
||||
return fail();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.kiisoo.ic.promotion.service;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.kiisoo.ic.promotion.entity.PmnPromotionSrcVO;
|
||||
import com.kiisoo.ic.promotion.mapper.PmnPromotionSrcMapper;
|
||||
import com.kiisoo.ic.store.mapper.PoiStoreStaffDOMapper;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@Service
|
||||
public class PromotionSrcService {
|
||||
|
||||
@Autowired
|
||||
PmnPromotionSrcMapper pmnPromotionSrcMapper;
|
||||
@Autowired
|
||||
PoiStoreStaffDOMapper poiStoreStaffDOMapper;
|
||||
|
||||
|
||||
public Map<String, Object> listStaff(Long instanceId, Long storeId, int pageNum, int pageSize) {
|
||||
|
||||
Map<String, Object> results = new HashMap<>();
|
||||
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<PmnPromotionSrcVO> pmnPromotionSrcList = pmnPromotionSrcMapper.queryList(instanceId, storeId);
|
||||
if (CollectionUtils.isEmpty(pmnPromotionSrcList)) {
|
||||
results.put("this", null);
|
||||
return results;
|
||||
}
|
||||
AtomicInteger number = new AtomicInteger(1 + ((pageNum - 1) * pageSize));
|
||||
//求分页总数
|
||||
Page<PmnPromotionSrcVO> pageList = (Page<PmnPromotionSrcVO>) pmnPromotionSrcList;
|
||||
Long totalSize = pageList.getTotal();
|
||||
for (PmnPromotionSrcVO m : pmnPromotionSrcList) {
|
||||
|
||||
m.setTotalSize(totalSize);
|
||||
m.setNumber(number.get());
|
||||
number.incrementAndGet();
|
||||
}
|
||||
results.put("this", new PageInfo<>(pmnPromotionSrcList));
|
||||
return results;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.kiisoo.ic.promotion.mapper.PmnPromotionSrcMapper">
|
||||
<!--拉黑-->
|
||||
|
||||
<select id="queryList" resultType="com.kiisoo.ic.promotion.entity.PmnPromotionSrcVO">
|
||||
SELECT
|
||||
c.name, b.staff_code, c.mobile,d.name store_name, b.type, a.code
|
||||
FROM
|
||||
pmn_promotion_src a
|
||||
LEFT JOIN poi_store_staff b ON a.promoter_id = b.id
|
||||
LEFT JOIN privilage_user c ON b.user_id = c.id
|
||||
LEFT JOIN poi_store d ON b.store_id = d.id
|
||||
WHERE
|
||||
a.type = 1 AND b.store_id = #{storeId} and a.instance_id=#{instanceId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue