Sfoglia il codice sorgente

sz 添加查询条件,翻译企业

xiao547607 5 anni fa
parent
commit
b7bfd1e364

+ 8 - 12
common/src/main/resources/mapper/base/MessageNotice.xml

@@ -94,18 +94,16 @@ id_,title_,content_,sender_id,recipient_id,status_,del_flag,create_by,create_tim
 		<![CDATA[
 			select * from base_message_notice a
 			LEFT JOIN base_message_notice_company b ON a.id_ = b.notice_id
-			LEFT JOIN base_company_info c ON b.company_id = c.id_
 		]]>
 		<where>
 			and a.del_flag = false
 			<if test="searchParams.title != null">
 				and a.title_ like #{searchParams.title}
 			</if>
-			<if test="searchParams.companyId != null">
-				and b.company_id = #{searchParams.companyId}
-			</if>
-			<if test="searchParams.companyCode != null">
-				and c.code_ like #{searchParams.companyCode}
+			<if test="searchParams.companyIds != null">
+				<foreach collection="searchParams.companyIds" item="companyId" open=" and b.company_id in("  close=")" separator=",">
+					#{companyId}
+				</foreach>
 			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">
@@ -116,18 +114,16 @@ id_,title_,content_,sender_id,recipient_id,status_,del_flag,create_by,create_tim
 		<![CDATA[
 			select a.id_,a.title_,a.create_time from base_message_notice a
 			LEFT JOIN base_message_notice_company b ON a.id_ = b.notice_id
-			LEFT JOIN base_company_info c ON b.company_id = c.id_
 		]]>
 		<where>
 			and a.del_flag = false
 			<if test="searchParams.title != null">
 				and a.title_ like #{searchParams.title}
 			</if>
-			<if test="searchParams.companyId != null">
-				and b.company_id like #{searchParams.companyId}
-			</if>
-			<if test="searchParams.companyCode != null">
-				and c.code_ like #{searchParams.companyCode}
+			<if test="searchParams.companyIds != null">
+				<foreach collection="searchParams.companyIds" item="companyId" open=" and b.company_id in("  close=")" separator=",">
+					#{companyId}
+				</foreach>
 			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">

+ 3 - 3
web/src/main/java/com/jpsoft/smart/modules/base/controller/MessageNoticeController.java

@@ -285,12 +285,12 @@ public class MessageNoticeController {
         }
 
         if (StringUtils.isEmpty(companyCode)){
-            if (!userService.hasRole(subject,"SYSADMIN")) {
-                searchParams.put("companyCode", companyInfo.getCode() + "%");
+            if (userService.hasRole(subject,"SYSADMIN")) {
+                searchParams.put("companyIds", companyInfo.getCode().split(","));
             }
         }
         else{
-            searchParams.put("companyCode", companyCode + "%");
+            searchParams.put("companyIds", companyInfo.getCode().split(","));
         }
 
         Page<MessageNotice> page = messageNoticeService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);

+ 2 - 2
web/src/main/java/com/jpsoft/smart/modules/mobile/controller/MessageNoticeApiController.java

@@ -114,7 +114,7 @@ public class MessageNoticeApiController {
         MessageResult<Map> msgResult = new MessageResult<>();
 
         Map<String,Object> searchParams = new HashMap<>();
-        searchParams.put("companyId", personInfo.getCompanyId());
+        //searchParams.put("companyId", personInfo.getCompanyId());
 
         List<Sort> sortList = new ArrayList<>();
         sortList.add(new Sort("create_time","desc"));
@@ -122,7 +122,7 @@ public class MessageNoticeApiController {
         //获取公司CODE
         CompanyInfo company = companyService.get(personInfo.getCompanyId());
         //包含下级公司
-        searchParams.put("companyCode", company.getCode() + "%");
+        searchParams.put("companyIds", company.getCode().split(","));
 
         Page<MessageNotice> page = messageNoticeService.pageSearchShort(searchParams,pageIndex,pageSize,true,sortList);