security框架功能

This commit is contained in:
谢洪龙
2017-07-21 17:57:55 +08:00
parent 5c4332cf61
commit 234e360f3e
23 changed files with 2110 additions and 13 deletions
@@ -0,0 +1,57 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.config;
import com.ifish.bean.Tbl_Security_User;
import com.ifish.helper.UserHelper;
import java.util.ArrayList;
import java.util.List;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
/**
*
* @author Administrator
*/
public class MyUserDetailService implements UserDetailsService {
private final UserHelper userHelper;
public MyUserDetailService(UserHelper u) {
this.userHelper = u;
}
@Override
public UserDetails loadUserByUsername(String userName) throws UsernameNotFoundException {
Tbl_Security_User user = userHelper.getTbl_Security_User(userName);
if (user == null) {
throw new UsernameNotFoundException("用户不存在!");
}
List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
authorities.add(new SimpleGrantedAuthority("ROLE_" + user.getRole()));
boolean enabled = true;
boolean accountNonExpired = true;
boolean credentialsNonExpired = true;
boolean accountNonLocked = true;
UserInfo userdetails = new UserInfo();
userdetails.setId(user.getId());
userdetails.setUsername(user.getUsername());
userdetails.setEmail(user.getEmail());
userdetails.setRole(user.getRole());
userdetails.setRoleName(user.getRolename());
userdetails.setCode(user.getCode());
return userdetails;
}
}
@@ -7,13 +7,72 @@ package com.ifish.config;
import com.ifish.helper.UserHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.web.filter.CharacterEncodingFilter;
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
/**
*
* @author Administrator
*/
@Configuration
@EnableWebSecurity
public class SecuredConfig extends WebSecurityConfigurerAdapter {
@Autowired
private UserHelper userHelper;
@Override
protected void configure(HttpSecurity http) throws Exception {
//The CharacterEncodingFilter must be started before SecurityFilter. I moved it to security configuration:
CharacterEncodingFilter encodingFilter = new CharacterEncodingFilter();
encodingFilter.setEncoding("UTF-8");
encodingFilter.setForceEncoding(true);
//做csrf验证
//http.addFilterBefore(encodingFilter, CsrfFilter.class).csrf().requireCsrfProtectionMatcher(mycsrfRequestMatcher());
//取消csrf验证
//http.csrf().disable();
//免登陆
//http.rememberMe().rememberMeServices(rememberMeServinces());
http.authorizeRequests() //对下面几个url进行授权
//.antMatchers("/news/*","/school/*").hasAnyRole("1","4") //UserBean的utype为1或4才能访问'/news/*','/school/*'
//.antMatchers("/score/*").hasRole("4") //同上,utype为4的才能访问
//.antMatchers("/**").authenticated() //authenticated()只有登陆验证过用户才可以访问hasRole()只有特定权限,这里是Utype用户才可以访问
.antMatchers("/admin/**").hasAnyRole("4")
.and() //相当于方法结束符,and结束的几个方法是并行的,没有顺序之分,最后一个方法不需要and结束
.formLogin()//配置FBA。登陆,若有role权限,formLogin不能少
.loginProcessingUrl("/login")//登陆后是否跳转前一个URL,参数为登陆的POST地址
.loginPage("/") //登陆页面
.defaultSuccessUrl("/", false)
.failureUrl("/")
//.failureUrl("/login?error") //登陆失败跳转页面
.usernameParameter("username")
.passwordParameter("password")
.and()
.logout() //退出
.logoutSuccessUrl("/login?logout")
.and()
.sessionManagement()
.invalidSessionUrl("/")//过期回首页 目前不确定这样对不对 需要继续观察
//.and()
// .rememberMe().key("gkweb") //记住密码,cookie的name为remember-mekey的值相当于token
// .tokenValiditySeconds(1209600) //cookie有效期,时间为秒
.and().exceptionHandling().accessDeniedPage("/403") //请求异常,请求403
;
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(new MyUserDetailService(userHelper));
// auth.inMemoryAuthentication()
// .withUser("1").password("1").roles("4").and()
// .withUser("2").password("2").roles("USER", "ADMIN").and()
// .withUser("3").password("3").roles("ADMIN");
}
}
@@ -0,0 +1,303 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.config;
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import org.springframework.security.core.CredentialsContainer;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.util.Assert;
/**
*
* @author Administrator
*/
public class UserInfo implements UserDetails, CredentialsContainer {
private static final long serialVersionUID = 5997839307263494359L;
// ~ Instance fields
// ================================================================================================
private String password;//用户密码
private String email;// 用户的邮箱地址
private int id;//用户ID
private String role;//用户类型
private String roleName;
private String code;
private String username;//email或者Account等综合的
private Set<GrantedAuthority> authorities;
private boolean accountNonExpired;
private boolean accountNonLocked;
private boolean credentialsNonExpired;
private boolean enabled;
/**
* @return the password
*/
public String getPassword() {
return password;
}
/**
* @param password the password to set
*/
public void setPassword(String password) {
this.password = password;
}
/**
* @return the email
*/
public String getEmail() {
return email;
}
/**
* @param email the email to set
*/
public void setEmail(String email) {
this.email = email;
}
/**
* @return the id
*/
public int getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(int id) {
this.id = id;
}
/**
* @return the role
*/
public String getRole() {
return role;
}
/**
* @param role the role to set
*/
public void setRole(String role) {
this.role = role;
}
/**
* @return the roleName
*/
public String getRoleName() {
return roleName;
}
/**
* @param roleName the roleName to set
*/
public void setRoleName(String roleName) {
this.roleName = roleName;
}
/**
* @return the code
*/
public String getCode() {
return code;
}
/**
* @param code the code to set
*/
public void setCode(String code) {
this.code = code;
}
/**
* @return the username
*/
public String getUsername() {
return username;
}
/**
* @param username the username to set
*/
public void setUsername(String username) {
this.username = username;
}
/**
* @return the authorities
*/
public Set<GrantedAuthority> getAuthorities() {
return authorities;
}
/**
* @param authorities the authorities to set
*/
public void setAuthorities(Set<GrantedAuthority> authorities) {
this.authorities = authorities;
}
/**
* @return the accountNonExpired
*/
public boolean isAccountNonExpired() {
return accountNonExpired;
}
/**
* @param accountNonExpired the accountNonExpired to set
*/
public void setAccountNonExpired(boolean accountNonExpired) {
this.accountNonExpired = accountNonExpired;
}
/**
* @return the accountNonLocked
*/
public boolean isAccountNonLocked() {
return accountNonLocked;
}
/**
* @param accountNonLocked the accountNonLocked to set
*/
public void setAccountNonLocked(boolean accountNonLocked) {
this.accountNonLocked = accountNonLocked;
}
/**
* @return the credentialsNonExpired
*/
public boolean isCredentialsNonExpired() {
return credentialsNonExpired;
}
/**
* @param credentialsNonExpired the credentialsNonExpired to set
*/
public void setCredentialsNonExpired(boolean credentialsNonExpired) {
this.credentialsNonExpired = credentialsNonExpired;
}
/**
* @return the enabled
*/
public boolean isEnabled() {
return enabled;
}
/**
* @param enabled the enabled to set
*/
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
private static SortedSet<GrantedAuthority> sortAuthorities(
Collection<? extends GrantedAuthority> authorities) {
Assert.notNull(authorities, "Cannot pass a null GrantedAuthority collection");
// Ensure array iteration order is predictable (as per
// UserDetails.getAuthorities() contract and SEC-717)
SortedSet<GrantedAuthority> sortedAuthorities = new TreeSet<GrantedAuthority>(new AuthorityComparator());
for (GrantedAuthority grantedAuthority : authorities) {
Assert.notNull(grantedAuthority, "GrantedAuthority list cannot contain any null elements");
sortedAuthorities.add(grantedAuthority);
}
return sortedAuthorities;
}
@Override
public void eraseCredentials() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
private static class AuthorityComparator implements
Comparator<GrantedAuthority>, Serializable {
public int compare(GrantedAuthority g1, GrantedAuthority g2) {
// Neither should ever be null as each entry is checked before
// adding it to the set.
// If the authority is null, it is a custom authority and should
// precede others.
if (g2.getAuthority() == null) {
return -1;
}
if (g1.getAuthority() == null) {
return 1;
}
return g1.getAuthority().compareTo(g2.getAuthority());
}
}
@Override
public boolean equals(Object rhs) {
if (rhs instanceof UserInfo) {
return getUsername().equals(((UserInfo) rhs).getUsername());
}
return false;
}
@Override
public int hashCode() {
return getUsername().hashCode();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(super.toString()).append(": ");
sb.append("Username: ").append(this.getUsername()).append("; ");
sb.append("Password: [PROTECTED]; ");
sb.append("Enabled: ").append(this.isEnabled()).append("; ");
sb.append("AccountNonExpired: ").append(this.isAccountNonExpired()).append("; ");
sb.append("credentialsNonExpired: ").append(this.isCredentialsNonExpired()).append("; ");
sb.append("AccountNonLocked: ").append(this.isAccountNonLocked()).append("; ");
if (!authorities.isEmpty()) {
sb.append("Granted Authorities: ");
boolean first = true;
for (GrantedAuthority auth : getAuthorities()) {
if (!first) {
sb.append(",");
}
first = false;
sb.append(auth);
}
} else {
sb.append("Not granted any authorities");
}
return sb.toString();
}
}
@@ -28,7 +28,7 @@ public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServlet
@Override
protected String[] getServletMappings() {
return new String[]{"/api/*"};
return new String[]{"/"};
}
@Override
+35 -2
View File
@@ -1,7 +1,12 @@
package com.ifish.controller;
import java.util.Calendar;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
/*
@@ -16,8 +21,36 @@ import org.springframework.web.servlet.ModelAndView;
@Controller
public class Index {
@RequestMapping(value = "", method = RequestMethod.GET)
public ModelAndView Index() {
@RequestMapping(value = "/login", method = RequestMethod.GET)
public ModelAndView login(
@RequestParam(value = "error", required = false) String error,
@RequestParam(value = "logout", required = false) String logout,
String ReturnUrl, HttpServletRequest request) {
ModelAndView mv = new ModelAndView();
if (error != null) {
if (StringUtils.isNotBlank(error)) {
mv.addObject("error", error);
} else {
mv.addObject("error", "用户名密码不对!");
}
}
if (logout != null) {
mv.addObject("msg", "退出成功.");
if (StringUtils.isNotBlank(ReturnUrl)) {
mv.setViewName("redirect:/");
return mv;
}
}
mv.setViewName("index");
return mv;
}
@RequestMapping(value = "/test", method = RequestMethod.GET)
public Object test() {
ModelAndView mv = new ModelAndView();
mv.setViewName("index");
return mv;
@@ -69,6 +69,17 @@ public class RedisKeyHelper implements RedisKeyHelperI {
return RedisKey.USER_ID_KEY + userId;
}
/**
* 根据userName获取Tbl_Security_User管理用户的redis缓存key键值
*
* @param userName
* @return
*/
@Override
public String getTbl_Security_UserRedisKeyByUserName(String userName) {
return RedisKey.SECURITY_USER + userName;
}
/**
* 根据mac地址获取Tbl_Device的redis缓存key键值
*
@@ -49,6 +49,14 @@ public interface RedisKeyHelperI {
*/
public String getTbl_UserRedisKeyByEmail(String email);
/**
* 根据userName获取Tbl_Security_User管理用户的redis缓存key键值
*
* @param userName
* @return
*/
public String getTbl_Security_UserRedisKeyByUserName(String userName);
/**
* 根据mac地址获取Tbl_Device的redis缓存key键值
*
@@ -6,18 +6,44 @@
package com.ifish.helper;
import com.ifish.bean.Tbl_Security_User;
import com.ifish.mapper.Tbl_User_Mapper;
import com.ifish.util.IfishUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
*
* @author Administrator
*/
@Component
public class UserHelperI implements UserHelper {
@Autowired
private RedisHelperI redisHelperI;
@Autowired
private RedisKeyHelperI redisKeyHelperI;
@Autowired
private Tbl_User_Mapper tbl_User_Mapper;
@Override
public Tbl_Security_User getTbl_Security_User(String usernameSring) {
Tbl_Security_User tbl_Security_User = null;
try {
String key = redisKeyHelperI.getTbl_Security_UserRedisKeyByUserName(usernameSring);
String redisString = redisHelperI.getRedis(key);
if (StringUtils.isNotBlank(redisString)) {
tbl_Security_User = (Tbl_Security_User) IfishUtil.JsonToBean(redisString, Tbl_Security_User.class);
} else {
tbl_Security_User = tbl_User_Mapper.getSecurity_UserByUserName(usernameSring);
if (tbl_Security_User != null && tbl_Security_User.getId() > 0) {
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(tbl_Security_User));
}
}
} catch (Exception e) {
}
return tbl_Security_User;
}
}
@@ -0,0 +1,209 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.mapper;
import com.ifish.bean.Tbl_Activa_Code;
import com.ifish.bean.Tbl_Device;
import com.ifish.bean.Tbl_Device_Statistics;
import com.ifish.bean.Tbl_Device_User;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
/**
*
* @author Administrator
*/
public interface Tbl_Device_Mapper {
/**
* 根据设备ID获取设备详情
*
* @param deviceid
* @return
*/
@Select("SELECT device_id,server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,"
+ "today_remind,water_remind,remind_cycle,remind_date,factory_code,brand_code,create_time,active_code,active_time,update_time,camera_id from tbl_device WHERE device_id= #{deviceid}")
Tbl_Device getDeviceById(@Param("deviceid") Integer deviceid);
/**
* 根据摄像头ID获取设备详情
*
* @param deviceid
* @return
*/
@Select("SELECT device_id,server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,"
+ "today_remind,water_remind,remind_cycle,remind_date,factory_code,brand_code,create_time,active_code,active_time,update_time,camera_id from tbl_device WHERE camera_id= #{cameraID}")
Tbl_Device getDeviceByCameraId(@Param("cameraID") String cameraID);
/**
* 根据设备ID获取设备详情
*
* @param deviceid
* @return
*/
@Select("SELECT device_id,server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,"
+ "today_remind,water_remind,remind_cycle,remind_date,factory_code,brand_code,create_time,active_code,active_time,update_time,camera_id from tbl_device WHERE mac_address= #{mac_address}")
Tbl_Device getDeviceByMacAddress(@Param("mac_address") String macAddress);
/**
* 根据用户ID获取用户绑定设备集合
*
* @param userid
* @param deviceId
* @return
*/
@Select("SELECT id,user_id,device_id,is_master,show_name,create_time,update_time,custom_icon_name,custom_show_name,is_look,is_live from tbl_device_user WHERE user_id = #{userid}")
List<Tbl_Device_User> getDeviceUsersByUserId(@Param("userid") Integer userid);
/**
* 根据设备ID和用户ID获取设备与其他用户的关系
*
* @param userid
* @param deviceId
* @return
*/
@Select("SELECT id,user_id,device_id,is_master,show_name,create_time,update_time,custom_icon_name,custom_show_name,is_look,is_live from tbl_device_user WHERE user_id <> ${userid} AND device_id = #{deviceid}")
List<Tbl_Device_User> getOtherDeviceUsersByOtherUserIdAndDeviceId(@Param("userid") Integer userid, @Param("deviceid") Integer deviceId);
/**
* 根据设备ID和用户ID获取设备与用户的关系
*
* @param userid
* @param deviceId
* @return
*/
@Select("SELECT id,user_id,device_id,is_master,show_name,create_time,update_time,custom_icon_name,custom_show_name,is_look,is_live from tbl_device_user WHERE user_id = #{userid} AND device_id = #{deviceid}")
Tbl_Device_User getDeviceUsersByUserIdAndDeviceId(@Param("userid") Integer userid, @Param("deviceid") Integer deviceId);
/**
* 根据设备ID查询此设备关联的所有用户
*
* @param deviceId
* @return
*/
@Select("SELECT id,user_id,device_id,is_master,show_name,create_time,update_time,custom_icon_name,custom_show_name,is_look,is_live from tbl_device_user WHERE device_id = #{deviceid}")
List<Tbl_Device_User> getDeviceUsersByDeviceId(@Param("deviceid") Integer deviceId);
/**
* 修改用户和设备关系表数据
*
* @param device_User
* @return
*/
@UpdateProvider(method = "updateTblDeviceUser", type = Tbl_Device_MapperSql.class)
int updateTblDeviceUser(@Param("deviceUser") Tbl_Device_User device_User);
/**
* 删除设备和用户的关系
*
* @param id
* @return
*/
@Delete("DELETE from tbl_device_user where id = #{id}")
int deleteDeviceUserById(@Param("id") Integer id);
/**
* 根据设备ID查询设备统计信息
*
* @param deviceid
* @return
*/
@Select("SELECT id,device_id,mac_address,login_count,login_time,first_activate,create_time,is_charge,sdk_version,sdk_time,create_date,is_upgrade,upgrade_version,"
+ "upgrade_time,authorize_time,create_code,MCU_count,module_count,router_count,server_count,server_try_count,software_version,hardware_type,factory_code,brand_code FROM tbl_device_statistics WHERE device_id=#{deviceid}")
Tbl_Device_Statistics getDevStatisticsByDeviceId(@Param("deviceid") Integer deviceid);
/**
* 根据设备ID查询设备统计信息
*
* @param deviceid
* @return
*/
@Select("SELECT id,device_id,mac_address,login_count,login_time,first_activate,create_time,is_charge,sdk_version,sdk_time,create_date,is_upgrade,upgrade_version,"
+ "upgrade_time,authorize_time,create_code,MCU_count,module_count,router_count,server_count,server_try_count,software_version,hardware_type,factory_code,brand_code FROM tbl_device_statistics WHERE mac_address=#{mac}")
Tbl_Device_Statistics getDevStatisticsByMacAddress(@Param("mac") String macAddress);
/**
* 插入一条设备统计信息
*
* @param device_Statistics
* @return
*/
@InsertProvider(type = Tbl_Device_MapperSql.class, method = "insertDeviceStatistics")
@SelectKey(statement = "select @@IDENTITY as id", keyProperty = "deviceStatistics.id", keyColumn = "id", before = false, resultType = int.class)
Integer insertDeviceStatistics(@Param("deviceStatistics") Tbl_Device_Statistics device_Statistics);
/**
* 修改设备统计信息表
*
* @param device_Statistics
* @return
*/
@UpdateProvider(type = Tbl_Device_MapperSql.class, method = "updateDeviceStatistics")
Integer updateDeviceStatistics(@Param("deviceStatistics") Tbl_Device_Statistics device_Statistics);
/**
* 插入一条设备信息
*
* @param device
* @return
*/
@InsertProvider(type = Tbl_Device_MapperSql.class, method = "insertDevice")
@SelectKey(statement = "select @@IDENTITY as device_id", keyProperty = "device.deviceId", keyColumn = "device_id", before = false, resultType = int.class)
Integer insertDevice(@Param("device") Tbl_Device device);
/**
* 插入一套设备与用户关系数据
*
* @param deviceUser
* @return
*/
@InsertProvider(type = Tbl_Device_MapperSql.class, method = "insertDeviceUser")
@SelectKey(statement = "select @@IDENTITY as id", keyProperty = "deviceUser.id", keyColumn = "id", before = false, resultType = int.class)
Integer insertDeviceUser(@Param("deviceUser") Tbl_Device_User deviceUser);
/**
* 根据ID删除设备信息数据(摄像头)
*
* @param id
* @return
*/
@Delete("DELETE from tbl_device where id = #{id}")
int deleteDeviceById(@Param("id") Integer id);
/**
* 根据激活码查询激活码对象
*
* @param activeCode
* @return
*/
@Select("SELECT active_code,batch_code,is_used,create_time FROM tbl_activa_code WHERE active_code = #{code}")
Tbl_Activa_Code getActiva_CodeByCode(@Param("code") String activeCode);
/**
* 修改设备信息
*
* @param device
* @return
*/
@UpdateProvider(type = Tbl_Device_MapperSql.class, method = "updateTbl_Device")
Integer updateTbl_Device(@Param("device") Tbl_Device device);
/**
* 修改摄像头激活码信息为已使用
*
* @param activa_Code
* @return
*/
@Update("UPDATE tbl_activa_code set is_used='1' WHERE active_code = #{code}")
Integer updateTblActivaCodeIsUse(@Param("code") String activa_Code);
}
@@ -0,0 +1,269 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.mapper;
import com.ifish.bean.Tbl_Device;
import com.ifish.bean.Tbl_Device_Statistics;
import com.ifish.bean.Tbl_Device_User;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
/**
*
* @author Administrator
*/
public class Tbl_Device_MapperSql {
/**
* 修改设备和用户的表
*
* @param device_User
* @return
*/
public String updateTblDeviceUser(@Param("deviceUser") Tbl_Device_User device_User) {
StringBuilder sb = new StringBuilder();
sb.append("UPDATE tbl_device_user SET ");
if (device_User.getUserId() != null && device_User.getUserId() > 0) {
sb.append("user_id = #{deviceUser.userId}, ");
}
if (device_User.getDeviceId() != null && device_User.getDeviceId() > 0) {
sb.append("device_id = #{deviceUser.deviceId}, ");
}
if (StringUtils.isNotBlank(device_User.getIsMaster())) {
sb.append("is_master = #{deviceUser.isMaster}, ");
}
if (StringUtils.isNotBlank(device_User.getShowName())) {
sb.append("show_name = #{deviceUser.showName}, ");
}
if (device_User.getCreateTime() != null && StringUtils.isNotBlank(device_User.getCreateTime().toString())) {
sb.append("create_time = #{deviceUser.createTime}, ");
}
if (StringUtils.isNotBlank(device_User.getCustomIconName())) {
sb.append("custom_icon_name = #{deviceUser.customIconName}, ");
}
if (StringUtils.isNotBlank(device_User.getCustomShowName())) {
sb.append("custom_show_name = #{deviceUser.customShowName}, ");
}
if (StringUtils.isNotBlank(device_User.getIsLook())) {
sb.append("is_look = #{deviceUser.isLook}, ");
}
if (StringUtils.isNotBlank(device_User.getIsLive())) {
sb.append("is_live = #{deviceUser.isLive}, ");
}
sb.append("update_time = now() ");
sb.append(" WHERE id = #{deviceUser.id}");
return sb.toString();
}
/**
* 插入一条设备统计信息表
*
* @param device_Statistics
* @return
*/
public String insertDeviceStatistics(@Param("deviceStatistics") Tbl_Device_Statistics device_Statistics) {
StringBuilder sb = new StringBuilder();
sb.append("INSERT tbl_device_statistics(device_id,mac_address,login_count,login_time,first_activate,create_time,is_charge,sdk_version,sdk_time,create_date,authorize_time,create_code,hardware_type,factory_code,brand_code)");
sb.append("values(#{deviceStatistics.deviceId},#{deviceStatistics.macAddress},#{deviceStatistics.loginCount},#{deviceStatistics.loginTime},#{deviceStatistics.firstActivate},#{deviceStatistics.createTime},");
sb.append("#{deviceStatistics.isCharge},#{deviceStatistics.sdkVersion},#{deviceStatistics.sdkTime},#{deviceStatistics.createDate},#{deviceStatistics.authorizeTime},#{deviceStatistics.createCode},");
sb.append("#{deviceStatistics.hardwareType},#{deviceStatistics.factoryCode},#{deviceStatistics.brandCode})");
return sb.toString();
}
/**
* 修改设备统计信息表
*
* @param device_Statistics
* @return
*/
public String updateDeviceStatistics(@Param("deviceStatistics") Tbl_Device_Statistics device_Statistics) {
StringBuilder sb = new StringBuilder();
sb.append("UPDATE tbl_device_statistics SET ");
if (device_Statistics.getDeviceId() != null && device_Statistics.getDeviceId() > 0) {
sb.append("device_id = #{deviceStatistics.deviceId}, ");
}
if (StringUtils.isNotBlank(device_Statistics.getMacAddress())) {
sb.append("mac_address = #{deviceStatistics.macAddress}, ");
}
if (device_Statistics.getLoginCount() != null && device_Statistics.getLoginCount() > 0) {
sb.append("login_count = #{deviceStatistics.loginCount}, ");
}
if (device_Statistics.getLoginTime() != null && StringUtils.isNotBlank(device_Statistics.getLoginTime().toString())) {
sb.append("login_time= #{deviceStatistics.loginTime}, ");
}
if (device_Statistics.getFirstActivate() != null && StringUtils.isNotBlank(device_Statistics.getFirstActivate().toString())) {
sb.append("first_activate= #{deviceStatistics.firstActivate}, ");
}
if (device_Statistics.getCreateTime() != null && StringUtils.isNotBlank(device_Statistics.getCreateTime().toString())) {
sb.append("create_time= #{deviceStatistics.createTime}, ");
}
if (StringUtils.isNotBlank(device_Statistics.getIsCharge())) {
sb.append("is_charge = #{deviceStatistics.isCharge}, ");
}
if (StringUtils.isNotBlank(device_Statistics.getSdkVersion())) {
sb.append("sdk_version = #{deviceStatistics.sdkVersion}, ");
}
if (device_Statistics.getSdkTime() != null && StringUtils.isNotBlank(device_Statistics.getSdkTime().toString())) {
sb.append("sdk_time= #{deviceStatistics.sdkTime}, ");
}
if (device_Statistics.getCreateDate() != null && StringUtils.isNotBlank(device_Statistics.getCreateDate().toString())) {
sb.append("create_date= #{deviceStatistics.createDate}, ");
}
if (StringUtils.isNotBlank(device_Statistics.getIsUpgrade())) {
sb.append("is_upgrade = #{deviceStatistics.isUpgrade}, ");
}
if (StringUtils.isNotBlank(device_Statistics.getUpgradeVersion())) {
sb.append("upgrade_version = #{deviceStatistics.upgradeVersion}, ");
}
if (device_Statistics.getUpgradeTime() != null && StringUtils.isNotBlank(device_Statistics.getUpgradeTime().toString())) {
sb.append("upgrade_time= #{deviceStatistics.upgradeTime}, ");
}
if (device_Statistics.getAuthorizeTime() != null && StringUtils.isNotBlank(device_Statistics.getAuthorizeTime().toString())) {
sb.append("authorize_time= #{deviceStatistics.authorizeTime}, ");
}
if (StringUtils.isNotBlank(device_Statistics.getCreateCode())) {
sb.append("create_code = #{deviceStatistics.createCode}, ");
}
if (device_Statistics.getMcuCount() != null && device_Statistics.getMcuCount() > 0) {
sb.append("mcu_count = #{deviceStatistics.mcuCount}, ");
}
if (device_Statistics.getModuleCount() != null && device_Statistics.getModuleCount() > 0) {
sb.append("module_count = #{deviceStatistics.moduleCount}, ");
}
if (device_Statistics.getRouterCount() != null && device_Statistics.getRouterCount() > 0) {
sb.append("router_count = #{deviceStatistics.routerCount}, ");
}
if (device_Statistics.getServerCount() != null && device_Statistics.getServerCount() > 0) {
sb.append("server_count = #{deviceStatistics.serverCount}, ");
}
if (device_Statistics.getServerTryCount() != null && device_Statistics.getServerTryCount() > 0) {
sb.append("server_try_count = #{deviceStatistics.serverTryCount}, ");
}
if (StringUtils.isNotBlank(device_Statistics.getSoftwareVersion())) {
sb.append("software_version = #{deviceStatistics.softwareVersion}, ");
}
if (StringUtils.isNotBlank(device_Statistics.getHardwareType())) {
sb.append("hardware_type = #{deviceStatistics.hardwareType}, ");
}
if (StringUtils.isNotBlank(device_Statistics.getFactoryCode())) {
sb.append("factory_code = #{deviceStatistics.factoryCode}, ");
}
if (StringUtils.isNotBlank(device_Statistics.getBrandCode())) {
sb.append("brand_code = #{deviceStatistics.brandCode}, ");
}
if (sb.lastIndexOf(",") == sb.length() - 2) {
sb.deleteCharAt(sb.length() - 2);
}
sb.append(" WHERE id = #{deviceStatistics.id}");
return sb.toString();
}
/**
* 插入一条设备信息
*
* @param device
* @return
*/
public String insertDevice(@Param("device") Tbl_Device device) {
StringBuilder sb = new StringBuilder();
sb.append("INSERT INTO tbl_device(server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,today_remind,water_remind,remind_date,remind_cycle,factory_code,brand_code,");
sb.append("create_time,active_code,active_time,update_time,camera_id) VALUES(#{device.serverIp},#{device.deviceIp},#{device.isCamera},#{device.macAddress},#{device.loginTime},#{device.isBlacklist},#{device.hardwareType},#{device.onOff},");
sb.append("#{device.todayRemind},#{device.waterRemind},#{device.remindDate},#{device.remindCycle},#{device.factoryCode},#{device.brandCode},#{device.createTime},#{device.activeCode},#{device.activeTime},#{device.updateTime},#{device.cameraId})");
return sb.toString();
}
/**
* 插入设备和用户信息
*
* @param deviceUser
* @return
*/
public String insertDeviceUser(@Param("deviceUser") Tbl_Device_User deviceUser) {
StringBuilder sb = new StringBuilder();
sb.append("INSERT INTO tbl_device_user (user_id,device_id,is_master,show_name,create_time,update_time,custom_icon_name,custom_show_name,is_look,is_live) VALUES(");
sb.append("#{deviceUser.userId},#{deviceUser.deviceId},#{deviceUser.isMaster},#{deviceUser.showName},#{deviceUser.createTime},#{deviceUser.updateTime},#{deviceUser.customIconName},#{deviceUser.customShowName},#{deviceUser.isLook},#{deviceUser.isLive})");
return sb.toString();
}
/**
* 修改设备信息
*
* @param device
* @return
*/
public String updateTbl_Device(@Param("device") Tbl_Device device) {
StringBuilder sb = new StringBuilder();
sb.append("UPDATE tbl_device SET ");
if (StringUtils.isNotBlank(device.getServerIp())) {
sb.append("server_ip = #{device.serverIp}, ");
}
if (StringUtils.isNotBlank(device.getDeviceIp())) {
sb.append("device_ip = #{device.deviceIp}, ");
}
if (StringUtils.isNotBlank(device.getIsCamera())) {
sb.append("is_camera = #{device.isCamera}, ");
}
if (StringUtils.isNotBlank(device.getMacAddress())) {
sb.append("mac_address = #{device.macAddress}, ");
}
if (device.getLoginTime() != null && StringUtils.isNotBlank(device.getLoginTime().toString())) {
sb.append("login_time = #{device.loginTime}, ");
}
if (device.getRemindDate() != null && StringUtils.isNotBlank(device.getRemindDate().toString())) {
sb.append("remind_date = #{device.loginTime}, ");
}
if (StringUtils.isNotBlank(device.getIsBlacklist())) {
sb.append("is_blacklist = #{device.isBlacklist}, ");
}
if (StringUtils.isNotBlank(device.getHardwareType())) {
sb.append("hardware_type = #{device.hardwareType}, ");
}
if (StringUtils.isNotBlank(device.getOnOff())) {
sb.append("on_off = #{device.onOff}, ");
}
if (StringUtils.isNotBlank(device.getTodayRemind())) {
sb.append("today_remind = #{device.todayRemind}, ");
}
if (StringUtils.isNotBlank(device.getWaterRemind())) {
sb.append("water_remind = #{device.waterRemind}, ");
}
if (device.getRemindCycle() != null && device.getRemindCycle() > 0) {
sb.append("remind_cycle = #{device.remindCycle}, ");
}
if (StringUtils.isNotBlank(device.getFactoryCode())) {
sb.append("factory_code = #{device.factoryCode}, ");
}
if (StringUtils.isNotBlank(device.getBrandCode())) {
sb.append("brand_code = #{device.brandCode}, ");
}
if (StringUtils.isNotBlank(device.getCameraId())) {
sb.append("camera_id = #{device.cameraId}, ");
}
if (device.getCreateTime() != null && StringUtils.isNotBlank(device.getCreateTime().toString())) {
sb.append("create_time = #{device.createTime}, ");
}
if (device.getActiveTime() != null && StringUtils.isNotBlank(device.getActiveTime().toString())) {
sb.append("active_time = #{device.activeTime}, ");
}
if (StringUtils.isNotBlank(device.getActiveCode())) {
sb.append("active_code = #{device.activeCode}, ");
}
sb.append("update_time = now() ");
sb.append(" WHERE device_id = #{device.deviceId}");
return sb.toString();
}
}
@@ -0,0 +1,38 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.mapper;
import com.ifish.bean.Tbl_HardWare_Type;
import com.ifish.bean.Tbl_Vender;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
*
* @author Administrator
*/
public interface Tbl_Hardware_Type_Mapper {
/**
* 根据设备类型Code获取厂家设备类型详情
*
* @param type
* @return
*/
@Select("select hardware_type,hardware_name,control_amount,timer_amount,is_work_model,is_custom_icon,all_icon_name,all_show_name,default_icon_name,default_show_name,"
+ "icon_link,is_lightness,is_sark_lamp,hardware_desc,update_time,create_time from tbl_hardware_type where hardware_type=#{type}")
Tbl_HardWare_Type getHardwareTypeByTypeCode(@Param("type") String type);
/**
* 根据code获取厂家信息
*
* @param code
* @return
*/
@Select("select brand_code,brand_name,brand_introduce,brand_logo from tbl_vender_list where brand_code=#{code}")
Tbl_Vender getVenderListByBrandCode(@Param("code") String code);
}
@@ -0,0 +1,209 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.mapper;
import com.ifish.bean.LiveRoomPageInfo;
import com.ifish.bean.Tbl_Live_Message;
import com.ifish.bean.Tbl_Live_Room;
import com.ifish.bean.Tbl_Live_Watch;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
/**
*
* @author Administrator
*/
public interface Tbl_Live_Room_Mapper {
/**
* 建立一个直播间
*/
@Insert("INSERT INTO tbl_live_room (user_id,camera_id,room_name,room_desc,room_status,popularity_value,create_time,room_Img) VALUES("
+ "#{liveroom.userId},#{liveroom.cameraId},#{liveroom.roomName},#{liveroom.roomDesc},#{liveroom.roomStatus},#{liveroom.popularityValue},now(),#{liveroom.roomImg})")
@SelectKey(statement = "select @@IDENTITY as room_id", keyProperty = "liveroom.roomId", keyColumn = "room_id", before = false, resultType = int.class)
Integer insertLiveRoom(@Param("liveroom") Tbl_Live_Room liveRoom);
/**
* 插入一条直播间评论
*
* @param live_Message
* @return
*/
@Insert("INSERT INTO TBL_LIVE_MESSAGE (room_id,user_id,as_user_id,message_content,create_time) VALUES (#{livemessage.roomId},#{livemessage.userId},#{livemessage.asUserId},#{livemessage.messageContent},#{livemessage.createTime})")
@SelectKey(statement = "select @@IDENTITY as message_id", keyProperty = "livemessage.messageId", keyColumn = "message_id", before = false, resultType = int.class)
Integer insertLiveMessage(@Param("livemessage") Tbl_Live_Message live_Message);
/**
* 查询直播间总赞数
*
* @param roomID
* @return
*/
@Select("select count(*) from tbl_live_room_zan where room_id=#{roomid} ")
Integer getLiveRoomZanCountByRoomId(@Param("roomid") Integer roomID);
/**
* 查询某个用户是否点赞了某个直播间
*
* @param roomID
* @param userID
* @return
*/
@Select("SELECT COUNT(1) FROM TBL_LIVE_ROOM_ZAN WHERE ROOM_ID = #{roomid} AND USER_ID = #{userid}")
Integer IsZan(@Param("roomid") Integer roomID, @Param("userid") Integer userID);
/**
* 取消点赞
*
* @param roomID
* @param userID
* @return
*/
@Delete("DELETE FROM TBL_LIVE_ROOM_ZAN WHERE ROOM_ID = #{roomid} AND USER_ID = #{userid}")
Integer cancelZan(@Param("roomid") Integer roomID, @Param("userid") Integer userID);
/**
* 执行点赞
*
* @param roomID
* @param userID
* @return
*/
@Insert("INSERT INTO TBL_LIVE_ROOM_ZAN(ROOM_ID,USER_ID,CREATE_TIME) VALUES (#{roomid},#{userid},NOW())")
Integer ImplementZan(@Param("roomid") Integer roomID, @Param("userid") Integer userID);
/**
* 根据房间ID查询直播间信息
*
* @param roomid
* @return
*/
@Select("SELECT ROOM_ID,USER_ID,CAMERA_ID,ROOM_NAME,ROOM_DESC,ROOM_STATUS,POPULARITY_VALUE,CREATE_TIME,UPDATE_TIME,room_Img,zanNum FROM TBL_LIVE_ROOM WHERE ROOM_ID = #{roomid}")
Tbl_Live_Room getTbl_Live_RoomById(@Param("roomid") Integer roomid);
/**
* 根据开播时间来查询直播间
*
* @param pageSize
* @param FirstResult
* @return
*/
@Select(" select a.roomId,a.userId,a.userType,a.nickName,a.userImg,a.loginTime,a.createTime,a.cameraId,a.roomName,a.roomDesc,a.popularityValue,a.roomImg,a.numberDays,a.zanNum,count(*) as pinglunNum from ("
+ " SELECT l.room_id AS roomId,u.user_id AS userId,u.user_type AS userType,u.nick_name AS nickName,u.user_img AS userImg,u.login_time AS loginTime,l.create_time AS createTime,"
+ " td.camera_id AS cameraId,l.room_name AS roomName,l.room_desc AS roomDesc,l.popularity_value AS popularityValue,l.room_Img AS roomImg,"
+ " (TO_DAYS(NOW())-TO_DAYS(l.create_time)) AS numberDays,l.zanNum,b.message_id"
+ " from tbl_user u"
+ " LEFT JOIN tbl_device_user c ON u.user_id=c.user_id "
+ " LEFT JOIN tbl_device td ON c.device_id = td.device_id"
+ " LEFT JOIN tbl_live_room l ON u.user_id=l.user_id and l.camera_id = td.camera_id"
+ " LEFT JOIN tbl_live_message b ON l.room_id = b.room_id"
+ " where c.is_live='1' AND l.room_status='1' ) as a"
+ " GROUP BY a.roomId,a.userId,a.userType,a.nickName,a.userImg,a.loginTime,a.createTime,a.cameraId,a.roomName,a.roomDesc,a.popularityValue,a.roomImg,a.numberDays,a.zanNum"
+ " ORDER BY a.createTime DESC LIMIT ${first},${pagesize}")
List<LiveRoomPageInfo> getLiveRoomListByCreateTime(@Param("pagesize") Integer pageSize, @Param("first") Integer FirstResult);
/**
* 根据开播时间来查询直播间
*
* @param pageSize
* @param FirstResult
* @return
*/
@Select(" select a.roomId,a.userId,a.userType,a.nickName,a.userImg,a.loginTime,a.createTime,a.cameraId,a.roomName,a.roomDesc,a.popularityValue,a.roomImg,a.numberDays,a.zanNum,count(*) as pinglunNum from ("
+ " SELECT l.room_id AS roomId,u.user_id AS userId,u.user_type AS userType,u.nick_name AS nickName,u.user_img AS userImg,u.login_time AS loginTime,l.create_time AS createTime,"
+ " td.camera_id AS cameraId,l.room_name AS roomName,l.room_desc AS roomDesc,l.popularity_value AS popularityValue,l.room_Img AS roomImg,"
+ " (TO_DAYS(NOW())-TO_DAYS(l.create_time)) AS numberDays,l.zanNum,b.message_id"
+ " from tbl_user u"
+ " LEFT JOIN tbl_device_user c ON u.user_id=c.user_id "
+ " LEFT JOIN tbl_device td ON c.device_id = td.device_id"
+ " LEFT JOIN tbl_live_room l ON u.user_id=l.user_id and l.camera_id = td.camera_id"
+ " LEFT JOIN tbl_live_message b ON l.room_id = b.room_id"
+ " where c.is_live='1' AND l.room_status='1' ) as a"
+ " GROUP BY a.roomId,a.userId,a.userType,a.nickName,a.userImg,a.loginTime,a.createTime,a.cameraId,a.roomName,a.roomDesc,a.popularityValue,a.roomImg,a.numberDays,a.zanNum"
+ " ORDER BY a.popularityValue DESC LIMIT ${first},${pagesize}")
List<LiveRoomPageInfo> getLiveRoomListByRenqi(@Param("pagesize") Integer pageSize, @Param("first") Integer FirstResult);
/**
* 查询所有直播间数量
*
* @return
*/
@Select("SELECT COUNT(1)"
+ " from tbl_user u"
+ " LEFT JOIN tbl_device_user c ON u.user_id=c.user_id "
+ " LEFT JOIN tbl_device td ON c.device_id = td.device_id"
+ " LEFT JOIN tbl_live_room l ON u.user_id=l.user_id and l.camera_id = td.camera_id"
+ " where c.is_live='1' AND l.room_status='1'")
Integer getLiveRoomListCount();
/**
* 修改直播间信息
*
* @param live_Room
* @return
*/
@UpdateProvider(type = Tbl_Live_Room_MapperSql.class, method = "updateLiveRoom")
Integer updateLiveRoom(@Param("live") Tbl_Live_Room live_Room);
/**
* 修改人气值
*
* @param live_Room
* @return
*/
@Update("UPDATE TBL_LIVE_ROOM SET popularity_value = #{live.popularityValue} WHERE room_id = #{live.roomId}")
Integer updateLiveRoomPopularityValue(@Param("live") Tbl_Live_Room live_Room);
/**
* 根据直播间ID获取此直播间评论列表
*
* @param roomid
* @return
*/
@Select("select l.message_id as messageId,l.room_id as roomId,l.user_id as userId,l.as_user_id as asUserId,"
+ "uu.nick_name as asUserName,u.user_img as userImg,u.nick_name as userName,l.message_content as messageContent,l.create_time as createTime "
+ "from tbl_live_message l "
+ "LEFT JOIN tbl_user u ON l.user_id = u.user_id "
+ "LEFT JOIN tbl_user uu ON l.as_user_id=uu.user_id "
+ "WHERE room_id = #{roomid} LIMIT ${first},${page} ")
List<Map> getLive_MessagesListByRoomId(@Param("roomid") Integer roomid, @Param("first") Integer firstResult, @Param("page") Integer pageSize);
/**
* 根据直播间和用户ID获取观看记录
*
* @param roomId
* @param userId
* @return
*/
@Select("SELECT ROOM_ID,USER_ID,UPDATE_TIME,CREATE_TIME FROM TBL_LIVE_WATCH WHERE ROOM_ID=#{roomid} AND USER_ID=#{userid}")
Tbl_Live_Watch getTbl_Live_WatchByRoomIdAndUserId(@Param("roomid") Integer roomId, @Param("userid") Integer userId);
/**
* 修改用户直播观看记录
*
* @param live
* @return
*/
@Update("UPDATE TBL_LIVE_WATCH SET UPDATE_TIME=#{live.updateTime} WHERE room_id=#{live.roomId} AND user_id=#{live.userId}")
Integer updateTbl_Live_Watch(@Param("live") Tbl_Live_Watch live);
/**
* 插入一条用户观看记录
*
* @param live
* @return
*/
@Insert("INSERT INTO TBL_LIVE_WATCH(room_id,user_id,update_time,create_time) VALUES (#{live.roomId},#{live.userId},#{live.updateTime},#{live.createTime})")
Integer insertTbl_Live_Watch(@Param("live") Tbl_Live_Watch live);
}
@@ -0,0 +1,58 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.mapper;
import com.ifish.bean.Tbl_Live_Room;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
/**
*
* @author Administrator
*/
public class Tbl_Live_Room_MapperSql {
/**
* 修改直播间信息
*
* @param live_Room
* @return
*/
public String updateLiveRoom(@Param("live") Tbl_Live_Room live_Room) {
StringBuilder sb = new StringBuilder();
sb.append("UPDATE TBL_LIVE_ROOM SET ");
if (StringUtils.isNotBlank(live_Room.getCameraId())) {
sb.append("camera_id = #{live.cameraId}, ");
}
if (StringUtils.isNotBlank(live_Room.getRoomDesc())) {
sb.append("room_desc = #{live.roomDesc}, ");
}
if (StringUtils.isNotBlank(live_Room.getRoomImg())) {
sb.append("room_img = #{live.roomImg}, ");
}
if (StringUtils.isNotBlank(live_Room.getRoomName())) {
sb.append("room_name = #{live.roomName}, ");
}
if (StringUtils.isNotBlank(live_Room.getRoomStatus())) {
sb.append("room_status = #{live.roomStatus}, ");
}
if (live_Room.getPopularityValue() != null && live_Room.getPopularityValue() >= 0) {
sb.append("popularity_value = #{live.popularityValue}, ");
}
if (live_Room.getZanNum() != null && live_Room.getZanNum() >= 0) {
sb.append("zanNum = #{live.zanNum}, ");
}
if (sb.lastIndexOf(",") == sb.length() - 2) {
sb.deleteCharAt(sb.length() - 2);
}
sb.append(" WHERE room_id=#{live.roomId} ");
return sb.toString();
}
}
@@ -0,0 +1,63 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.mapper;
import com.ifish.bean.Tbl_Push_List;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
/**
*
* @author Administrator
*/
public interface Tbl_Push_List_Mapper {
/**
* 分页获取用户推送消息
*
* @param userId
* @param pushType
* @param pageSize
* @param firstResult
* @return
*/
@SelectProvider(type = Tbl_Push_List_MapperSql.class, method = "getPushList")
List<Tbl_Push_List> getPushList(@Param("userid") Integer userId, @Param("pushtype") String pushType, @Param("pagesize") Integer pageSize, @Param("first") Integer firstResult);
/**
* 根据ID查询推送消息对象
*
* @param pushId
* @return
*/
@Select("SELECT push_id,user_id,device_id,show_name,phone_type,push_type,push_title,push_context,create_time,push_link,jpush_status,google_status FROM TBL_PUSH_LIST WHERE push_id = #{pushid}")
Tbl_Push_List getPush_ListById(@Param("pushid") Integer pushId);
/**
* 根据ID删除推送消息
*
* @param pushId
* @return
*/
@Delete("DELETE FROM TBL_PUSH_LIST WHERE push_id = #{id}")
Integer deletePushListById(@Param("id") Integer pushId);
/**
* 分页获取用户推送消息
*
* @param userId
* @param pushType
* @param pageSize
* @param firstResult
* @return
*/
@Select("SELECT COUNT(1) FROM TBL_PUSH_LIST WHERE user_id = #{userid} AND push_type = #{pushtype} LIMIT ${first},${pagesize}")
Integer getPushListCount(@Param("userid") Integer userId, @Param("pushtype") String pushType, @Param("pagesize") Integer pageSize, @Param("first") Integer firstResult);
}
@@ -0,0 +1,30 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.mapper;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
/**
*
* @author Administrator
*/
public class Tbl_Push_List_MapperSql {
public String getPushList(@Param("userid") Integer userId, @Param("pushtype") String pushType, @Param("pagesize") Integer pageSize, @Param("first") Integer firstResult) {
StringBuilder sb = new StringBuilder();
sb.append("SELECT push_id,user_id,device_id,show_name,phone_type,push_type,push_title,push_context,create_time,push_link,jpush_status,google_status FROM TBL_PUSH_LIST WHERE ");
sb.append("user_id = #{userid} ");
if (StringUtils.isNotBlank(pushType)) {
sb.append("AND push_type = #{pushtype} ");
}
sb.append("ORDER BY push_id DESC LIMIT ").append(firstResult).append(",").append(pageSize);
return sb.toString();
}
}
@@ -0,0 +1,113 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.mapper;
import com.ifish.bean.Tbl_Security_User;
import com.ifish.bean.Tbl_User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
/**
*
* @author Administrator
*/
public interface Tbl_User_Mapper {
/**
* 根据手机号获取用户对象
*
* @return
*/
@Select("select user_id,nick_name,user_password,phone_number,user_email,user_type,user_img,user_sex,login_count,update_time,login_time,create_time,login_type,remarks,address,P2PVerify_code1,P2PVerify_code2,"
+ "gwell_userID,is_register_gwell,jiguang_userID,token,longitude,latitude from tbl_user where phone_number=#{phoneNumber}")
Tbl_User getUserByPhoneNumber(@Param("phoneNumber") String phoneNumber);
/**
* 根据用户邮箱获取用户对象
*
* @param userid
* @return
*/
@Select("select user_id,nick_name,user_password,phone_number,user_email,user_type,user_img,user_sex,login_count,update_time,login_time,create_time,login_type,remarks,address,P2PVerify_code1,P2PVerify_code2,"
+ "gwell_userID,is_register_gwell,jiguang_userID,token,longitude,latitude from tbl_user where user_email=#{user_email}")
Tbl_User getUserByUserEmail(@Param("user_email") String userEmail);
/**
* 根据用户token获取用户对象
*
* @param userid
* @return
*/
@Select("select user_id,nick_name,user_password,phone_number,user_email,user_type,user_img,user_sex,login_count,update_time,login_time,create_time,login_type,remarks,address,P2PVerify_code1,P2PVerify_code2,"
+ "gwell_userID,is_register_gwell,jiguang_userID,token,longitude,latitude from tbl_user where token=#{token}")
Tbl_User getUserByUserToken(@Param("token") String token);
/**
* 根据用户ID获取用户对象
*
* @param userid
* @return
*/
@Select("select user_id,nick_name,user_password,phone_number,user_email,user_type,user_img,user_sex,login_count,update_time,login_time,create_time,login_type,remarks,address,P2PVerify_code1,P2PVerify_code2,"
+ "gwell_userID,is_register_gwell,jiguang_userID,token,longitude,latitude from tbl_user where user_id=#{userid}")
Tbl_User getUserByUserId(@Param("userid") String userid);
/**
* 每次登陆后修改登陆时间、次数和手机类型
*
* @param userId
* @param loginType
* @return
*/
@Update("update tbl_user set login_count=if(login_count is null,1,login_count+1),login_type=#{logintype},login_time=current_timestamp() where user_id=#{userid}")
Integer executeLoginUpdate(@Param("userid") Integer userId, @Param("logintype") String loginType);
/**
* 修改用户账号信息
*
* @param user
* @return
*/
@UpdateProvider(type = Tbl_User_MapperSql.class, method = "updateUser")
Integer updateUser(@Param("user") Tbl_User user);
/**
* 游客注册用户
*
* @param user
* @return
*/
@InsertProvider(type = Tbl_User_MapperSql.class, method = "registerUserByTourist")
@SelectKey(statement = "select @@IDENTITY as user_id", keyProperty = "user.userId", keyColumn = "userId", before = false, resultType = int.class)
Integer insertUserByTourist(@Param("user") Tbl_User user);
/**
* 手机邮箱注册用户
*
* @param user
* @return
*/
@Insert("INSERT INTO tbl_user (`nick_name`, `user_password`, `phone_number`, `user_email`, `user_type`, `user_img`, `user_sex`, `login_count`, `update_time`, `login_time`, `create_time`, `login_type`, `remarks`, `address`, `P2PVerify_code1`, `P2PVerify_code2`, `gwell_userID`, `is_register_gwell`, `jiguang_userID`,`token`, `longitude`, `latitude`) "
+ "VALUES (#{user.nickName},#{user.userPassword},#{user.phoneNumber},#{user.userEmail},#{user.userType},#{user.userImg},#{user.userSex},#{user.loginCount},#{user.updateTime},#{user.loginTime},"
+ "#{user.createTime},#{user.loginType},#{user.remarks},#{user.address},#{user.p2pverifyCode1},#{user.p2pverifyCode2},#{user.gwellUserid},#{user.isRegisterGwell},#{user.jiguangUserid},"
+ "#{user.token},#{user.longitude},#{userlatitude})")
@SelectKey(statement = "select @@IDENTITY as user_id", keyProperty = "user.userId", keyColumn = "userId", before = false, resultType = int.class)
Integer insertUserByPhoneNumberAndEmail(@Param("user") Tbl_User user);
/**
* 根据用户名查找管理用户
*
* @param userName
* @return
*/
@Select("SELECT * FROM tbl_security_user where username=#{user}")
Tbl_Security_User getSecurity_UserByUserName(@Param("user") String userName);
}
@@ -0,0 +1,95 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.mapper;
import com.ifish.bean.Tbl_User;
import org.apache.ibatis.annotations.Param;
import org.apache.commons.lang3.StringUtils;
/**
*
* @author Administrator
*/
public class Tbl_User_MapperSql {
public String updateUser(@Param("user") Tbl_User user) {
StringBuilder sb = new StringBuilder();
sb.append("Update tbl_User SET ");
if (user.getNickName() != null && StringUtils.isNotBlank(user.getNickName())) {
sb.append("nick_name = #{user.nickName}, ");
}
if (user.getUserPassword() != null && StringUtils.isNotBlank(user.getUserPassword())) {
sb.append("user_password = #{user.userPassword}, ");
}
if (user.getPhoneNumber() != null && StringUtils.isNotBlank(user.getPhoneNumber())) {
sb.append("phone_number = #{user.phoneNumber}, ");
}
if (user.getUserEmail() != null && StringUtils.isNotBlank(user.getUserEmail())) {
sb.append("user_email = #{user.userEmail}, ");
}
// if (user.getUserType() != null && StringUtils.isNotBlank(user.getUserType())) {
// sb.append("user_type = #{user.userType}, ");
// }
if (user.getUserImg() != null && StringUtils.isNotBlank(user.getUserImg())) {
sb.append("user_img = #{user.userImg}, ");
}
if (user.getUserSex() != null && StringUtils.isNotBlank(user.getUserSex())) {
sb.append("user_sex = #{user.userSex}, ");
}
if (user.getLoginTime() != null) {
sb.append("login_time = #{user.loginTime}, ");
}
//注册时间不予修改
if (user.getLoginType() != null && StringUtils.isNotBlank(user.getLoginType())) {
sb.append("login_type = #{user.loginType}, ");
}
if (user.getRemarks() != null && StringUtils.isNotBlank(user.getRemarks())) {
sb.append("remarks = #{user.remarks}, ");
}
if (user.getAddress() != null && StringUtils.isNotBlank(user.getAddress())) {
sb.append("address = #{user.address}, ");
}
if (user.getP2pverifyCode1() != null && StringUtils.isNotBlank(user.getP2pverifyCode1())) {
sb.append("p2pverify_code1 = #{user.p2pverifyCode1}, ");
}
if (user.getP2pverifyCode2() != null && StringUtils.isNotBlank(user.getP2pverifyCode2())) {
sb.append("p2pverify_code2 = #{user.p2pverifyCode2}, ");
}
if (user.getGwellUserid() != null && StringUtils.isNotBlank(user.getGwellUserid())) {
sb.append("gwell_userid = #{user.gwellUserid}, ");
}
if (user.getIsRegisterGwell() != null && StringUtils.isNotBlank(user.getIsRegisterGwell())) {
sb.append("is_register_gwell = #{user.isRegisterGwell}, ");
}
if (user.getJiguangUserid() != null && StringUtils.isNotBlank(user.getJiguangUserid())) {
sb.append("jiguang_userID = #{user.jiguangUserid}, ");
}
if (user.getLatitude() != null && user.getLatitude() > 0) {
sb.append("latitude = #{user.latitude}, ");
}
if (user.getLongitude() != null && user.getLongitude() > 0) {
sb.append("longitude = #{iser.longitude}, ");
}
sb.append("update_time = NOW() ");
sb.append(" WHERE user_id = #{user.userId}");
return sb.toString();
}
/**
* 游客注册接口
*
* @param user
* @return
*/
public String registerUserByTourist(@Param("user") Tbl_User user) {
StringBuilder sb = new StringBuilder();
sb.append("INSERT tbl_user (user_type,token) value ('0',#{user.token})");
return sb.toString();
}
}
+494
View File
@@ -0,0 +1,494 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.util;
import com.ifish.bean.PageResult;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.JavaType;
import org.springframework.web.multipart.MultipartFile;
/**
*
* @author Administrator
*/
public class IfishUtil {
private static final String formatDate = "yyyy-MM-dd HH:mm:ss";
private static final String formatDate3 = "MM-dd HH:mm";
private static final String formatDate2 = "yyyy-MM-dd HH:mm";
private static final String formatDate1 = "yyyy-MM-dd";
/**
* 测试缓存时间:一分钟;单位:秒
*/
public static final int CacheTime_Test_SECONDS = 60;
/**
* 缓存时间:一秒;单位:秒
*/
public static final int CacheTime_SECONDS = 1;
/**
* 缓存时间:一分钟;单位:分
*/
public static final int CacheTime_MINUTES = 1;
/**
* 缓存时间:一小时;单位:小时
*/
public static final int CacheTime_HOURS = 1;
/**
* 缓存时间:一天;单位:天
*/
public static final int CacheTime_DAYS = 1;
/**
* Object转Json
*/
public static String ObjectToJson(Object value) {
try {
if (value == null) {
return null;
}
ObjectMapper mapper = new ObjectMapper();
String js = mapper.writeValueAsString(value);
return js;
} catch (Exception ex) {
System.out.println("【异常信息】 >>> " + ex.toString());
return "Error";
}
}
/**
* Json转ObjectList
*
* @param json 需要转换的JSON字符串
* @param bean JavaBean,
* @return 拿到结果需要强转一次,因为你拿到的是Object, 例如这样调用和强转: List&lt;School&gt; lst
* =(List&lt;School&gt;)StringUtil.JsonToObjectList(value, School.class);
*/
public static Object JsonToList(String json, Class<?> bean) throws Exception {
ObjectMapper mapper = new ObjectMapper();
JavaType javaType = mapper.getTypeFactory().constructParametricType(List.class, bean);
return mapper.readValue(json, javaType);
}
/**
* Json转ObjectJavaBean
*
* @param json 需要转换的JSON字符串
* @param bean JavaBean,
* @return 拿到结果需要强转一次,因为你拿到的是Object, 例如这样调用和强转: School lst
* =(School)StringUtil.JsonToObjectList(value, School.class);
*/
public static Object JsonToBean(String json, Class<?> bean) throws Exception {
ObjectMapper mapper = new ObjectMapper();
JavaType javaType = mapper.getTypeFactory().uncheckedSimpleType(bean);
return mapper.readValue(json, javaType);
}
/**
* 将json格式的字符串解析成Map对象
*/
public static Map<String, Map<String, String>> JsonToMap(String json) {
try {
ObjectMapper mapper = new ObjectMapper();
Map<String, Map<String, String>> maps = mapper.readValue(json, Map.class);
return maps;
} catch (Exception e) {
System.out.println("【异常信息】 >>> " + e.toString());
return null;
}
}
public static Map<String, Map> JsonToMapContainMap(String json) {
try {
ObjectMapper mapper = new ObjectMapper();
Map<String, Map> maps = mapper.readValue(json, Map.class);
return maps;
} catch (Exception e) {
System.out.println("【异常信息】 >>> " + e.toString());
return null;
}
}
public static Map JsonToRealMap(String json) {
try {
ObjectMapper mapper = new ObjectMapper();
Map maps = mapper.readValue(json, Map.class);
return maps;
} catch (Exception e) {
System.out.println("【异常信息】 >>> " + e.toString());
return null;
}
}
/**
* 返回分页数据
*
* @param str
* @return
*/
public static Object returnPageData(PageResult<?> page, String resultKey) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("result", resultKey);
//实际的行数
map.put("total", page.getTotalCount());
//数据
map.put("data", page.getList());
return map;
}
//返回时分秒的时间字符串
public static String TimestampToStringAndSecond(Object timestamp) {
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
return (format.format(timestamp));
} catch (Exception e) {
System.out.println("【isGaokaoYearExpire 异常】:" + e);
return "";
}
}
//返回时分秒的时间字符串
public static String TimestampToStringAndSecond(Object timestamp, String geshi) {
DateFormat format = new SimpleDateFormat(geshi);
try {
return (format.format(timestamp));
} catch (Exception e) {
System.out.println("【isGaokaoYearExpire 异常】:" + e);
return "";
}
}
/**
* 返回当前日期yyyy-MM-dd
*
* @return
* @throws ParseException
*/
public static Date getCurDate() {
DateFormat df = DateFormat.getDateInstance();
try {
return df.parse(df.format(new Date()));
} catch (ParseException e) {
}
return null;
}
/**
* 格式化日期yyyy-MM-dd HH:mm:ss
*
* @param date
* @return
*/
public static String format(Date date) {
SimpleDateFormat format = new SimpleDateFormat(formatDate);
return format.format(date);
}
/**
* 格式化日期
*
* @param date
* @return
*/
public static String format1(Date date) {
SimpleDateFormat format = new SimpleDateFormat(formatDate1);
return format.format(date);
}
/**
* 格式化日期
*
* @param date
* @return
*/
public static String format2(Date date) {
SimpleDateFormat format = new SimpleDateFormat(formatDate2);
return format.format(date);
}
/**
* 格式化日期
*
* @param date
* @return
*/
public static String format3(Date date) {
SimpleDateFormat format = new SimpleDateFormat(formatDate3);
return format.format(date);
}
/**
* 字符串转换成日期
*
* @param str
* @return date
*/
public static Date StrToDate(String str) {
SimpleDateFormat format = new SimpleDateFormat(formatDate1);
Date date = null;
try {
date = format.parse(str);
} catch (ParseException e) {
e.printStackTrace();
}
return date;
}
/**
* 随机生成字母与数字组合
*
* @param length
* @return
*/
public static String getCharAndNumr(int length) {
String val = "";
Random random = new Random();
for (int i = 0; i < length; i++) {
// 输出字母还是数字
String charOrNum = random.nextInt(2) % 2 == 0 ? "char" : "num";
// 字符串
if ("char".equalsIgnoreCase(charOrNum)) {
// 取得大写字母还是小写字母
int choice = random.nextInt(2) % 2 == 0 ? 65 : 97;
val += (char) (choice + random.nextInt(26));
// 数字
} else if ("num".equalsIgnoreCase(charOrNum)) {
val += String.valueOf(random.nextInt(10));
}
}
return val;
}
/**
* 返回json数据
*
* @param str
* @return
*/
public static Map<String, Object> returnJson(String key, Object value) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("result", key);
if (value.equals("")) {
map.put("data", null);
} else {
map.put("data", value);
}
return map;
}
/**
* 返回json数据
*
* @param str
* @return
*/
public static Map<String, Object> toJson(String key, Object value) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("result", key);
if (value.equals("")) {
map.put("data", null);
} else {
if (value.getClass().equals(HashMap.class)) {
Map map1 = (Map) value;
if (map1.get("total") != null && StringUtils.isNotBlank(map1.get("total").toString())) {
map.put("total", map1.get("total"));
map1.remove("total");
}
}
map.put("data", value);
}
return map;
}
/**
* 上传图片文件
*
* @param fileUpload
* @param path
* @return
*/
public static String uploadFile(MultipartFile fileUpload, String path) {
//根据时间得文件名
Calendar calendar = Calendar.getInstance();
String fileName = String.valueOf(calendar.getTimeInMillis());
//保存文件
if (fileUpload == null) {
return "base/default.png";
}
if (!fileUpload.isEmpty()) {
try {
if (!fileUpload.getOriginalFilename().equals("")) {
File picFile = new File(path, fileName + ".png");
//不存在则创建
if (!picFile.exists()) {
picFile.mkdirs();
}
//保存
fileUpload.transferTo(picFile);
}
return "share/" + fileName + ".png";
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return "";
}
/**
* 生成微信分享页面
*
* @param title
* @param base64
* @return
*/
public static String getHtmlFile(String title, String pngName, String modelFile, String filePath) {
try {
if (pngName != null && !pngName.equals("")) {
//读取模板文件
FileInputStream fileinputstream = new FileInputStream(filePath + modelFile);
int lenght = fileinputstream.available();
byte bytes[] = new byte[lenght];
fileinputstream.read(bytes);
fileinputstream.close();
String templateContent = new String(bytes);
//替换掉模板中相应的地方
templateContent = templateContent.replaceAll("###title###", title);
templateContent = templateContent.replaceAll("###fileName###", pngName);
//根据时间得文件名
Calendar calendar = Calendar.getInstance();
String fileName = String.valueOf(calendar.getTimeInMillis());
fileName = fileName + ".html";
//建立文件输出流
FileOutputStream fileoutputstream = new FileOutputStream(filePath + fileName);
byte tag_bytes[] = templateContent.getBytes();
fileoutputstream.write(tag_bytes);
fileoutputstream.close();
return fileName;
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return "";
}
/**
* 随即区间整数
*
* @param min
* @param max
* @return
*/
public static int getRandom(int min, int max) {
int r = new Random().nextInt(max - min);
return r + min;
}
/**
* URL 解码
*
* @return String
* @author lifq
* @date 2015-3-17 下午04:09:51
*/
public static String getURLDecoderString(String str) {
String result = "";
if (null == str) {
return "";
}
try {
result = java.net.URLDecoder.decode(str, "GBK");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return result;
}
/**
* URL 转码
*
* @return String
* @author lifq
* @date 2015-3-17 下午04:10:28
*/
public static String getURLEncoderString(String str) {
String result = "";
if (null == str) {
return "";
}
try {
result = java.net.URLEncoder.encode(str, "GBK");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return result;
}
/**
* 正则表达式截取字符串
*
* @param str
* @param regex
* @return
*/
public static String regex(String str, String regex) {
Matcher matcher = Pattern.compile(regex).matcher(str);
if (matcher.find()) {
return matcher.group(0);
} else {
return "";
}
}
public static String regexToChinese(String str) {
String regex = "([\\u4e00-\\u9fa5]+)";
return regex(str, regex);
}
/**
* 验证当前系统是windows(本地,返回true),还是unix(服务器,返回false)
*
* @return
*/
public static boolean IsWinOrUnix() {
String os = System.getProperty("os.name");//获取当前操作系统
return os.toLowerCase().startsWith("win");
}
public static String EncoderByMd5(String str) throws NoSuchAlgorithmException, UnsupportedEncodingException {
byte[] bs = MessageDigest.getInstance("MD5").digest(str.getBytes());
StringBuilder sb = new StringBuilder(40);
for (byte x : bs) {
if ((x & 0xff) >> 4 == 0) {
sb.append("0").append(Integer.toHexString(x & 0xff));
} else {
sb.append(Integer.toHexString(x & 0xff));
}
}
return sb.toString();
}
}
@@ -30,6 +30,11 @@ public class RedisKey {
*/
public static final String USER_TOKEN = "userE:to_";
/**
* 管理用户缓存前缀
*/
public static final String SECURITY_USER = "seuserE:un_";
/**
* 设备用户关系缓存前缀,以设备ID和用户ID进行存储
*/
+1 -1
View File
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/IfishSystemEnglish"/>
<Context antiJARLocking="true" path=""/>
+17
View File
@@ -0,0 +1,17 @@
<%--
Document : index
Created on : 2017-7-21, 16:48:04
Author : Administrator
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
+4 -4
View File
@@ -21,7 +21,7 @@
<div class="page-form">
<div class="panel panel-blue">
<div class="panel-body pan">
<form action="#" class="form-horizontal">
<form action="/j-spring-security-check" class="form-horizontal" method="POST">
<div class="form-body pal">
<div class="col-md-12 text-center">
<h1 style="margin-top: -90px; font-size: 48px;">
@@ -46,7 +46,7 @@
<div class="col-md-9">
<div class="input-icon right">
<i class="fa fa-user"></i>
<input id="inputName" type="text" placeholder="" class="form-control" /></div>
<input id="username" type="text" placeholder="" class="form-control" /></div>
</div>
</div>
<div class="form-group">
@@ -55,7 +55,7 @@
<div class="col-md-9">
<div class="input-icon right">
<i class="fa fa-lock"></i>
<input id="inputPassword" type="password" placeholder="" class="form-control" /></div>
<input id="password" type="password" placeholder="" class="form-control" /></div>
</div>
</div>
<div class="form-group mbn">
@@ -78,7 +78,7 @@
</div>
<div class="col-lg-12 text-center">
<p>
<!-- 忘记密码?-->
<!-- 忘记密码?-->
</p>
</div>
</div>