| | |
| | | package com.lf.server.controller.data; |
| | | |
| | | import com.lf.server.aspect.SysLog; |
| | | import com.lf.server.controller.all.BaseController; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.helper.ClassHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.lf.server.mapper.bd.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ°æ®æ£ç´¢ |
| | | * @author WWW |
| | | */ |
| | | @Api(tags = "æ°æ®ç®¡ç\\åå
¸ç®¡ç") |
| | | @Api(tags = "æ°æ®ç®¡ç\\æ°æ®æ£ç´¢") |
| | | @RestController |
| | | @RequestMapping("/dataQuery") |
| | | public class DataQueryController extends BaseController { |
| | | // |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢è®°å½æ°") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "ns", value = "å称空é´", dataType = "String", paramType = "query", example = "bd"), |
| | | @ApiImplicitParam(name = "entity", value = "å®ä½åç§°", dataType = "String", paramType = "query", example = "DlgAgnp") |
| | | }) |
| | | @GetMapping({"/selectCount"}) |
| | | public ResponseMsg<Integer> selectCount(String ns, String entity) { |
| | | try { |
| | | if (StringHelper.isEmpty(ns) || StringHelper.isEmpty(entity)) { |
| | | return fail("å称空é´åå®ä½åç§°ä¸è½ä¸ºç©º", null); |
| | | } |
| | | |
| | | String className = String.format("com.lf.server.mapper.%s.%sMapper", ns.trim(), entity.trim()); |
| | | Object obj = ClassHelper.createInstance(className); |
| | | if (obj == null) { |
| | | return fail("æ¥è¯¢å¯¹è±¡ä¸åå¨", null); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | int count = 0; |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "å页æ¥è¯¢") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "ns", value = "å称空é´", dataType = "String", paramType = "query", example = "bd"), |
| | | @ApiImplicitParam(name = "entity", value = "å®ä½åç§°", dataType = "String", paramType = "query", example = "DlgAgnp") |
| | | }) |
| | | @GetMapping(value = "/selectByPage") |
| | | public ResponseMsg<List<Object>> selectByPage(String ns, String entity, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("æ¯é¡µé¡µæ°æå页æ°å°äº1", null); |
| | | } |
| | | |
| | | List<Object> rs = null; |
| | | |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | } |