bug修复
This commit is contained in:
parent
3e047407ab
commit
2b82b773a1
2
pom.xml
2
pom.xml
@ -26,7 +26,7 @@
|
|||||||
<druid.version>1.1.10</druid.version>
|
<druid.version>1.1.10</druid.version>
|
||||||
<jwt.version>0.9.1</jwt.version>
|
<jwt.version>0.9.1</jwt.version>
|
||||||
<commons.version>2.6</commons.version>
|
<commons.version>2.6</commons.version>
|
||||||
<swagger.ui.version>1.8.7</swagger.ui.version>
|
<swagger.ui.version>1.9.6</swagger.ui.version>
|
||||||
<tomcat.version>9.0.12</tomcat.version>
|
<tomcat.version>9.0.12</tomcat.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|||||||
@ -10,10 +10,17 @@ import springfox.documentation.RequestHandler;
|
|||||||
import springfox.documentation.builders.ApiInfoBuilder;
|
import springfox.documentation.builders.ApiInfoBuilder;
|
||||||
import springfox.documentation.builders.PathSelectors;
|
import springfox.documentation.builders.PathSelectors;
|
||||||
import springfox.documentation.service.ApiInfo;
|
import springfox.documentation.service.ApiInfo;
|
||||||
|
import springfox.documentation.service.ApiKey;
|
||||||
|
import springfox.documentation.service.AuthorizationScope;
|
||||||
|
import springfox.documentation.service.SecurityReference;
|
||||||
import springfox.documentation.spi.DocumentationType;
|
import springfox.documentation.spi.DocumentationType;
|
||||||
|
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||||
import springfox.documentation.spring.web.plugins.Docket;
|
import springfox.documentation.spring.web.plugins.Docket;
|
||||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @program: Iot
|
* @program: Iot
|
||||||
@ -30,38 +37,28 @@ public class SwaggerConfig {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Docket createZwRestApi() {
|
public Docket createZwRestApi() {
|
||||||
return new Docket(DocumentationType.SWAGGER_2)
|
return new Docket(DocumentationType.SWAGGER_2).groupName("2政务接口").apiInfo(apiInfo("政务管理API", "政务前后端联调api文档", "1.0")).select()
|
||||||
.groupName("政务接口")
|
|
||||||
.apiInfo(apiInfo("政务管理API", "政务前后端联调api文档", "1.0"))
|
|
||||||
.select()
|
|
||||||
//.apis(RequestHandlerSelectors.basePackage("com.zhgd.xmgl"))
|
//.apis(RequestHandlerSelectors.basePackage("com.zhgd.xmgl"))
|
||||||
.apis(basePackage("com.zhwl.zw"))
|
.apis(basePackage("com.zhwl.zw")).paths(PathSelectors.any())
|
||||||
.paths(PathSelectors.any())
|
|
||||||
//.paths(PathSelectors.regex("/zw.*"))
|
//.paths(PathSelectors.regex("/zw.*"))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Docket createRestApi() {
|
public Docket createRestApi() {
|
||||||
return new Docket(DocumentationType.SWAGGER_2)
|
return new Docket(DocumentationType.SWAGGER_2).groupName("1项目接口").apiInfo(apiInfo("项目管理API", "项目前后端联调api文档", "1.0")).select()
|
||||||
.groupName("项目接口")
|
|
||||||
.apiInfo(apiInfo("项目管理API", "项目前后端联调api文档", "1.0"))
|
|
||||||
.select()
|
|
||||||
//.apis(RequestHandlerSelectors.basePackage("com.zhgd.xmgl"))
|
//.apis(RequestHandlerSelectors.basePackage("com.zhgd.xmgl"))
|
||||||
.apis(basePackage("com.zhgd.xmgl"))
|
.apis(basePackage("com.zhgd.xmgl"))
|
||||||
//.apis(basePackage("com.zhgd.xmgl"+splitor+"com.zhgd.xmgl.device"))
|
//.apis(basePackage("com.zhgd.xmgl"+splitor+"com.zhgd.xmgl.device"))
|
||||||
.paths(PathSelectors.any())
|
.paths(PathSelectors.any())
|
||||||
|
|
||||||
//.paths(PathSelectors.regex("/xmgl.*"))
|
//.paths(PathSelectors.regex("/xmgl.*"))
|
||||||
.build();
|
.build()
|
||||||
|
/* 设置安全模式,swagger可以设置访问token */.securitySchemes(securitySchemes()).securityContexts(securityContexts());
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiInfo apiInfo(String titleName, String description, String version) {
|
private ApiInfo apiInfo(String titleName, String description, String version) {
|
||||||
return new ApiInfoBuilder()
|
return new ApiInfoBuilder().title(titleName).description(description).version(version).build();
|
||||||
.title(titleName)
|
|
||||||
.description(description)
|
|
||||||
.version(version)
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Predicate<RequestHandler> basePackage(final String basePackage) {
|
public static Predicate<RequestHandler> basePackage(final String basePackage) {
|
||||||
@ -84,4 +81,34 @@ public class SwaggerConfig {
|
|||||||
private static Optional<? extends Class<?>> declaringClass(RequestHandler input) {
|
private static Optional<? extends Class<?>> declaringClass(RequestHandler input) {
|
||||||
return Optional.fromNullable(input.declaringClass());
|
return Optional.fromNullable(input.declaringClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全模式,这里指定token通过Authorization头请求头传递
|
||||||
|
*/
|
||||||
|
private List<ApiKey> securitySchemes() {
|
||||||
|
List<ApiKey> apiKeyList = new ArrayList<ApiKey>();
|
||||||
|
apiKeyList.add(new ApiKey("Authorization", "Authorization", "header"));
|
||||||
|
return apiKeyList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全上下文
|
||||||
|
*/
|
||||||
|
private List<SecurityContext> securityContexts() {
|
||||||
|
List<SecurityContext> securityContexts = new ArrayList<>();
|
||||||
|
securityContexts.add(SecurityContext.builder().securityReferences(defaultAuth()).forPaths(PathSelectors.regex("^(?!auth).*$")).build());
|
||||||
|
return securityContexts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认的安全上引用
|
||||||
|
*/
|
||||||
|
private List<SecurityReference> defaultAuth() {
|
||||||
|
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
|
||||||
|
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
||||||
|
authorizationScopes[0] = authorizationScope;
|
||||||
|
List<SecurityReference> securityReferences = new ArrayList<>();
|
||||||
|
securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
|
||||||
|
return securityReferences;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
12
src/main/java/com/zhgd/xmgl/entity/RequestPage.java
Normal file
12
src/main/java/com/zhgd/xmgl/entity/RequestPage.java
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package com.zhgd.xmgl.entity;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RequestPage {
|
||||||
|
@ApiModelProperty(value = "第几页", example = "1")
|
||||||
|
private Integer current = 1;
|
||||||
|
@ApiModelProperty(value = "每页显示条数", example = "10")
|
||||||
|
private Integer size = 10;
|
||||||
|
}
|
||||||
@ -1,6 +1,8 @@
|
|||||||
package com.zhgd.xmgl.modules.basicdata.controller;
|
package com.zhgd.xmgl.modules.basicdata.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.zhgd.jeecg.common.api.vo.Result;
|
import com.zhgd.jeecg.common.api.vo.Result;
|
||||||
|
import com.zhgd.xmgl.modules.basicdata.controller.dto.ModuleListPageDto;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.BaseModule;
|
import com.zhgd.xmgl.modules.basicdata.entity.BaseModule;
|
||||||
import com.zhgd.xmgl.modules.basicdata.service.IBaseModuleService;
|
import com.zhgd.xmgl.modules.basicdata.service.IBaseModuleService;
|
||||||
import com.zhgd.xmgl.util.MessageUtil;
|
import com.zhgd.xmgl.util.MessageUtil;
|
||||||
@ -20,11 +22,11 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Title: Controller
|
* @Title: Controller
|
||||||
* @Description: 模块
|
* @Description: 模块
|
||||||
* @author: pds
|
* @author: pds
|
||||||
* @date: 2020-10-12
|
* @date: 2020-10-12
|
||||||
* @version: V1.0
|
* @version: V1.0
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@ -32,137 +34,148 @@ import java.util.Map;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Api(tags = "模块")
|
@Api(tags = "模块")
|
||||||
public class BaseModuleController {
|
public class BaseModuleController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IBaseModuleService baseModuleService;
|
private IBaseModuleService baseModuleService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 列表查询
|
||||||
* @return
|
*
|
||||||
*/
|
* @return
|
||||||
@ApiOperation(value = "列表查询所有模块信息", notes = "列表查询所有模块信息", httpMethod="POST")
|
*/
|
||||||
|
@ApiOperation(value = "列表查询所有模块信息", notes = "列表查询所有模块信息", httpMethod = "POST")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "moduleType", value = "模块类型,1企业模块,2项目后台模块,3企业后台,4项目看板", paramType = "query", required = false, dataType = "String"),
|
@ApiImplicitParam(name = "moduleType", value = "模块类型,1企业模块,2项目后台模块,3企业后台,4项目看板", paramType = "query", required = false, dataType = "String"),
|
||||||
@ApiImplicitParam(name = "styleType", value = "样式类型,默认查1样式", paramType = "query", required = false, dataType = "String"),
|
@ApiImplicitParam(name = "styleType", value = "样式类型,默认查1样式", paramType = "query", required = false, dataType = "String"),
|
||||||
})
|
})
|
||||||
@PostMapping(value = "/list")
|
@PostMapping(value = "/list")
|
||||||
public Result<List<BaseModule>> getModuleList(@RequestBody Map<String, Object> map) {
|
public Result<List<BaseModule>> getModuleList(@RequestBody Map<String, Object> map) {
|
||||||
List<BaseModule> pageList = baseModuleService.getModuleList(map);
|
List<BaseModule> pageList = baseModuleService.getModuleList(map);
|
||||||
return Result.success(pageList);
|
return Result.success(pageList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "查询总企业默认的模块列表", notes = "查询总企业默认的模块列表", httpMethod="POST")
|
@ApiOperation(value = "分页列表查询所有模块信息", notes = "列表查询所有模块信息", httpMethod = "POST")
|
||||||
@ApiImplicitParams({
|
@PostMapping(value = "/page")
|
||||||
@ApiImplicitParam(name = "headquartersSn", value = "总公司sn", paramType = "query", required = true, dataType = "String"),
|
public Result<Page<BaseModule>> getModuleListByPage(@RequestBody ModuleListPageDto dto) {
|
||||||
})
|
Page<BaseModule> pageList = baseModuleService.getModuleListByPage(dto);
|
||||||
@PostMapping(value = "/getCompanyModuleList")
|
return Result.success(pageList);
|
||||||
public Result<List<BaseModule>> getCompanyModuleList(@RequestBody Map<String, Object> map) {
|
}
|
||||||
return Result.success(baseModuleService.getCompanyModuleList(map));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "查询企业下项目默认的模块列表", notes = "查询企业下项目默认的模块列表", httpMethod="POST")
|
@ApiOperation(value = "查询总企业默认的模块列表", notes = "查询总企业默认的模块列表", httpMethod = "POST")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "String"),
|
@ApiImplicitParam(name = "headquartersSn", value = "总公司sn", paramType = "query", required = true, dataType = "String"),
|
||||||
})
|
})
|
||||||
@PostMapping(value = "/getProjectModuleList")
|
@PostMapping(value = "/getCompanyModuleList")
|
||||||
public Result<List<BaseModule>> getProjectModuleList(@RequestBody Map<String, Object> map) {
|
public Result<List<BaseModule>> getCompanyModuleList(@RequestBody Map<String, Object> map) {
|
||||||
return Result.success(baseModuleService.getProjectModuleList(map));
|
return Result.success(baseModuleService.getCompanyModuleList(map));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "查询企业用户配置的模块列表", notes = "查询企业用户配置的模块列表", httpMethod="POST")
|
@ApiOperation(value = "查询企业下项目默认的模块列表", notes = "查询企业下项目默认的模块列表", httpMethod = "POST")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "userId", value = "人员ID", paramType = "query", required = true, dataType = "String"),
|
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "String"),
|
||||||
@ApiImplicitParam(name = "styleType", value = "样式类型", paramType = "query", required = true, dataType = "String"),
|
})
|
||||||
})
|
@PostMapping(value = "/getProjectModuleList")
|
||||||
@PostMapping(value = "/getUserModuleList")
|
public Result<List<BaseModule>> getProjectModuleList(@RequestBody Map<String, Object> map) {
|
||||||
public Result<List<BaseModule>> getUserModuleList(@RequestBody Map<String, Object> map) {
|
return Result.success(baseModuleService.getProjectModuleList(map));
|
||||||
return Result.success(baseModuleService.getUserModuleList(map));
|
}
|
||||||
}
|
|
||||||
/**
|
@ApiOperation(value = "查询企业用户配置的模块列表", notes = "查询企业用户配置的模块列表", httpMethod = "POST")
|
||||||
* 添加
|
@ApiImplicitParams({
|
||||||
* @param baseModule
|
@ApiImplicitParam(name = "userId", value = "人员ID", paramType = "query", required = true, dataType = "String"),
|
||||||
* @return
|
@ApiImplicitParam(name = "styleType", value = "样式类型", paramType = "query", required = true, dataType = "String"),
|
||||||
*/
|
})
|
||||||
@ApiOperation(value = " 添加模块信息", notes = "添加模块信息" , httpMethod="POST")
|
@PostMapping(value = "/getUserModuleList")
|
||||||
@PostMapping(value = "/add")
|
public Result<List<BaseModule>> getUserModuleList(@RequestBody Map<String, Object> map) {
|
||||||
public Result<BaseModule> add(@RequestBody BaseModule baseModule) {
|
return Result.success(baseModuleService.getUserModuleList(map));
|
||||||
Result<BaseModule> result = new Result<BaseModule>();
|
}
|
||||||
try {
|
|
||||||
baseModuleService.save(baseModule);
|
/**
|
||||||
|
* 添加
|
||||||
|
*
|
||||||
|
* @param baseModule
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = " 添加模块信息", notes = "添加模块信息", httpMethod = "POST")
|
||||||
|
@PostMapping(value = "/add")
|
||||||
|
public Result<BaseModule> add(@RequestBody BaseModule baseModule) {
|
||||||
|
Result<BaseModule> result = new Result<BaseModule>();
|
||||||
|
try {
|
||||||
|
baseModuleService.save(baseModule);
|
||||||
result.successMsg(MessageUtil.get("addSucess"));
|
result.successMsg(MessageUtil.get("addSucess"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.info(e.getMessage());
|
log.info(e.getMessage());
|
||||||
result.error500(MessageUtil.get("failErr"));
|
result.error500(MessageUtil.get("failErr"));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑
|
* 编辑
|
||||||
* @param baseModule
|
*
|
||||||
* @return
|
* @param baseModule
|
||||||
*/
|
* @return
|
||||||
@ApiOperation(value = "编辑模块信息", notes = "编辑模块信息" , httpMethod="POST")
|
*/
|
||||||
@PostMapping(value = "/edit")
|
@ApiOperation(value = "编辑模块信息", notes = "编辑模块信息", httpMethod = "POST")
|
||||||
public Result<BaseModule> edit(@RequestBody BaseModule baseModule) {
|
@PostMapping(value = "/edit")
|
||||||
Result<BaseModule> result = new Result<BaseModule>();
|
public Result<BaseModule> edit(@RequestBody BaseModule baseModule) {
|
||||||
BaseModule baseModuleEntity = baseModuleService.getById(baseModule.getModuleId());
|
Result<BaseModule> result = new Result<BaseModule>();
|
||||||
if(baseModuleEntity==null) {
|
BaseModule baseModuleEntity = baseModuleService.getById(baseModule.getModuleId());
|
||||||
|
if (baseModuleEntity == null) {
|
||||||
result.error500(MessageUtil.get("notFindErr"));
|
result.error500(MessageUtil.get("notFindErr"));
|
||||||
}else {
|
} else {
|
||||||
boolean ok = baseModuleService.updateById(baseModule);
|
boolean ok = baseModuleService.updateById(baseModule);
|
||||||
//TODO 返回false说明什么?
|
if (ok) {
|
||||||
if(ok) {
|
|
||||||
result.successMsg(MessageUtil.get("editSucess"));
|
result.successMsg(MessageUtil.get("editSucess"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id删除
|
* 通过id删除
|
||||||
* @param
|
*
|
||||||
* @return
|
* @param
|
||||||
*/
|
* @return
|
||||||
@ApiOperation(value = "删除模块信息", notes = "删除模块信息" , httpMethod="POST")
|
*/
|
||||||
@ApiImplicitParam(name = "moduleId", value = "模块ID", paramType = "query", required = true, dataType = "Integer")
|
@ApiOperation(value = "删除模块信息", notes = "删除模块信息", httpMethod = "POST")
|
||||||
@PostMapping(value = "/delete")
|
@ApiImplicitParam(name = "moduleId", value = "模块ID", paramType = "query", required = true, dataType = "Integer")
|
||||||
public Result<BaseModule> delete(@RequestBody Map<String,Object> map) {
|
@PostMapping(value = "/delete")
|
||||||
Result<BaseModule> result = new Result<BaseModule>();
|
public Result<BaseModule> delete(@RequestBody Map<String, Object> map) {
|
||||||
BaseModule baseModule = baseModuleService.getById(MapUtils.getString(map,"moduleId"));
|
Result<BaseModule> result = new Result<BaseModule>();
|
||||||
if(baseModule==null) {
|
BaseModule baseModule = baseModuleService.getById(MapUtils.getString(map, "moduleId"));
|
||||||
|
if (baseModule == null) {
|
||||||
result.error500(MessageUtil.get("notFindErr"));
|
result.error500(MessageUtil.get("notFindErr"));
|
||||||
}else {
|
} else {
|
||||||
boolean ok = baseModuleService.removeById(MapUtils.getString(map,"moduleId"));
|
boolean ok = baseModuleService.removeById(MapUtils.getString(map, "moduleId"));
|
||||||
if(ok) {
|
if (ok) {
|
||||||
result.successMsg(MessageUtil.get("deleteSucess"));
|
result.successMsg(MessageUtil.get("deleteSucess"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
/**
|
* 通过id查询
|
||||||
* 通过id查询
|
*
|
||||||
* @param
|
* @param
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "通过id查询模块信息", notes = "通过id查询模块信息" , httpMethod="POST")
|
@ApiOperation(value = "通过id查询模块信息", notes = "通过id查询模块信息", httpMethod = "POST")
|
||||||
@ApiImplicitParam(name = "moduleId", value = "模块ID", paramType = "query", required = true, dataType = "Integer")
|
@ApiImplicitParam(name = "moduleId", value = "模块ID", paramType = "query", required = true, dataType = "Integer")
|
||||||
@PostMapping(value = "/queryById")
|
@PostMapping(value = "/queryById")
|
||||||
public Result<BaseModule> queryById(@RequestBody Map<String,Object> map) {
|
public Result<BaseModule> queryById(@RequestBody Map<String, Object> map) {
|
||||||
Result<BaseModule> result = new Result<BaseModule>();
|
Result<BaseModule> result = new Result<BaseModule>();
|
||||||
BaseModule baseModule = baseModuleService.getById(MapUtils.getString(map,"moduleId"));
|
BaseModule baseModule = baseModuleService.getById(MapUtils.getString(map, "moduleId"));
|
||||||
if(baseModule==null) {
|
if (baseModule == null) {
|
||||||
result.error500(MessageUtil.get("notFindErr"));
|
result.error500(MessageUtil.get("notFindErr"));
|
||||||
}else {
|
} else {
|
||||||
result.setResult(baseModule);
|
result.setResult(baseModule);
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.zhgd.xmgl.modules.basicdata.controller.dto;
|
||||||
|
|
||||||
|
import com.zhgd.xmgl.entity.RequestPage;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ModuleListPageDto extends RequestPage {
|
||||||
|
@ApiModelProperty("模块类型,1企业模块,2项目后台模块,3企业后台,4项目看板")
|
||||||
|
private String moduleType;
|
||||||
|
@ApiModelProperty("样式类型,默认查1样式")
|
||||||
|
private String styleType;
|
||||||
|
}
|
||||||
@ -3,9 +3,12 @@ package com.zhgd.xmgl.modules.basicdata.mapper;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.zhgd.xmgl.modules.basicdata.controller.dto.ModuleListPageDto;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.BaseModule;
|
import com.zhgd.xmgl.modules.basicdata.entity.BaseModule;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 模块
|
* @Description: 模块
|
||||||
@ -25,4 +28,6 @@ public interface BaseModuleMapper extends BaseMapper<BaseModule> {
|
|||||||
List<BaseModule> getProjectUserModuleList(Map<String, Object> param);
|
List<BaseModule> getProjectUserModuleList(Map<String, Object> param);
|
||||||
|
|
||||||
List<BaseModule> getModuleList(Map<String, Object> map);
|
List<BaseModule> getModuleList(Map<String, Object> map);
|
||||||
|
|
||||||
|
Page<BaseModule> getModuleListByPage(Page<BaseModule> page, @Param("dto") ModuleListPageDto dto);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,13 +45,27 @@
|
|||||||
SELECT a.*
|
SELECT a.*
|
||||||
from base_module a
|
from base_module a
|
||||||
<where>
|
<where>
|
||||||
<if test="moduleType!=null and moduleType!=''">
|
<if test="moduleType != null and moduleType != ''">
|
||||||
and a.module_type=#{moduleType}
|
and a.module_type=#{moduleType}
|
||||||
</if>
|
</if>
|
||||||
<if test="styleType!=null and styleType!=''">
|
<if test="styleType != null and styleType != ''">
|
||||||
and a.style_type=#{styleType}
|
and a.style_type=#{styleType}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY a.module_type,a.label_sort_num,a.label_name,a.module_id
|
ORDER BY a.module_type,a.label_sort_num,a.label_name,a.module_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getModuleListByPage" resultType="com.zhgd.xmgl.modules.basicdata.entity.BaseModule">
|
||||||
|
SELECT a.*
|
||||||
|
from base_module a
|
||||||
|
<where>
|
||||||
|
<if test="dto.moduleType != null and dto.moduleType != ''">
|
||||||
|
and a.module_type=#{dto.moduleType}
|
||||||
|
</if>
|
||||||
|
<if test="dto.styleType != null and dto.styleType != ''">
|
||||||
|
and a.style_type=#{dto.styleType}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
ORDER BY a.module_type,a.label_sort_num,a.label_name,a.module_id
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package com.zhgd.xmgl.modules.basicdata.service;
|
package com.zhgd.xmgl.modules.basicdata.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.zhgd.xmgl.modules.basicdata.controller.dto.ModuleListPageDto;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.BaseModule;
|
import com.zhgd.xmgl.modules.basicdata.entity.BaseModule;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
@ -21,4 +23,6 @@ public interface IBaseModuleService extends IService<BaseModule> {
|
|||||||
List<BaseModule> getUserModuleList(Map<String, Object> map);
|
List<BaseModule> getUserModuleList(Map<String, Object> map);
|
||||||
|
|
||||||
List<BaseModule> getModuleList(Map<String, Object> map);
|
List<BaseModule> getModuleList(Map<String, Object> map);
|
||||||
|
|
||||||
|
Page<BaseModule> getModuleListByPage(ModuleListPageDto dto);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
package com.zhgd.xmgl.modules.basicdata.service.impl;
|
package com.zhgd.xmgl.modules.basicdata.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.zhgd.xmgl.modules.basicdata.controller.dto.ModuleListPageDto;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.BaseModule;
|
import com.zhgd.xmgl.modules.basicdata.entity.BaseModule;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.CompanyConfig;
|
import com.zhgd.xmgl.modules.basicdata.entity.CompanyConfig;
|
||||||
import com.zhgd.xmgl.modules.basicdata.mapper.BaseModuleMapper;
|
import com.zhgd.xmgl.modules.basicdata.mapper.BaseModuleMapper;
|
||||||
@ -9,8 +12,6 @@ import com.zhgd.xmgl.modules.basicdata.service.IBaseModuleService;
|
|||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -19,7 +20,7 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* @Description: 模块
|
* @Description: 模块
|
||||||
* @author: pds
|
* @author: pds
|
||||||
* @date: 2020-10-12
|
* @date: 2020-10-12
|
||||||
* @version: V1.0
|
* @version: V1.0
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@ -32,24 +33,24 @@ public class BaseModuleServiceImpl extends ServiceImpl<BaseModuleMapper, BaseMod
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BaseModule> getCompanyModuleList(Map<String, Object> map) {
|
public List<BaseModule> getCompanyModuleList(Map<String, Object> map) {
|
||||||
QueryWrapper<CompanyConfig> queryWrapper=new QueryWrapper<>();
|
QueryWrapper<CompanyConfig> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.lambda().eq(CompanyConfig::getCompanySn,MapUtils.getString(map,"headquartersSn"));
|
queryWrapper.lambda().eq(CompanyConfig::getCompanySn, MapUtils.getString(map, "headquartersSn"));
|
||||||
CompanyConfig companyConfig=companyConfigMapper.selectOne(queryWrapper);
|
CompanyConfig companyConfig = companyConfigMapper.selectOne(queryWrapper);
|
||||||
if(companyConfig!=null&&companyConfig.getStyleType()!=null){
|
if (companyConfig != null && companyConfig.getStyleType() != null) {
|
||||||
map.put("styleType",companyConfig.getStyleType());
|
map.put("styleType", companyConfig.getStyleType());
|
||||||
}else{
|
} else {
|
||||||
map.put("styleType",1);
|
map.put("styleType", 1);
|
||||||
}
|
}
|
||||||
return baseModuleMapper.getCompanyModuleList(map);
|
return baseModuleMapper.getCompanyModuleList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BaseModule> getProjectModuleList(Map<String, Object> map) {
|
public List<BaseModule> getProjectModuleList(Map<String, Object> map) {
|
||||||
CompanyConfig companyConfig=companyConfigMapper.selectConfigByProject(MapUtils.getString(map,"projectSn"));
|
CompanyConfig companyConfig = companyConfigMapper.selectConfigByProject(MapUtils.getString(map, "projectSn"));
|
||||||
if(companyConfig!=null&&companyConfig.getStyleType()!=null){
|
if (companyConfig != null && companyConfig.getStyleType() != null) {
|
||||||
map.put("styleType",companyConfig.getStyleType());
|
map.put("styleType", companyConfig.getStyleType());
|
||||||
}else{
|
} else {
|
||||||
map.put("styleType",1);
|
map.put("styleType", 1);
|
||||||
}
|
}
|
||||||
return baseModuleMapper.getProjectModuleList(map);
|
return baseModuleMapper.getProjectModuleList(map);
|
||||||
}
|
}
|
||||||
@ -61,8 +62,17 @@ public class BaseModuleServiceImpl extends ServiceImpl<BaseModuleMapper, BaseMod
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BaseModule> getModuleList(Map<String, Object> map) {
|
public List<BaseModule> getModuleList(Map<String, Object> map) {
|
||||||
Integer styleType= MapUtils.getInteger(map,"styleType",1);
|
Integer styleType = MapUtils.getInteger(map, "styleType", 1);
|
||||||
map.put("styleType",styleType);
|
map.put("styleType", styleType);
|
||||||
return baseModuleMapper.getModuleList(map);
|
return baseModuleMapper.getModuleList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<BaseModule> getModuleListByPage(ModuleListPageDto dto) {
|
||||||
|
Page<BaseModule> page = new Page<>(dto.getCurrent(), dto.getSize());
|
||||||
|
if (dto.getStyleType() == null) {
|
||||||
|
dto.setStyleType("1");
|
||||||
|
}
|
||||||
|
return baseModuleMapper.getModuleListByPage(page, dto);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user