| @@ -3,6 +3,7 @@ package com.ffii.fpsms.modules.user.entity; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Optional; | import java.util.Optional; | ||||
| import com.ffii.fpsms.modules.user.entity.projections.UserCombo; | |||||
| import org.springframework.data.repository.query.Param; | import org.springframework.data.repository.query.Param; | ||||
| import com.ffii.core.support.AbstractRepository; | import com.ffii.core.support.AbstractRepository; | ||||
| @@ -12,4 +13,6 @@ public interface UserRepository extends AbstractRepository<User, Long> { | |||||
| List<User> findByName(@Param("name") String name); | List<User> findByName(@Param("name") String name); | ||||
| Optional<User> findByUsernameAndDeletedFalse(String username); | Optional<User> findByUsernameAndDeletedFalse(String username); | ||||
| List<UserCombo> findUserComboByTitleNotNullAndDepartmentNotNull(); | |||||
| } | } | ||||
| @@ -0,0 +1,19 @@ | |||||
| package com.ffii.fpsms.modules.user.entity.projections; | |||||
| import org.springframework.beans.factory.annotation.Value; | |||||
| public interface UserCombo { | |||||
| Long getId(); | |||||
| @Value("#{target.id}") | |||||
| Long getValue(); | |||||
| @Value("#{target.department} - #{target.title} - #{target.name}") | |||||
| String getLabel(); | |||||
| String getName(); | |||||
| String getDepartment(); | |||||
| String getTitle(); | |||||
| } | |||||
| @@ -8,6 +8,7 @@ import java.util.Optional; | |||||
| import java.util.Set; | import java.util.Set; | ||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
| import com.ffii.fpsms.modules.user.entity.projections.UserCombo; | |||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -269,4 +270,8 @@ public class UserService extends AbstractBaseEntityService<User, Long, UserRepos | |||||
| instance = save(instance); | instance = save(instance); | ||||
| return randomPassword; | return randomPassword; | ||||
| } | } | ||||
| public List<UserCombo> getEscalationCombo() { | |||||
| return userRepository.findUserComboByTitleNotNullAndDepartmentNotNull(); | |||||
| } | |||||
| } | } | ||||
| @@ -5,6 +5,7 @@ import java.util.HashMap; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| import com.ffii.fpsms.modules.user.entity.projections.UserCombo; | |||||
| import com.ffii.fpsms.modules.user.service.pojo.UserRecord; | import com.ffii.fpsms.modules.user.service.pojo.UserRecord; | ||||
| import org.apache.commons.logging.Log; | import org.apache.commons.logging.Log; | ||||
| import org.apache.commons.logging.LogFactory; | import org.apache.commons.logging.LogFactory; | ||||
| @@ -72,6 +73,11 @@ public class UserController{ | |||||
| return ResponseEntity.ok(userService.search(req)); | return ResponseEntity.ok(userService.search(req)); | ||||
| } | } | ||||
| @GetMapping("/escalation-combo") | |||||
| public ResponseEntity<List<UserCombo>> escalationCombo() { | |||||
| return ResponseEntity.ok(userService.getEscalationCombo()); | |||||
| } | |||||
| @GetMapping("/name-list") | @GetMapping("/name-list") | ||||
| public ResponseEntity<List<Map<String, Object>>> namelist() { | public ResponseEntity<List<Map<String, Object>>> namelist() { | ||||
| SearchUserReq req = new SearchUserReq(); | SearchUserReq req = new SearchUserReq(); | ||||