Pārlūkot izejas kodu

feat:修改人情往来事件列表查询SQL

liuchuanwei 5 mēneši atpakaļ
vecāks
revīzija
b34fc81ff6

+ 7 - 8
src/main/java/com/anyway/favor/controller/FavorController.java

@@ -44,15 +44,13 @@ public class FavorController {
      * @return
      */
     @RequestMapping("/toList")
-    public ModelAndView toList(@RequestParam Map<String, Object> map, ModelAndView mv) {
+    public ModelAndView toList(ModelAndView mv) {
         User currentUser = SessionUtils.currentUser();
-        map.put("createBy", currentUser.getId());
-        if(!map.containsKey("sortName")) {
-            map.put("sortName", "occur_date");
-            map.put("sortOrder", "asc");
-        }
-        List<Favor> favorList = favorService.findByCondition(map);
-        mv.addObject("favorList", favorList);
+        //人员列表
+        Map<String, Object> map = new HashMap<>();
+        map.put("relatedId", SessionUtils.currentUserId());
+        List<Person> personList = personService.findByCondition(map);
+        mv.addObject("personList", personList);
         mv.setViewName("/favor/list");
         return mv;
     }
@@ -89,6 +87,7 @@ public class FavorController {
         map.put("relatedId", SessionUtils.currentUserId());
         List<Person> personList = personService.findByCondition(map);
         mv.addObject("personList", personList);
+        //送礼人员列表
         if (!StringUtils.isEmpty(sourcePersonIds)) {
             map.put("idList", Arrays.asList(sourcePersonIds.split(",")));
             List<Person> sourcePersonList = personService.findByCondition(map);

+ 7 - 1
src/main/resources/mapper/FavorMapper.xml

@@ -24,10 +24,16 @@
         <if test="occurDate != null">
             AND f.occur_date = #{occurDate}
         </if>
+        <if test="@Ognl@isNotEmpty(startOccurDate)">
+            AND f.occur_date >= DATE_FORMAT(#{startOccurDate},'%Y-%m-%d')
+        </if>
+        <if test="@Ognl@isNotEmpty(endOccurDate)">
+            <![CDATA[ AND f.occur_date <= DATE_FORMAT(#{endOccurDate},'%Y-%m-%d') ]]>
+        </if>
         <if test="title != null and title != ''">
             AND f.title LIKE CONCAT('%', #{title}, '%')
         </if>
-        <if test="personId != null">
+        <if test="@Ognl@isNotEmpty(personId)">
             AND f.person_id = #{personId}
         </if>
         <if test="remark != null and remark != ''">