Commit c75af4eb authored by licc's avatar licc

新增团队业绩接口

parent 049b4d2c
......@@ -4,8 +4,8 @@ import cn.wisenergy.model.app.TeamPerformance;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @author 86187
......@@ -85,4 +85,19 @@ public interface TeamPerformanceMapper extends BaseMapper<TeamPerformance> {
*/
Double monthUserTeamByuserId(@Param("userid") String userId,@Param("yearMonth") String yearMonth);
/**
* 统计团队业绩总记录数
*
* @param map 入参
* @return 结果
*/
int count( Map<String, Object> map);
/**
* 获取团队业绩流水列表
* @param map 入参
* @return 结果集
*/
List<TeamPerformance> getList(Map<String, Object> map);
}
......@@ -173,4 +173,35 @@
and `year_month` = #{yearMonth}
</where>
</select>
<select id="count" resultType="java.lang.Integer">
select count(1)
from
<include refid="table"/>
<where>
<if test="userId != null and userId != ''">
user_id=#{userId}
</if>
<if test="queryTime != null and queryTime != ''">
and `year_month` = #{queryTime}
</if>
</where>
</select>
<select id="getList" resultType="cn.wisenergy.model.app.TeamPerformance">
select
<include refid="cols_all"/>
from
<include refid="table"/>
<where>
<if test="userId != null and userId != ''">
user_id=#{userId}
</if>
<if test="queryTime != null and queryTime != ''">
and `year_month` = #{queryTime}
</if>
</where>
order by create_time desc
limit #{startNum},#{endNum}
</select>
</mapper>
\ No newline at end of file
package cn.wisenergy.model.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
*@ Description: 团队业绩查询Dto
*@ Author : 86187
*@ Date : 2021/3/22 16:26
* @author 86187
*/
@Data
@ApiModel("TeamQueryDto")
public class TeamQueryDto {
/**
* 用户id
*/
@ApiModelProperty(value = "用户id", name = "userId")
private String userId;
/**
* 查询时间 格式(yyyy-MM-dd)
*/
@ApiModelProperty(value = "查询时间 格式(yyyy-MM-dd)", name = "queryTime")
private String queryTime;
/**
* 页码
*/
@ApiModelProperty(value = "页码", name = "pageNo")
private Integer pageNo;
/**
* 页条数
*/
@ApiModelProperty(value = "页条数", name = "pageSize")
private Integer pageSize;
private Integer startNum;
private Integer endNum;
}
package cn.wisenergy.service.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.TeamPerformance;
import cn.wisenergy.model.dto.TeamQueryDto;
import com.github.pagehelper.PageInfo;
/**
* @author 86187
*/
public interface TeamPerformanceService {
/**
* 查询团队业绩列表
*
* @param queryDto 查询参数
* @return 列表
*/
R<PageInfo<TeamPerformance>> getList(TeamQueryDto queryDto);
}
package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.constant.CommonAttributes;
import cn.wisenergy.common.utils.DateUtil;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.mapper.TeamPerformanceMapper;
import cn.wisenergy.model.app.TeamPerformance;
import cn.wisenergy.model.dto.TeamQueryDto;
import cn.wisenergy.service.app.TeamPerformanceService;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author 86187
*/
@Slf4j
@Service
public class TeamPerformanceServiceImpl implements TeamPerformanceService {
@Autowired
private TeamPerformanceMapper teamPerformanceMapper;
@Override
public R<PageInfo<TeamPerformance>> getList(TeamQueryDto query) {
log.info("shop-mall[]TeamPerformanceServiceImpl[]getList[]input.param.query:" + query);
if (null == query) {
return R.error("入参不能为空!");
}
pageHandle(query);
Map<String, Object> map = new HashMap<>(8);
map.put("userId", query.getUserId());
if (!StringUtils.isBlank(query.getQueryTime())) {
Date date = DateUtil.convertStrToDate(query.getQueryTime(), "yyyy-MM-dd");
map.put("queryTime", date);
}
int total = teamPerformanceMapper.count(map);
map.put("startNum", query.getStartNum());
map.put("endNum", query.getEndNum());
List<TeamPerformance> list = teamPerformanceMapper.getList(map);
PageInfo<TeamPerformance> info = new PageInfo<>();
info.setPageSize(query.getPageSize());
info.setPageNum(query.getPageNo());
info.setTotal(total);
info.setList(list);
return R.ok(info);
}
/**
* 分页处理方法
*
* @param schemeVo 参数
*/
private void pageHandle(TeamQueryDto schemeVo) {
Integer pageNum = schemeVo.getPageNo();
Integer pageSize = schemeVo.getPageSize();
if (null == pageSize || pageSize == 0) {
pageSize = 10;
}
if (null == pageNum || pageNum == 0) {
pageNum = 1;
}
Integer endNum = pageSize;
Integer startNum = (pageNum - CommonAttributes.NUM_ONE) * pageSize;
schemeVo.setEndNum(endNum);
schemeVo.setStartNum(startNum);
schemeVo.setPageNo(pageNum);
schemeVo.setPageSize(pageSize);
}
}
package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.TeamPerformance;
import cn.wisenergy.model.dto.TeamQueryDto;
import cn.wisenergy.service.app.TeamPerformanceService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author 86187
*/
@Api(tags = "团队业绩--后台管理")
@RestController
@RequestMapping("/team")
@Slf4j
public class TeamController {
@Autowired
private TeamPerformanceService teamPerformanceService;
@ApiOperation(value = "团队业绩列表", notes = "团队业绩列表", httpMethod = "GET")
@ApiImplicitParam(name = "query", value = "查询参数", dataType = "TeamQueryDto")
@GetMapping("/queryList")
public R<PageInfo<TeamPerformance>> queryList(TeamQueryDto query) {
log.info("shop-mall[]TeamController[]queryList[]input.param.query:" + query);
return teamPerformanceService.getList(query);
}
}
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