新增队伍人员接口,处理问题

This commit is contained in:
wanggeng 2021-11-09 11:45:33 +08:00
parent 318df67a0a
commit f4443bc2d3
7 changed files with 346 additions and 12 deletions

View File

@ -149,4 +149,100 @@ public class TeamMemberController extends DefaultBaseController {
return teamMemberService.listByAreaCodeAndRoleId(areaCode, roleId);
}
@ApiOperation(value = "队伍人员列表", notes = "区域队伍人员列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "areaCode", value = "地区编码", paramType = "path", required = true),
@ApiImplicitParam(name = "sort", value = "排序方式ase或者desc", paramType = "query"),
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list/area-code/{areaCode}")
public List<TeamMemberDTO> listByAreaCode(@PathVariable("areaCode") String areaCode,
@RequestParam(name = "sort", required = false) String sort) {
return teamMemberService.listByAreaCodeAndSort(areaCode, sort);
}
@ApiOperation(value = "队伍人员分页列表", notes = "队伍人员分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "areaCode", value = "地区编码", paramType = "path", required = true),
@ApiImplicitParam(name = "sort", value = "排序方式ase或者desc", paramType = "query"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpage/area-code/{areaCode}")
public SuccessResultList<List<TeamMemberDTO>> listPageByAreaCode(@PathVariable("areaCode") String areaCode,
@RequestParam(name = "sort", required = false) String sort,
ListPage page) {
Map<String, Object> params = requestParams();
page.setParams(params);
return teamMemberService.listPageByAreaCodeAndSort(areaCode, sort, page);
}
@ApiOperation(value = "队伍全部人员列表", notes = "区域全部队伍人员列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "areaCode", value = "地区编码", paramType = "path", required = true),
@ApiImplicitParam(name = "sort", value = "排序方式ase或者desc", paramType = "query"),
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list-all/area-code/{areaCode}")
public List<TeamMemberDTO> listAllByAreaCode(@PathVariable("areaCode") String areaCode,
@RequestParam(name = "sort", required = false) String sort) {
return teamMemberService.listAllByAreaCodeAndSort(areaCode, sort);
}
@ApiOperation(value = "队伍全部人员分页列表", notes = "区域全部队伍人员分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "areaCode", value = "地区编码", paramType = "path", required = true),
@ApiImplicitParam(name = "sort", value = "排序方式ase或者desc", paramType = "query"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpage-all/area-code/{areaCode}")
public SuccessResultList<List<TeamMemberDTO>> listPageAllByAreaCode(@PathVariable("areaCode") String areaCode,
@RequestParam(name = "sort", required = false) String sort,
ListPage page) {
Map<String, Object> params = requestParams();
page.setParams(params);
return teamMemberService.listPageAllByAreaCodeAndSort(areaCode, sort, page);
}
@ApiOperation(value = "区域下队伍人员列表", notes = "区域下人员列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "areaCode", value = "地区编码", paramType = "path", required = true),
@ApiImplicitParam(name = "sort", value = "排序方式ase或者desc", paramType = "query"),
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list-sub/area-code/{areaCode}")
public List<TeamMemberDTO> listSubByAreaCode(@PathVariable("areaCode") String areaCode,
@RequestParam(name = "sort", required = false) String sort) {
return teamMemberService.listSubByAreaCodeAndSort(areaCode, sort);
}
@ApiOperation(value = "区域下队伍人员分页列表", notes = "区域下人员分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "areaCode", value = "地区编码", paramType = "path", required = true),
@ApiImplicitParam(name = "sort", value = "排序方式ase或者desc", paramType = "query"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpage-sub/area-code/{areaCode}")
public SuccessResultList<List<TeamMemberDTO>> listPageSubByAreaCode(@PathVariable("areaCode") String areaCode,
@RequestParam(name = "sort", required = false) String sort,
ListPage page) {
Map<String, Object> params = requestParams();
page.setParams(params);
return teamMemberService.listPageSubByAreaCodeAndSort(areaCode, sort, page);
}
}

View File

@ -10,10 +10,7 @@ import ink.wgink.pojo.result.SuccessResultData;
import ink.wgink.pojo.result.SuccessResultList;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@ -93,4 +90,100 @@ public class TeamMemberResourceController extends DefaultBaseController {
return teamMemberService.listByAreaCodeAndRoleId(areaCode, roleId);
}
@ApiOperation(value = "队伍人员列表", notes = "区域队伍人员列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "areaCode", value = "地区编码", paramType = "path", required = true),
@ApiImplicitParam(name = "sort", value = "排序方式ase或者desc", paramType = "query"),
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list/area-code/{areaCode}")
public List<TeamMemberDTO> listByAreaCode(@PathVariable("areaCode") String areaCode,
@RequestParam(name = "sort", required = false) String sort) {
return teamMemberService.listByAreaCodeAndSort(areaCode, sort);
}
@ApiOperation(value = "队伍人员分页列表", notes = "队伍人员分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "areaCode", value = "地区编码", paramType = "path", required = true),
@ApiImplicitParam(name = "sort", value = "排序方式ase或者desc", paramType = "query"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpage/area-code/{areaCode}")
public SuccessResultList<List<TeamMemberDTO>> listPageByAreaCode(@PathVariable("areaCode") String areaCode,
@RequestParam(name = "sort", required = false) String sort,
ListPage page) {
Map<String, Object> params = requestParams();
page.setParams(params);
return teamMemberService.listPageByAreaCodeAndSort(areaCode, sort, page);
}
@ApiOperation(value = "队伍全部人员列表", notes = "区域全部队伍人员列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "areaCode", value = "地区编码", paramType = "path", required = true),
@ApiImplicitParam(name = "sort", value = "排序方式ase或者desc", paramType = "query"),
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list-all/area-code/{areaCode}")
public List<TeamMemberDTO> listAllByAreaCode(@PathVariable("areaCode") String areaCode,
@RequestParam(name = "sort", required = false) String sort) {
return teamMemberService.listAllByAreaCodeAndSort(areaCode, sort);
}
@ApiOperation(value = "队伍全部人员分页列表", notes = "区域全部队伍人员分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "areaCode", value = "地区编码", paramType = "path", required = true),
@ApiImplicitParam(name = "sort", value = "排序方式ase或者desc", paramType = "query"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpage-all/area-code/{areaCode}")
public SuccessResultList<List<TeamMemberDTO>> listPageAllByAreaCode(@PathVariable("areaCode") String areaCode,
@RequestParam(name = "sort", required = false) String sort,
ListPage page) {
Map<String, Object> params = requestParams();
page.setParams(params);
return teamMemberService.listPageAllByAreaCodeAndSort(areaCode, sort, page);
}
@ApiOperation(value = "区域下队伍人员列表", notes = "区域下人员列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "areaCode", value = "地区编码", paramType = "path", required = true),
@ApiImplicitParam(name = "sort", value = "排序方式ase或者desc", paramType = "query"),
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list-sub/area-code/{areaCode}")
public List<TeamMemberDTO> listSubByAreaCode(@PathVariable("areaCode") String areaCode,
@RequestParam(name = "sort", required = false) String sort) {
return teamMemberService.listSubByAreaCodeAndSort(areaCode, sort);
}
@ApiOperation(value = "区域下队伍人员分页列表", notes = "区域下人员分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "areaCode", value = "地区编码", paramType = "path", required = true),
@ApiImplicitParam(name = "sort", value = "排序方式ase或者desc", paramType = "query"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpage-sub/area-code/{areaCode}")
public SuccessResultList<List<TeamMemberDTO>> listPageSubByAreaCode(@PathVariable("areaCode") String areaCode,
@RequestParam(name = "sort", required = false) String sort,
ListPage page) {
Map<String, Object> params = requestParams();
page.setParams(params);
return teamMemberService.listPageSubByAreaCodeAndSort(areaCode, sort, page);
}
}

View File

@ -237,4 +237,61 @@ public interface ITeamMemberService {
* @return
*/
List<TeamMemberDTO> listByAreaCodeAndRoleId(String areaCode, String roleId);
/**
* 队伍人员列表
*
* @param areaCode 区域编码
* @param sort 排序方式
* @return
*/
List<TeamMemberDTO> listByAreaCodeAndSort(String areaCode, String sort);
/**
* 队伍全部人员列表
*
* @param areaCode 区域编码
* @param sort 排序方式
* @return
*/
List<TeamMemberDTO> listAllByAreaCodeAndSort(String areaCode, String sort);
/**
* 区域下队伍人员列表
*
* @param areaCode 区域编码
* @param sort 排序方式
* @return
*/
List<TeamMemberDTO> listSubByAreaCodeAndSort(String areaCode, String sort);
/**
* 队伍人员分页列表
*
* @param areaCode 区域编码
* @param sort 排序方式
* @param page 分页
* @return
*/
SuccessResultList<List<TeamMemberDTO>> listPageByAreaCodeAndSort(String areaCode, String sort, ListPage page);
/**
* 队伍全部人员分页列表
*
* @param areaCode 区域编码
* @param sort 排序方式
* @param page 分页
* @return
*/
SuccessResultList<List<TeamMemberDTO>> listPageAllByAreaCodeAndSort(String areaCode, String sort, ListPage page);
/**
* 区域下队伍人员分页列表
*
* @param areaCode 区域编码
* @param sort 排序方式
* @param page 分页
* @return
*/
SuccessResultList<List<TeamMemberDTO>> listPageSubByAreaCodeAndSort(String areaCode, String sort, ListPage page);
}

View File

@ -17,6 +17,7 @@ import ink.wgink.pojo.dtos.user.UserDTO;
import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.util.UUIDUtil;
import ink.wgink.util.map.HashMapUtil;
import ink.wgink.util.string.WStringUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -236,6 +237,59 @@ public class TeamMemberServiceImpl extends DefaultBaseService implements ITeamMe
return listByUserIdsAndAreaCode(userIds, areaCode);
}
@Override
public List<TeamMemberDTO> listByAreaCodeAndSort(String areaCode, String sort) {
Map<String, Object> params = getHashMap(6);
params.put("areaCode", areaCode);
params.put("order", "areaCode");
params.put("sort", StringUtils.isBlank(sort) ? null : sort.toLowerCase());
return list(params);
}
@Override
public List<TeamMemberDTO> listAllByAreaCodeAndSort(String areaCode, String sort) {
Map<String, Object> params = getHashMap(6);
params.put("areaCodeLike", WStringUtil.cutContinuityRepeatCharDesc(areaCode, '0'));
params.put("order", "areaCode");
params.put("sort", StringUtils.isBlank(sort) ? null : sort.toLowerCase());
return list(params);
}
@Override
public List<TeamMemberDTO> listSubByAreaCodeAndSort(String areaCode, String sort) {
Map<String, Object> params = getHashMap(8);
params.put("areaCodeLike", WStringUtil.cutContinuityRepeatCharDesc(areaCode, '0'));
params.put("excludeAreaCode", areaCode);
params.put("order", "areaCode");
params.put("sort", StringUtils.isBlank(sort) ? null : sort.toLowerCase());
return list(params);
}
@Override
public SuccessResultList<List<TeamMemberDTO>> listPageByAreaCodeAndSort(String areaCode, String sort, ListPage page) {
page.getParams().put("areaCode", areaCode);
page.getParams().put("order", "areaCode");
page.getParams().put("sort", StringUtils.isBlank(sort) ? null : sort.toLowerCase());
return listPage(page);
}
@Override
public SuccessResultList<List<TeamMemberDTO>> listPageAllByAreaCodeAndSort(String areaCode, String sort, ListPage page) {
page.getParams().put("areaCodeLike", WStringUtil.cutContinuityRepeatCharDesc(areaCode, '0'));
page.getParams().put("order", "areaCode");
page.getParams().put("sort", StringUtils.isBlank(sort) ? null : sort.toLowerCase());
return listPage(page);
}
@Override
public SuccessResultList<List<TeamMemberDTO>> listPageSubByAreaCodeAndSort(String areaCode, String sort, ListPage page) {
page.getParams().put("areaCodeLike", WStringUtil.cutContinuityRepeatCharDesc(areaCode, '0'));
page.getParams().put("excludeAreaCode", areaCode);
page.getParams().put("order", "areaCode");
page.getParams().put("sort", StringUtils.isBlank(sort) ? null : sort.toLowerCase());
return listPage(page);
}
/**
* 设置用户
*

View File

@ -219,12 +219,6 @@
FROM
city_team_member t1
<where>
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
@ -251,6 +245,18 @@
#{userIds[${index}]}
</foreach>
</if>
<if test="areaCode != null and areaCode != ''">
AND
t1.area_code = #{areaCode}
</if>
<if test="areaCodeLike != null and areaCodeLike != ''">
AND
t1.area_code LIKE CONCAT(#{areaCodeLike}, '%')
</if>
<if test="excludeAreaCode != null and excludeAreaCode != ''">
AND
t1.area_code != #{excludeAreaCode}
</if>
</where>
<if test="order != null and order != ''">
ORDER BY
@ -258,6 +264,9 @@
<if test="order == 'memberOrder'">
t1.member_order <if test="sort != null and sort != ''"><if test="sort == 'asc'">ASC</if><if test="sort == 'desc'">DESC</if></if>,
</if>
<if test="order == 'areaCode'">
t1.area_code <if test="sort != null and sort != ''"><if test="sort == 'asc'">ASC</if><if test="sort == 'desc'">DESC</if></if>,
</if>
</trim>
</if>
</select>

View File

@ -73,7 +73,7 @@
<label class="layui-form-label layui-form-label-up">选择地区 *</label>
<div class="layui-input-block layui-input-block-down">
<input type="hidden" id="areaCode" name="areaCode">
<input type="text" id="areaName" name="areaName" class="layui-input" value="" placeholder="请选择地区" maxlength="255" readonly lay-verify="required">
<input type="text" id="areaName" name="areaName" class="layui-input" value="" placeholder="请选择地区" maxlength="255" readonly lay-verify="required" style="cursor: pointer">
</div>
</div>
<div class="layui-form-item layui-layout-admin">

View File

@ -67,7 +67,7 @@
<label class="layui-form-label layui-form-label-up">选择地区 *</label>
<div class="layui-input-block layui-input-block-down">
<input type="hidden" id="areaCode" name="areaCode">
<input type="text" id="areaName" name="areaName" class="layui-input" value="" placeholder="请选择地区" maxlength="255" readonly lay-verify="required">
<input type="text" id="areaName" name="areaName" class="layui-input" value="" placeholder="请选择地区" maxlength="255" readonly lay-verify="required" style="cursor: pointer">
</div>
</div>
<div class="layui-form-item layui-layout-admin">
@ -177,6 +177,31 @@
closeBox();
});
$('#areaName').on('click', function() {
top.dialog.open({
title: '选择地区',
url: top.restAjax.path('route/area/get-select?areaName={areaName}', [encodeURI($('#areaName').val())]),
width: '600px',
height: '225px',
onClose: function() {
var selectedAreaArray = top.dialog.dialogData.selectedAreaArray;
var areaCode = '';
var areaName = '';
if(selectedAreaArray.length > 0) {
areaCode = selectedAreaArray[selectedAreaArray.length - 1].areaCode;
for(var i = 0, item; item = selectedAreaArray[i++];) {
if(areaName) {
areaName += '/';
}
areaName += item.areaName;
}
}
$('#areaCode').val(areaCode);
$('#areaName').val(areaName);
}
})
});
// 校验
form.verify({
});