src/main/java/com/jsh/erp/controller/ConfigSecurityController.java
@@ -2,6 +2,7 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageInfo; import com.jsh.erp.datasource.entities.SysDict; import com.jsh.erp.dto.ConfigSecurityCreateOrUpdate; import com.jsh.erp.dto.ConfigSecurityQuery; @@ -83,10 +84,13 @@ BaseResponseInfo res = new BaseResponseInfo(); Map<String, Object> map = new HashMap<String, Object>(); try { List<ConfigSecurity> dataList = configSecurityService.findList(configSecurityQuery); Long total = configSecurityService.findListCount(configSecurityQuery); map.put("total", total); map.put("rows", dataList); // List<ConfigSecurity> dataList = configSecurityService.findList(configSecurityQuery); // Long total = configSecurityService.findListCount(configSecurityQuery); // map.put("total", total); // map.put("rows", dataList); PageInfo<ConfigSecurity> pageInfo =configSecurityService.findPageInfo(configSecurityQuery); map.put("total",pageInfo.getTotal()); map.put("rows",pageInfo.getList()); res.code = 200; res.data = map; } catch(Exception e){ src/main/java/com/jsh/erp/dto/ConfigSecurityCreateOrUpdate.java
@@ -7,6 +7,7 @@ import javax.validation.constraints.Max; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; @Data @NoArgsConstructor @@ -16,7 +17,7 @@ private Long id; @NotEmpty(message = "关键字不能为空") @Max(value = 50, message = "关键字长度不能超过50") @Size(max = 50, message = "关键字长度不能超过50") private String keyword; @NotEmpty(message = "类型不能为空") src/main/java/com/jsh/erp/service/configSecurity/ConfigSecurityService.java
@@ -1,5 +1,6 @@ package com.jsh.erp.service.configSecurity; import com.github.pagehelper.PageInfo; import com.jsh.erp.datasource.entities.ConfigSecurity; import com.jsh.erp.dto.ConfigSecurityQuery; @@ -21,4 +22,6 @@ int deleteBatch(String ids); int batchSetStatus(Integer status, String ids) throws Exception; PageInfo<ConfigSecurity> findPageInfo(ConfigSecurityQuery configSecurityQuery); } src/main/java/com/jsh/erp/service/configSecurity/impl/ConfigSecurityServiceImpl.java
@@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.datasource.entities.ConfigSecurity; import com.jsh.erp.datasource.entities.ConfigSecurityExample; @@ -53,7 +54,7 @@ @Override public List<ConfigSecurity> findList(ConfigSecurityQuery configSecurityQuery) { // 设置分页参数 PageHelper.startPage(configSecurityQuery.getCurrentPage()-1, configSecurityQuery.getPageSize()); ConfigSecurityExample example = new ConfigSecurityExample(); ConfigSecurityExample.Criteria criteria = example.createCriteria(); @@ -67,6 +68,7 @@ example.setOrderByClause(" create_time desc "); PageHelper.startPage(configSecurityQuery.getCurrentPage(), configSecurityQuery.getPageSize()); return configSecurityMapper.selectByExample(example); } @@ -155,5 +157,25 @@ return result; } @Override public PageInfo<ConfigSecurity> findPageInfo(ConfigSecurityQuery configSecurityQuery) { ConfigSecurityExample example = new ConfigSecurityExample(); ConfigSecurityExample.Criteria criteria = example.createCriteria(); criteria.andDeleteFlagEqualTo(false); if (StringUtils.isNotEmpty(configSecurityQuery.getKeyword())) { criteria.andKeywordLike("%" + configSecurityQuery.getKeyword() + "%"); } if (StringUtils.isNotEmpty(configSecurityQuery.getType())) { criteria.andTypeEqualTo(configSecurityQuery.getType()); } example.setOrderByClause(" create_time desc "); PageHelper.startPage(configSecurityQuery.getCurrentPage(), configSecurityQuery.getPageSize()); List<ConfigSecurity> list = configSecurityMapper.selectByExample(example); return new PageInfo<>(list); } } src/main/resources/application.properties
@@ -10,11 +10,13 @@ spring.datasource.password=CloudRoam #mybatis-plus配置 mybatis-plus.mapper-locations=classpath:./mapper_xml/*.xml # Redis #spring.redis.host=192.168.1.235 spring.redis.host=localhost spring.redis.host=192.168.1.235 spring.redis.port=6379 #spring.redis.password=123456 spring.redis.password=123456 #租户对应的角色id manage.roleId=10 #租户允许创建的用户数 @@ -40,4 +42,9 @@ volc.sms.secret-key= your-volc-secret-key # ???SecretKey volc.sms.region= cn-north-1 # ?????????? volc.sms.sign-name= ????? # ???? volc.sms.template-id= SMS_1234567890 # ????ID volc.sms.template-id= SMS_1234567890 # ????ID pagehelper.helper-dialect=mysql pagehelper.reasonable=true pagehelper.support-methods-arguments=true pagehelper.params=count=countSql