gaoxiong 2 роки тому
батько
коміт
d9580af8dc

+ 11 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/mapper/SysNfcBindMapper.java

@@ -2,9 +2,12 @@ package com.xunmei.system.mapper;
 
 import java.util.List;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.xunmei.system.api.domain.SysUser;
 import com.xunmei.system.domain.SysNfcBind;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 【请填写功能名称】Mapper接口
@@ -31,6 +34,14 @@ public interface SysNfcBindMapper extends BaseMapper<SysNfcBind> {
      List<SysNfcBind> selectSysNfcBindList(SysNfcBind sysNfcBind);
 
     /**
+     * 自定义分页
+     * @param page
+     * @param info
+     * @return
+     */
+    Page<SysNfcBind> selectNFCPage(Page<SysNfcBind> page, @Param("info") SysNfcBind info);
+
+    /**
      * 修改区域名称
      * @param sysNfcBind
      * @return

+ 18 - 22
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysNfcBindServiceImpl.java

@@ -62,31 +62,27 @@ public class SysNfcBindServiceImpl extends ServiceImpl<SysNfcBindMapper, SysNfcB
             page = new Page<>();
         }
         //查询条件
-        String name = sysNfcBind.getAreaName();
-        sysNfcBind.setAreaName(null);
-        String code = sysNfcBind.getCode();
-        sysNfcBind.setCode(null);
-        QueryWrapper<SysNfcBind> query = new QueryWrapper<>(sysNfcBind);
-        if (StringUtils.isNotEmpty(name)) {
-            query.like("area_name", name);
-        }
-        if (StringUtils.isNotEmpty(code)) {
-            query.like("code", code);
+        QueryWrapper<SysOrg> queryWrapper = new QueryWrapper<>();
+        SysOrg org = null;
+        if (null == sysNfcBind.getOrgId()) {
+            queryWrapper.eq("parent_id", -1);
+            org = orgService.getOne(queryWrapper);
+        } else {
+            org = orgService.getById(sysNfcBind.getOrgId());
         }
+        sysNfcBind.setOrgPath(org.getPath());
+
         //下穿
-        if (sysNfcBind.getCheckSub()) {
-            List<Long> ids = orgService.selectCheckSubOrgIdList(sysNfcBind.getOrgId());
-            //清空前端传递的org_id
-            sysNfcBind.setOrgId(null);
-            //添加in条件
-            query.in("org_id", ids);
-        }
-        //时间范围查询
-        if (sysNfcBind.getParams().get("beginTime") != null && sysNfcBind.getParams().get("endTime") != null) {
-            query.between("create_time", sysNfcBind.getParams().get("beginTime"), sysNfcBind.getParams().get("endTime"));
-        }
+//        if (sysNfcBind.getCheckSub()) {
+//            List<Long> ids = orgService.selectCheckSubOrgIdList(sysNfcBind.getOrgId());
+//            //清空前端传递的org_id
+//            sysNfcBind.setOrgId(null);
+//            //添加in条件
+//            query.in("org_id", ids);
+//        }
+
         //获取数据
-        page = sysNfcBindMapper.selectPage(page, query);
+        page = sysNfcBindMapper.selectNFCPage(page, sysNfcBind);
         return TableDataInfo.build(page);
 
 

+ 42 - 0
soc-modules/soc-modules-system/src/main/resources/mapper/system/SysNfcBindMapper.xml

@@ -76,6 +76,48 @@
         <include refid="selectSysNfcBindVo"/>
         where id = #{id}
     </select>
+    <select id="selectNFCPage" resultType="com.xunmei.system.domain.SysNfcBind">
+        SELECT
+            a.id,
+            a.area_id,
+            a.area_name,
+            a.ENABLE,
+            a.del_flag,
+            a.CODE,
+            a.update_id,
+            a.org_id,
+            a.org_name,
+            a.org_path,
+            a.collection_area_name,
+            a.check_id,
+            a.create_by,
+            a.create_time,
+            a.update_by,
+            a.update_time
+            FROM
+                sys_nfc_bind  a
+                LEFT JOIN sys_org b on a.org_id = b.id
+            WHERE
+                del_flag = 0
+        <choose>
+            <when test="info.checkSub">
+                AND b.path like concat('%', #{info.orgPath}, '%')
+            </when>
+            <otherwise>
+                AND b.id = #{info.orgId}
+            </otherwise>
+        </choose>
+        <if test="info.areaName != null  and info.areaName != ''">
+            and a.area_name = concat("%",#{info.areaName},"%")
+        </if>
+        <if test="info.code != null  and info.code != ''">
+            and a.code = concat("%",#{info.code},"%")
+        </if>
+        <if test="info.enable != null  and info.enable != ''">
+            and a.enable = #{info.enable}
+        </if>
+        order by a.org_id,a.area_id,code
+    </select>
 
     <insert id="insertSysNfcBind" parameterType="com.xunmei.system.domain.SysNfcBind">
         insert into sys_nfc_bind