Sfoglia il codice sorgente

我的报表查询

zhonghui 3 anni fa
parent
commit
ca85c3e9f7

+ 7 - 2
boman-report/src/main/java/com/boman/report/controller/StatisticReportController.java

@@ -1,7 +1,9 @@
 package com.boman.report.controller;
 
 import com.boman.common.core.web.controller.BaseController;
+import com.boman.common.core.web.page.TableDataInfo;
 import com.boman.domain.dto.AjaxResult;
+import com.boman.domain.entity.StatisticReportPersonnel;
 import com.boman.report.service.StatisticReportService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -11,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 @RestController
 @RequestMapping("/statistic/report")
 public class StatisticReportController extends BaseController {
@@ -35,9 +39,10 @@ public class StatisticReportController extends BaseController {
      * @return
      */
     @RequestMapping("/list")
-    public AjaxResult list(@RequestBody StatisticReport report) {
+    public TableDataInfo list(@RequestBody StatisticReport report) {
         startPage();
-        return AjaxResult.success(reportService.selectList(report));
+        List<StatisticReport> list = reportService.selectList(report);
+        return getDataTable(list);
     }
 
     @RequestMapping("/saveOrUpdate")

+ 30 - 0
boman-report/src/main/java/com/boman/report/controller/StatisticReportPersonnelController.java

@@ -0,0 +1,30 @@
+package com.boman.report.controller;
+
+import com.boman.common.core.web.controller.BaseController;
+import com.boman.common.core.web.page.TableDataInfo;
+import com.boman.domain.entity.StatisticReportPersonnel;
+import com.boman.report.service.StatisticReportPersonnelService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/statistic/reportPersonnel")
+public class StatisticReportPersonnelController extends BaseController {
+
+    @Autowired
+    private StatisticReportPersonnelService service;
+
+    /**
+     * 列表
+     * @return
+     */
+    @RequestMapping("/list")
+    public TableDataInfo list(@RequestBody StatisticReportPersonnel personnel) {
+        startPage();
+        List<StatisticReportPersonnel> list = service.selectList(personnel);
+        return getDataTable(list);
+    }
+
+}

+ 4 - 0
boman-report/src/main/java/com/boman/report/mapper/StatisticReportPersonnelMapper.java

@@ -15,5 +15,9 @@ public interface StatisticReportPersonnelMapper {
     int deleteByStatisticIds(List<Long> ids);
 
     int insert(StatisticReportPersonnel personnel);
+
     List<StatisticReportPersonnel> selectByStatisticId(Long id);
+
+    List<StatisticReportPersonnel> selectList(StatisticReportPersonnel personnel);
+
 }

+ 2 - 0
boman-report/src/main/java/com/boman/report/service/StatisticReportPersonnelService.java

@@ -13,4 +13,6 @@ public interface StatisticReportPersonnelService {
     int deleteByStatisticIds(List<Long> ids);
 
     int insert(List<StatisticReportPersonnel> personnels);
+
+    List<StatisticReportPersonnel> selectList(StatisticReportPersonnel personnel);
 }

+ 9 - 0
boman-report/src/main/java/com/boman/report/service/impl/StatisticReportPersonnelImpl.java

@@ -1,5 +1,6 @@
 package com.boman.report.service.impl;
 
+import com.boman.common.core.utils.SecurityUtils;
 import com.boman.domain.entity.StatisticReportPersonnel;
 import com.boman.report.mapper.StatisticReportPersonnelMapper;
 import com.boman.report.service.StatisticReportPersonnelService;
@@ -43,4 +44,12 @@ public class StatisticReportPersonnelImpl implements StatisticReportPersonnelSer
         }
         return personnels.size();
     }
+
+    @Override
+    public List<StatisticReportPersonnel> selectList(StatisticReportPersonnel personnel) {
+        personnel.setUserName(SecurityUtils.getUsername());
+        return personnelMapper.selectList(personnel);
+    }
+
+
 }

+ 0 - 1
boman-report/src/main/resources/mapper/StatisticReportMapper.xml

@@ -63,7 +63,6 @@
             </if>
         </where>
         order by create_time DESC
-        limit
     </select>
 
     <insert id="insert" parameterType="com.boman.domain.entity.StatisticReport" useGeneratedKeys="true" keyProperty="id">

+ 16 - 0
boman-report/src/main/resources/mapper/StatisticReportPersonnelMapper.xml

@@ -20,6 +20,22 @@
         <result property="updateTime" column="update_time"/>
     </resultMap>
 
+    <select id="selectList" parameterType="com.boman.domain.entity.StatisticReportPersonnel" resultMap="StatisticReportPersonnelResult">
+        SELECT r.* FROM  statistic_report_personnel p
+        JOIN statistic_report r on r.id = p.statistic_id AND r.is_del = 'N' and r.`status` = '2'
+        <where>
+            <if test="createBy != null and createBy != ''">
+                AND p.create_by = #{createBy}
+            </if>
+            <if test="reportName != null and reportName != ''">
+                AND lower(r.report_name) like lower(concat('%', #{reportName}, '%'))
+            </if>
+            <if test="userName != null and userName != ''">
+                AND p.user_name = #{userName}
+            </if>
+        </where>
+    </select>
+
     <delete id="deleteByStatisticIds" parameterType="java.util.List">
         delete from statistic_report_personnel where statistic_id in
         <foreach collection="ids" item="id" open="(" separator="," close=")">