Bläddra i källkod

分页上传8.2晚上

李卫 1 år sedan
förälder
incheckning
a0bc635794

+ 5 - 3
warewms-system/src/main/java/com/warewms/system/controller/system/SysConfigController.java

@@ -3,6 +3,7 @@ package com.warewms.system.controller.system;
 import com.warewms.common.annotation.Log;
 import com.warewms.common.core.controller.BaseController;
 import com.warewms.common.core.domain.AjaxResult;
+import com.warewms.common.core.domain.base.page.PageDomain;
 import com.warewms.common.core.domain.base.page.TableDataInfo;
 import com.warewms.common.enums.BusinessType;
 import com.warewms.common.utils.poi.ExcelUtil;
@@ -23,7 +24,7 @@ import java.util.List;
  */
 @RestController
 @RequestMapping("/system/config")
-public class  SysConfigController extends BaseController
+public class  SysConfigController extends BaseController<SysConfig>
 {
     @Autowired
     private ISysConfigService configService;
@@ -31,10 +32,11 @@ public class  SysConfigController extends BaseController
     /**
      * 获取参数配置列表
      */
+
     @PreAuthorize("@ss.hasPermi('system:config:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysConfig config) {
-        return null;
+    public TableDataInfo<SysConfig> list(PageDomain pageDomain, SysConfig config) {
+        return configService.selectConfigList(pageDomain,config);
     }
 
 

+ 1 - 3
warewms-system/src/main/java/com/warewms/system/controller/system/SysDictDataController.java

@@ -5,9 +5,7 @@ import com.warewms.common.core.controller.BaseController;
 import com.warewms.common.core.domain.AjaxResult;
 import com.warewms.common.core.domain.base.page.PageDomain;
 import com.warewms.common.core.domain.base.page.TableDataInfo;
-import com.warewms.common.core.domain.entity.SysDept;
 import com.warewms.common.core.domain.entity.SysDictData;
-import com.warewms.common.core.domain.entity.SysUser;
 import com.warewms.common.enums.BusinessType;
 import com.warewms.common.utils.StringUtils;
 import com.warewms.common.utils.poi.ExcelUtil;
@@ -29,7 +27,7 @@ import java.util.List;
  */
 @RestController
 @RequestMapping("/system/dict/data")
-public class SysDictDataController extends BaseController
+public class SysDictDataController extends BaseController<SysDictData>
 {
     @Autowired
     private ISysDictDataService dictDataService;

+ 1 - 3
warewms-system/src/main/java/com/warewms/system/controller/system/SysDictTypeController.java

@@ -34,12 +34,10 @@ public class SysDictTypeController extends BaseController<SysDictType>
 
     @PreAuthorize("@ss.hasPermi('system:dict:list')")
     @GetMapping("/list")
-    public TableDataInfo page(PageDomain pageDomain, SysDictType sysDictType) {
+    public TableDataInfo<SysDictType> page(PageDomain pageDomain, SysDictType sysDictType) {
 
         return dictTypeService.selectDictTypeList(pageDomain,sysDictType);
 
-
-        //dictTypeService.selectDictTypeList();
     }
 
 

+ 1 - 3
warewms-system/src/main/java/com/warewms/system/controller/system/SysPostController.java

@@ -5,10 +5,8 @@ import com.warewms.common.core.controller.BaseController;
 import com.warewms.common.core.domain.AjaxResult;
 import com.warewms.common.core.domain.base.page.PageDomain;
 import com.warewms.common.core.domain.base.page.TableDataInfo;
-import com.warewms.common.core.domain.entity.SysUser;
 import com.warewms.common.enums.BusinessType;
 import com.warewms.common.utils.poi.ExcelUtil;
-import com.warewms.system.domain.SysNotice;
 import com.warewms.system.domain.SysPost;
 import com.warewms.system.service.ISysPostService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -26,7 +24,7 @@ import java.util.List;
  */
 @RestController
 @RequestMapping("/system/post")
-public class SysPostController extends BaseController
+public class SysPostController extends BaseController<SysPost>
 {
     @Autowired
     private ISysPostService postService;

+ 1 - 3
warewms-system/src/main/java/com/warewms/system/controller/system/SysRoleController.java

@@ -7,12 +7,10 @@ import com.warewms.common.core.domain.base.page.PageDomain;
 import com.warewms.common.core.domain.base.page.TableDataInfo;
 import com.warewms.common.core.domain.entity.SysDept;
 import com.warewms.common.core.domain.entity.SysRole;
-import com.warewms.common.core.domain.entity.SysUser;
 import com.warewms.common.core.domain.model.LoginUser;
 import com.warewms.common.enums.BusinessType;
 import com.warewms.common.utils.StringUtils;
 import com.warewms.common.utils.poi.ExcelUtil;
-import com.warewms.system.domain.SysPost;
 import com.warewms.system.domain.SysUserRole;
 import com.warewms.system.service.ISysDeptService;
 import com.warewms.system.service.ISysRoleService;
@@ -34,7 +32,7 @@ import java.util.List;
  */
 @RestController
 @RequestMapping("/system/role")
-public class SysRoleController extends BaseController
+public class SysRoleController extends BaseController<SysRole>
 {
     @Autowired
     private ISysRoleService roleService;

+ 6 - 3
warewms-system/src/main/java/com/warewms/system/mapper/SysConfigMapper.java

@@ -2,15 +2,16 @@ package com.warewms.system.mapper;
 
 import java.util.List;
 
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.warewms.system.domain.SysConfig;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 参数配置 数据层
  * 
  * @author ruoyi
  */
-public interface SysConfigMapper extends BaseMapper<SysConfig> {
+public interface SysConfigMapper {
     /**
      * 查询参数配置信息
      *
@@ -33,7 +34,9 @@ public interface SysConfigMapper extends BaseMapper<SysConfig> {
      * @param config 参数配置信息
      * @return 参数配置集合
      */
-    public List<SysConfig> selectConfigList(SysConfig config);
+    public List<SysConfig> selectConfigList(@Param("config") SysConfig config);
+
+    public Page<SysConfig> selectConfigList(@Param("page") Page<SysConfig> page, @Param("config") SysConfig config);
 
     /**
      * 根据键名查询参数配置信息

+ 12 - 2
warewms-system/src/main/java/com/warewms/system/service/ISysConfigService.java

@@ -2,7 +2,8 @@ package com.warewms.system.service;
 
 import java.util.List;
 
-import com.warewms.common.service.CrudService;
+import com.warewms.common.core.domain.base.page.PageDomain;
+import com.warewms.common.core.domain.base.page.TableDataInfo;
 import com.warewms.system.domain.SysConfig;
 
 /**
@@ -10,7 +11,7 @@ import com.warewms.system.domain.SysConfig;
  * 
  * @author ruoyi
  */
-public interface ISysConfigService extends CrudService<SysConfig, SysConfig>
+public interface ISysConfigService
 {
     /**
      * 查询参数配置信息
@@ -43,6 +44,15 @@ public interface ISysConfigService extends CrudService<SysConfig, SysConfig>
      */
     public List<SysConfig> selectConfigList(SysConfig config);
 
+    /**
+     * 新增参数配置
+     *
+     * @param config 参数配置信息
+     * @return 结果
+     */
+    public TableDataInfo<SysConfig> selectConfigList(PageDomain pageDomain, SysConfig config);
+
+
     /**
      * 新增参数配置
      * 

+ 27 - 17
warewms-system/src/main/java/com/warewms/system/service/impl/SysConfigServiceImpl.java

@@ -2,11 +2,12 @@ package com.warewms.system.service.impl;
 
 import java.util.Collection;
 import java.util.List;
-import java.util.Map;
 import javax.annotation.PostConstruct;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.warewms.common.service.impl.CrudServiceImpl;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.warewms.common.core.domain.base.page.PageDomain;
+import com.warewms.common.core.domain.base.page.TableDataInfo;
+import com.warewms.common.service.impl.SystemService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.warewms.common.annotation.DataSource;
@@ -27,7 +28,12 @@ import com.warewms.system.service.ISysConfigService;
  * @author ruoyi
  */
 @Service
-public class SysConfigServiceImpl extends CrudServiceImpl<SysConfigMapper, SysConfig, SysConfig> implements ISysConfigService {
+public class SysConfigServiceImpl extends SystemService<SysConfig> implements ISysConfigService {
+
+
+    @Autowired
+    private SysConfigMapper sysConfigMapper;
+
     @Autowired
     private RedisCache redisCache;
 
@@ -51,7 +57,7 @@ public class SysConfigServiceImpl extends CrudServiceImpl<SysConfigMapper, SysCo
     public SysConfig selectConfigById(Long configId) {
         SysConfig config = new SysConfig();
         config.setConfigId(configId);
-        return baseDao.selectConfig(config);
+        return sysConfigMapper.selectConfig(config);
     }
 
     /**
@@ -69,7 +75,7 @@ public class SysConfigServiceImpl extends CrudServiceImpl<SysConfigMapper, SysCo
         }
         SysConfig config = new SysConfig();
         config.setConfigKey(configKey);
-        SysConfig retConfig = baseDao.selectConfig(config);
+        SysConfig retConfig = sysConfigMapper.selectConfig(config);
         if (StringUtils.isNotNull(retConfig))
         {
             redisCache.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue());
@@ -101,7 +107,14 @@ public class SysConfigServiceImpl extends CrudServiceImpl<SysConfigMapper, SysCo
      */
     @Override
     public List<SysConfig> selectConfigList(SysConfig config) {
-        return baseDao.selectConfigList(config);
+        return sysConfigMapper.selectConfigList(config);
+    }
+
+    @Override
+    public TableDataInfo<SysConfig> selectConfigList(PageDomain pageDomain, SysConfig config)
+    {
+        Page<SysConfig> page = convertToPage(pageDomain);
+        return getDataTable(sysConfigMapper.selectConfigList(page,config));
     }
 
     /**
@@ -112,7 +125,7 @@ public class SysConfigServiceImpl extends CrudServiceImpl<SysConfigMapper, SysCo
      */
     @Override
     public int insertConfig(SysConfig config) {
-        int row = baseDao.insertConfig(config);
+        int row = sysConfigMapper.insertConfig(config);
         if (row > 0)
         {
             redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
@@ -128,13 +141,13 @@ public class SysConfigServiceImpl extends CrudServiceImpl<SysConfigMapper, SysCo
      */
     @Override
     public int updateConfig(SysConfig config) {
-        SysConfig temp = baseDao.selectConfigById(config.getConfigId());
+        SysConfig temp = sysConfigMapper.selectConfigById(config.getConfigId());
         if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey()))
         {
             redisCache.deleteObject(getCacheKey(temp.getConfigKey()));
         }
 
-        int row = baseDao.updateConfig(config);
+        int row = sysConfigMapper.updateConfig(config);
         if (row > 0)
         {
             redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
@@ -156,7 +169,7 @@ public class SysConfigServiceImpl extends CrudServiceImpl<SysConfigMapper, SysCo
             {
                 throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
             }
-            baseDao.deleteConfigById(configId);
+            sysConfigMapper.deleteConfigById(configId);
             redisCache.deleteObject(getCacheKey(config.getConfigKey()));
         }
     }
@@ -166,7 +179,7 @@ public class SysConfigServiceImpl extends CrudServiceImpl<SysConfigMapper, SysCo
      */
     @Override
     public void loadingConfigCache() {
-        List<SysConfig> configsList = baseDao.selectConfigList(new SysConfig());
+        List<SysConfig> configsList = sysConfigMapper.selectConfigList(new SysConfig());
         for (SysConfig config : configsList)
         {
             redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
@@ -200,7 +213,7 @@ public class SysConfigServiceImpl extends CrudServiceImpl<SysConfigMapper, SysCo
     @Override
     public boolean checkConfigKeyUnique(SysConfig config) {
         Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId();
-        SysConfig info = baseDao.checkConfigKeyUnique(config.getConfigKey());
+        SysConfig info = sysConfigMapper.checkConfigKeyUnique(config.getConfigKey());
         if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue())
         {
             return UserConstants.NOT_UNIQUE;
@@ -219,8 +232,5 @@ public class SysConfigServiceImpl extends CrudServiceImpl<SysConfigMapper, SysCo
         return CacheConstants.SYS_CONFIG_KEY + configKey;
     }
 
-    @Override
-    public QueryWrapper<SysConfig> getWrapper(Map<String, Object> params) {
-        return null;
-    }
+
 }

+ 10 - 10
warewms-system/src/main/resources/mapper/system/SysConfigMapper.xml

@@ -41,20 +41,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectConfigList" parameterType="SysConfig" resultMap="SysConfigResult">
         <include refid="selectConfigVo"/>
         <where>
-			<if test="configName != null and configName != ''">
-				AND config_name like concat('%', #{configName}, '%')
+			<if test="config.configName != null and config.configName != ''">
+				AND config_name like concat('%', #{config.configName}, '%')
 			</if>
-			<if test="configType != null and configType != ''">
-				AND config_type = #{configType}
+			<if test="config.configType != null and config.configType != ''">
+				AND config_type = #{config.configType}
 			</if>
-			<if test="configKey != null and configKey != ''">
-				AND config_key like concat('%', #{configKey}, '%')
+			<if test="config.configKey != null and config.configKey != ''">
+				AND config_key like concat('%', #{config.configKey}, '%')
 			</if>
-			<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-				and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+			<if test="config.params.beginTime != null and config.params.beginTime != ''"><!-- 开始时间检索 -->
+				and date_format(create_time,'%y%m%d') &gt;= date_format(#{config.params.beginTime},'%y%m%d')
 			</if>
-			<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-				and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+			<if test="config.params.endTime != null and config.params.endTime != ''"><!-- 结束时间检索 -->
+				and date_format(create_time,'%y%m%d') &lt;= date_format(#{config.params.endTime},'%y%m%d')
 			</if>
 		</where>
     </select>