diff --git a/src/main/java/cn/com/tenlion/usercenter/controller/api/teammember/TeamMemberController.java b/src/main/java/cn/com/tenlion/usercenter/controller/api/teammember/TeamMemberController.java index 64c6cd5..06952a3 100644 --- a/src/main/java/cn/com/tenlion/usercenter/controller/api/teammember/TeamMemberController.java +++ b/src/main/java/cn/com/tenlion/usercenter/controller/api/teammember/TeamMemberController.java @@ -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 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> listPageByAreaCode(@PathVariable("areaCode") String areaCode, + @RequestParam(name = "sort", required = false) String sort, + ListPage page) { + Map 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 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> listPageAllByAreaCode(@PathVariable("areaCode") String areaCode, + @RequestParam(name = "sort", required = false) String sort, + ListPage page) { + Map 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 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> listPageSubByAreaCode(@PathVariable("areaCode") String areaCode, + @RequestParam(name = "sort", required = false) String sort, + ListPage page) { + Map params = requestParams(); + page.setParams(params); + return teamMemberService.listPageSubByAreaCodeAndSort(areaCode, sort, page); + } + } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/usercenter/controller/resource/teammember/TeamMemberResourceController.java b/src/main/java/cn/com/tenlion/usercenter/controller/resource/teammember/TeamMemberResourceController.java index 283b2d5..a48db9e 100644 --- a/src/main/java/cn/com/tenlion/usercenter/controller/resource/teammember/TeamMemberResourceController.java +++ b/src/main/java/cn/com/tenlion/usercenter/controller/resource/teammember/TeamMemberResourceController.java @@ -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 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> listPageByAreaCode(@PathVariable("areaCode") String areaCode, + @RequestParam(name = "sort", required = false) String sort, + ListPage page) { + Map 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 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> listPageAllByAreaCode(@PathVariable("areaCode") String areaCode, + @RequestParam(name = "sort", required = false) String sort, + ListPage page) { + Map 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 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> listPageSubByAreaCode(@PathVariable("areaCode") String areaCode, + @RequestParam(name = "sort", required = false) String sort, + ListPage page) { + Map params = requestParams(); + page.setParams(params); + return teamMemberService.listPageSubByAreaCodeAndSort(areaCode, sort, page); + } + } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/usercenter/service/teammember/ITeamMemberService.java b/src/main/java/cn/com/tenlion/usercenter/service/teammember/ITeamMemberService.java index 4eb6d2c..6907a09 100644 --- a/src/main/java/cn/com/tenlion/usercenter/service/teammember/ITeamMemberService.java +++ b/src/main/java/cn/com/tenlion/usercenter/service/teammember/ITeamMemberService.java @@ -237,4 +237,61 @@ public interface ITeamMemberService { * @return */ List listByAreaCodeAndRoleId(String areaCode, String roleId); + + /** + * 队伍人员列表 + * + * @param areaCode 区域编码 + * @param sort 排序方式 + * @return + */ + List listByAreaCodeAndSort(String areaCode, String sort); + + /** + * 队伍全部人员列表 + * + * @param areaCode 区域编码 + * @param sort 排序方式 + * @return + */ + List listAllByAreaCodeAndSort(String areaCode, String sort); + + /** + * 区域下队伍人员列表 + * + * @param areaCode 区域编码 + * @param sort 排序方式 + * @return + */ + List listSubByAreaCodeAndSort(String areaCode, String sort); + + /** + * 队伍人员分页列表 + * + * @param areaCode 区域编码 + * @param sort 排序方式 + * @param page 分页 + * @return + */ + SuccessResultList> listPageByAreaCodeAndSort(String areaCode, String sort, ListPage page); + + /** + * 队伍全部人员分页列表 + * + * @param areaCode 区域编码 + * @param sort 排序方式 + * @param page 分页 + * @return + */ + SuccessResultList> listPageAllByAreaCodeAndSort(String areaCode, String sort, ListPage page); + + /** + * 区域下队伍人员分页列表 + * + * @param areaCode 区域编码 + * @param sort 排序方式 + * @param page 分页 + * @return + */ + SuccessResultList> listPageSubByAreaCodeAndSort(String areaCode, String sort, ListPage page); } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/usercenter/service/teammember/impl/TeamMemberServiceImpl.java b/src/main/java/cn/com/tenlion/usercenter/service/teammember/impl/TeamMemberServiceImpl.java index d1f7568..be262e0 100644 --- a/src/main/java/cn/com/tenlion/usercenter/service/teammember/impl/TeamMemberServiceImpl.java +++ b/src/main/java/cn/com/tenlion/usercenter/service/teammember/impl/TeamMemberServiceImpl.java @@ -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 listByAreaCodeAndSort(String areaCode, String sort) { + Map 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 listAllByAreaCodeAndSort(String areaCode, String sort) { + Map 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 listSubByAreaCodeAndSort(String areaCode, String sort) { + Map 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> 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> 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> 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); + } + /** * 设置用户 * diff --git a/src/main/resources/mybatis/mapper/teammember/team-member-mapper.xml b/src/main/resources/mybatis/mapper/teammember/team-member-mapper.xml index 0e6f2ee..8a5686a 100644 --- a/src/main/resources/mybatis/mapper/teammember/team-member-mapper.xml +++ b/src/main/resources/mybatis/mapper/teammember/team-member-mapper.xml @@ -219,12 +219,6 @@ FROM city_team_member t1 - - AND ( - - t1.id LIKE CONCAT('%', #{keywords}, '%') - ) - AND LEFT(t1.gmt_create, 10) = ]]> #{startTime} @@ -251,6 +245,18 @@ #{userIds[${index}]} + + AND + t1.area_code = #{areaCode} + + + AND + t1.area_code LIKE CONCAT(#{areaCodeLike}, '%') + + + AND + t1.area_code != #{excludeAreaCode} + ORDER BY @@ -258,6 +264,9 @@ t1.member_order ASCDESC, + + t1.area_code ASCDESC, + diff --git a/src/main/resources/templates/team/save.html b/src/main/resources/templates/team/save.html index da1f1e5..a525d4f 100644 --- a/src/main/resources/templates/team/save.html +++ b/src/main/resources/templates/team/save.html @@ -73,7 +73,7 @@
- +
diff --git a/src/main/resources/templates/team/update.html b/src/main/resources/templates/team/update.html index fd90cff..0d4381a 100644 --- a/src/main/resources/templates/team/update.html +++ b/src/main/resources/templates/team/update.html @@ -67,7 +67,7 @@
- +
@@ -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({ });