mybatis-jpa-extra-2.7

This commit is contained in:
MaxKey 2021-12-24 19:11:40 +08:00
parent dc686cb08c
commit 283c4a5bb6
33 changed files with 198 additions and 185 deletions

View File

@ -40,9 +40,11 @@ public class JsonPretty implements Pretty{
* @return String
*/
public String jacksonFormat(Object bean){
String prettyJson="";
String prettyJson = "";
try {
prettyJson= (new ObjectMapper()).writerWithDefaultPrettyPrinter().writeValueAsString(bean);
prettyJson = (new ObjectMapper())
.writerWithDefaultPrettyPrinter()
.writeValueAsString(bean);
} catch (JsonGenerationException e) {
e.printStackTrace();
} catch (JsonMappingException e) {
@ -59,7 +61,9 @@ public class JsonPretty implements Pretty{
* @return String
*/
public String format(Object bean){
Gson gson = new GsonBuilder().setPrettyPrinting().create();
Gson gson = new GsonBuilder()
.setPrettyPrinting()
.create();
String json = gson.toJson(bean);
return json;
}

View File

@ -26,6 +26,7 @@ import java.util.StringTokenizer;
import org.maxkey.pretty.Pretty;
public class SqlPretty implements Pretty{
public static final String WHITESPACE = " \n\r\f\t";
private static final Set<String> BEGIN_CLAUSES = new HashSet<String>();
private static final Set<String> END_CLAUSES = new HashSet<String>();
@ -33,6 +34,9 @@ public class SqlPretty implements Pretty{
private static final Set<String> QUANTIFIERS = new HashSet<String>();
private static final Set<String> DML = new HashSet<String>();
private static final Set<String> MISC = new HashSet<String>();
private static final String INDENT_STRING = " ";
//mhshi modify
private static final String INITIAL = "";//System.lineSeparator() + INDENT_STRING;
static {
BEGIN_CLAUSES.add( "left" );
@ -72,10 +76,6 @@ public class SqlPretty implements Pretty{
MISC.add( "on" );
}
private static final String INDENT_STRING = " ";
//mhshi modify
private static final String INITIAL = "";//System.lineSeparator() + INDENT_STRING;
public SqlPretty() {
}

View File

@ -20,10 +20,15 @@ package org.maxkey.constants;
public class ConstantsEntryType {
public static int USERINFO_TYPE = 1;
public static int ORG_TYPE = 2;
public static int ORGANIZATION_TYPE = 2;
public static int GROUP_TYPE = 3;
public static int PASSWORD_TYPE = 4;
public static int RESOURCES_TYPE = 5;
public static int PERMISSIONS_TYPE = 6;
}

View File

@ -20,14 +20,23 @@ package org.maxkey.constants;
public class ConstantsLoginType {
public static final String LOCAL = "Local Login";
public static final String BASIC = "Basic";
public static final String SOCIALSIGNON = "Social Sign On";
public static final String REMEBER_ME = "RemeberMe";
public static final String DESKTOP = "Desktop";
public static final String KERBEROS = "Kerberos";
public static final String SAMLTRUST = "SAML v2.0 Trust";
public static final String MSADTRUST = "MS AD Trust";
public static final String CAS = "CAS";
public static final String WSFEDERATION = "WsFederation";
public static final String JWT = "Jwt";

View File

@ -28,8 +28,8 @@ public final class ConstantsPasswordSetType {
public static final int INITIAL_PASSWORD = 1;
public static final int MANAGER_CHANGED_PASSWORD = 2;
public static final int PASSWORD_EXPIRED = 3;
public static final int MANAGER_CHANGED_PASSWORD = 2;
}

View File

@ -32,18 +32,18 @@ public final class ConstantsProtocols {
public static final String TOKENBASED = "Token_Based";
// OAuth
public static final String OAUTH20 = "OAuth_v2.0";
public static final String OAUTH21 = "OAuth_v2.1";
// SAML
public static final String SAML20 = "SAML_v2.0";
public static final String OPEN_ID_CONNECT10 = "OpenID_Connect_v1.0";
public static final String CAS = "CAS";
public static final String JWT = "JWT";
// OAuth
public static final String OAUTH20 = "OAuth_v2.0";
public static final String OAUTH21 = "OAuth_v2.1";
public static final String OPEN_ID_CONNECT10 = "OpenID_Connect_v1.0";
}

View File

@ -45,6 +45,4 @@ public class ContentType {
public static final String IMAGE_PNG = "image/png";
}

View File

@ -86,7 +86,7 @@ public class FormBasedDetailsServiceTest {
idList.add("ab7422e9-a91a-4840-9e59-9d911257c918");
idList.add("12b6ceb8-573b-4f01-ad85-cfb24cfa007c");
idList.add("dafd5ba4-d2e3-4656-bd42-178841e610fe");
service.batchDelete(idList);
service.deleteBatch(idList);
}
@Test

View File

@ -76,19 +76,17 @@ public class AuthorizeBaseEndpoint {
Accounts account=new Accounts();
UserInfo userInfo=WebContext.getUserInfo();
Apps loadApp = getApp(app.getId());
if(loadApp.getCredential()==Apps.CREDENTIALS.USER_DEFINED){
account=accountsService.load(new Accounts(userInfo.getId(),loadApp.getId()));
if(account!=null){
if(loadApp.getCredential() == Apps.CREDENTIALS.USER_DEFINED){
account = accountsService.load(new Accounts(userInfo.getId(),loadApp.getId()));
if(account != null){
account.setRelatedPassword(PasswordReciprocal.getInstance().decoder(account.getRelatedPassword()));
}
}else if(loadApp.getCredential()==Apps.CREDENTIALS.SHARED){
}else if(loadApp.getCredential() == Apps.CREDENTIALS.SHARED){
account.setRelatedUsername(loadApp.getSharedUsername());
account.setRelatedPassword(PasswordReciprocal.getInstance().decoder(loadApp.getSharedPassword()));
}else if(loadApp.getCredential()==Apps.CREDENTIALS.SYSTEM){
}else if(loadApp.getCredential() == Apps.CREDENTIALS.SYSTEM){
if(loadApp.getSystemUserAttr().equalsIgnoreCase("userId")){
account.setUsername(userInfo.getId());
}else if(loadApp.getSystemUserAttr().equalsIgnoreCase("username")){
@ -104,7 +102,6 @@ public class AuthorizeBaseEndpoint {
account.setRelatedPassword(PasswordReciprocal.getInstance().decoder(WebContext.getUserInfo().getDecipherable()));
}else if(loadApp.getCredential()==Apps.CREDENTIALS.NONE){
account.setUsername(userInfo.getUsername());
account.setRelatedPassword(userInfo.getUsername());

View File

@ -44,6 +44,6 @@ public class OnlineTicketEndpoint {
public String ticketValidate(
@RequestParam(value ="ticket",required = true) String ticket) {
OnlineTicket onlineTicket = onlineTicketServices.get(ticket);
return onlineTicket == null ? "" :onlineTicket.getTicketId();
return onlineTicket == null ? "" : onlineTicket.getTicketId();
}
}

View File

@ -21,12 +21,12 @@ package org.maxkey.authz.cas.endpoint.ticket;
public class CasConstants {
/* CAS Protocol Parameters. **/
public static final class PARAMETER{
public final static String ENDPOINT_CAS_DETAILS="CAS_AUTHORIZE_ENDPOINT_CAS_DETAILS";
public final static String ENDPOINT_CAS_DETAILS = "CAS_AUTHORIZE_ENDPOINT_CAS_DETAILS";
public final static String PARAMETER_MAP="CAS_AUTHORIZE_ENDPOINT_PARAMETER_MAP";
public final static String PARAMETER_MAP = "CAS_AUTHORIZE_ENDPOINT_PARAMETER_MAP";
/** Constant representing the ticket parameter in the request. */
public final static String TICKET="ticket";
public final static String TICKET = "ticket";
/** Constant representing the service parameter in the request. */
public static final String SERVICE = "service";

View File

@ -139,7 +139,7 @@ public class AdaptersController {
public Message delete(@ModelAttribute("appsAdapter") AppsAdapters appsAdapter) {
_logger.debug("-delete appsAdapter :" + appsAdapter);
if (appsAdaptersService.batchDelete(appsAdapter.getId())) {
if (appsAdaptersService.deleteBatch(appsAdapter.getId())) {
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.DELETE_SUCCESS),MessageType.success);
} else {

View File

@ -166,7 +166,7 @@ public class ApplicationsController extends BaseAppContorller {
@RequestMapping(value={"/delete"})
public Message delete(@ModelAttribute("application") Apps application) {
_logger.debug("-delete application :" + application);
if (appsService.batchDelete(application.getId())) {
if (appsService.deleteBatch(application.getId())) {
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.DELETE_SUCCESS),MessageType.success);
} else {

View File

@ -144,7 +144,7 @@ public class AccountsController {
_logger.debug("-delete AppAccounts :" + appAccounts);
accountsService.batchDelete(appAccounts.getId());
accountsService.deleteBatch(appAccounts.getId());
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.DELETE_SUCCESS),MessageType.success);

View File

@ -157,7 +157,7 @@ public class GroupMemberController {
return new Message("传入参数为空",MessageType.error);
}
if(groupMemberService.batchDelete(groupMember.getId())) {
if(groupMemberService.deleteBatch(groupMember.getId())) {
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_SUCCESS),MessageType.info);
}
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_ERROR),MessageType.error);

View File

@ -129,7 +129,7 @@ public class GroupPrivilegesController {
return new Message("传入参数为空",MessageType.error);
}
if(groupPrivilegesService.batchDelete(groupApp.getId())) {
if(groupPrivilegesService.deleteBatch(groupApp.getId())) {
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_SUCCESS),MessageType.info);
}

View File

@ -131,7 +131,7 @@ public class NoticesController {
public Message delete(@ModelAttribute("notice")Notices notice) {
_logger.debug("-delete notice :" + notice);
if (noticesService.batchDelete(notice.getId())) {
if (noticesService.deleteBatch(notice.getId())) {
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.DELETE_SUCCESS),MessageType.success);
} else {

View File

@ -175,7 +175,7 @@ public class OrganizationsController {
@RequestMapping({"/delete"})
public Message delete(@ModelAttribute("org") Organizations org) {
_logger.debug("-delete organization :" + org);
if (this.organizationsService.batchDelete(org.getId())) {
if (this.organizationsService.deleteBatch(org.getId())) {
return new Message(WebContext.getI18nValue("message.action.delete.success"), MessageType.success);
}
@ -208,7 +208,7 @@ public class OrganizationsController {
// 数据去重
if(!CollectionUtils.isEmpty(orgsList)){
orgsList = orgsList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getId()))), ArrayList::new));
if(organizationsService.batchInsert(orgsList)) {
if(organizationsService.insertBatch(orgsList)) {
new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_SUCCESS), null, MessageType.success, OperateType.add, MessageScope.DB);
}else {
new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_ERROR), MessageType.error);

View File

@ -144,7 +144,7 @@ public class ResourcesController {
public Message delete(@ModelAttribute("resource") Resources resource) {
_logger.debug("-delete resource :" + resource);
if (resourcesService.batchDelete(resource.getId())) {
if (resourcesService.deleteBatch(resource.getId())) {
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.DELETE_SUCCESS),MessageType.success);
} else {

View File

@ -144,7 +144,7 @@ public class RoleMemberController {
return new Message("传入参数为空",MessageType.error);
}
if(roleMemberService.batchDelete(roleMember.getId())) {
if(roleMemberService.deleteBatch(roleMember.getId())) {
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_SUCCESS),MessageType.info);
}
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_ERROR),MessageType.error);

View File

@ -133,7 +133,7 @@ public class SocialsProviderController {
public Message delete(@ModelAttribute("socialsProvider") SocialsProvider socialsProvider) {
_logger.debug("-delete socialsProvider :" + socialsProvider);
if (socialsProviderService.batchDelete(socialsProvider.getId())) {
if (socialsProviderService.deleteBatch(socialsProvider.getId())) {
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.DELETE_SUCCESS),MessageType.success);
} else {

View File

@ -136,7 +136,7 @@ public class UserAdjointController {
public Message delete(@ModelAttribute("userInfoAdjoint") UserInfoAdjoint userInfoAdjoint) {
_logger.debug("-delete group :" + userInfoAdjoint);
if (userInfoAdjointService.batchDelete(userInfoAdjoint.getId())) {
if (userInfoAdjointService.deleteBatch(userInfoAdjoint.getId())) {
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.DELETE_SUCCESS),MessageType.success);
} else {
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.DELETE_SUCCESS),MessageType.error);

View File

@ -217,7 +217,7 @@ public class UserInfoController {
@RequestMapping(value="/batchDelete")
public Message batchDeleteUsers(@RequestParam("id")String id) {
_logger.debug(id);
if(userInfoService.batchDelete(StringUtils.string2List(id, ","))) {
if(userInfoService.deleteBatch(StringUtils.string2List(id, ","))) {
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.DELETE_SUCCESS),MessageType.success);
} else {
@ -235,7 +235,7 @@ public class UserInfoController {
@RequestMapping(value="/delete")
public Message deleteUsersById(@RequestParam("id") String id) {
_logger.debug(id);
if(userInfoService.batchDelete(id)) {
if(userInfoService.deleteBatch(id)) {
//provisioningPrepare.prepare(userInfo, OPERATEACTION.DELETE_ACTION);
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.DELETE_SUCCESS),MessageType.success);
} else {
@ -313,7 +313,7 @@ public class UserInfoController {
// 数据去重
if(!CollectionUtils.isEmpty(userInfoList)){
userInfoList = userInfoList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getUsername()))), ArrayList::new));
if( userInfoService.batchInsert(userInfoList)) {
if( userInfoService.insertBatch(userInfoList)) {
new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_SUCCESS), null, MessageType.success, OperateType.add, MessageScope.DB);
}else {
new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_ERROR), MessageType.error);