| | |
| | | <parent> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-parent</artifactId> |
| | | <version>2.7.3</version> |
| | | <version>2.3.0.RELEASE</version> |
| | | <relativePath/> |
| | | </parent> |
| | | |
| | |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.commons</groupId> |
| | | <artifactId>commons-text</artifactId> |
| | | <version>1.1</version> |
| | | </dependency> |
| | | <!--swagger--> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger2</artifactId> |
| | | <version>3.0.0</version> |
| | | <version>2.9.2</version> |
| | | </dependency> |
| | | <!--swagger ui--> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger-ui</artifactId> |
| | | <version>3.0.0</version> |
| | | <version>2.9.2</version> |
| | | </dependency> |
| | | <!--<dependency> |
| | | <groupId>org.thymeleaf.extras</groupId> |
| | |
| | | * @author |
| | | */ |
| | | @SuppressWarnings("ALL") |
| | | @Configuration |
| | | //@Configuration |
| | | public class ShiroConfig { |
| | | @ConfigurationProperties(prefix = "spring.datasource") |
| | | @Bean |
| | |
| | | package com.lf.server.config; |
| | | |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import springfox.documentation.builders.ApiInfoBuilder; |
| | | import springfox.documentation.builders.PathSelectors; |
| | | import springfox.documentation.builders.RequestHandlerSelectors; |
| | | import springfox.documentation.service.ApiInfo; |
| | | import springfox.documentation.spi.DocumentationType; |
| | | import springfox.documentation.spring.web.plugins.Docket; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | /** |
| | |
| | | @Configuration |
| | | @EnableSwagger2 |
| | | public class SwaggerConfig { |
| | | // |
| | | @Bean |
| | | public Docket createRestApi() { |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | .apiInfo(apiInfo()) |
| | | .select() |
| | | .apis(RequestHandlerSelectors.basePackage("com.lf.server.controller")) |
| | | .paths(PathSelectors.any()).build(); |
| | | } |
| | | |
| | | private ApiInfo apiInfo() { |
| | | return new ApiInfoBuilder() |
| | | .title("Spring Bootæ¥å£API") |
| | | .description("Spring Bootç¤ºä¾æ¥å£API") |
| | | .version("1.0").build(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.lf.server.controller; |
| | | |
| | | import com.lf.server.entity.all.HttpStatus; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | |
| | | /** |
| | | * Controlleråºç±» |
| | | * @author www |
| | | */ |
| | | public class BaseController { |
| | | public Log log = LogFactory.getLog(getClass()); |
| | | |
| | | public <T> ResponseMsg<T> success(T result) { |
| | | return new ResponseMsg<T>(HttpStatus.OK, result); |
| | | } |
| | | |
| | | public <T> ResponseMsg<T> success(String msg, T result) { |
| | | return new ResponseMsg<T>(HttpStatus.OK, msg, result); |
| | | } |
| | | |
| | | public <T> ResponseMsg<T> success(int count, T result) { |
| | | return new ResponseMsg<T>(HttpStatus.OK, count, result); |
| | | } |
| | | |
| | | public <T> ResponseMsg<T> success(String msg, int count, T result) { |
| | | return new ResponseMsg<T>(HttpStatus.OK, msg, count, result); |
| | | } |
| | | |
| | | public <T> ResponseMsg<T> fail(T result) { |
| | | return new ResponseMsg<T>(HttpStatus.ERROR, result); |
| | | } |
| | | |
| | | public <T> ResponseMsg<T> fail(String msg, T result) { |
| | | return new ResponseMsg<T>(HttpStatus.ERROR, msg, result); |
| | | } |
| | | } |
| | |
| | | package com.lf.server.controller.data; |
| | | |
| | | import com.lf.server.controller.BaseController; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.data.DepEntity; |
| | | import com.lf.server.entity.data.DictEntity; |
| | | import com.lf.server.service.data.DepService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | * @date 2022-09-23 |
| | | */ |
| | | |
| | | @Api(tags = "ç»ç»æºæ") |
| | | @RestController |
| | | @RequestMapping("/dep") |
| | | public class DepController { |
| | | public class DepController extends BaseController { |
| | | @Autowired |
| | | DepService depService; |
| | | |
| | | @RequestMapping(value ="/insertDep", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer insertDep(DepEntity depEntity){ |
| | | @ApiOperation(value = "æå
¥æ°æ®") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "DepEntity", value = "åå
¸å®ä½ç±»", dataType = "com.lf.server.entity.data.DepEntity", paramType = "body", example = "") |
| | | }) |
| | | @RequestMapping(value = "/insertDep", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> insertDep(DepEntity depEntity) { |
| | | try { |
| | | int count = depService.insertDep(depEntity); |
| | | |
| | | return depService.insertDep(depEntity); |
| | | } |
| | | |
| | | @RequestMapping(value ="/insertDes", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer insertDes(@RequestBody List<DepEntity> depEntity){ |
| | | |
| | | return depService.insertDeps(depEntity); |
| | | } |
| | | @ResponseBody |
| | | @RequestMapping(value ="/deleteDep", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer deleteDep(int id){ |
| | | return depService.deleteDep(id); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value ="/deleteDeps", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer deleteDeps(@RequestBody List<Integer> ids){ |
| | | if(!ids.isEmpty()){ |
| | | return depService.deleteDeps(ids); |
| | | }else { |
| | | return -1; |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æå
¥å¤æ¡æ°æ®") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "DepEntity", value = "åå
¸å®ä½ç±»", dataType = "com.lf.server.entity.data.DepEntity", paramType = "body", example = "") |
| | | }) |
| | | @RequestMapping(value = "/insertDes", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> insertDes(@RequestBody List<DepEntity> depEntity) { |
| | | try { |
| | | int count = depService.insertDeps(depEntity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "å é¤ä¸æ¡æ°æ®") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "主é®ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/deleteDep") |
| | | public ResponseMsg<Integer> deleteDep(int id) { |
| | | try { |
| | | int count = depService.deleteDep(id); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "å é¤å¤æ¡æ°æ®") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "ids", value = "主é®ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/deleteDeps") |
| | | public ResponseMsg<Integer> deleteDeps(List<Integer> ids) { |
| | | try { |
| | | if (ids == null || ids.isEmpty()) { |
| | | return fail("idæ°ç»ä¸è½ä¸ºç©º", -1); |
| | | } |
| | | |
| | | int count = depService.deleteDeps(ids); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æ´æ°ä¸æ¡æ°æ®") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "depEntity", value = "主é®IDéå", dataType = "DepEntity", paramType = "body", example = "") |
| | | }) |
| | | @ResponseBody |
| | | @RequestMapping(value ="/updateDep", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer updateDep(DepEntity depEntity){ |
| | | return depService.updateDep(depEntity); |
| | | @RequestMapping(value = "/updateDep", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> updateDep(DepEntity depEntity) { |
| | | try { |
| | | int count = depService.updateDep(depEntity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @GetMapping(value ="/selectDep") |
| | | public DepEntity selectDep(int id){ |
| | | return depService.selectDep(id); |
| | | @ApiOperation(value = "æ ¹æ®IDæ¥è¯¢") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "主é®ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectDep") |
| | | public ResponseMsg<DepEntity> selectDep(int id) { |
| | | try { |
| | | DepEntity de = depService.selectDep(id); |
| | | return success(de); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @GetMapping(value ="/selectDepAll") |
| | | public List<DepEntity> selectDepAll( ){ |
| | | return depService.selectDepAll( ); |
| | | @ApiOperation(value = "æ¥è¯¢æææ°æ®") |
| | | @GetMapping(value = "/selectDepAll") |
| | | public ResponseMsg<List<DepEntity>> selectDepAll() { |
| | | try { |
| | | List<DepEntity> list = depService.selectDepAll(); |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | package com.lf.server.controller.data; |
| | | |
| | | |
| | | import com.lf.server.controller.BaseController; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.data.DictEntity; |
| | | import com.lf.server.service.data.DictService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | |
| | | /** |
| | | * åå
¸ç®¡ç |
| | | * @author sws |
| | | * @author SWS + WWW |
| | | * @date 2022-09.26 |
| | | */ |
| | | @Api(tags = "DictController", description = "åå
¸ç®¡ç") |
| | | @Api(tags = "åå
¸ç®¡ç") |
| | | @RestController |
| | | @RequestMapping("/Dict") |
| | | public class DictController { |
| | | @RequestMapping("/dict") |
| | | public class DictController extends BaseController { |
| | | @Autowired |
| | | DictService dictService; |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢è®°å½æ°", notes = "æ¥è¯¢è®°å½æ°") |
| | | @ApiOperation(value = "æ¥è¯¢è®°å½æ°") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "tab", value = "表å", dataType = "String", paramType = "query", required = false, example = "sys_dict") |
| | | }) |
| | | @GetMapping({"/selectCount"}) |
| | | public Integer selectCount(String tab) { |
| | | return dictService.selectCount(tab); |
| | | public ResponseMsg<Integer> selectCount(String tab) { |
| | | try { |
| | | int count = dictService.selectCount(tab); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "å页æ¥è¯¢", notes = "å页æ¥è¯¢") |
| | | @ApiOperation(value = "å页æ¥è¯¢") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "tab", value = "表å", dataType = "String", paramType = "query", required = false, example = "sys_dict"), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯é¡µæ¡æ°", dataType = "Integer", paramType = "query", required = false, example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "å页索å¼ï¼ä»0å¼å§ï¼", dataType = "Integer", paramType = "query", required = false, example = "0") |
| | | @ApiImplicitParam(name = "tab", value = "表å", dataType = "String", paramType = "query", example = "sys_dict"), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯é¡µæ¡æ°", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "å页索å¼ï¼ä»0å¼å§ï¼", dataType = "Integer", paramType = "query", example = "0") |
| | | }) |
| | | @GetMapping(value = "/selectByPage") |
| | | public List<DictEntity> selectByPage(String tab, Integer pageSize, Integer pageIndex) { |
| | | if (pageSize < 1 || pageIndex < 0) { |
| | | return null; |
| | | } |
| | | public ResponseMsg<List<DictEntity>> selectByPage(String tab, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 0) { |
| | | return fail("å页æ°å°äº1æå页索å¼å°äº0", null); |
| | | } |
| | | |
| | | return dictService.selectByPage(tab, pageSize, pageSize * pageIndex); |
| | | } |
| | | List<DictEntity> rs = dictService.selectByPage(tab, pageSize, pageSize * pageIndex); |
| | | |
| | | @RequestMapping(value = "/insertDict", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer insertDict(DictEntity dictEntity) { |
| | | |
| | | return dictService.insertDict(dictEntity); |
| | | } |
| | | |
| | | @RequestMapping(value = "/insertDicts", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer insertDicts(@RequestBody List<DictEntity> dictEntity) { |
| | | |
| | | return dictService.insertDicts(dictEntity); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/deleteDict", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer deleteStyle(int id) { |
| | | return dictService.deleteDict(id); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/deleteDicts", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer deleteDicts(@RequestBody List<Integer> ids) { |
| | | if (!ids.isEmpty()) { |
| | | return dictService.deleteDicts(ids); |
| | | } else { |
| | | return -1; |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/updateDict", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer updateDict(DictEntity dictEntity) { |
| | | return dictService.updateDict(dictEntity); |
| | | @ApiOperation(value = "å页æ¥è¯¢å¹¶è¿åè®°å½æ°") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "tab", value = "表å", dataType = "String", paramType = "query", example = "sys_dict"), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯é¡µæ¡æ°", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "å页索å¼ï¼ä»0å¼å§ï¼", dataType = "Integer", paramType = "query", example = "0") |
| | | }) |
| | | @GetMapping(value = "/selectByPageAndCount") |
| | | public ResponseMsg<List<DictEntity>> selectByPageAndCount(String tab, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 0) { |
| | | return fail("å页æ°å°äº1æå页索å¼å°äº0", null); |
| | | } |
| | | |
| | | int count = dictService.selectCount(tab); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | |
| | | List<DictEntity> rs = dictService.selectByPage(tab, pageSize, pageSize * pageIndex); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æå
¥åå
¸") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "dictEntity", value = "åå
¸å®ä½ç±»", dataType = "com.lf.server.entity.data.DictEntity", paramType = "body", example = "") |
| | | }) |
| | | @PostMapping(value = "/insertDict", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> insertDict(DictEntity dictEntity) { |
| | | try { |
| | | int count = dictService.insertDict(dictEntity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æå
¥å¤æ¡åå
¸") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "dictEntity", value = "åå
¸å®ä½ç±»éå", dataType = "List<DictEntity>", paramType = "body", example = "") |
| | | }) |
| | | @PostMapping(value = "/insertDicts", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> insertDicts(@RequestBody List<DictEntity> dictEntity) { |
| | | try { |
| | | int count = dictService.insertDicts(dictEntity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "å é¤ä¸æ¡åå
¸") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "åå
¸ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/deleteDict") |
| | | public ResponseMsg<Integer> deleteDict(int id) { |
| | | try { |
| | | int count = dictService.deleteDict(id); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "å é¤å¤æ¡åå
¸") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "ids", value = "åå
¸IDéå", dataType = "List<Integer>", paramType = "query", example = "1,2") |
| | | }) |
| | | @GetMapping(value = "/deleteDicts") |
| | | public ResponseMsg<Integer> deleteDicts(List<Integer> ids) { |
| | | try { |
| | | if (ids == null || ids.isEmpty()) { |
| | | return fail("idæ°ç»ä¸è½ä¸ºç©º", -1); |
| | | } |
| | | |
| | | int count = dictService.deleteDicts(ids); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æ´æ°ä¸æ¡åå
¸") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "dictEntity", value = "åå
¸IDéå", dataType = "DictEntity", paramType = "body", example = "") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/updateDict", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> updateDict(DictEntity dictEntity) { |
| | | try { |
| | | int count = dictService.updateDict(dictEntity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ¹æ®IDæ¥è¯¢åå
¸") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "åå
¸ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectDict") |
| | | public DictEntity selectDict(int id) { |
| | | return dictService.selectDict(id); |
| | | public ResponseMsg<DictEntity> selectDict(int id) { |
| | | try { |
| | | DictEntity de = dictService.selectDict(id); |
| | | |
| | | return success(de); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢ææåå
¸") |
| | | @GetMapping(value = "/selectDictAll") |
| | | public List<DictEntity> selectDictAll() { |
| | | return dictService.selectDictAll(); |
| | | public ResponseMsg<List<DictEntity>> selectDictAll() { |
| | | try { |
| | | List<DictEntity> list = dictService.selectDictAll(); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢åå
¸ä¸çææè¡¨å") |
| | | @GetMapping(value = "/selectDictTab") |
| | | public List<DictEntity> selectDictTab() { |
| | | return dictService.selectDictTab(); |
| | | public ResponseMsg<List<DictEntity>> selectDictTab() { |
| | | try { |
| | | List<DictEntity> list = dictService.selectDictTab(); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.lf.server.controller.data; |
| | | |
| | | import com.lf.server.controller.BaseController; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.data.DirEntity; |
| | | import com.lf.server.service.data.DirService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | * @author sws |
| | | * @date 2022-09-22 |
| | | */ |
| | | |
| | | @Api(tags = "ç®å½ç®¡ç") |
| | | @RestController |
| | | @RequestMapping("/dir") |
| | | public class DirController { |
| | | public class DirController extends BaseController { |
| | | @Autowired |
| | | DirService dirService; |
| | | |
| | | @ApiOperation(value = "æå
¥æ°æ®") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "DirEntity", value = "ç®å½å®ä½ç±»", dataType = "com.lf.server.entity.data.DirEntity", paramType = "body", example = "") |
| | | }) |
| | | @RequestMapping(value = "/insertDir", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer insertDir(DirEntity dirEntity) { |
| | | public ResponseMsg<Integer> insertDir(DirEntity dirEntity) { |
| | | try { |
| | | int count = dirService.insertDir(dirEntity); |
| | | |
| | | return dirService.insertDir(dirEntity); |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æå
¥å¤æ¡æ°æ®") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "DirEntity", value = "ç®å½å®ä½ç±»", dataType = "com.lf.server.entity.data.DirEntity", paramType = "body", example = "") |
| | | }) |
| | | @RequestMapping(value = "/insertDirs", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer insertDirs(@RequestBody List<DirEntity> dirEntity) { |
| | | public ResponseMsg<Integer> insertDirs(@RequestBody List<DirEntity> dirEntity) { |
| | | try { |
| | | int count = dirService.insertDirs(dirEntity); |
| | | |
| | | return dirService.insertDirs(dirEntity); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/deleteDir", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer deleteDir(int id) { |
| | | |
| | | return dirService.deleteDir(id); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/deleteDirs", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer deleteDirs(@RequestBody List<Integer> ids) { |
| | | |
| | | if (!ids.isEmpty()) { |
| | | |
| | | return dirService.deleteDirs(ids); |
| | | |
| | | } else { |
| | | |
| | | return -1; |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/updateDir", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer updateDir(DirEntity dirEntity) { |
| | | @ApiOperation(value = "å é¤ä¸æ¡æ°æ®") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "主é®ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/deleteDir") |
| | | public ResponseMsg<Integer> deleteDir(int id) { |
| | | try { |
| | | int count = dirService.deleteDir(id); |
| | | |
| | | return dirService.updateDir(dirEntity); |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "å é¤å¤æ¡æ°æ®") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "ids", value = "主é®IDéå", dataType = "List<Integer>", paramType = "query", example = "1,2") |
| | | }) |
| | | @GetMapping(value = "/deleteDirs") |
| | | public ResponseMsg<Integer> deleteDirs( List<Integer> ids) { |
| | | try { |
| | | if (ids == null || ids.isEmpty()) { |
| | | return fail("idæ°ç»ä¸è½ä¸ºç©º", -1); |
| | | } |
| | | |
| | | int count = dirService.deleteDirs(ids); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | @ApiOperation(value = "æ´æ°ä¸æ¡æ°æ®") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "dirEntity", value = "主é®IDéå", dataType = "DictEntity", paramType = "body", example = "") |
| | | }) |
| | | @ResponseBody |
| | | @RequestMapping(value = "/updateDir", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> updateDir(DirEntity dirEntity) { |
| | | try { |
| | | int count = dirService.updateDir(dirEntity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ¹æ®IDæ¥è¯¢æ°æ®") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "主é®ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @ResponseBody |
| | | @RequestMapping(value = "/selectDir", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public DirEntity selectDir(int id) { |
| | | return dirService.selectDir(id); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢æææ°æ®") |
| | | @GetMapping(value = "/selectDirAll") |
| | | public List<DirEntity> selectDirAll() { |
| | | |
| | |
| | | package com.lf.server.controller.data; |
| | | |
| | | import com.lf.server.controller.BaseController; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.data.DictEntity; |
| | | import com.lf.server.entity.data.MenusEntity; |
| | | import com.lf.server.service.data.MenusService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | * @date 2022-09-23 |
| | | */ |
| | | |
| | | @Api(tags= "èå管ç") |
| | | @RestController |
| | | @RequestMapping("/Menu") |
| | | public class MenusController { |
| | | public class MenusController extends BaseController { |
| | | @Autowired |
| | | MenusService menuService; |
| | | |
| | | @ApiOperation(value = "æå
¥ä¸æ¡æ°æ®") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "MenusEntity", value = "åå
¸å®ä½ç±»", dataType = "com.lf.server.entity.data.MenusEntity", paramType = "body", example = "") |
| | | }) |
| | | @RequestMapping(value = "/insertMenu", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer insertMenu(MenusEntity menusEntity) { |
| | | |
| | | return menuService.insertMenu(menusEntity); |
| | | } |
| | | |
| | | @RequestMapping(value = "/insertMenus", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer insertMenus(@RequestBody List<MenusEntity> menusEntity) { |
| | | |
| | | return menuService.insertMenus(menusEntity); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/deleteMenu", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer deleteMenu(int id) { |
| | | return menuService.deleteMenu(id); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/deleteMenus", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer deleteMenus(@RequestBody List<Integer> ids) { |
| | | if (!ids.isEmpty()) { |
| | | return menuService.deleteMenus(ids); |
| | | } else { |
| | | return -1; |
| | | public ResponseMsg<Integer> insertMenu(MenusEntity menusEntity) { |
| | | try { |
| | | int count = menuService.insertMenu(menusEntity); |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æå
¥å¤æ¡æ°æ®") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "MenusEntity", value = "åå
¸å®ä½ç±»", dataType = "com.lf.server.entity.data.MenusEntity", paramType = "body", example = "") |
| | | }) |
| | | @RequestMapping(value = "/insertMenus", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> insertMenus(@RequestBody List<MenusEntity> menusEntity) { |
| | | try { |
| | | int count = menuService.insertMenus(menusEntity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "å é¤ä¸æ¡æ°æ®") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "主é®ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/deleteMenu") |
| | | public ResponseMsg<Integer> deleteMenu(int id) { |
| | | try { |
| | | int count = menuService.deleteMenu(id); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "å é¤å¤æ¡æ°æ®") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "主é®ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/deleteMenus") |
| | | public ResponseMsg<Integer> deleteMenus( List<Integer> ids) { |
| | | try { |
| | | if (ids == null || ids.isEmpty()) { |
| | | return fail("idæ°ç»ä¸è½ä¸ºç©º", -1); |
| | | } |
| | | |
| | | int count = menuService.deleteMenus(ids); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æ´æ°ä¸æ¡æ°æ®") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "MenusEntity", value = "èåIDéå", dataType = "MenusEntity", paramType = "body", example = "") |
| | | }) |
| | | @ResponseBody |
| | | @RequestMapping(value = "/updateMenu", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer updateMenu(MenusEntity menusEntity) { |
| | | return menuService.updateMenu(menusEntity); |
| | | public ResponseMsg<Integer> updateMenu(MenusEntity menusEntity) { |
| | | try { |
| | | int count = menuService.updateMenu(menusEntity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ¹æ®IDæ¥è¯¢åå
¸") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "åå
¸ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectMenu") |
| | | public MenusEntity selectMenu(int id) { |
| | | return menuService.selectMenu(id); |
| | | public ResponseMsg<MenusEntity> selectMenu(int id) { |
| | | try { |
| | | MenusEntity menusEntity = menuService.selectMenu(id); |
| | | |
| | | return success(menusEntity); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢ææåå
¸") |
| | | @GetMapping(value = "/selectMenuAll") |
| | | public List<MenusEntity> selectMenuAll() { |
| | | return menuService.selectMenuAll(); |
| | | public ResponseMsg<List<MenusEntity>> selectMenuAll() { |
| | | try { |
| | | List<MenusEntity> list = menuService.selectMenuAll(); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | package com.lf.server.controller.data; |
| | | |
| | | import com.lf.server.controller.BaseController; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.data.DictEntity; |
| | | import com.lf.server.entity.data.StyleEntity; |
| | | import com.lf.server.service.data.StyleService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | * @author sws |
| | | * @date 2022-09.26 |
| | | */ |
| | | |
| | | @Api(tags = "æ ·å¼ç®¡ç") |
| | | @RestController |
| | | @RequestMapping("/Style") |
| | | public class StyleController { |
| | | public class StyleController extends BaseController { |
| | | @Autowired |
| | | StyleService styleService; |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢è®°å½æ°") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "åç§°", dataType = "String", paramType = "query", required = false, example = "sys_style") |
| | | }) |
| | | @GetMapping({"/selectCount"}) |
| | | public Integer selectCount(String name) { |
| | | return styleService.selectCount(name); |
| | | public ResponseMsg<Integer> selectCount(String name) { |
| | | try { |
| | | int count = styleService.selectCount(name); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "å页æ¥è¯¢") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "åç§°", dataType = "String", paramType = "query", required = false, example = "sys_style"), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯é¡µæ¡æ°", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "å页索å¼ï¼ä»0å¼å§ï¼", dataType = "Integer", paramType = "query", example = "0") |
| | | }) |
| | | @GetMapping(value = "/selectByPage") |
| | | public List<StyleEntity> selectByPage(String name, Integer pageSize, Integer pageIndex) { |
| | | if (pageSize < 1 || pageIndex < 0) { |
| | | return null; |
| | | public ResponseMsg<List<StyleEntity>> selectByPage(String name, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 0) { |
| | | return fail("å页æ°å°äº1æå页索å¼å°äº0", null); |
| | | } |
| | | |
| | | List<StyleEntity> rs = styleService.selectByPage(name, pageSize, pageSize * pageIndex); |
| | | |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | |
| | | return styleService.selectByPage(name, pageSize, pageSize * pageIndex); |
| | | } |
| | | |
| | | @ApiOperation(value = "å页æ¥è¯¢å¹¶è¿åè®°å½æ°") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "åç§°", dataType = "String", paramType = "query", example = "sys_style"), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯é¡µæ¡æ°", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "å页索å¼ï¼ä»0å¼å§ï¼", dataType = "Integer", paramType = "query", example = "0") |
| | | }) |
| | | |
| | | @GetMapping(value = "/selectByPageAndCount") |
| | | public ResponseMsg<List<StyleEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 0) { |
| | | return fail("å页æ°å°äº1æå页索å¼å°äº0", null); |
| | | } |
| | | |
| | | int count = styleService.selectCount(name); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | |
| | | List<StyleEntity> rs = styleService.selectByPage(name, pageSize, pageSize * pageIndex); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æå
¥åå
¸") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "StyleEntity", value = "åå
¸å®ä½ç±»", dataType = "List<StyleEntity>", paramType = "body", example = "") |
| | | }) |
| | | @RequestMapping(value = "/insertStyle", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer insertStyle(StyleEntity styleEntity) { |
| | | public ResponseMsg<Integer> insertStyle(StyleEntity styleEntity) { |
| | | try { |
| | | int count = styleService.insertStyle(styleEntity); |
| | | |
| | | return styleService.insertStyle(styleEntity); |
| | | } |
| | | |
| | | @RequestMapping(value = "/insertStyles", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer insertStyles(@RequestBody List<StyleEntity> styleEntity) { |
| | | |
| | | return styleService.insertStyles(styleEntity); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/deleteStyle", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer deleteStyle(int id) { |
| | | return styleService.deleteStyle(id); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/deleteStyles", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer deleteStyles(@RequestBody List<Integer> ids) { |
| | | if (!ids.isEmpty()) { |
| | | return styleService.deleteStyles(ids); |
| | | } else { |
| | | return -1; |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æå
¥å¤æ¡åå
¸") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "StyleEntity", value = "åå
¸å®ä½ç±»", dataType = "com.lf.server.entity.data.StyleEntity", paramType = "body", example = "") |
| | | }) |
| | | @RequestMapping(value = "/insertStyles", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> insertStyles(@RequestBody List<StyleEntity> styleEntity) { |
| | | try { |
| | | int count = styleService.insertStyles(styleEntity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "å é¤ä¸æ¡åå
¸") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "åå
¸ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/deleteStyle") |
| | | public ResponseMsg<Integer> deleteStyle(int id) { |
| | | try { |
| | | int count = styleService.deleteStyle(id); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "å é¤å¤æ¡åå
¸") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "åå
¸ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/deleteStyles") |
| | | public ResponseMsg<Integer> deleteStyles( List<Integer> ids) { |
| | | try { |
| | | if (ids == null || ids.isEmpty()) { |
| | | return fail("idæ°ç»ä¸è½ä¸ºç©º", -1); |
| | | } |
| | | |
| | | int count = styleService.deleteStyles(ids); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æ´æ°ä¸æ¡åå
¸") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "styleEntity", value = "åå
¸IDéå", dataType = "StyleEntity", paramType = "body", example = "") |
| | | }) |
| | | @ResponseBody |
| | | @RequestMapping(value = "/updateStyle", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer updateStyle(StyleEntity styleEntity) { |
| | | return styleService.updateStyle(styleEntity); |
| | | public ResponseMsg<Integer> updateStyle(StyleEntity styleEntity) { |
| | | try { |
| | | int count = styleService.updateStyle(styleEntity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ¹æ®IDæ¥è¯¢åå
¸") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "åå
¸ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectStyle") |
| | | public StyleEntity selectStyle(int id) { |
| | | return styleService.selectStyle(id); |
| | | public ResponseMsg<StyleEntity> selectStyle(int id) { |
| | | try { |
| | | StyleEntity styleEntity = styleService.selectStyle(id); |
| | | ; |
| | | |
| | | return success(styleEntity); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢ææåå
¸") |
| | | @GetMapping(value = "/selectStyleAll") |
| | | public List<StyleEntity> selectStyleAll() { |
| | | return styleService.selectStyleAll(); |
| | | public ResponseMsg<List<StyleEntity>> selectStyleAll() { |
| | | |
| | | try { |
| | | List<StyleEntity> list = styleService.selectStyleAll(); |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.lf.server.entity.all; |
| | | |
| | | /** |
| | | * HttpStatus |
| | | * @author |
| | | */ |
| | | public enum HttpStatus { |
| | | OK(200,"è¯·æ±æå"), |
| | | |
| | | BAD_REQUEST(400,"è¯·æ±æ æ"), |
| | | |
| | | UNAUTHORIZED(401,"æªç»ææè®¿é®"), |
| | | |
| | | NOT_FOUND(404,"æå¡è¯·æ±æªæ¾å°"), |
| | | |
| | | NODATA_FOUND(404404,"æ°æ®æªæ¾å°"), |
| | | |
| | | ERROR(500,"ç³»ç»é误"), |
| | | |
| | | UNIQUE_ERROR(500100,"æ°æ®å¯ä¸æ§é误,åå¨éå¤çæ°æ®"), |
| | | |
| | | VALIDATE_ERROR(500101,"åæ°æ ¡éªé误"), |
| | | |
| | | TOKEN_ERROR(500102,"tokené误"), |
| | | |
| | | NO_LOGIN_ERROR(500104,"ç¨æ·æªç»é"), |
| | | |
| | | LOGIN_ERROR(500105,"ç¨æ·ç»é失败"), |
| | | |
| | | NO_AUTH_ERROR(500106,"æ æé访é®"), |
| | | |
| | | LOGIN_USER_ERROR(500107,"ç¨æ·åé误"), |
| | | |
| | | LOGIN_PWD_ERROR(500108,"ç¨æ·å¯ç é误"), |
| | | |
| | | USER_LOCK_ERROR(500109,"ç¨æ·è¢«éå®"), |
| | | |
| | | PWD_NONSTANDARD(500111,"ç¨æ·å¯ç ä¸åè§è"), |
| | | |
| | | ACCOUNT_TYPE_ERROR(500112,"ç¨æ·è´¦å·ç±»åä¸å¹é
"), |
| | | |
| | | EMAIL_NONSTANDARD(500113,"é®ç®±æ ¼å¼é误ï¼"), |
| | | |
| | | PHONE_NONSTANDARD(500114,"çµè¯æ ¼å¼é误ï¼"), |
| | | |
| | | DATA_NO_AUTH_ERROR(500115,"æ°æ®ä¸å¨æ¥è¯¢èå´å
"), |
| | | |
| | | LOGIN_PWD_EXPIRE(500116,"å¯ç è¿æ"), |
| | | |
| | | WORK_FLOW_SUBMIT_ERROR(500200,"æµç¨æäº¤é误"), |
| | | |
| | | WORK_FLOW_APPROVAL_ERROR(500201,"æµç¨å®¡æ ¸é误"), |
| | | |
| | | WORK_FLOW_REJECT_ERROR(500202,"æµç¨éåé误"), |
| | | |
| | | WORK_FLOW_CANCEL_ERROR(500203,"æµç¨åæ¶é误"), |
| | | |
| | | WORK_FLOW_NO_EXIST(500204,"ä¸å卿µç¨åå²è®°å½"), |
| | | |
| | | EMAIL_CONFIG_ERROR(500300,"é®ç®±æªé
ç½®"), |
| | | |
| | | JST_CONFIG_ERROR(500301,"峿¶éæªé
ç½®"), |
| | | |
| | | JST_ACCOUNT_ERROR(500302,"峿¶è´¦å·é误"), |
| | | |
| | | SECRET_KEY_ERROR(500304,"å¯é¥æªé
ç½®é误"), |
| | | |
| | | DB_DEL_NODATA_ERROR(500401,"å é¤0æ¡æ°æ®"); |
| | | |
| | | private HttpStatus(int value, String msg) { |
| | | this.value = value; |
| | | this.msg = msg; |
| | | } |
| | | |
| | | private int value; |
| | | |
| | | private String msg; |
| | | |
| | | public int getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.lf.server.entity.all; |
| | | |
| | | /** |
| | | * ååºæ¶æ¯ |
| | | * @author www |
| | | * @param <T> |
| | | */ |
| | | public class ResponseMsg<T> { |
| | | public ResponseMsg() { |
| | | this.time = System.currentTimeMillis(); |
| | | } |
| | | |
| | | public ResponseMsg(HttpStatus code, T result) { |
| | | this.code = code.getValue(); |
| | | this.msg = this.code == 200 ? "æå" : "失败"; |
| | | this.result = result; |
| | | this.time = System.currentTimeMillis(); |
| | | } |
| | | |
| | | public ResponseMsg(HttpStatus code, String msg, T result) { |
| | | this.code = code.getValue(); |
| | | this.msg = msg; |
| | | this.result = result; |
| | | this.time = System.currentTimeMillis(); |
| | | } |
| | | |
| | | public ResponseMsg(int code, String msg, T result, long time) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | this.result = result; |
| | | this.time = time; |
| | | } |
| | | |
| | | public ResponseMsg(HttpStatus code, int count, T result) { |
| | | this.code = code.getValue(); |
| | | this.msg = this.code == 200 ? "æå" : "失败"; |
| | | this.count = count; |
| | | this.result = result; |
| | | this.time = System.currentTimeMillis(); |
| | | } |
| | | |
| | | public ResponseMsg(HttpStatus code, String msg, int count, T result) { |
| | | this.code = code.getValue(); |
| | | this.msg = msg; |
| | | this.count = count; |
| | | this.result = result; |
| | | this.time = System.currentTimeMillis(); |
| | | } |
| | | |
| | | public ResponseMsg(int code, String msg, int count, T result, long time) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | this.count = count; |
| | | this.result = result; |
| | | this.time = time; |
| | | } |
| | | |
| | | private int code; |
| | | |
| | | private String msg; |
| | | |
| | | private int count; |
| | | |
| | | private T result; |
| | | |
| | | private long time; |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public void setMsg(String msg) { |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public int getCount() { |
| | | return count; |
| | | } |
| | | |
| | | public void setCount(int count) { |
| | | this.count = count; |
| | | } |
| | | |
| | | public T getResult() { |
| | | return result; |
| | | } |
| | | |
| | | public void setResult(T result) { |
| | | this.result = result; |
| | | } |
| | | |
| | | public long getTime() { |
| | | return time; |
| | | } |
| | | |
| | | public void setTime(long time) { |
| | | this.time = time; |
| | | } |
| | | } |
| | |
| | | context-path: /land |
| | | |
| | | spring: |
| | | mvc: |
| | | pathmatch: |
| | | matching-strategy: ant_path_matcher |
| | | datasource: |
| | | username : postgres |
| | | password: postgres |