jz.kai 5 лет назад
Родитель
Сommit
578212b81a

+ 6 - 3
common/src/main/resources/mapper/base/MessageNotice.xml

@@ -106,12 +106,15 @@ id_,title_,content_,sender_id,recipient_id,status_,del_flag,create_by,create_tim
 	</select>
 	<select id="searchShort" parameterType="hashmap" resultMap="MessageNoticeMap">
 		<![CDATA[
-			select id_,title_,create_time from base_message_notice
+			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
 		]]>
 		<where>
-			and del_flag = false
+			and a.del_flag = false
 			<if test="searchParams.title != null">
-				and title_ like #{searchParams.title}
+				and a.title_ like #{searchParams.title}
+			</if>
+			<if test="searchParams.companyId != null">
+				and b.company_id like #{searchParams.companyId}
 			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">

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

@@ -2,7 +2,10 @@ package com.jpsoft.smart.modules.mobile.controller;
 
 import com.github.pagehelper.Page;
 import com.jpsoft.smart.modules.base.entity.MessageNotice;
+import com.jpsoft.smart.modules.base.entity.MessageNoticeCompany;
+import com.jpsoft.smart.modules.base.entity.PersonInfo;
 import com.jpsoft.smart.modules.base.service.MessageNoticeService;
+import com.jpsoft.smart.modules.base.service.PersonInfoService;
 import com.jpsoft.smart.modules.common.dto.MessageResult;
 import com.jpsoft.smart.modules.common.dto.Sort;
 import com.jpsoft.smart.modules.common.utils.PojoUtils;
@@ -26,6 +29,8 @@ public class MessageNoticeApiController {
 
     @Autowired
     private MessageNoticeService messageNoticeService;
+    @Autowired
+    private PersonInfoService personInfoService;
 
     @ApiOperation(value="获取信息")
     @RequestMapping(value = "detail",method = RequestMethod.POST)
@@ -91,6 +96,7 @@ public class MessageNoticeApiController {
     @ApiOperation(value="列表")
     @RequestMapping(value = "pageListShort",method = RequestMethod.POST)
     public MessageResult<Map> pageListShort(
+            String openId,
             String token,
             @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
             @RequestParam(value="pageSize",defaultValue="20") int pageSize,
@@ -98,10 +104,12 @@ public class MessageNoticeApiController {
 
         //当前用户ID
         System.out.println(subject);
+        PersonInfo personInfo = personInfoService.findByOpenId(openId);
 
         MessageResult<Map> msgResult = new MessageResult<>();
 
         Map<String,Object> searchParams = new HashMap<>();
+        searchParams.put("companyId", personInfo.getCompanyId());
 
         List<Sort> sortList = new ArrayList<>();
         sortList.add(new Sort("create_time","desc"));