Explorar o código

打卡记录月份筛选

zxz %!s(int64=3) %!d(string=hai) anos
pai
achega
530cccd4ef

+ 7 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/ClockInfo.java

@@ -141,6 +141,13 @@ public class ClockInfo extends BaseModel<ClockInfo> {
      */
     @TableField(exist = false)
     private String searchKeyWord;
+    /**
+     * 年月
+     */
+    @JsonFormat(pattern = "yyyy-MM")
+    @DateTimeFormat(pattern = "yyyy-MM")
+    @TableField(exist = false)
+    private Date yearMonth;
     /**
      * 开始时间
      */

+ 1 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/ClockInfoServiceImpl.java

@@ -127,6 +127,7 @@ public class ClockInfoServiceImpl extends ServiceImpl<ClockInfoMapper, ClockInfo
         pageView.put("compId", clockInfo.getCompId());
         pageView.put("commonId", clockInfo.getCommonId());
         pageView.put("pageSize", clockInfo.getPageSize());
+        pageView.put("yearMonth",clockInfo.getYearMonth());
         pageView.put("currentPage", clockInfo.getCurrentPage());
         // 查询总数
         Integer dataCount = baseMapper.getCountByCondition(pageView);

+ 8 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/ClockInfoMapper.xml

@@ -10,6 +10,10 @@
         comp_id = #{compId}
         and common_id = #{commonId}
         and delete_flag = '0'
+        <if test="yearMonth != null">
+            AND (DATE_FORMAT(create_date,"%Y%m") like
+            DATE_FORMAT(#{yearMonth},"%Y%m"))
+        </if>
 --         and leave_id == null
     </select>
     <!-- 打卡记录查询 -->
@@ -39,6 +43,10 @@
         and common_id = #{commonId}
         and delete_flag = '0'
 --         and leave_id == ''
+        <if test="yearMonth != null">
+            AND (DATE_FORMAT(create_date,"%Y%m") like
+            DATE_FORMAT(#{yearMonth},"%Y%m"))
+        </if>
         ORDER BY create_date
         <if test="currentPage != null and currentPage != ''">
             LIMIT ${startRecord}, ${pageSize}