Explorar el Código

add 增长下载列表的查询

周箭河 hace 4 años
padre
commit
3cd0f574fc

+ 19 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/ManagerDownloadQueryInfo.java

@@ -0,0 +1,19 @@
+package com.ym.mec.biz.dal.page;
+
+
+import com.ym.mec.common.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
+
+public class ManagerDownloadQueryInfo extends QueryInfo {
+
+    @ApiModelProperty(value = "用户id", required = false)
+    private Integer userId = 0;
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+}

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/ManagerDownloadService.java

@@ -0,0 +1,8 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.ManagerDownload;
+import com.ym.mec.common.service.BaseService;
+
+public interface ManagerDownloadService extends BaseService<Integer, ManagerDownload> {
+
+}

+ 22 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ManagerDownloadServiceImpl.java

@@ -0,0 +1,22 @@
+package com.ym.mec.biz.service.impl;
+
+import com.ym.mec.biz.dal.dao.ManagerDownloadDao;
+import com.ym.mec.biz.dal.entity.ManagerDownload;
+import com.ym.mec.biz.service.ManagerDownloadService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class ManagerDownloadServiceImpl extends BaseServiceImpl<Integer, ManagerDownload> implements ManagerDownloadService {
+
+    @Autowired
+    private ManagerDownloadDao managerDownloadDao;
+
+    @Override
+    public BaseDAO<Integer, ManagerDownload> getDAO() {
+        return managerDownloadDao;
+    }
+
+}

+ 5 - 8
mec-biz/src/main/resources/config/mybatis/ManagerDownloadMapper.xml

@@ -29,8 +29,8 @@
         insert into manager_download (user_id_, name_, file_url_,
         status_, create_time_, update_time_
         )
-        values (#{userId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{fileUrl,jdbcType=VARCHAR},
-        #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
+        values (#{userId}, #{name}, #{fileUrl},
+        #{status}, #{createTime}, #{updateTime}
         )
     </insert>
 
@@ -50,12 +50,8 @@
             <if test="status != null">
                 status_ = #{status},
             </if>
-            <if test="createTime != null">
-                create_time_ = #{createTime},
-            </if>
-            <if test="updateTime != null">
-                update_time_ = #{updateTime},
-            </if>
+            create_time_ = NOW(),
+            update_time_ = NOW(),
         </set>
         where id_ = #{id}
     </update>
@@ -64,6 +60,7 @@
     <select id="queryPage" resultMap="ManagerDownload" parameterType="map">
         SELECT * FROM manager_download
         <include refid="queryPageSql"/>
+        ORDER BY id_ DESC
         <include refid="global.limit"/>
     </select>
 

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -1122,7 +1122,7 @@ public class ExportController extends BaseController {
         managerDownload.setUpdateTime(nowDate);
         managerDownloadDao.insert(managerDownload);
         exportService.orderList(params,managerDownload);
-        return succeed("导出成功,请到下载列表查看");
+        return succeed("数据导出中,请到下载列表查看");
     }
 
 

+ 47 - 0
mec-web/src/main/java/com/ym/mec/web/controller/ManagerDownloadController.java

@@ -0,0 +1,47 @@
+package com.ym.mec.web.controller;
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.entity.Organization;
+import com.ym.mec.biz.dal.page.ManagerDownloadQueryInfo;
+import com.ym.mec.biz.dal.page.OrganizationQueryInfo;
+import com.ym.mec.biz.service.ManagerDownloadService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+@RequestMapping("managerDownload")
+@Api(tags = "下载列表")
+@RestController
+public class ManagerDownloadController extends BaseController {
+
+    @Autowired
+    private ManagerDownloadService managerDownloadService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+
+    @ApiOperation(value = "分页查询列表")
+    @GetMapping("/queryPage")
+    @PreAuthorize("@pcs.hasPermissions('managerDownload/queryPage')")
+    public Object queryPage(ManagerDownloadQueryInfo queryInfo) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        queryInfo.setUserId(sysUser.getId());
+        return succeed(managerDownloadService.queryPage(queryInfo));
+    }
+
+    @ApiOperation(value = "删除")
+    @PostMapping("/del/{id}")
+    @PreAuthorize("@pcs.hasPermissions('managerDownload/del')")
+    public Object del(@ApiParam(value = "下载记录id", required = true) @PathVariable("id") Integer id) {
+        return succeed(managerDownloadService.delete(id));
+    }
+
+}