complete login
This commit is contained in:
parent
92f11e27fb
commit
f4890e4b71
@ -16,8 +16,8 @@
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<project.build.finalName>admin-api</project.build.finalName>
|
||||
<start-class>com.pudonghot.ambition.admin.AmbitionAdminCloud</start-class>
|
||||
<project.build.finalName>ambition-crm</project.build.finalName>
|
||||
<start-class>com.pudonghot.ambition.crm.AmbitionCRM</start-class>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@ -27,7 +27,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pudonghot.ambition</groupId>
|
||||
<artifactId>mapper</artifactId>
|
||||
<artifactId>crm-mapper</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pudonghot.ambition</groupId>
|
||||
|
@ -1,28 +0,0 @@
|
||||
package com.pudonghot.ambition.admin.service.support;
|
||||
|
||||
import me.chyxion.tigon.model.ViewModel;
|
||||
import com.pudonghot.ambition.model.AdminAuthFailedLog;
|
||||
import com.pudonghot.ambition.mapper.AdminAuthFailedLogMapper;
|
||||
import com.pudonghot.ambition.admin.service.AdminAuthFailedLogService;
|
||||
import me.chyxion.tigon.service.support.BaseCrudServiceSupport;
|
||||
import com.pudonghot.ambition.form.create.AdminAuthFailedLogFormForCreate;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Shaun Chyxion <br>
|
||||
* chyxion@163.com <br>
|
||||
* May 14, 2016 3:23:37 PM
|
||||
*/
|
||||
public class AdminAuthFailedServiceSupport
|
||||
extends BaseCrudServiceSupport<String, AdminAuthFailedLog, AdminAuthFailedLogMapper>
|
||||
implements AdminAuthFailedLogService {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ViewModel<AdminAuthFailedLog> create(AdminAuthFailedLogFormForCreate form) {
|
||||
return create(form.copy(new AdminAuthFailedLog()));
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package com.pudonghot.ambition.admin.service.support;
|
||||
|
||||
import com.pudonghot.ambition.admin.service.AdminLoginLogService;
|
||||
import me.chyxion.tigon.model.ViewModel;
|
||||
import com.pudonghot.ambition.model.AdminLoginLog;
|
||||
import com.pudonghot.ambition.mapper.AdminLoginLogMapper;
|
||||
import me.chyxion.tigon.service.support.BaseCrudServiceSupport;
|
||||
import com.pudonghot.ambition.form.create.AdminLoginLogFormForCreate;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Shaun Chyxion <br>
|
||||
* chyxion@163.com <br>
|
||||
* May 14, 2016 3:23:37 PM
|
||||
*/
|
||||
public class AdminLoginLogServiceSupport
|
||||
extends BaseCrudServiceSupport<String, AdminLoginLog, AdminLoginLogMapper>
|
||||
implements AdminLoginLogService {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ViewModel<AdminLoginLog> create(AdminLoginLogFormForCreate form) {
|
||||
return create(form.copy(new AdminLoginLog()));
|
||||
}
|
||||
}
|
@ -1,161 +0,0 @@
|
||||
package com.pudonghot.ambition.admin.service.support;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.InputStream;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.Assert;
|
||||
import me.chyxion.tigon.mybatis.Search;
|
||||
import me.chyxion.tigon.model.ViewModel;
|
||||
import com.pudonghot.ambition.model.Admin;
|
||||
import me.chyxion.tigon.sequence.IdSequence;
|
||||
import com.pudonghot.ambition.file.ImageTool;
|
||||
import com.pudonghot.ambition.util.Sha512Utils;
|
||||
import com.pudonghot.ambition.mapper.AdminMapper;
|
||||
import com.pudonghot.ambition.file.AmbitionFileApi;
|
||||
import com.pudonghot.ambition.admin.service.AdminService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import com.pudonghot.ambition.form.create.AdminFormForCreate;
|
||||
import com.pudonghot.ambition.form.update.AdminFormForUpdate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import me.chyxion.tigon.service.support.BaseCrudByFormServiceSupport;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Shaun Chyxion <br>
|
||||
* chyxion@163.com <br>
|
||||
* Sep 22, 2015 10:45:41 AM
|
||||
*/
|
||||
@Slf4j
|
||||
public class AdminServiceSupport
|
||||
extends BaseCrudByFormServiceSupport<String, Admin,
|
||||
AdminFormForCreate, AdminFormForUpdate, AdminMapper>
|
||||
implements AdminService {
|
||||
@Autowired
|
||||
private AmbitionFileApi fileApi;
|
||||
@Autowired
|
||||
private ImageTool imageTool;
|
||||
@Value("${default.admin.avatar.size:512}")
|
||||
private int defaultAvatarSize;
|
||||
@Autowired
|
||||
private IdSequence idSeq;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ViewModel<Admin> create(AdminFormForCreate form, InputStream avatar) {
|
||||
final ViewModel<Admin> viewModel = super.create(form);
|
||||
final Admin admin = viewModel.getData();
|
||||
if (avatar != null) {
|
||||
uploadAvatar(admin.getId(), avatar);
|
||||
}
|
||||
else {
|
||||
uploadAvatar(admin.getId(),
|
||||
admin.getName(),
|
||||
admin.getGender());
|
||||
}
|
||||
return viewModel;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public ViewModel<Admin> update(AdminFormForUpdate form, InputStream avatar) {
|
||||
ViewModel<Admin> viewModel = update(form);
|
||||
if (avatar != null) {
|
||||
fileApi.uploadImage(imageTool.cropToSquare(avatar, defaultAvatarSize),
|
||||
AVATAR_FOLDER, String.valueOf(form.getId()));
|
||||
}
|
||||
return viewModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean validatePassword(String adminId, String password) {
|
||||
final Admin admin = mapper.find(adminId);
|
||||
return hashPassword(admin.getId(), password)
|
||||
.equals((admin.getPassword()));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ViewModel<Admin> loginFind(String loginId) {
|
||||
log.info("Find Admin By [{}].", loginId);
|
||||
Admin user = null;
|
||||
for (String field : new String[] {Admin.LOGIN_ID, Admin.MOBILE, Admin.EMAIL}) {
|
||||
user = mapper.find(new Search(field, loginId).eq(Admin.ENABLED, true));
|
||||
if (user != null) {
|
||||
log.info("Found Admin [{}] By [{}].", user, field);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return user != null ? toViewModel(user) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public ViewModel<Admin> update(String adminId, InputStream avatar) {
|
||||
final Admin admin = mapper.find(adminId);
|
||||
Assert.state(admin != null, "No Admin [" + adminId + "] Found");
|
||||
admin.setUpdatedBy(adminId);
|
||||
admin.setDateUpdated(new Date());
|
||||
mapper.update(admin);
|
||||
fileApi.uploadImage(imageTool.cropToSquare(avatar, defaultAvatarSize),
|
||||
AVATAR_FOLDER, String.valueOf(adminId));
|
||||
return toViewModel(admin);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ViewModel<Admin> updatePassword(String userId, String password) {
|
||||
final Admin admin = mapper.find(userId);
|
||||
Assert.state(admin != null, "No Admin [" + userId + "] Found");
|
||||
final String passwordSalt = idSeq.get();
|
||||
admin.setPassword(hashPassword(passwordSalt, password));
|
||||
return update(admin);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void processViewModel(ViewModel<Admin> viewModel, Admin model) {
|
||||
super.processViewModel(viewModel, model);
|
||||
if (model != null) {
|
||||
viewModel.setAttr("avatar", urlCacheClear(model,
|
||||
fileApi.getUrl(AVATAR_FOLDER, String.valueOf(model.getId()))));
|
||||
}
|
||||
}
|
||||
|
||||
String uploadAvatar(final String userId, final String name, final String gender) {
|
||||
return fileApi.uploadAvatar(AVATAR_FOLDER, String.valueOf(userId), name, gender);
|
||||
}
|
||||
|
||||
String uploadAvatar(String id, InputStream avatar) {
|
||||
String avatarUrl = null;
|
||||
if (avatar != null) {
|
||||
avatarUrl = fileApi.uploadImage(
|
||||
imageTool.cropToSquare(avatar, defaultAvatarSize),
|
||||
AVATAR_FOLDER, String.valueOf(id));
|
||||
}
|
||||
return avatarUrl;
|
||||
}
|
||||
|
||||
protected String hashPassword(final String passwordSalt, final String password) {
|
||||
return Sha512Utils.encode(password, passwordSalt);
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.pudonghot.ambition.admin;
|
||||
package com.pudonghot.ambition.crm;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
@ -14,13 +14,13 @@ import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
|
||||
@EnableAutoConfiguration(exclude = {
|
||||
RedisAutoConfiguration.class,
|
||||
DataSourceAutoConfiguration.class})
|
||||
@ComponentScan("com.pudonghot.ambition.admin")
|
||||
public class AmbitionAdminCloud {
|
||||
@ComponentScan("com.pudonghot.ambition.crm")
|
||||
public class AmbitionCRM {
|
||||
|
||||
/**
|
||||
* @param args start args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AmbitionAdminCloud.class, args);
|
||||
SpringApplication.run(AmbitionCRM.class, args);
|
||||
}
|
||||
}
|
@ -1,25 +1,25 @@
|
||||
package com.pudonghot.ambition.admin.auth;
|
||||
package com.pudonghot.ambition.crm.auth;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.pudonghot.ambition.model.Admin;
|
||||
import me.chyxion.tigon.model.ViewModel;
|
||||
import org.apache.shiro.session.Session;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import me.chyxion.tigon.shiro.AuthCallback;
|
||||
import me.chyxion.tigon.shiro.model.AuthUser;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import me.chyxion.tigon.shiro.AuthCallback;
|
||||
import org.springframework.stereotype.Service;
|
||||
import me.chyxion.tigon.shiro.model.AuthInfo;
|
||||
import com.pudonghot.ambition.crm.model.User;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.apache.shiro.web.subject.WebSubject;
|
||||
import org.apache.shiro.authc.AuthenticationInfo;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import com.pudonghot.ambition.admin.service.AdminLoginLogService;
|
||||
import com.pudonghot.ambition.crm.service.AuthLogService;
|
||||
import com.pudonghot.ambition.util.HttpServletRequestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.pudonghot.ambition.admin.service.AdminAuthFailedLogService;
|
||||
import com.pudonghot.ambition.form.create.AdminLoginLogFormForCreate;
|
||||
import com.pudonghot.ambition.form.create.AdminAuthFailedLogFormForCreate;
|
||||
import com.pudonghot.ambition.crm.service.AuthFailedLogService;
|
||||
import com.pudonghot.ambition.crm.form.create.AuthLogFormForCreate;
|
||||
import com.pudonghot.ambition.crm.form.create.AuthFailedLogFormForCreate;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
@ -32,9 +32,9 @@ import com.pudonghot.ambition.form.create.AdminAuthFailedLogFormForCreate;
|
||||
@Service
|
||||
public class AuthCallbackSupport implements AuthCallback {
|
||||
@Autowired
|
||||
private AdminLoginLogService authLogService;
|
||||
private AuthLogService authLogService;
|
||||
@Autowired
|
||||
private AdminAuthFailedLogService authLogFailedService;
|
||||
private AuthFailedLogService authLogFailedService;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
@ -47,20 +47,20 @@ public class AuthCallbackSupport implements AuthCallback {
|
||||
Session session = ws.getSession(false);
|
||||
HttpServletRequest request = (HttpServletRequest) ws.getServletRequest();
|
||||
|
||||
AuthUser<ViewModel<Admin>> authUser = new AuthUser<ViewModel<Admin>>();
|
||||
AuthUser<ViewModel<User>> authUser = new AuthUser<ViewModel<User>>();
|
||||
String ip = HttpServletRequestUtils.getClientIP(request);
|
||||
authUser.setAttr("ip", ip);
|
||||
String userAgent = request.getHeader("User-Agent");
|
||||
authUser.setAttr("userAgent", userAgent);
|
||||
ViewModel<Admin> user = (ViewModel<Admin>) ((AuthInfo) info).getExtra();
|
||||
ViewModel<User> user = (ViewModel<User>) ((AuthInfo) info).getExtra();
|
||||
final String userId = user.getData().getId();
|
||||
authUser.setUserId(userId);
|
||||
authUser.setUser(user);
|
||||
log.info("Save Auth User [{}] To Session [{}].", user, session.getId());
|
||||
authUser.save(session);
|
||||
|
||||
AdminLoginLogFormForCreate alForm = new AdminLoginLogFormForCreate();
|
||||
alForm.setAdminId(userId);
|
||||
AuthLogFormForCreate alForm = new AuthLogFormForCreate();
|
||||
alForm.setUserId(userId);
|
||||
alForm.setIp(ip);
|
||||
alForm.setUserAgent(userAgent);
|
||||
alForm.setCreatedBy(userId);
|
||||
@ -82,7 +82,7 @@ public class AuthCallbackSupport implements AuthCallback {
|
||||
|
||||
WebSubject ws = (WebSubject) subject;
|
||||
HttpServletRequest request = (HttpServletRequest) ws.getServletRequest();
|
||||
AdminAuthFailedLogFormForCreate form = new AdminAuthFailedLogFormForCreate();
|
||||
AuthFailedLogFormForCreate form = new AuthFailedLogFormForCreate();
|
||||
form.setLoginId(loginId);
|
||||
form.setPassword(password);
|
||||
form.setIp(HttpServletRequestUtils.getClientIP(request));
|
@ -1,12 +1,12 @@
|
||||
package com.pudonghot.ambition.admin.auth;
|
||||
package com.pudonghot.ambition.crm.auth;
|
||||
|
||||
import me.chyxion.tigon.model.ViewModel;
|
||||
import me.chyxion.tigon.shiro.AuthRealm;
|
||||
import com.pudonghot.ambition.model.Admin;
|
||||
import com.pudonghot.ambition.crm.model.User;
|
||||
import org.springframework.stereotype.Service;
|
||||
import me.chyxion.tigon.shiro.model.Credential;
|
||||
import com.pudonghot.ambition.admin.service.AdminService;
|
||||
import org.apache.shiro.authc.LockedAccountException;
|
||||
import com.pudonghot.ambition.crm.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
@ -20,7 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
public class AuthRealmSupport extends AuthRealm {
|
||||
|
||||
@Autowired
|
||||
private AdminService userService;
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
@ -28,15 +28,15 @@ public class AuthRealmSupport extends AuthRealm {
|
||||
@Override
|
||||
public Credential credential(Object principal) {
|
||||
Credential credential = null;
|
||||
final ViewModel<Admin> adminViewModel = userService.loginFind((String) principal);
|
||||
if (adminViewModel != null) {
|
||||
Admin admin = adminViewModel.getData();
|
||||
final ViewModel<User> userViewModel = userService.loginFind((String) principal);
|
||||
if (userViewModel != null) {
|
||||
User admin = userViewModel.getData();
|
||||
if (!admin.isEnabled()) {
|
||||
throw new LockedAccountException("账户已禁用,请联系管理员");
|
||||
}
|
||||
credential = new Credential(
|
||||
admin.getPassword(),
|
||||
admin.getId()).setExtra(adminViewModel);
|
||||
admin.getId()).setExtra(userViewModel);
|
||||
}
|
||||
return credential;
|
||||
}
|
||||
@ -47,7 +47,7 @@ public class AuthRealmSupport extends AuthRealm {
|
||||
@Override
|
||||
public boolean credentialMatch(Object password, Credential credential) {
|
||||
return userService.validatePassword(
|
||||
((ViewModel<Admin>) credential.getExtra()).getData().getId(),
|
||||
((ViewModel<User>) credential.getExtra()).getData().getId(),
|
||||
new String((char[])password));
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.pudonghot.ambition.admin.controller;
|
||||
package com.pudonghot.ambition.crm.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -9,7 +9,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import org.apache.commons.lang3.CharEncoding;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import com.pudonghot.ambition.common.Constants;
|
||||
import com.pudonghot.ambition.crm.common.Constants;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import me.chyxion.tigon.exception.InvalidParamException;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -168,7 +168,7 @@ public abstract class AbstractBaseController {
|
||||
}
|
||||
else {
|
||||
throw new InvalidParamException(
|
||||
"Unknown Request Device Type [{}] OS [{}]", deviceType, os) ;
|
||||
"Unknown Request Device Type [{}] OS [{}]", deviceType, os) ;
|
||||
}
|
||||
return platform;
|
||||
}
|
@ -1,16 +1,16 @@
|
||||
package com.pudonghot.ambition.admin.controller;
|
||||
package com.pudonghot.ambition.crm.controller;
|
||||
|
||||
import me.chyxion.tigon.model.ViewModel;
|
||||
import com.pudonghot.ambition.model.Admin;
|
||||
import com.pudonghot.ambition.crm.model.User;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import me.chyxion.tigon.shiro.service.AuthService;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
import com.pudonghot.ambition.admin.service.AdminService;
|
||||
import com.pudonghot.ambition.crm.service.UserService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @author Shaun Chyxion <br>
|
||||
@ -21,12 +21,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@Controller
|
||||
public class AuthController {
|
||||
@Autowired
|
||||
private AdminService adminService;
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private AuthService authService;
|
||||
|
||||
@RequestMapping(value = "/auth/login", method = RequestMethod.POST)
|
||||
public ViewModel<Admin> login(
|
||||
public ViewModel<User> login(
|
||||
@NotBlank(message = "Param 'loginId' Could Not Be Blank")
|
||||
@RequestParam("loginId")
|
||||
String loginId,
|
||||
@ -35,7 +35,7 @@ public class AuthController {
|
||||
String password,
|
||||
@RequestParam(value = "rememberMe", defaultValue = "false")
|
||||
boolean rememberMe) {
|
||||
return adminService.findViewModel((String) authService.login(
|
||||
return userService.findViewModel((String) authService.login(
|
||||
loginId, password, rememberMe).getUserId());
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ public class AuthController {
|
||||
}
|
||||
|
||||
@RequestMapping("/auth/info")
|
||||
public ViewModel<Admin> info() {
|
||||
return adminService.findViewModel((String) authService.getAuthUser().getUserId());
|
||||
public ViewModel<User> info() {
|
||||
return userService.findViewModel((String) authService.getAuthUser().getUserId());
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
package com.pudonghot.ambition.admin.controller;
|
||||
package com.pudonghot.ambition.crm.controller;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import me.chyxion.tigon.model.ViewModel;
|
||||
import com.pudonghot.ambition.model.Admin;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.pudonghot.ambition.crm.model.User;
|
||||
import me.chyxion.tigon.shiro.model.AuthUser;
|
||||
import me.chyxion.tigon.shiro.service.AuthService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -31,14 +31,14 @@ public class BaseController extends AbstractBaseController {
|
||||
* get auth user
|
||||
* @return
|
||||
*/
|
||||
protected AuthUser<ViewModel<Admin>> getAuthUser() {
|
||||
return authService.<ViewModel<Admin>>getAuthUser();
|
||||
protected AuthUser<ViewModel<User>> getAuthUser() {
|
||||
return authService.getAuthUser();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
protected ViewModel<Admin> getUser() {
|
||||
protected ViewModel<User> getUser() {
|
||||
return getAuthUser().getUser();
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.pudonghot.ambition.admin.controller;
|
||||
package com.pudonghot.ambition.crm.controller;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -10,14 +10,15 @@ import me.chyxion.tigon.shiro.service.AuthService;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.bind.annotation.InitBinder;
|
||||
import com.pudonghot.ambition.form.create.BaseFormForCreate;
|
||||
import com.pudonghot.ambition.form.update.BaseFormForUpdate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.context.request.ServletWebRequest;
|
||||
import org.springframework.web.multipart.support.ByteArrayMultipartFileEditor;
|
||||
|
||||
import com.pudonghot.ambition.crm.form.create.BaseFormForCreate;
|
||||
import com.pudonghot.ambition.crm.form.update.BaseFormForUpdate;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
@ -1,15 +1,17 @@
|
||||
package com.pudonghot.ambition.admin.controller;
|
||||
package com.pudonghot.ambition.crm.controller;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import me.chyxion.tigon.model.BaseModel;
|
||||
import me.chyxion.tigon.model.ViewModel;
|
||||
import me.chyxion.tigon.form.BaseFormForUpdateApi;
|
||||
import me.chyxion.tigon.service.BaseCrudByFormService;
|
||||
import com.pudonghot.ambition.form.create.BaseFormForCreate;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import com.pudonghot.ambition.crm.form.create.BaseFormForCreate;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
@ -1,10 +1,12 @@
|
||||
package com.pudonghot.ambition.admin.controller;
|
||||
package com.pudonghot.ambition.crm.controller;
|
||||
|
||||
import me.chyxion.tigon.model.BaseModel;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import me.chyxion.tigon.form.BaseFormForUpdateApi;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import com.pudonghot.ambition.form.create.BaseFormForCreate;
|
||||
|
||||
import com.pudonghot.ambition.crm.form.create.BaseFormForCreate;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.pudonghot.ambition.admin.controller;
|
||||
package com.pudonghot.ambition.crm.controller;
|
||||
|
||||
import me.chyxion.tigon.model.M2;
|
||||
import me.chyxion.tigon.mybatis.Search;
|
@ -1,4 +1,4 @@
|
||||
package com.pudonghot.ambition.admin.controller;
|
||||
package com.pudonghot.ambition.crm.controller;
|
||||
|
||||
import java.io.File;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -7,9 +7,11 @@ import me.chyxion.tigon.mybatis.Search;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import me.chyxion.tigon.webmvc.ResourceModel;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import com.pudonghot.ambition.model.FileInfo;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import com.pudonghot.ambition.mapper.FileInfoMapper;
|
||||
|
||||
import com.pudonghot.ambition.crm.mapper.FileInfoMapper;
|
||||
import com.pudonghot.ambition.crm.model.FileInfo;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
@ -1,4 +1,4 @@
|
||||
package com.pudonghot.ambition.admin.controller;
|
||||
package com.pudonghot.ambition.crm.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
@ -1,4 +1,4 @@
|
||||
package com.pudonghot.ambition.admin.controller;
|
||||
package com.pudonghot.ambition.crm.controller;
|
||||
|
||||
import java.io.InputStream;
|
||||
import javax.validation.Valid;
|
||||
@ -6,16 +6,16 @@ import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import me.chyxion.tigon.model.ViewModel;
|
||||
import me.chyxion.tigon.model.ListResult;
|
||||
import com.pudonghot.ambition.model.Admin;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import com.pudonghot.ambition.crm.model.User;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import com.pudonghot.ambition.crm.service.UserService;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.pudonghot.ambition.admin.service.AdminService;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import com.pudonghot.ambition.form.create.AdminFormForCreate;
|
||||
import com.pudonghot.ambition.form.update.AdminFormForUpdate;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.pudonghot.ambition.crm.form.create.UserFormForCreate;
|
||||
import com.pudonghot.ambition.crm.form.update.UserFormForUpdate;
|
||||
|
||||
/**
|
||||
* @author Shaun Chyxion <br>
|
||||
@ -23,12 +23,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
* Mar 09, 2017 21:54:00
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/admin")
|
||||
public class AdminController
|
||||
extends BaseQueryController<Admin> {
|
||||
@RequestMapping("/user")
|
||||
public class UserController
|
||||
extends BaseQueryController<User> {
|
||||
|
||||
@RequestMapping("/list")
|
||||
public ListResult<ViewModel<Admin>> list(
|
||||
public ListResult<ViewModel<User>> list(
|
||||
@Min(0)
|
||||
@RequestParam(value = "start", defaultValue = "0")
|
||||
int start,
|
||||
@ -42,36 +42,36 @@ public class AdminController
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
public ViewModel<Admin> create(
|
||||
@Valid AdminFormForCreate form,
|
||||
public ViewModel<User> create(
|
||||
@Valid UserFormForCreate form,
|
||||
HttpServletRequest request) {
|
||||
return ((AdminService) queryService)
|
||||
return ((UserService) queryService)
|
||||
.create(form, getAvatar(request));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public ViewModel<Admin> update(
|
||||
@Valid AdminFormForUpdate form,
|
||||
public ViewModel<User> update(
|
||||
@Valid UserFormForUpdate form,
|
||||
HttpServletRequest request) {
|
||||
return ((AdminService) queryService)
|
||||
return ((UserService) queryService)
|
||||
.update(form, getAvatar(request));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/profile")
|
||||
public ViewModel<Admin> profile() {
|
||||
public ViewModel<User> profile() {
|
||||
return queryService.findViewModel(getUserId());
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/upload-avatar")
|
||||
public ViewModel<Admin> uploadAvatar(
|
||||
public ViewModel<User> uploadAvatar(
|
||||
@RequestParam("avatar") MultipartFile avatar) {
|
||||
return ((AdminService) queryService).update(
|
||||
return ((UserService) queryService).update(
|
||||
getUserId(), getInputStream(avatar));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-password")
|
||||
public ViewModel<Admin> uploadPassword(@RequestParam("password") String password) {
|
||||
return ((AdminService) queryService).updatePassword(getUserId(), password);
|
||||
public ViewModel<User> uploadPassword(@RequestParam("password") String password) {
|
||||
return ((UserService) queryService).updatePassword(getUserId(), password);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,11 +79,11 @@ public class AdminController
|
||||
*/
|
||||
@Override
|
||||
protected String[] searchCols() {
|
||||
return new String[] {Admin.NAME,
|
||||
Admin.LOGIN_ID,
|
||||
Admin.MOBILE,
|
||||
Admin.EMAIL,
|
||||
Admin.NOTE};
|
||||
return new String[] {User.NAME,
|
||||
User.LOGIN_ID,
|
||||
User.MOBILE,
|
||||
User.EMAIL,
|
||||
User.NOTE};
|
||||
}
|
||||
|
||||
private InputStream getAvatar(HttpServletRequest request) {
|
@ -1,12 +1,12 @@
|
||||
package com.pudonghot.ambition.admin.service;
|
||||
package com.pudonghot.ambition.crm.service;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import me.chyxion.tigon.model.ViewModel;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import me.chyxion.tigon.service.BaseCrudService;
|
||||
import com.pudonghot.ambition.model.AdminLoginLog;
|
||||
import com.pudonghot.ambition.crm.model.AuthFailedLog;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.pudonghot.ambition.form.create.AdminLoginLogFormForCreate;
|
||||
import com.pudonghot.ambition.crm.form.create.AuthFailedLogFormForCreate;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
@ -16,7 +16,7 @@ import com.pudonghot.ambition.form.create.AdminLoginLogFormForCreate;
|
||||
* May 14, 2016 3:10:38 PM
|
||||
*/
|
||||
@Validated
|
||||
public interface AdminLoginLogService extends BaseCrudService<String, AdminLoginLog> {
|
||||
public interface AuthFailedLogService extends BaseCrudService<Long, AuthFailedLog> {
|
||||
|
||||
/**
|
||||
* create auth log
|
||||
@ -24,5 +24,5 @@ public interface AdminLoginLogService extends BaseCrudService<String, AdminLogin
|
||||
* @return
|
||||
*/
|
||||
@NotNull
|
||||
ViewModel<AdminLoginLog> create(@Valid AdminLoginLogFormForCreate form);
|
||||
ViewModel<AuthFailedLog> create(@Valid AuthFailedLogFormForCreate form);
|
||||
}
|
@ -1,12 +1,15 @@
|
||||
package com.pudonghot.ambition.admin.service;
|
||||
package com.pudonghot.ambition.crm.service;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.pudonghot.ambition.crm.model.AuthLog;
|
||||
import me.chyxion.tigon.model.ViewModel;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import me.chyxion.tigon.service.BaseCrudService;
|
||||
import com.pudonghot.ambition.model.AdminAuthFailedLog;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.pudonghot.ambition.form.create.AdminAuthFailedLogFormForCreate;
|
||||
|
||||
import com.pudonghot.ambition.crm.form.create.AuthLogFormForCreate;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
@ -16,7 +19,7 @@ import com.pudonghot.ambition.form.create.AdminAuthFailedLogFormForCreate;
|
||||
* May 14, 2016 3:10:38 PM
|
||||
*/
|
||||
@Validated
|
||||
public interface AdminAuthFailedLogService extends BaseCrudService<String, AdminAuthFailedLog> {
|
||||
public interface AuthLogService extends BaseCrudService<Long, AuthLog> {
|
||||
|
||||
/**
|
||||
* create auth log
|
||||
@ -24,5 +27,5 @@ public interface AdminAuthFailedLogService extends BaseCrudService<String, Admin
|
||||
* @return
|
||||
*/
|
||||
@NotNull
|
||||
ViewModel<AdminAuthFailedLog> create(@Valid AdminAuthFailedLogFormForCreate form);
|
||||
ViewModel<AuthLog> create(@Valid AuthLogFormForCreate form);
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
package com.pudonghot.ambition.admin.service;
|
||||
package com.pudonghot.ambition.crm.service;
|
||||
|
||||
import java.io.InputStream;
|
||||
import javax.validation.Valid;
|
||||
import me.chyxion.tigon.model.ViewModel;
|
||||
import com.pudonghot.ambition.model.Admin;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import com.pudonghot.ambition.crm.model.User;
|
||||
import me.chyxion.tigon.service.BaseCrudService;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
import com.pudonghot.ambition.form.create.AdminFormForCreate;
|
||||
import com.pudonghot.ambition.form.update.AdminFormForUpdate;
|
||||
import com.pudonghot.ambition.crm.form.create.UserFormForCreate;
|
||||
import com.pudonghot.ambition.crm.form.update.UserFormForUpdate;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
@ -17,16 +17,16 @@ import com.pudonghot.ambition.form.update.AdminFormForUpdate;
|
||||
* chyxion@163.com <br>
|
||||
* May 4, 2016 1:18:42 PM
|
||||
*/
|
||||
public interface AdminService
|
||||
extends BaseCrudService<String, Admin> {
|
||||
String AVATAR_FOLDER = "admin_avatar";
|
||||
public interface UserService
|
||||
extends BaseCrudService<String, User> {
|
||||
String AVATAR_FOLDER = "user_avatar";
|
||||
|
||||
/**
|
||||
* find user by login id
|
||||
* @param loginId
|
||||
* @return admin view model
|
||||
*/
|
||||
ViewModel<Admin> loginFind(@NotBlank String loginId);
|
||||
ViewModel<User> loginFind(@NotBlank String loginId);
|
||||
|
||||
/**
|
||||
* @param adminId
|
||||
@ -34,8 +34,8 @@ public interface AdminService
|
||||
* @return true if password is correct
|
||||
*/
|
||||
boolean validatePassword(
|
||||
@NotNull String adminId,
|
||||
@NotBlank String password);
|
||||
@NotNull String adminId,
|
||||
@NotBlank String password);
|
||||
|
||||
/**
|
||||
* create admin
|
||||
@ -43,10 +43,10 @@ public interface AdminService
|
||||
* @param avatar avatar
|
||||
* @return admin view model
|
||||
*/
|
||||
ViewModel<Admin> create(
|
||||
ViewModel<User> create(
|
||||
@NotNull
|
||||
@Valid
|
||||
AdminFormForCreate form,
|
||||
UserFormForCreate form,
|
||||
InputStream avatar);
|
||||
|
||||
/**
|
||||
@ -55,10 +55,10 @@ public interface AdminService
|
||||
* @param avatar avatar
|
||||
* @return admin view model
|
||||
*/
|
||||
ViewModel<Admin> update(
|
||||
@NotNull ViewModel<User> update(
|
||||
@NotNull
|
||||
@Valid
|
||||
AdminFormForUpdate form,
|
||||
UserFormForUpdate form,
|
||||
InputStream avatar);
|
||||
|
||||
/**
|
||||
@ -66,17 +66,17 @@ public interface AdminService
|
||||
* @param avatar
|
||||
* @return admin view model
|
||||
*/
|
||||
@NotNull ViewModel<Admin> update(
|
||||
@NotNull ViewModel<User> update(
|
||||
@NotBlank String adminId,
|
||||
@NotNull InputStream avatar);
|
||||
|
||||
/**
|
||||
* @param adminId admin id
|
||||
* @param userId admin id
|
||||
* @param password password
|
||||
* @return admin view model
|
||||
*/
|
||||
@NotNull ViewModel<Admin> updatePassword(
|
||||
@NotBlank String adminId,
|
||||
@NotNull ViewModel<User> updatePassword(
|
||||
@NotBlank String userId,
|
||||
@NotBlank String password);
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
package com.pudonghot.ambition.crm.service.support;
|
||||
|
||||
import me.chyxion.tigon.model.ViewModel;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.pudonghot.ambition.crm.model.AuthFailedLog;
|
||||
import com.pudonghot.ambition.crm.mapper.AuthFailedLogMapper;
|
||||
import com.pudonghot.ambition.crm.service.AuthFailedLogService;
|
||||
import me.chyxion.tigon.service.support.BaseCrudServiceSupport;
|
||||
import com.pudonghot.ambition.crm.form.create.AuthFailedLogFormForCreate;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Shaun Chyxion <br>
|
||||
* chyxion@163.com <br>
|
||||
* May 14, 2016 3:23:37 PM
|
||||
*/
|
||||
@Service
|
||||
public class AuthFailedServiceSupport
|
||||
extends BaseCrudServiceSupport<Long, AuthFailedLog, AuthFailedLogMapper>
|
||||
implements AuthFailedLogService {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ViewModel<AuthFailedLog> create(AuthFailedLogFormForCreate form) {
|
||||
return create(form.copy(new AuthFailedLog()));
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.pudonghot.ambition.crm.service.support;
|
||||
|
||||
import me.chyxion.tigon.model.ViewModel;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.pudonghot.ambition.crm.model.AuthLog;
|
||||
import com.pudonghot.ambition.crm.mapper.AuthLogMapper;
|
||||
import com.pudonghot.ambition.crm.service.AuthLogService;
|
||||
import me.chyxion.tigon.service.support.BaseCrudServiceSupport;
|
||||
import com.pudonghot.ambition.crm.form.create.AuthLogFormForCreate;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Shaun Chyxion <br>
|
||||
* chyxion@163.com <br>
|
||||
* May 14, 2016 3:23:37 PM
|
||||
*/
|
||||
@Service
|
||||
public class AuthLogServiceSupport
|
||||
extends BaseCrudServiceSupport<Long, AuthLog, AuthLogMapper>
|
||||
implements AuthLogService {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ViewModel<AuthLog> create(AuthLogFormForCreate form) {
|
||||
return create(form.copy(new AuthLog()));
|
||||
}
|
||||
}
|
@ -0,0 +1,160 @@
|
||||
package com.pudonghot.ambition.crm.service.support;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.InputStream;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.Assert;
|
||||
import me.chyxion.tigon.mybatis.Search;
|
||||
import me.chyxion.tigon.model.ViewModel;
|
||||
import com.pudonghot.ambition.crm.model.User;
|
||||
import com.pudonghot.ambition.file.ImageTool;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.pudonghot.ambition.util.Sha512Utils;
|
||||
import com.pudonghot.ambition.file.AmbitionFileApi;
|
||||
import com.pudonghot.ambition.crm.mapper.UserMapper;
|
||||
import com.pudonghot.ambition.crm.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.pudonghot.ambition.crm.form.create.UserFormForCreate;
|
||||
import com.pudonghot.ambition.crm.form.update.UserFormForUpdate;
|
||||
import me.chyxion.tigon.service.support.BaseCrudByFormServiceSupport;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Shaun Chyxion <br>
|
||||
* chyxion@163.com <br>
|
||||
* Sep 22, 2015 10:45:41 AM
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class UserServiceSupport
|
||||
extends BaseCrudByFormServiceSupport<String, User,
|
||||
UserFormForCreate, UserFormForUpdate, UserMapper>
|
||||
implements UserService {
|
||||
@Autowired
|
||||
private AmbitionFileApi fileApi;
|
||||
@Autowired
|
||||
private ImageTool imageTool;
|
||||
@Value("${user.avatar.size:512}")
|
||||
private int defaultAvatarSize;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public ViewModel<User> create(UserFormForCreate form, InputStream avatar) {
|
||||
final ViewModel<User> viewModel = super.create(form);
|
||||
final User user = viewModel.getData();
|
||||
if (avatar != null) {
|
||||
uploadAvatar(user.getId(), avatar);
|
||||
}
|
||||
else {
|
||||
uploadAvatar(user.getId(),
|
||||
user.getName(),
|
||||
user.getGender());
|
||||
}
|
||||
return viewModel;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public ViewModel<User> update(UserFormForUpdate form, InputStream avatar) {
|
||||
ViewModel<User> viewModel = update(form);
|
||||
if (avatar != null) {
|
||||
fileApi.uploadImage(imageTool.cropToSquare(avatar, defaultAvatarSize),
|
||||
AVATAR_FOLDER, form.getId());
|
||||
}
|
||||
return viewModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean validatePassword(String userId, String password) {
|
||||
final User user = mapper.find(userId);
|
||||
return hashPassword(user.getId(), password)
|
||||
.equals((user.getPassword()));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ViewModel<User> loginFind(String loginId) {
|
||||
log.info("Find User By [{}].", loginId);
|
||||
User user = null;
|
||||
for (String field : new String[] {User.LOGIN_ID, User.MOBILE, User.EMAIL}) {
|
||||
user = mapper.find(new Search(field, loginId).eq(User.ENABLED, true));
|
||||
if (user != null) {
|
||||
log.info("Found User [{}] By [{}].", user, field);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return user != null ? toViewModel(user) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public ViewModel<User> update(String userId, InputStream avatar) {
|
||||
final User user = mapper.find(userId);
|
||||
Assert.state(user != null, "No Admin [" + userId + "] Found");
|
||||
user.setUpdatedBy(userId);
|
||||
user.setDateUpdated(new Date());
|
||||
mapper.update(user);
|
||||
fileApi.uploadImage(imageTool.cropToSquare(avatar, defaultAvatarSize),
|
||||
AVATAR_FOLDER, userId);
|
||||
return toViewModel(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ViewModel<User> updatePassword(String userId, String password) {
|
||||
final User user = mapper.find(userId);
|
||||
Assert.state(user != null, "No Admin [" + userId + "] Found");
|
||||
user.setPassword(hashPassword(userId, password));
|
||||
return update(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void processViewModel(ViewModel<User> viewModel, User model) {
|
||||
super.processViewModel(viewModel, model);
|
||||
if (model != null) {
|
||||
viewModel.setAttr("avatar", urlCacheClear(model,
|
||||
fileApi.getUrl(AVATAR_FOLDER, model.getId())));
|
||||
}
|
||||
}
|
||||
|
||||
String uploadAvatar(final String userId, final String name, final String gender) {
|
||||
return fileApi.uploadAvatar(AVATAR_FOLDER, userId, name, gender);
|
||||
}
|
||||
|
||||
String uploadAvatar(String id, InputStream avatar) {
|
||||
String avatarUrl = null;
|
||||
if (avatar != null) {
|
||||
avatarUrl = fileApi.uploadImage(
|
||||
imageTool.cropToSquare(avatar, defaultAvatarSize),
|
||||
AVATAR_FOLDER, id);
|
||||
}
|
||||
return avatarUrl;
|
||||
}
|
||||
|
||||
protected String hashPassword(final String passwordSalt, final String password) {
|
||||
return Sha512Utils.encode(password, passwordSalt);
|
||||
}
|
||||
}
|
@ -1,23 +1,18 @@
|
||||
server.port=8088
|
||||
|
||||
# MySQL
|
||||
db.url=jdbc:mysql://127.0.0.1:43306/pudong_hot?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
|
||||
db.url=jdbc:mysql://127.0.0.1:43306/ambition_crm?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
|
||||
db.user=root
|
||||
db.password=696@2^~)oZ@^#*Q
|
||||
|
||||
file.server.base-path=http://10.0.10.93:41116/file/
|
||||
file.base-dir=/Users/chyxion/files
|
||||
|
||||
# Redis
|
||||
redis.host=127.0.0.1
|
||||
redis.port=46379
|
||||
redis.password=0211
|
||||
|
||||
# AliYun Account
|
||||
ali.access.key=K4oM0OVHbLS1cInv
|
||||
ali.access.secret=qjweLLtV1YLoAJQWI3CwFytG78UkTQ
|
||||
|
||||
# OSS
|
||||
ali.oss.bucket=ambition
|
||||
ali.oss.host.internal=oss-cn-shanghai.aliyuncs.com
|
||||
|
||||
# Session Redis prefix
|
||||
shiro.session.redis.prefix=ADMIN_AUTH_SESSION
|
||||
|
||||
|
@ -5,16 +5,17 @@ db.url=jdbc:mysql://127.0.0.1:43306/ambition_crm?useUnicode=true&characterEncodi
|
||||
db.user=root
|
||||
db.password=696@2^~)oZ@^#*Q
|
||||
|
||||
file.server.base-path=http://10.0.10.93:41116/file/
|
||||
file.server.base-path=http://127.0.0.:8088/f/
|
||||
file.base-dir=/Users/chyxion/files
|
||||
|
||||
# Redis
|
||||
redis.host=127.0.0.1
|
||||
redis.port=46379
|
||||
redis.password=0211
|
||||
redis.database=2
|
||||
|
||||
# Session Redis prefix
|
||||
shiro.session.redis.prefix=ADMIN_AUTH_SESSION
|
||||
# shiro.session.redis.prefix=ADMIN_AUTH_SESSION
|
||||
|
||||
spring.http.multipart.max-file-size=1024MB
|
||||
spring.http.multipart.max-request-size=1024MB
|
||||
|
@ -2,7 +2,6 @@ package com.pudonghot.ambition.admin.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.pudonghot.ambition.admin.AmbitionAdminCloud;
|
||||
import org.junit.Test;
|
||||
import java.util.HashMap;
|
||||
import org.junit.runner.RunWith;
|
||||
@ -12,6 +11,8 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.pudonghot.ambition.crm.AmbitionCRM;
|
||||
|
||||
/**
|
||||
* @author Shaun Chyxion <br>
|
||||
* chyxion@163.com <br>
|
||||
@ -19,7 +20,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
*/
|
||||
@SpringBootTest
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = AmbitionAdminCloud.class)
|
||||
@ContextConfiguration(classes = AmbitionCRM.class)
|
||||
public class SiteControllerTest {
|
||||
|
||||
@Autowired
|
||||
|
@ -1,13 +1,13 @@
|
||||
package com.pudonghot.ambition.admin.service;
|
||||
|
||||
import com.pudonghot.ambition.admin.AmbitionAdminCloud;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.pudonghot.ambition.crm.AmbitionCRM;
|
||||
|
||||
/**
|
||||
* @author Donghuang <br>
|
||||
* donghuang@wacai.com <br>
|
||||
@ -15,10 +15,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
*/
|
||||
@SpringBootTest
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = AmbitionAdminCloud.class)
|
||||
@ContextConfiguration(classes = AmbitionCRM.class)
|
||||
public class EmployeeServiceTest {
|
||||
@Autowired
|
||||
private EmployeeService employeeService;
|
||||
|
||||
@Test
|
||||
public void testListEmployee() {
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
<parent>
|
||||
<groupId>com.pudonghot.ambition</groupId>
|
||||
<artifactId>ambition</artifactId>
|
||||
<artifactId>ambition-crm</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../</relativePath>
|
||||
</parent>
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
<parent>
|
||||
<groupId>com.pudonghot.ambition</groupId>
|
||||
<artifactId>ambition</artifactId>
|
||||
<artifactId>ambition-crm</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../</relativePath>
|
||||
</parent>
|
||||
@ -22,7 +22,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pudonghot.ambition</groupId>
|
||||
<artifactId>mapper</artifactId>
|
||||
<artifactId>crm-mapper</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.chyxion.tigon</groupId>
|
||||
|
@ -4,16 +4,16 @@ import java.io.*;
|
||||
import java.util.Date;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import me.chyxion.tigon.mybatis.Search;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.springframework.util.Assert;
|
||||
import me.chyxion.tigon.mybatis.Search;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.pudonghot.ambition.model.FileInfo;
|
||||
import org.springframework.util.MimeTypeUtils;
|
||||
import com.pudonghot.ambition.crm.model.FileInfo;
|
||||
import com.pudonghot.ambition.file.AmbitionFileApi;
|
||||
import com.pudonghot.ambition.mapper.FileInfoMapper;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import com.pudonghot.ambition.crm.mapper.FileInfoMapper;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.apache.commons.io.filefilter.WildcardFileFilter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.pudonghot.ambition.file.support.AbstractAmbitionFileApi;
|
||||
@ -33,9 +33,8 @@ public class DiskFileSupport
|
||||
@Autowired
|
||||
private FileInfoMapper fileInfoMapper;
|
||||
|
||||
@Value("${site.file.server.base-path:}")
|
||||
@Value("${file.server.base-path}")
|
||||
private String basePath;
|
||||
|
||||
@Value("${file.base-dir}")
|
||||
private String baseDir;
|
||||
|
||||
@ -84,58 +83,35 @@ public class DiskFileSupport
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public String upload(InputStream in,
|
||||
long contentLength,
|
||||
String folder, String name,
|
||||
String contentType,
|
||||
String fileFormat,
|
||||
public String upload(final InputStream in,
|
||||
final long contentLength,
|
||||
String folder,
|
||||
final String name,
|
||||
String contentType,
|
||||
String fileFormat,
|
||||
String downloadName) {
|
||||
if (StringUtils.isNotBlank(folder)) {
|
||||
if (!folder.endsWith("/")) {
|
||||
folder += "/";
|
||||
}
|
||||
}
|
||||
|
||||
String fullName = null;
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
log.debug("Name [{}] Is Not Blank.", name);
|
||||
if (name.startsWith(basePath)) {
|
||||
log.debug("Name Starts With Base Path [{}], Trim.", basePath);
|
||||
fullName = name.replaceFirst(basePath, "");
|
||||
}
|
||||
else if (StringUtils.isNotBlank(folder)) {
|
||||
fullName = folder + name;
|
||||
}
|
||||
else {
|
||||
fullName = name;
|
||||
}
|
||||
}
|
||||
// name is blank, folder is not blank
|
||||
else if (StringUtils.isNotBlank(folder)) {
|
||||
fullName = folder + idSeq.get();
|
||||
}
|
||||
// name and folder are blank
|
||||
else {
|
||||
fullName = idSeq.get();
|
||||
}
|
||||
final String fileId = idSeq.get();
|
||||
final String fullName = getFileFullName(fileId, folder, name);
|
||||
boolean update = false;
|
||||
Date now = new Date();
|
||||
FileInfo fileInfo = fileInfoMapper.find(nameSearch(fullName));
|
||||
File prevFile = null;
|
||||
if (fileInfo != null) {
|
||||
fileInfo.setDateUpdated(now);
|
||||
update = true;
|
||||
// delete previous file
|
||||
prevFile = new File(getFileDir(), fileInfo.getFilePath());
|
||||
log.info("Will Delete Previous File [{}].", prevFile);
|
||||
}
|
||||
else {
|
||||
fileInfo = new FileInfo();
|
||||
fileInfo.setId(idSeq.get());
|
||||
fileInfo.setId(fileId);
|
||||
fileInfo.setName(fullName);
|
||||
fileInfo.setDateCreated(now);
|
||||
}
|
||||
File storeFile = getFile(fullName, fileFormat);
|
||||
if (!storeFile.getParentFile().isDirectory()) {
|
||||
storeFile.getParentFile().mkdirs();
|
||||
}
|
||||
// fileInfo.setRealPath(storeFile.getAbsolutePath());
|
||||
|
||||
final String filePath = getFilePath(fileId, folder, name, fileFormat);
|
||||
fileInfo.setFilePath(filePath);
|
||||
fileInfo.setEnabled(true);
|
||||
fileInfo.setContentLength(contentLength);
|
||||
fileInfo.setDownloadName(downloadName);
|
||||
@ -150,24 +126,32 @@ public class DiskFileSupport
|
||||
fileInfoMapper.insert(fileInfo);
|
||||
}
|
||||
|
||||
// File
|
||||
// File
|
||||
log.info("Upload Input Stream With Name [{}].", fullName);
|
||||
OutputStream fout = null;
|
||||
try {
|
||||
// delete previous files
|
||||
File prevFile = new File(getFileDir(), fullName);
|
||||
log.info("Delete File [{}] Before Upload.",
|
||||
prevFile.getAbsolutePath());
|
||||
FileUtils.deleteQuietly(prevFile);
|
||||
for (File file : getFileDir().listFiles(
|
||||
(FilenameFilter) new WildcardFileFilter(fullName + ".*"))) {
|
||||
log.info("Delete File [{}] Before Upload.", file.getAbsolutePath());
|
||||
FileUtils.deleteQuietly(file);
|
||||
if (prevFile != null) {
|
||||
FileUtils.deleteQuietly(prevFile);
|
||||
log.info("Delete File [{}] Before Upload.", prevFile);
|
||||
FileUtils.deleteQuietly(prevFile);
|
||||
}
|
||||
|
||||
fout = new FileOutputStream(getFile(fullName));
|
||||
// for (File file : getFileDir().listFiles(
|
||||
// (FilenameFilter) new WildcardFileFilter(filePath + ".*"))) {
|
||||
// log.info("Delete File [{}] Before Upload.", file.getAbsolutePath());
|
||||
// FileUtils.deleteQuietly(file);
|
||||
// }
|
||||
|
||||
final File storeFile = new File(getFileDir(), filePath);
|
||||
final File fileParent = storeFile.getParentFile();
|
||||
if (!fileParent.isDirectory()) {
|
||||
fileParent.mkdirs();
|
||||
}
|
||||
|
||||
fout = new FileOutputStream(storeFile);
|
||||
IOUtils.copy(in, fout);
|
||||
return getUrl(fullName);
|
||||
return getUrl(filePath);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IllegalStateException(
|
||||
@ -203,24 +187,22 @@ public class DiskFileSupport
|
||||
*/
|
||||
@Override
|
||||
public String getUrl(String folder, String name) {
|
||||
String fileFullname = null;
|
||||
String fileFullName = null;
|
||||
if (StringUtils.isNotBlank(folder)) {
|
||||
if (!folder.endsWith("/")) {
|
||||
folder += "/";
|
||||
}
|
||||
fileFullname = folder + name;
|
||||
fileFullName = folder + name;
|
||||
}
|
||||
else {
|
||||
fileFullname = name;
|
||||
fileFullName = name;
|
||||
}
|
||||
FileInfo fileInfo = fileInfoMapper.find(nameSearch(fileFullname));
|
||||
Assert.state(fileInfo != null,
|
||||
"No File [" + fileFullname + "] Found");
|
||||
String fileFormat = fileInfo.getFormat();
|
||||
if (StringUtils.isNotBlank(fileFormat)) {
|
||||
fileFullname += "." + fileFormat;
|
||||
final FileInfo fileInfo = fileInfoMapper.find(nameSearch(fileFullName));
|
||||
if (fileInfo == null) {
|
||||
log.error("No File [{}] Found.", fileFullName);
|
||||
return basePath + fileFullName;
|
||||
}
|
||||
return basePath + fileFullname;
|
||||
return basePath + fileInfo.getFilePath();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -252,4 +234,64 @@ public class DiskFileSupport
|
||||
return baseFileDir;
|
||||
}
|
||||
|
||||
String getFileFullName(String fileId, String folder, String name) {
|
||||
if (StringUtils.isNotBlank(folder)) {
|
||||
if (!folder.endsWith("/")) {
|
||||
folder += "/";
|
||||
}
|
||||
}
|
||||
String fullName = null;
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
log.debug("Name [{}] Is Not Blank.", name);
|
||||
if (name.startsWith(basePath)) {
|
||||
log.debug("Name Starts With Base Path [{}], Trim.", basePath);
|
||||
fullName = name.replaceFirst(basePath, "");
|
||||
}
|
||||
else if (StringUtils.isNotBlank(folder)) {
|
||||
fullName = folder + name;
|
||||
}
|
||||
else {
|
||||
fullName = name;
|
||||
}
|
||||
}
|
||||
// name is blank, folder is not blank
|
||||
else if (StringUtils.isNotBlank(folder)) {
|
||||
fullName = folder + fileId;
|
||||
}
|
||||
// name and folder are blank
|
||||
else {
|
||||
fullName = fileId;
|
||||
}
|
||||
return fullName;
|
||||
}
|
||||
|
||||
String getFilePath(final String fileId, final String folder, final String name, String fileFormat) {
|
||||
String distFolder = DateFormatUtils.format(new Date(), "yyyyMMdd") + "/";
|
||||
if (StringUtils.isNotBlank(folder)) {
|
||||
if (distFolder.endsWith("/")) {
|
||||
distFolder = folder + distFolder;
|
||||
}
|
||||
else {
|
||||
distFolder = folder + "/" + distFolder;
|
||||
}
|
||||
}
|
||||
|
||||
String filePath = null;
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
log.debug("Name [{}] Is Not Blank.", name);
|
||||
if (name.startsWith(basePath)) {
|
||||
log.debug("Name Starts With Base Path [{}], Trim.", basePath);
|
||||
filePath = name.replaceFirst(basePath, "");
|
||||
}
|
||||
else {
|
||||
filePath = distFolder + name;
|
||||
}
|
||||
}
|
||||
// name is blank, user file id as name
|
||||
else {
|
||||
filePath = distFolder + fileId;
|
||||
}
|
||||
return StringUtils.isNotBlank(fileFormat) ?
|
||||
filePath + "." + fileFormat : filePath;
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,18 @@
|
||||
package com.pudonghot.ambition.file.oss;
|
||||
|
||||
import org.junit.Test;
|
||||
import java.util.Date;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
|
||||
/**
|
||||
* @author Shaun Chyxion <br>
|
||||
* chyxion@163.com <br>
|
||||
* Mar 18, 2017 20:02:13
|
||||
*/
|
||||
public class TestDriver {
|
||||
|
||||
@Test
|
||||
public void testDateFormat() {
|
||||
System.err.println(DateFormatUtils.format(new Date(), "yyyy-MM-dd"));
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>mapper</artifactId>
|
||||
<artifactId>crm-mapper</artifactId>
|
||||
<name>Ambition Mapper</name>
|
||||
<packaging>${packaging}</packaging>
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
<parent>
|
||||
<groupId>com.pudonghot.ambition</groupId>
|
||||
<artifactId>ambition</artifactId>
|
||||
<artifactId>ambition-crm</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../</relativePath>
|
||||
</parent>
|
||||
@ -27,7 +27,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pudonghot.ambition</groupId>
|
||||
<artifactId>model</artifactId>
|
||||
<artifactId>crm-model</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.chyxion.tigon</groupId>
|
||||
|
@ -0,0 +1,14 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import me.chyxion.tigon.mybatis.BaseMapper;
|
||||
import com.pudonghot.ambition.crm.model.AuthFailedLog;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 7, 2017 8:55:41 PM
|
||||
*/
|
||||
public interface AuthFailedLogMapper extends BaseMapper<Long, AuthFailedLog> {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import me.chyxion.tigon.mybatis.BaseMapper;
|
||||
import com.pudonghot.ambition.crm.model.AuthLog;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 7, 2017 8:55:44 PM
|
||||
*/
|
||||
public interface AuthLogMapper extends BaseMapper<Long, AuthLog> {
|
||||
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import com.pudonghot.ambition.crm.model.FileInfo;
|
||||
|
||||
import me.chyxion.tigon.mybatis.BaseMapper;
|
||||
import com.pudonghot.ambition.model.FileInfo;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
@ -0,0 +1,14 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import me.chyxion.tigon.mybatis.BaseMapper;
|
||||
import com.pudonghot.ambition.crm.model.Permission;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 7, 2017 8:55:27 PM
|
||||
*/
|
||||
public interface PermissionMapper extends BaseMapper<String, Permission> {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import me.chyxion.tigon.mybatis.BaseMapper;
|
||||
import com.pudonghot.ambition.crm.model.Role;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 7, 2017 8:55:23 PM
|
||||
*/
|
||||
public interface RoleMapper extends BaseMapper<String, Role> {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import me.chyxion.tigon.mybatis.BaseMapper;
|
||||
import com.pudonghot.ambition.crm.model.RolePermission;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 7, 2017 8:55:19 PM
|
||||
*/
|
||||
public interface RolePermissionMapper extends BaseMapper<String, RolePermission> {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import me.chyxion.tigon.mybatis.BaseMapper;
|
||||
import com.pudonghot.ambition.crm.model.User;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 7, 2017 8:55:14 PM
|
||||
*/
|
||||
public interface UserMapper extends BaseMapper<String, User> {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import me.chyxion.tigon.mybatis.BaseMapper;
|
||||
import com.pudonghot.ambition.crm.model.UserRole;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 7, 2017 8:55:10 PM
|
||||
*/
|
||||
public interface UserRoleMapper extends BaseMapper<String, UserRole> {
|
||||
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import me.chyxion.tigon.mybatis.BaseMapper;
|
||||
import com.pudonghot.ambition.model.AdminAuthFailedLog;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Mar 13, 2017 10:57:44 PM
|
||||
*/
|
||||
public interface AdminAuthFailedLogMapper extends BaseMapper<String, AdminAuthFailedLog> {
|
||||
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import me.chyxion.tigon.mybatis.BaseMapper;
|
||||
import com.pudonghot.ambition.model.AdminLoginLog;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Mar 13, 2017 10:57:29 PM
|
||||
*/
|
||||
@Table("ph_admin_login_log")
|
||||
public interface AdminLoginLogMapper extends BaseMapper<String, AdminLoginLog> {
|
||||
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import com.pudonghot.ambition.model.Admin;
|
||||
import me.chyxion.tigon.mybatis.BaseMapper;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Mar 11, 2017 1:31:44 PM
|
||||
*/
|
||||
public interface AdminMapper extends BaseMapper<String, Admin> {
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
# CodeGen Config
|
||||
base.cols=enabled,note,date_created,date_updated,created_by,updated_by
|
||||
base.package=com.pudonghot.ambition
|
||||
super.base.model.name=M3<Long, Long>
|
||||
base.package=com.pudonghot.ambition.crm
|
||||
super.base.model.name=M3<String, String>
|
||||
super.base.model.full.name=me.chyxion.tigon.model.M3
|
||||
table.prefix=ph
|
||||
table.prefix=crm
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Config Dev
|
||||
|
||||
# Database
|
||||
db.url=jdbc:mysql://127.0.0.1:43306/pudong_hot?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
|
||||
db.url=jdbc:mysql://127.0.0.1:43306/ambition_crm?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
|
||||
db.user=root
|
||||
db.password=696@2^~)oZ@^#*Q
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Mar 13, 2017 10:57:44 PM
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE mapper PUBLIC
|
||||
"-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.pudonghot.ambition.mapper.AdminAuthFailedLogMapper">
|
||||
</mapper>
|
@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Mar 11, 2017 1:31:44 PM
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE mapper PUBLIC
|
||||
"-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.pudonghot.ambition.mapper.AdminMapper">
|
||||
<cache type="me.chyxion.tigon.mybatis.cache.RedisCache" />
|
||||
</mapper>
|
@ -2,14 +2,13 @@
|
||||
<!--
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Mar 13, 2017 10:57:29 PM
|
||||
* Jun 7, 2017 8:55:41 PM
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE mapper PUBLIC
|
||||
"-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.pudonghot.ambition.mapper.AdminLoginLogMapper">
|
||||
"-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.pudonghot.ambition.crm.mapper.AuthFailedLogMapper">
|
||||
</mapper>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 7, 2017 8:55:44 PM
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE mapper PUBLIC
|
||||
"-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.pudonghot.ambition.crm.mapper.AuthLogMapper">
|
||||
</mapper>
|
@ -11,5 +11,5 @@
|
||||
<!DOCTYPE mapper PUBLIC
|
||||
"-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.pudonghot.ambition.mapper.FileInfoMapper">
|
||||
<mapper namespace="com.pudonghot.ambition.crm.mapper.FileInfoMapper">
|
||||
</mapper>
|
||||
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 7, 2017 8:55:27 PM
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE mapper PUBLIC
|
||||
"-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.pudonghot.ambition.crm.mapper.PermissionMapper">
|
||||
</mapper>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 7, 2017 8:55:23 PM
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE mapper PUBLIC
|
||||
"-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.pudonghot.ambition.crm.mapper.RoleMapper">
|
||||
</mapper>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 7, 2017 8:55:19 PM
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE mapper PUBLIC
|
||||
"-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.pudonghot.ambition.crm.mapper.RolePermissionMapper">
|
||||
</mapper>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 7, 2017 8:55:14 PM
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE mapper PUBLIC
|
||||
"-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.pudonghot.ambition.crm.mapper.UserMapper">
|
||||
</mapper>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 7, 2017 8:55:10 PM
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE mapper PUBLIC
|
||||
"-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.pudonghot.ambition.crm.mapper.UserRoleMapper">
|
||||
</mapper>
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
<!DOCTYPE configuration PUBLIC
|
||||
"-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
<settings>
|
||||
@ -24,5 +25,4 @@
|
||||
<!-- 给予被嵌套的resultMap以字段-属性的映射支持 -->
|
||||
<setting name="autoMappingBehavior" value="FULL" />
|
||||
</settings>
|
||||
|
||||
</configuration>
|
||||
|
@ -30,12 +30,12 @@
|
||||
class="me.chyxion.tigon.mybatis.TigonSqlSessionFactoryBean"
|
||||
depends-on="redisCacheConfig"
|
||||
p:dataSource-ref="dataSource"
|
||||
p:typeAliasesPackage="com.pudonghot.ambition.model"
|
||||
p:typeAliasesPackage="com.pudonghot.ambition.crm.model"
|
||||
p:configLocation="classpath:mybatis/mybatis-config.xml"
|
||||
p:mapperLocations="classpath*:mybatis/mappers/**/*-mapper.xml" />
|
||||
<!-- MyBatis Mappers Auto Scan -->
|
||||
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"
|
||||
p:basePackage="com.pudonghot.ambition.mapper"
|
||||
p:basePackage="com.pudonghot.ambition.crm.mapper"
|
||||
p:sqlSessionFactoryBeanName="sqlSessionFactory" />
|
||||
|
||||
<bean class="org.springframework.jdbc.core.JdbcTemplate">
|
||||
|
@ -0,0 +1,73 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import org.junit.Test;
|
||||
import java.util.Date;
|
||||
import org.junit.Assert;
|
||||
import org.junit.runner.RunWith;
|
||||
import com.pudonghot.ambition.crm.model.AuthFailedLog;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 7, 2017 8:55:41 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class AuthFailedLogMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private AuthFailedLogMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
AuthFailedLog m = new AuthFailedLog();
|
||||
m.setDateCreated(new Date());
|
||||
m.setLoginId("s");
|
||||
m.setPassword("s");
|
||||
m.setIp("s");
|
||||
m.setUserAgent("s");
|
||||
m.setExt("s");
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
AuthFailedLog m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals("s", m.getLoginId());
|
||||
Assert.assertEquals("s", m.getPassword());
|
||||
Assert.assertEquals("s", m.getIp());
|
||||
Assert.assertEquals("s", m.getUserAgent());
|
||||
Assert.assertEquals("s", m.getExt());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setLoginId("S");
|
||||
m.setPassword("S");
|
||||
m.setIp("S");
|
||||
m.setUserAgent("S");
|
||||
m.setExt("S");
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals("S", m.getLoginId());
|
||||
Assert.assertEquals("S", m.getPassword());
|
||||
Assert.assertEquals("S", m.getIp());
|
||||
Assert.assertEquals("S", m.getUserAgent());
|
||||
Assert.assertEquals("S", m.getExt());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import org.junit.Test;
|
||||
import java.util.Date;
|
||||
import org.junit.Assert;
|
||||
import org.junit.runner.RunWith;
|
||||
import com.pudonghot.ambition.crm.model.AuthLog;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 7, 2017 8:55:44 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class AuthLogMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private AuthLogMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
AuthLog m = new AuthLog();
|
||||
m.setDateCreated(new Date());
|
||||
m.setUserId("s");
|
||||
m.setUserAgent("s");
|
||||
m.setIp("s");
|
||||
m.setExt("s");
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
AuthLog m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals("s", m.getUserId());
|
||||
Assert.assertEquals("s", m.getUserAgent());
|
||||
Assert.assertEquals("s", m.getIp());
|
||||
Assert.assertEquals("s", m.getExt());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setUserId("S");
|
||||
m.setUserAgent("S");
|
||||
m.setIp("S");
|
||||
m.setExt("S");
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals("S", m.getUserId());
|
||||
Assert.assertEquals("S", m.getUserAgent());
|
||||
Assert.assertEquals("S", m.getIp());
|
||||
Assert.assertEquals("S", m.getExt());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import org.junit.Test;
|
||||
import java.util.Date;
|
||||
import org.junit.Assert;
|
||||
import org.junit.runner.RunWith;
|
||||
import com.pudonghot.ambition.crm.model.Permission;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 7, 2017 8:55:27 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class PermissionMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private PermissionMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
Permission m = new Permission();
|
||||
String id = "id";
|
||||
m.setId(id);
|
||||
m.setDateCreated(new Date());
|
||||
m.setName("s");
|
||||
m.setPermission("s");
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
Permission m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals("s", m.getName());
|
||||
Assert.assertEquals("s", m.getPermission());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setName("S");
|
||||
m.setPermission("S");
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals("S", m.getName());
|
||||
Assert.assertEquals("S", m.getPermission());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import java.util.Date;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import com.pudonghot.ambition.crm.mapper.RoleMapper;
|
||||
import com.pudonghot.ambition.crm.model.Role;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 7, 2017 8:55:23 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class RoleMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private RoleMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
Role m = new Role();
|
||||
String id = "id";
|
||||
m.setId(id);
|
||||
m.setDateCreated(new Date());
|
||||
m.setName("s");
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
Role m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals("s", m.getName());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setName("S");
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals("S", m.getName());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import java.util.Date;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import com.pudonghot.ambition.crm.mapper.RolePermissionMapper;
|
||||
import com.pudonghot.ambition.crm.model.RolePermission;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 7, 2017 8:55:19 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class RolePermissionMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private RolePermissionMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
RolePermission m = new RolePermission();
|
||||
String id = "id";
|
||||
m.setId(id);
|
||||
m.setDateCreated(new Date());
|
||||
m.setRoleId("s");
|
||||
m.setPermissionId("s");
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
RolePermission m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals("s", m.getRoleId());
|
||||
Assert.assertEquals("s", m.getPermissionId());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setRoleId("S");
|
||||
m.setPermissionId("S");
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals("S", m.getRoleId());
|
||||
Assert.assertEquals("S", m.getPermissionId());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import java.util.Date;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import com.pudonghot.ambition.crm.mapper.UserMapper;
|
||||
import com.pudonghot.ambition.crm.model.User;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 7, 2017 8:55:14 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class UserMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private UserMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
User m = new User();
|
||||
String id = "id";
|
||||
m.setId(id);
|
||||
m.setDateCreated(new Date());
|
||||
m.setLoginId("s");
|
||||
m.setPassword("s");
|
||||
m.setMobile("s");
|
||||
m.setEmail("s");
|
||||
m.setName("s");
|
||||
m.setGender("s");
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
User m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals("s", m.getLoginId());
|
||||
Assert.assertEquals("s", m.getPassword());
|
||||
Assert.assertEquals("s", m.getMobile());
|
||||
Assert.assertEquals("s", m.getEmail());
|
||||
Assert.assertEquals("s", m.getName());
|
||||
Assert.assertEquals("s", m.getGender());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setLoginId("S");
|
||||
m.setPassword("S");
|
||||
m.setMobile("S");
|
||||
m.setEmail("S");
|
||||
m.setName("S");
|
||||
m.setGender("S");
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals("S", m.getLoginId());
|
||||
Assert.assertEquals("S", m.getPassword());
|
||||
Assert.assertEquals("S", m.getMobile());
|
||||
Assert.assertEquals("S", m.getEmail());
|
||||
Assert.assertEquals("S", m.getName());
|
||||
Assert.assertEquals("S", m.getGender());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import java.util.Date;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import com.pudonghot.ambition.crm.mapper.UserRoleMapper;
|
||||
import com.pudonghot.ambition.crm.model.UserRole;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 7, 2017 8:55:10 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class UserRoleMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private UserRoleMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
UserRole m = new UserRole();
|
||||
String id = "id";
|
||||
m.setId(id);
|
||||
m.setDateCreated(new Date());
|
||||
m.setUserId("s");
|
||||
m.setRoleId("s");
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
UserRole m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals("s", m.getUserId());
|
||||
Assert.assertEquals("s", m.getRoleId());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setUserId("S");
|
||||
m.setRoleId("S");
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals("S", m.getUserId());
|
||||
Assert.assertEquals("S", m.getRoleId());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import java.util.Date;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import com.pudonghot.ambition.mapper.AdminAuthFailedLogMapper;
|
||||
import com.pudonghot.ambition.model.AdminAuthFailedLog;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Mar 13, 2017 10:57:44 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class AdminAuthFailedLogMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private AdminAuthFailedLogMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
AdminAuthFailedLog m = new AdminAuthFailedLog();
|
||||
String id = "id";
|
||||
// m.setId(id);
|
||||
m.setDateCreated(new Date());
|
||||
m.setLoginId("s");
|
||||
m.setPassword("s");
|
||||
m.setIp("s");
|
||||
m.setUserAgent("s");
|
||||
m.setExt("s");
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
AdminAuthFailedLog m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals("s", m.getLoginId());
|
||||
Assert.assertEquals("s", m.getPassword());
|
||||
Assert.assertEquals("s", m.getIp());
|
||||
Assert.assertEquals("s", m.getUserAgent());
|
||||
Assert.assertEquals("s", m.getExt());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setLoginId("S");
|
||||
m.setPassword("S");
|
||||
m.setIp("S");
|
||||
m.setUserAgent("S");
|
||||
m.setExt("S");
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals("S", m.getLoginId());
|
||||
Assert.assertEquals("S", m.getPassword());
|
||||
Assert.assertEquals("S", m.getIp());
|
||||
Assert.assertEquals("S", m.getUserAgent());
|
||||
Assert.assertEquals("S", m.getExt());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import java.util.Date;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import com.pudonghot.ambition.mapper.AdminLoginLogMapper;
|
||||
import com.pudonghot.ambition.model.AdminLoginLog;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Mar 13, 2017 10:57:29 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class AdminLoginLogMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private AdminLoginLogMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
AdminLoginLog m = new AdminLoginLog();
|
||||
String id = "id";
|
||||
// m.setId(id);
|
||||
m.setDateCreated(new Date());
|
||||
m.setAdminId(1L);
|
||||
m.setUserAgent("s");
|
||||
m.setIp("s");
|
||||
m.setExt("s");
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
AdminLoginLog m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals(1L, m.getAdminId());
|
||||
Assert.assertEquals("s", m.getUserAgent());
|
||||
Assert.assertEquals("s", m.getIp());
|
||||
Assert.assertEquals("s", m.getExt());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setAdminId(2L);
|
||||
m.setUserAgent("S");
|
||||
m.setIp("S");
|
||||
m.setExt("S");
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals(2L, m.getAdminId());
|
||||
Assert.assertEquals("S", m.getUserAgent());
|
||||
Assert.assertEquals("S", m.getIp());
|
||||
Assert.assertEquals("S", m.getExt());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import java.util.Date;
|
||||
import org.junit.runner.RunWith;
|
||||
import com.pudonghot.ambition.model.Admin;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Mar 11, 2017 1:31:44 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class AdminMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private AdminMapper mapper;
|
||||
@Autowired
|
||||
private AppMapper appMapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
Admin m = new Admin();
|
||||
m.setDateCreated(new Date());
|
||||
m.setLoginId("s");
|
||||
m.setPasswordSalt("s");
|
||||
m.setPassword("s");
|
||||
m.setMobile("s");
|
||||
m.setEmail("s");
|
||||
m.setName("s");
|
||||
m.setGender("s");
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindNextId() {
|
||||
System.err.println(appMapper.nextId());
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import java.util.Date;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Mar 13, 2017 10:58:53 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class AppAuthFailedLogMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private AppAuthFailedLogMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
AppAuthFailedLog m = new AppAuthFailedLog();
|
||||
String id = "id";
|
||||
// m.setId(id);
|
||||
m.setDateCreated(new Date());
|
||||
m.setMobile("s");
|
||||
m.setPassword("s");
|
||||
m.setPlatform("s");
|
||||
m.setDeviceId("s");
|
||||
m.setDeviceName("s");
|
||||
m.setOsVersion("s");
|
||||
m.setIp("s");
|
||||
m.setExt("s");
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
AppAuthFailedLog m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals("s", m.getMobile());
|
||||
Assert.assertEquals("s", m.getPassword());
|
||||
Assert.assertEquals("s", m.getPlatform());
|
||||
Assert.assertEquals("s", m.getDeviceId());
|
||||
Assert.assertEquals("s", m.getDeviceName());
|
||||
Assert.assertEquals("s", m.getOsVersion());
|
||||
Assert.assertEquals("s", m.getIp());
|
||||
Assert.assertEquals("s", m.getExt());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setMobile("S");
|
||||
m.setPassword("S");
|
||||
m.setPlatform("S");
|
||||
m.setDeviceId("S");
|
||||
m.setDeviceName("S");
|
||||
m.setOsVersion("S");
|
||||
m.setIp("S");
|
||||
m.setExt("S");
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals("S", m.getMobile());
|
||||
Assert.assertEquals("S", m.getPassword());
|
||||
Assert.assertEquals("S", m.getPlatform());
|
||||
Assert.assertEquals("S", m.getDeviceId());
|
||||
Assert.assertEquals("S", m.getDeviceName());
|
||||
Assert.assertEquals("S", m.getOsVersion());
|
||||
Assert.assertEquals("S", m.getIp());
|
||||
Assert.assertEquals("S", m.getExt());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import java.util.Date;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Mar 13, 2017 10:58:41 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class AppLoginLogMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private AppLoginLogMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
AppLoginLog m = new AppLoginLog();
|
||||
String id = "id";
|
||||
// m.setId(id);
|
||||
m.setDateCreated(new Date());
|
||||
m.setUserId(1L);
|
||||
m.setPlatform("s");
|
||||
m.setDeviceId("s");
|
||||
m.setDeviceName("s");
|
||||
m.setOsVersion("s");
|
||||
m.setIp("s");
|
||||
m.setExt("s");
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
AppLoginLog m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals(1L, m.getUserId());
|
||||
Assert.assertEquals("s", m.getPlatform());
|
||||
Assert.assertEquals("s", m.getDeviceId());
|
||||
Assert.assertEquals("s", m.getDeviceName());
|
||||
Assert.assertEquals("s", m.getOsVersion());
|
||||
Assert.assertEquals("s", m.getIp());
|
||||
Assert.assertEquals("s", m.getExt());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setUserId(2L);
|
||||
m.setPlatform("S");
|
||||
m.setDeviceId("S");
|
||||
m.setDeviceName("S");
|
||||
m.setOsVersion("S");
|
||||
m.setIp("S");
|
||||
m.setExt("S");
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals(2L, m.getUserId());
|
||||
Assert.assertEquals("S", m.getPlatform());
|
||||
Assert.assertEquals("S", m.getDeviceId());
|
||||
Assert.assertEquals("S", m.getDeviceName());
|
||||
Assert.assertEquals("S", m.getOsVersion());
|
||||
Assert.assertEquals("S", m.getIp());
|
||||
Assert.assertEquals("S", m.getExt());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import java.util.Date;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Mar 13, 2017 10:58:46 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class AppLogoutLogMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private AppLogoutLogMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
AppLogoutLog m = new AppLogoutLog();
|
||||
String id = "id";
|
||||
// m.setId(id);
|
||||
m.setDateCreated(new Date());
|
||||
m.setUserId(1L);
|
||||
m.setIp("s");
|
||||
m.setExt("s");
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
AppLogoutLog m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals(1L, m.getUserId());
|
||||
Assert.assertEquals("s", m.getIp());
|
||||
Assert.assertEquals("s", m.getExt());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setUserId(2L);
|
||||
m.setIp("S");
|
||||
m.setExt("S");
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals(2L, m.getUserId());
|
||||
Assert.assertEquals("S", m.getIp());
|
||||
Assert.assertEquals("S", m.getExt());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Mar 10, 2017 1:30:16 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class AuthLogMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
}
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import java.util.Date;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Apr 9, 2017 3:49:19 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class ContactMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private ContactMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
Contact m = new Contact();
|
||||
// String id = "id";
|
||||
// m.setId(id);
|
||||
m.setDateCreated(new Date());
|
||||
m.setCorpId(1);
|
||||
m.setMobile("s");
|
||||
m.setName("s");
|
||||
m.setNamePinyin("s");
|
||||
m.setGender("s");
|
||||
m.setEmail("s");
|
||||
m.setWechat("s");
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
Contact m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals(1, m.getCorpId());
|
||||
Assert.assertEquals("s", m.getMobile());
|
||||
Assert.assertEquals("s", m.getName());
|
||||
Assert.assertEquals("s", m.getNamePinyin());
|
||||
Assert.assertEquals("s", m.getGender());
|
||||
Assert.assertEquals("s", m.getEmail());
|
||||
Assert.assertEquals("s", m.getWechat());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setCorpId(2);
|
||||
m.setMobile("S");
|
||||
m.setName("S");
|
||||
m.setNamePinyin("S");
|
||||
m.setGender("S");
|
||||
m.setEmail("S");
|
||||
m.setWechat("S");
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals(2, m.getCorpId());
|
||||
Assert.assertEquals("S", m.getMobile());
|
||||
Assert.assertEquals("S", m.getName());
|
||||
Assert.assertEquals("S", m.getNamePinyin());
|
||||
Assert.assertEquals("S", m.getGender());
|
||||
Assert.assertEquals("S", m.getEmail());
|
||||
Assert.assertEquals("S", m.getWechat());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Mar 10, 2017 1:30:54 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class CorpMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private CorpMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
}
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
|
||||
import org.junit.Test;
|
||||
import java.util.Date;
|
||||
import org.junit.Assert;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Apr 9, 2017 3:49:09 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class DeptContactMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private DeptContactMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
DeptContact m = new DeptContact();
|
||||
// String id = "id";
|
||||
// m.setId(id);
|
||||
m.setDateCreated(new Date());
|
||||
m.setDeptId(1L);
|
||||
m.setContactId(1L);
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
DeptContact m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals(1, m.getDeptId());
|
||||
Assert.assertEquals(1, m.getContactId());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setDeptId(2);
|
||||
m.setContactId(2);
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals(2, m.getDeptId());
|
||||
Assert.assertEquals(2, m.getContactId());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import java.util.Date;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Apr 9, 2017 3:49:04 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class DeptMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private DeptMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
Dept m = new Dept();
|
||||
// String id = "id";
|
||||
// m.setId(id);
|
||||
m.setDateCreated(new Date());
|
||||
m.setName("s");
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
Dept m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals("s", m.getName());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setName("S");
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals("S", m.getName());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import java.util.Date;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Apr 9, 2017 3:49:13 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class DeptPathMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private DeptPathMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
DeptPath m = new DeptPath();
|
||||
// String id = "id";
|
||||
// m.setId(id);
|
||||
m.setDateCreated(new Date());
|
||||
m.setAncestor(1L);
|
||||
m.setDescendant(1L);
|
||||
m.setPathLength(1);
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
DeptPath m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals(1, m.getAncestor());
|
||||
Assert.assertEquals(1, m.getDescendant());
|
||||
Assert.assertEquals(1, m.getPathLength());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setAncestor(2);
|
||||
m.setDescendant(2);
|
||||
m.setPathLength(2);
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals(2, m.getAncestor());
|
||||
Assert.assertEquals(2, m.getDescendant());
|
||||
Assert.assertEquals(2, m.getPathLength());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Mar 10, 2017 1:31:13 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class EmployeeMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private EmployeeMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
}
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import java.util.Date;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Apr 9, 2017 9:07:23 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class SiteVisitLogMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private SiteVisitLogMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
SiteVisitLog m = new SiteVisitLog();
|
||||
m.setDateCreated(new Date());
|
||||
m.setCorpId(1L);
|
||||
m.setEmployeeId(1L);
|
||||
m.setUrl("s");
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
SiteVisitLog m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals(1, m.getCorpId());
|
||||
Assert.assertEquals(1, m.getEmployeeId());
|
||||
Assert.assertEquals("s", m.getUrl());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setCorpId(2);
|
||||
m.setEmployeeId(2);
|
||||
m.setUrl("S");
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals(2, m.getCorpId());
|
||||
Assert.assertEquals(2, m.getEmployeeId());
|
||||
Assert.assertEquals("S", m.getUrl());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Mar 10, 2017 1:31:41 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class TinyAppGroupMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private TinyAppGroupMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Mar 10, 2017 1:31:25 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class TinyAppMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private TinyAppMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
}
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import java.util.Date;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Apr 9, 2017 9:07:30 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class TinyAppVisitLogMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private TinyAppVisitLogMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
TinyAppVisitLog m = new TinyAppVisitLog();
|
||||
m.setDateCreated(new Date());
|
||||
m.setCorpId(1L);
|
||||
m.setEmployeeId(1L);
|
||||
m.setTinyAppId(1L);
|
||||
m.setUrl("s");
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
TinyAppVisitLog m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals(1, m.getCorpId());
|
||||
Assert.assertEquals(1, m.getEmployeeId());
|
||||
Assert.assertEquals(1, m.getTinyAppId());
|
||||
Assert.assertEquals("s", m.getUrl());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setCorpId(2);
|
||||
m.setEmployeeId(2);
|
||||
m.setTinyAppId(2);
|
||||
m.setUrl("S");
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals(2, m.getCorpId());
|
||||
Assert.assertEquals(2, m.getEmployeeId());
|
||||
Assert.assertEquals(2, m.getTinyAppId());
|
||||
Assert.assertEquals("S", m.getUrl());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package com.pudonghot.ambition.mapper;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Mar 5, 2017 5:09:42 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class UserMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private UserMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
System.out.println(mapper.list(null));
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>model</artifactId>
|
||||
<artifactId>crm-model</artifactId>
|
||||
<name>Ambition Data Model</name>
|
||||
<packaging>${packaging}</packaging>
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
<parent>
|
||||
<groupId>com.pudonghot.ambition</groupId>
|
||||
<artifactId>ambition</artifactId>
|
||||
<artifactId>ambition-crm</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../</relativePath>
|
||||
</parent>
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.pudonghot.ambition.common;
|
||||
package com.pudonghot.ambition.crm.common;
|
||||
|
||||
/**
|
||||
* @author Shaun Chyxion <br>
|
@ -1,4 +1,4 @@
|
||||
package com.pudonghot.ambition.form.create;
|
||||
package com.pudonghot.ambition.crm.form.create;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
@ -1,4 +1,4 @@
|
||||
package com.pudonghot.ambition.form.create;
|
||||
package com.pudonghot.ambition.crm.form.create;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
@ -1,4 +1,4 @@
|
||||
package com.pudonghot.ambition.form.create;
|
||||
package com.pudonghot.ambition.crm.form.create;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
@ -1,11 +1,13 @@
|
||||
package com.pudonghot.ambition.form.create;
|
||||
package com.pudonghot.ambition.crm.form.create;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import com.pudonghot.ambition.common.Constants;
|
||||
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
|
||||
import com.pudonghot.ambition.crm.common.Constants;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
@ -1,14 +1,15 @@
|
||||
package com.pudonghot.ambition.form.create;
|
||||
package com.pudonghot.ambition.crm.form.create;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import javax.validation.constraints.Min;
|
||||
import com.pudonghot.ambition.model.Rgba;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
import com.pudonghot.ambition.crm.model.Rgba;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
@ -1,12 +1,14 @@
|
||||
package com.pudonghot.ambition.form.create;
|
||||
package com.pudonghot.ambition.crm.form.create;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import com.pudonghot.ambition.model.Rgba;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
|
||||
import com.pudonghot.ambition.crm.model.Rgba;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
@ -1,4 +1,4 @@
|
||||
package com.pudonghot.ambition.form.create;
|
||||
package com.pudonghot.ambition.crm.form.create;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
@ -1,13 +1,15 @@
|
||||
package com.pudonghot.ambition.form.create;
|
||||
package com.pudonghot.ambition.crm.form.create;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.chyxion.tigon.form.FC1;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import com.pudonghot.ambition.common.Constants;
|
||||
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
|
||||
import com.pudonghot.ambition.crm.common.Constants;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
@ -1,4 +1,4 @@
|
||||
package com.pudonghot.ambition.form.create;
|
||||
package com.pudonghot.ambition.crm.form.create;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
@ -1,13 +1,11 @@
|
||||
package com.pudonghot.ambition.form.create;
|
||||
package com.pudonghot.ambition.crm.form.create;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
@ -1,4 +1,4 @@
|
||||
package com.pudonghot.ambition.form.create;
|
||||
package com.pudonghot.ambition.crm.form.create;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
@ -1,4 +1,4 @@
|
||||
package com.pudonghot.ambition.form.create;
|
||||
package com.pudonghot.ambition.crm.form.create;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
@ -1,4 +1,4 @@
|
||||
package com.pudonghot.ambition.form.create;
|
||||
package com.pudonghot.ambition.crm.form.create;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@ -14,7 +14,7 @@ import org.hibernate.validator.constraints.NotBlank;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class AdminAuthFailedLogFormForCreate extends BaseForm {
|
||||
public class AuthFailedLogFormForCreate extends BaseForm {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// Properties
|
@ -1,4 +1,4 @@
|
||||
package com.pudonghot.ambition.form.create;
|
||||
package com.pudonghot.ambition.crm.form.create;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@ -14,12 +14,12 @@ import org.hibernate.validator.constraints.NotBlank;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class AdminLoginLogFormForCreate extends FC2<String> {
|
||||
public class AuthLogFormForCreate extends FC2<String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// Properties
|
||||
@NotBlank
|
||||
private String adminId;
|
||||
private String userId;
|
||||
@NotBlank
|
||||
private String userAgent;
|
||||
@NotBlank
|
@ -1,4 +1,4 @@
|
||||
package com.pudonghot.ambition.form.create;
|
||||
package com.pudonghot.ambition.crm.form.create;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user