buzhanyi 1 rok pred
rodič
commit
d796303406

+ 3 - 3
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/upms/controller/SysDeptController.java

@@ -236,12 +236,12 @@ public class SysDeptController {
             PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
         }
         SysPost filter = MyModelUtil.copyTo(sysPostDtoFilter, SysPost.class);
-        String orderBy = MyOrderParam.buildOrderBy(orderParam, SysPost.class);
+        //String orderBy = MyOrderParam.buildOrderBy(orderParam, SysPost.class);
         List<SysPost> sysPostList;
         if (MyCommonUtil.isNotBlankOrNull(deptId)) {
-            sysPostList = sysPostService.getNotInSysPostListByDeptId(deptId, filter, orderBy);
+            sysPostList = sysPostService.getNotInSysPostListByDeptId(deptId, filter);
         } else {
-            sysPostList = sysPostService.getSysPostList(filter, orderBy);
+            sysPostList = sysPostService.getSysPostList(filter);
             sysPostService.buildRelationForDataList(sysPostList, MyRelationParam.dictOnly());
         }
         return ResponseResult.success(MyPageUtil.makeResponseData(sysPostList, SysPost.INSTANCE));

+ 6 - 11
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/upms/controller/SysPostController.java

@@ -64,7 +64,7 @@ public class SysPostController {
      */
     @OperationLog(type = SysOperationLogType.UPDATE)
     @PostMapping("/update")
-    public ResponseResult<Void> update(@MyRequestBody SysPostDto sysPostDto) {
+    public ResponseResult<Void> update(@RequestBody SysPostDto sysPostDto) {
         String errorMessage = MyCommonUtil.getModelValidationError(sysPostDto, Default.class, UpdateGroup.class);
         if (errorMessage != null) {
             return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
@@ -113,21 +113,16 @@ public class SysPostController {
      * 列出符合过滤条件的岗位管理列表。
      *
      * @param sysPostDtoFilter 过滤对象。
-     * @param orderParam       排序参数。
-     * @param pageParam        分页参数。
      * @return 应答结果对象,包含查询结果集。
      */
     @PostMapping("/list")
     public ResponseResult<MyPageData<SysPostVo>> list(
-            @MyRequestBody SysPostDto sysPostDtoFilter,
-            @MyRequestBody MyOrderParam orderParam,
-            @MyRequestBody MyPageParam pageParam) {
-        if (pageParam != null) {
-            PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
+            @RequestBody SysPostDto sysPostDtoFilter) {
+        if (sysPostDtoFilter.getPageNum() != null) {
+            PageMethod.startPage(sysPostDtoFilter.getPageNum(), sysPostDtoFilter.getPageSize());
         }
         SysPost sysPostFilter = MyModelUtil.copyTo(sysPostDtoFilter, SysPost.class);
-        String orderBy = MyOrderParam.buildOrderBy(orderParam, SysPost.class);
-        List<SysPost> sysPostList = sysPostService.getSysPostListWithRelation(sysPostFilter, orderBy);
+        List<SysPost> sysPostList = sysPostService.getSysPostListWithRelation(sysPostFilter);
         return ResponseResult.success(MyPageUtil.makeResponseData(sysPostList, SysPost.INSTANCE));
     }
 
@@ -170,7 +165,7 @@ public class SysPostController {
      * @return 应答结果对象,包含字典形式的数据集合。
      */
     @PostMapping("/listDictByIds")
-    public ResponseResult<List<Map<String, Object>>> listDictByIds(@MyRequestBody List<Long> postIds) {
+    public ResponseResult<List<Map<String, Object>>> listDictByIds(@RequestBody List<Long> postIds) {
         List<SysPost> resultList = sysPostService.getInList(new HashSet<>(postIds));
         return ResponseResult.success(BeanQuery.select("postId as id", "postName as name").executeFrom(resultList));
     }

+ 2 - 5
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/upms/dao/SysPostMapper.java

@@ -18,11 +18,10 @@ public interface SysPostMapper extends BaseDaoMapper<SysPost> {
      * 获取过滤后的对象列表。
      *
      * @param sysPostFilter 主表过滤对象。
-     * @param orderBy       排序字符串,order by从句的参数。
      * @return 对象列表。
      */
     List<SysPost> getSysPostList(
-            @Param("sysPostFilter") SysPost sysPostFilter, @Param("orderBy") String orderBy);
+            @Param("sysPostFilter") SysPost sysPostFilter);
 
     /**
      * 获取指定部门的岗位列表。
@@ -42,11 +41,9 @@ public interface SysPostMapper extends BaseDaoMapper<SysPost> {
      *
      * @param deptId        关联主表Id。
      * @param sysPostFilter 过滤对象。
-     * @param orderBy       排序字符串,order by从句的参数。
      * @return 与主表没有建立关联的从表数据列表。
      */
     List<SysPost> getNotInSysPostListByDeptId(
             @Param("deptId") Long deptId,
-            @Param("sysPostFilter") SysPost sysPostFilter,
-            @Param("orderBy") String orderBy);
+            @Param("sysPostFilter") SysPost sysPostFilter);
 }

+ 0 - 6
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/upms/dao/mapper/SysPostMapper.xml

@@ -44,9 +44,6 @@
         <where>
             <include refid="filterRef"/>
         </where>
-        <if test="orderBy != null and orderBy != ''">
-            ORDER BY ${orderBy}
-        </if>
     </select>
 
     <select id="getSysPostListByDeptId" resultMap="BaseResultMapWithSysDeptPost">
@@ -76,8 +73,5 @@
             WHERE work_sys_dept_post.dept_id = #{deptId} AND work_sys_dept_post.post_id = work_sys_post.post_id)
             <include refid="filterRef"/>
         </where>
-        <if test="orderBy != null and orderBy != ''">
-            ORDER BY ${orderBy}
-        </if>
     </select>
 </mapper>

+ 2 - 1
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/upms/dto/SysPostDto.java

@@ -1,5 +1,6 @@
 package com.ankaibei.workFlow.webadmin.upms.dto;
 
+import com.ankaibei.workFlow.common.core.object.MyPageParam;
 import com.ankaibei.workFlow.common.core.validator.UpdateGroup;
 
 import io.swagger.annotations.ApiModel;
@@ -16,7 +17,7 @@ import javax.validation.constraints.*;
  */
 @ApiModel("岗位Dto")
 @Data
-public class SysPostDto {
+public class SysPostDto extends MyPageParam {
 
     /**
      * 岗位Id。

+ 4 - 7
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/upms/service/SysPostService.java

@@ -43,11 +43,10 @@ public interface SysPostService extends IBaseService<SysPost, Long> {
      * 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
      * 如果需要同时获取关联数据,请移步(getSysPostListWithRelation)方法。
      *
-     * @param filter  过滤对象。
-     * @param orderBy 排序参数。
+     * @param filter 过滤对象。
      * @return 查询结果集。
      */
-    List<SysPost> getSysPostList(SysPost filter, String orderBy);
+    List<SysPost> getSysPostList(SysPost filter);
 
     /**
      * 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
@@ -55,20 +54,18 @@ public interface SysPostService extends IBaseService<SysPost, Long> {
      * 如果仅仅需要获取主表数据,请移步(getSysPostList),以便获取更好的查询性能。
      *
      * @param filter  主表过滤对象。
-     * @param orderBy 排序参数。
      * @return 查询结果集。
      */
-    List<SysPost> getSysPostListWithRelation(SysPost filter, String orderBy);
+    List<SysPost> getSysPostListWithRelation(SysPost filter);
 
     /**
      * 在多对多关系中,当前Service的数据表为从表,返回不与指定主表主键Id存在对多对关系的列表。
      *
      * @param deptId  主表主键Id。
      * @param filter  从表的过滤对象。
-     * @param orderBy 排序参数。
      * @return 查询结果集。
      */
-    List<SysPost> getNotInSysPostListByDeptId(Long deptId, SysPost filter, String orderBy);
+    List<SysPost> getNotInSysPostListByDeptId(Long deptId, SysPost filter);
 
     /**
      * 获取指定部门的岗位列表。

+ 7 - 10
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/upms/service/impl/SysPostServiceImpl.java

@@ -111,13 +111,12 @@ public class SysPostServiceImpl extends BaseService<SysPost, Long> implements Sy
      * 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
      * 如果需要同时获取关联数据,请移步(getSysPostListWithRelation)方法。
      *
-     * @param filter  过滤对象。
-     * @param orderBy 排序参数。
+     * @param filter 过滤对象。
      * @return 查询结果集。
      */
     @Override
-    public List<SysPost> getSysPostList(SysPost filter, String orderBy) {
-        return sysPostMapper.getSysPostList(filter, orderBy);
+    public List<SysPost> getSysPostList(SysPost filter) {
+        return sysPostMapper.getSysPostList(filter);
     }
 
     /**
@@ -126,12 +125,11 @@ public class SysPostServiceImpl extends BaseService<SysPost, Long> implements Sy
      * 如果仅仅需要获取主表数据,请移步(getSysPostList),以便获取更好的查询性能。
      *
      * @param filter  主表过滤对象。
-     * @param orderBy 排序参数。
      * @return 查询结果集。
      */
     @Override
-    public List<SysPost> getSysPostListWithRelation(SysPost filter, String orderBy) {
-        List<SysPost> resultList = sysPostMapper.getSysPostList(filter, orderBy);
+    public List<SysPost> getSysPostListWithRelation(SysPost filter) {
+        List<SysPost> resultList = sysPostMapper.getSysPostList(filter);
         // 在缺省生成的代码中,如果查询结果resultList不是Page对象,说明没有分页,那么就很可能是数据导出接口调用了当前方法。
         // 为了避免一次性的大量数据关联,规避因此而造成的系统运行性能冲击,这里手动进行了分批次读取,开发者可按需修改该值。
         int batchSize = resultList instanceof Page ? 0 : 1000;
@@ -144,12 +142,11 @@ public class SysPostServiceImpl extends BaseService<SysPost, Long> implements Sy
      *
      * @param deptId  主表主键Id。
      * @param filter  从表的过滤对象。
-     * @param orderBy 排序参数。
      * @return 查询结果集。
      */
     @Override
-    public List<SysPost> getNotInSysPostListByDeptId(Long deptId, SysPost filter, String orderBy) {
-        List<SysPost> resultList = sysPostMapper.getNotInSysPostListByDeptId(deptId, filter, orderBy);
+    public List<SysPost> getNotInSysPostListByDeptId(Long deptId, SysPost filter) {
+        List<SysPost> resultList = sysPostMapper.getNotInSysPostListByDeptId(deptId, filter);
         this.buildRelationForDataList(resultList, MyRelationParam.dictOnly());
         return resultList;
     }