mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-16 05:20:42 +08:00
✨ 添加新特性
1. 添加MaxKey用户通过excel导入功能-后端接口开发 100%
This commit is contained in:
@@ -26,12 +26,10 @@ import java.util.Map;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import org.apache.mybatis.jpa.persistence.JpaPageResults;
|
||||
import org.maxkey.constants.ConstantsOperateMessage;
|
||||
import org.maxkey.crypto.ReciprocalUtils;
|
||||
import org.maxkey.domain.UserInfo;
|
||||
import org.maxkey.persistence.service.UserInfoListener;
|
||||
import org.maxkey.persistence.service.UserInfoService;
|
||||
import org.maxkey.util.JsonUtils;
|
||||
import org.maxkey.util.StringUtils;
|
||||
@@ -144,8 +142,11 @@ public class UserInfoController {
|
||||
*/
|
||||
@RequestMapping(value = "/importing")
|
||||
public Object importing(MultipartFile file) throws IOException {
|
||||
EasyExcel.read(file.getInputStream(), UserInfo.class, new UserInfoListener(userInfoService)).sheet().doRead();
|
||||
return "success";
|
||||
if (userInfoService.importing(file)) {
|
||||
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_SUCCESS), null, MessageType.success, OperateType.add, MessageScope.DB);
|
||||
}else {
|
||||
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_ERROR), MessageType.error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user