mirror of
https://github.com/chatopera/cosin.git
synced 2025-08-01 16:38:02 +08:00
Fix IMGroupRepository related class
This commit is contained in:
parent
0bca180d6b
commit
5837db1bfd
@ -37,6 +37,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.lang.NonNull;
|
import org.springframework.lang.NonNull;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
@ -44,6 +45,7 @@ import org.springframework.util.FileCopyUtils;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import org.springframework.web.server.ResponseStatusException;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@ -230,7 +232,7 @@ public class EntIMController extends Handler {
|
|||||||
@Menu(type = "im", subtype = "entim")
|
@Menu(type = "im", subtype = "entim")
|
||||||
public ModelAndView groupMore(HttpServletRequest request, @Valid String id) {
|
public ModelAndView groupMore(HttpServletRequest request, @Valid String id) {
|
||||||
ModelAndView view = request(super.createEntIMTempletResponse("/apps/entim/group/index"));
|
ModelAndView view = request(super.createEntIMTempletResponse("/apps/entim/group/index"));
|
||||||
IMGroup imGroup = imGroupRes.findById(id);
|
IMGroup imGroup = imGroupRes.findById(id).orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("IMGroup %s not found", id)));
|
||||||
view.addObject("imGroup", imGroup);
|
view.addObject("imGroup", imGroup);
|
||||||
view.addObject("imGroupUserList", imGroupUserRes.findByImgroupAndOrgi(imGroup, super.getOrgi(request)));
|
view.addObject("imGroupUserList", imGroupUserRes.findByImgroupAndOrgi(imGroup, super.getOrgi(request)));
|
||||||
view.addObject("contextid", id);
|
view.addObject("contextid", id);
|
||||||
@ -264,7 +266,7 @@ public class EntIMController extends Handler {
|
|||||||
users.forEach(userProxy::attachOrgansPropertiesForUser);
|
users.forEach(userProxy::attachOrgansPropertiesForUser);
|
||||||
view.addObject("userList", users);
|
view.addObject("userList", users);
|
||||||
|
|
||||||
IMGroup imGroup = imGroupRes.findById(id);
|
IMGroup imGroup = imGroupRes.findById(id).orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("IMGroup %s not found", id)));
|
||||||
List<Organ> organs = organRes.findAllById(affiliates);
|
List<Organ> organs = organRes.findAllById(affiliates);
|
||||||
|
|
||||||
view.addObject("imGroup", imGroup);
|
view.addObject("imGroup", imGroup);
|
||||||
@ -318,12 +320,11 @@ public class EntIMController extends Handler {
|
|||||||
@Valid String tipmsg
|
@Valid String tipmsg
|
||||||
) {
|
) {
|
||||||
ModelAndView view = request(super.createRequestPageTempletResponse("/apps/entim/group/tipmsg"));
|
ModelAndView view = request(super.createRequestPageTempletResponse("/apps/entim/group/tipmsg"));
|
||||||
IMGroup imGroup = imGroupRes.findById(id);
|
imGroupRes.findById(id).ifPresent(imGroup -> {
|
||||||
if (imGroup != null) {
|
|
||||||
imGroup.setTipmessage(tipmsg);
|
imGroup.setTipmessage(tipmsg);
|
||||||
imGroupRes.save(imGroup);
|
imGroupRes.save(imGroup);
|
||||||
}
|
view.addObject("imGroup", imGroup);
|
||||||
view.addObject("imGroup", imGroup);
|
});
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,31 +1,30 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2017 优客服-多渠道客服系统
|
* Copyright (C) 2017 优客服-多渠道客服系统
|
||||||
* Modifications copyright (C) 2018-2019 Chatopera Inc, <https://www.chatopera.com>
|
* Modifications copyright (C) 2018-2019 Chatopera Inc, <https://www.chatopera.com>
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.chatopera.cc.persistence.repository;
|
package com.chatopera.cc.persistence.repository;
|
||||||
|
|
||||||
import com.chatopera.cc.model.IMGroup;
|
import com.chatopera.cc.model.IMGroup;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface IMGroupRepository extends
|
public interface IMGroupRepository extends JpaRepository<IMGroup, String> {
|
||||||
JpaRepository<IMGroup, String> {
|
// IMGroup findById(String id);
|
||||||
IMGroup findById(String id);
|
|
||||||
|
List<IMGroup> findByCreaterAndOrgi(String user, String orgi);
|
||||||
List<IMGroup> findByCreaterAndOrgi(String user, String orgi);
|
|
||||||
|
int countByNameAndOrgi(String name, String orgi);
|
||||||
int countByNameAndOrgi(String name, String orgi);
|
}
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user