Commit 661946b8 authored by zjy's avatar zjy

user/role

parent e45e826a
...@@ -6,10 +6,14 @@ import com.pangding.web.tright.dao.RoleDao; ...@@ -6,10 +6,14 @@ import com.pangding.web.tright.dao.RoleDao;
import com.pangding.web.tright.dto.RoleDto; import com.pangding.web.tright.dto.RoleDto;
import com.pangding.web.tright.service.RoleService; import com.pangding.web.tright.service.RoleService;
import com.pangding.web.tright.vo.RoleVo; import com.pangding.web.tright.vo.RoleVo;
import com.yanzuoguang.util.helper.CheckerHelper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@RestController @RestController
@RequestMapping("/roles") @RequestMapping("/roles")
public class RoleController { public class RoleController {
...@@ -25,9 +29,17 @@ public class RoleController { ...@@ -25,9 +29,17 @@ public class RoleController {
*/ */
@RequestMapping(value = "/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Object saveRole(@RequestBody RoleDto roleDto){ public Object saveRole(@RequestBody RoleDto roleDto){
roleServiceImpl.saveRole(roleDto); String id = roleDto.getId();
Result result = new Result(0,"SUCCESS",null); String name = roleDto.getName();
return result; if (roleServiceImpl.getRoleById(id) != null){
return new Result(4001, "该角色ID已存在", null);
}
if (roleServiceImpl.getRoleByName(name) != null){
return new Result(4001, "该角色名已存在", null);
}
roleServiceImpl.saveRole((RoleVo)roleDto);
roleServiceImpl.roleAndTright(roleDto);
return new Result(0,"SUCCESS",null);
} }
/** /**
...@@ -37,7 +49,12 @@ public class RoleController { ...@@ -37,7 +49,12 @@ public class RoleController {
*/ */
@RequestMapping(value = "/update", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/update", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Object updateRole(@RequestBody RoleDto roleDto){ public Object updateRole(@RequestBody RoleDto roleDto){
roleServiceImpl.saveRole(roleDto); RoleVo roleVo = roleDto;
if (!roleServiceImpl.checkNameExist(roleVo)){
return new Result(4001,"该角色名已存在",null);
}
roleServiceImpl.saveRole(roleVo);
roleServiceImpl.roleAndTright(roleDto);
Result result = new Result(0,"SUCCESS",null); Result result = new Result(0,"SUCCESS",null);
return result; return result;
} }
...@@ -48,8 +65,22 @@ public class RoleController { ...@@ -48,8 +65,22 @@ public class RoleController {
*/ */
@RequestMapping(value = "/list", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/list", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Object listRoles(){ public Object listRoles(){
List<RoleVo> roleVoList = roleServiceImpl.getRoleVoList();
Result result = new Result(0,"SUCCESS",null); List<RoleDto> roleDtoList = new ArrayList(roleVoList.size());
if (roleVoList == null || roleVoList.size() == 0){
return new Result(0,"暂无角色信息",null);
}
for (RoleVo roleVo:roleVoList) {
List<String> trightIdList = roleServiceImpl.getTrightIdList(roleVo.getId());
List<String> trightNameList = new ArrayList(trightIdList.size());
for (String trightId:trightIdList) {
String trightName = roleServiceImpl.getTrightNameByTrightId(trightId);
trightNameList.add(trightName);
}
RoleDto roleDto = roleServiceImpl.makeRoleDto(roleVo,trightIdList,trightNameList);
roleDtoList.add(roleDto);
}
Result result = new Result(0,"SUCCESS",roleDtoList);
return result; return result;
} }
...@@ -61,9 +92,16 @@ public class RoleController { ...@@ -61,9 +92,16 @@ public class RoleController {
* @return * @return
*/ */
@RequestMapping(value = "/role", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/role", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Object role(@PathVariable Long id){ public Object role(@PathVariable String roleId){
RoleVo roleVo = roleDao.getById(id); RoleVo roleVo = roleServiceImpl.getRoleById(roleId);
Result result = new Result(0,"SUCCESS",roleVo); List<String> trightIdList = roleServiceImpl.getTrightIdList(roleId);
List<String> trightNameList = new ArrayList(trightIdList.size());
for (String trightId:trightIdList) {
String trightName = roleServiceImpl.getTrightNameByTrightId(trightId);
trightNameList.add(trightName);
}
RoleDto roleDto = roleServiceImpl.makeRoleDto(roleVo,trightIdList,trightNameList);
Result result = new Result(0,"SUCCESS",roleDto);
return result; return result;
} }
...@@ -73,8 +111,10 @@ public class RoleController { ...@@ -73,8 +111,10 @@ public class RoleController {
* @return * @return
*/ */
@RequestMapping(value = "/delete", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/delete", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Object delete(@PathVariable Long id){ public Object delete(@PathVariable String roleId){
roleServiceImpl.deleteRole(id); roleServiceImpl.deleteRole(roleId);
roleServiceImpl.deleteRoleUser(roleServiceImpl.getRoleUserPKByRoleId(roleId));
roleServiceImpl.deleteRoleTright(roleServiceImpl.getRoleTrightPKByRoleId(roleId));
Result result = new Result(0,"SUCCESS",null); Result result = new Result(0,"SUCCESS",null);
return result; return result;
} }
......
...@@ -8,6 +8,7 @@ import com.pangding.web.tright.currency.Result; ...@@ -8,6 +8,7 @@ import com.pangding.web.tright.currency.Result;
import com.pangding.web.tright.dao.TrightDao; import com.pangding.web.tright.dao.TrightDao;
import com.pangding.web.tright.service.TrightService; import com.pangding.web.tright.service.TrightService;
import com.pangding.web.tright.vo.TrightVo; import com.pangding.web.tright.vo.TrightVo;
import org.bouncycastle.jcajce.provider.digest.MD5;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -30,6 +31,9 @@ public class TrightController { ...@@ -30,6 +31,9 @@ public class TrightController {
*/ */
@RequestMapping(value = "/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Object saveTright(@RequestBody TrightVo trightVo){ public Object saveTright(@RequestBody TrightVo trightVo){
if (!trightServiceImpl.checkValid(trightVo)){
return new Result(4001,"该权限不合法,请修改权限名或权限url",null);
}
trightServiceImpl.save(trightVo); trightServiceImpl.save(trightVo);
Result result = new Result(0,"SUCCESS",null); Result result = new Result(0,"SUCCESS",null);
return result; return result;
...@@ -42,6 +46,9 @@ public class TrightController { ...@@ -42,6 +46,9 @@ public class TrightController {
*/ */
@RequestMapping(value = "/update", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/update", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Object updateTright(@RequestBody TrightVo trightVo){ public Object updateTright(@RequestBody TrightVo trightVo){
if (!trightServiceImpl.checkValid(trightVo)){
return new Result(4001,"该权限不合法,请修改权限名或权限url",null);
}
trightServiceImpl.update(trightVo); trightServiceImpl.update(trightVo);
Result result = new Result(0,"SUCCESS",null); Result result = new Result(0,"SUCCESS",null);
return result; return result;
......
...@@ -16,7 +16,7 @@ import java.util.Date; ...@@ -16,7 +16,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
@RestController @RestController
@RequestMapping("/user") @RequestMapping(value = "/user")
public class UserController { public class UserController {
@Autowired @Autowired
...@@ -30,13 +30,22 @@ public class UserController { ...@@ -30,13 +30,22 @@ public class UserController {
*/ */
@RequestMapping(value = "/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Object saveUser(@RequestBody UserDto userDto){ public Object saveUser(@RequestBody UserDto userDto){
//userDto.setPassword();
//检查用户是否存在
UserVo u = userServiceImpl.getUser(userDto); UserVo u = userServiceImpl.getUser(userDto);
//存在,直接返回
if (u != null) { if (u != null) {
return new Result(4001,"该用户已存在",null); return new Result(4001,"该用户已存在",null);
//throw new IllegalArgumentException(userDto.getUserName() + "已存在"); //throw new IllegalArgumentException(userDto.getUserName() + "已存在");
} }
UserVo userVo = userServiceImpl.saveUser(userDto); //不存在,保存用户信息
Result result = new Result(0,"SUCCESS",userVo); userDao.create(userDto);
if (userDto.getRoleIds()!=null&&userDto.getRoleIds().size()!=0){
userServiceImpl.userAndRole(userDto);
}
Result result = new Result(0,"SUCCESS",null);
return result; return result;
} }
...@@ -46,21 +55,11 @@ public class UserController { ...@@ -46,21 +55,11 @@ public class UserController {
* @return * @return
*/ */
@RequestMapping(value = "/update", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/update", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Object updateUser(){//@RequestBody UserDto userDto public Object updateUser(@RequestBody UserDto userDto){
UserDto userDto = new UserDto(); UserVo u = userDto;
userDto.setTuId(11l); userDao.update(u);
List<Long> longs = new ArrayList<>(); userServiceImpl.userAndRole(userDto);
longs.add(1l); Result result = new Result(0,"SUCCESS",null);
longs.add(11l);
longs.add(111l);
userDto.setRoleIds(longs);
userDto.setUserName("test11234111");
userDto.setPassword("12345612");
userDto.setPhoneNumber("123456789110");
userDto.setCreateTime(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
userDto.setCount(0);
UserVo userVo = userServiceImpl.updateUser(userDto);
Result result = new Result(0,"SUCCESS",userVo);
return result; return result;
} }
...@@ -71,9 +70,22 @@ public class UserController { ...@@ -71,9 +70,22 @@ public class UserController {
@RequestMapping(value = "/list", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/list", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Object listUsers(){ public Object listUsers(){
List<UserVo> userVoList = userServiceImpl.listUserVo();
List<UserDto> userDtoList = new ArrayList(userVoList.size());
for (int var1 = 0;var1 < userVoList.size();++var1){
UserVo userVo = userVoList.get(var1);
List<String> roleIdList = userServiceImpl.listRoleIdList(userVo);
List<String> roleList = new ArrayList(roleIdList.size());
for (int var2 = 0;var2 < roleIdList.size();++var2){
String role = userServiceImpl.getRoleByRoleId(roleIdList.get(var2));
roleList.add(role);
}
UserDto userDto = userServiceImpl.makeUserDto(userVo,roleIdList,roleList);
userDtoList.add(userDto);
}
Result result = new Result(0,"SUCCESS",null); Result result = new Result(0,"SUCCESS",userDtoList);
return result; return result;
} }
...@@ -83,11 +95,20 @@ public class UserController { ...@@ -83,11 +95,20 @@ public class UserController {
* @return * @return
*/ */
@RequestMapping(value = "/user", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/user", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Object user(){//@PathVariable Long id public Object user(String userId){//@PathVariable Long id
UserVo vo = userDao.load(null,UserVo.class); UserVo userVo = userServiceImpl.getUserById(userId);
//UserVo userVo = userDao.getById(id); if(userVo == null){
Result result = new Result(0,"SUCCESS",vo); return new Result(4001,"该用户不存在",null);
}
List<String> roleIdList = userServiceImpl.listRoleIdList(userVo);
List<String> roleList = new ArrayList(roleIdList.size());
for (int var2 = 0;var2 < roleIdList.size();++var2){
String role = userServiceImpl.getRoleByRoleId(roleIdList.get(var2));
roleList.add(role);
}
UserDto userDto = userServiceImpl.makeUserDto(userVo,roleIdList,roleList);
Result result = new Result(0,"SUCCESS",userDto);
return result; return result;
} }
......
package com.pangding.web.tright.dao; package com.pangding.web.tright.dao;
import com.pangding.web.tright.dto.RoleDto;
import com.pangding.web.tright.vo.RoleTrightRelation;
import com.pangding.web.tright.vo.RoleVo; import com.pangding.web.tright.vo.RoleVo;
import com.yanzuoguang.dao.BaseDao;
import java.util.List; import java.util.List;
public interface RoleDao { public interface RoleDao extends BaseDao {
int save(RoleVo roleVo); RoleVo getRoleById(String id);
RoleVo getRole(String name); RoleVo getRoleByName(String name);
int update(RoleVo roleVo); int checkNameExist(RoleVo roleVo);
int deleteRole(Long id);
int deleteRoleUser(Long roleId); List<RoleVo> getRoleVoList();
RoleVo getById(Long id); List<String> getTrightIdList(String roleId);
int deleteRoleTright(Long roleId); String getTrightNameByTrightId(String trightId);
int saveRoleTright(Long roleId, List<Long> trights); int update(RoleVo roleVo);
} }
package com.pangding.web.tright.dao;
import com.yanzuoguang.dao.BaseDao;
public interface RoleTrightDao extends BaseDao {
String getPKByRoleId(String roleId);
}
package com.pangding.web.tright.dao; package com.pangding.web.tright.dao;
import com.pangding.web.tright.vo.TrightVo; import com.pangding.web.tright.vo.TrightVo;
import com.yanzuoguang.dao.BaseDao;
import java.util.List; import java.util.List;
public interface TrightDao { public interface TrightDao extends BaseDao {
int save(TrightVo trightVo); int checkValid(TrightVo trightVo);
int update(TrightVo trightVo);
int deleteRoleTright(Long id); int deleteRoleTright(Long id);
......
package com.pangding.web.tright.dao; package com.pangding.web.tright.dao;
import com.pangding.web.tright.dto.UserDto;
import com.pangding.web.tright.vo.UserRoleRelation; import com.pangding.web.tright.vo.UserRoleRelation;
import com.pangding.web.tright.vo.UserVo; import com.pangding.web.tright.vo.UserVo;
import com.yanzuoguang.dao.BaseDao; import com.yanzuoguang.dao.BaseDao;
...@@ -11,12 +12,16 @@ public interface UserDao extends BaseDao { ...@@ -11,12 +12,16 @@ public interface UserDao extends BaseDao {
// int saveUser(UserVo userVo); // int saveUser(UserVo userVo);
// //
UserVo getUser(UserVo userVo); UserVo getUser(UserVo userVo);
// //
// int update(UserVo userVo); // int update(UserVo userVo);
int deleteUserRole(UserRoleRelation userRoleRelation); List<UserVo> listUserVo();
List<String> getRoleIdList(UserVo userVo);
int saveUserRoles(List<UserRoleRelation> userRoleRelations); String getRoleByRoleId(String roleId);
// UserVo getById(Long id); UserVo getUserById(String userId);
} }
package com.pangding.web.tright.dao;
import com.yanzuoguang.dao.BaseDao;
public interface UserRoleDao extends BaseDao {
String getPKByRoleId(String roleId);
}
...@@ -9,48 +9,71 @@ import java.util.List; ...@@ -9,48 +9,71 @@ import java.util.List;
@Component @Component
public class RoleDaoImpl extends BaseDaoImpl implements RoleDao { public class RoleDaoImpl extends BaseDaoImpl implements RoleDao {
private static final String GET_ROLE_BY_ID = "GET_ROLE_BY_ID";
private static final String GET_ROLE_BY_NAME = "GET_ROLE_BY_NAME";
private static final String CHECK_NAME_EXIST = "CHECK_NAME_EXIST";
private static final String GET_ROLELIST = "GET_ROLEDTO_LIST";
private static final String GET_TRIGHTID_LIST = "GET_TRIGHTID_LIST";
private static final String GET_TRIGHTNAME_BY_TRIGHTID = "GET_TRIGHTNAME_BY_TRIGHTID";
@Override @Override
public int save(RoleVo roleVo) { protected void init() {
return 0; register(RoleVo.class);
Table.add(GET_ROLE_BY_ID,"select r.* from pd_role r where 1=1")
.add("id","and r.id = ?");
Table.add(GET_ROLE_BY_NAME,"select r.* from pd_role r where 1=1")
.add("name","and r.name = ?");
Table.add(CHECK_NAME_EXIST,"select count(r.id) from pd_role r where 1=1")
.add("name","and r.name = ?")
.add("id","and r.id <> ?");
Table.add(GET_ROLELIST,"select * from pd_role where 1=1");
Table.add(GET_TRIGHTID_LIST,"select authority_id from pd_role_authority where 1=1")
.add("roleId","and role_id = ?");
Table.add(GET_TRIGHTNAME_BY_TRIGHTID,"select name from pd_authority where 1=1")
.add("trightId","and id = ?");
} }
@Override @Override
public RoleVo getRole(String name) { public RoleVo getRoleById(String id) {
return null; return this.queryFirst(RoleVo.class,GET_ROLE_BY_ID,id);
} }
@Override @Override
public int update(RoleVo roleVo) { public RoleVo getRoleByName(String name) {
return 0; return this.queryFirst(RoleVo.class,GET_ROLE_BY_NAME,name);
} }
@Override @Override
public int deleteRole(Long id) { public int checkNameExist(RoleVo roleVo) {
return 0; return this.queryFirst(int.class,CHECK_NAME_EXIST,roleVo);
} }
@Override @Override
public int deleteRoleUser(Long roleId) { public List<RoleVo> getRoleVoList() {
return 0; return this.query(RoleVo.class,GET_ROLELIST,null);
} }
@Override @Override
public RoleVo getById(Long id) { public List<String> getTrightIdList(String roleId) {
return null; return this.query(String.class,GET_TRIGHTID_LIST,roleId);
} }
@Override @Override
public int deleteRoleTright(Long roleId) { public String getTrightNameByTrightId(String trightId) {
return 0; return this.queryFirst(String.class,GET_TRIGHTNAME_BY_TRIGHTID,trightId);
} }
@Override @Override
public int saveRoleTright(Long roleId, List<Long> trights) { public int update(RoleVo roleVo) {
return 0; return 0;
} }
@Override
protected void init() {
}
} }
package com.pangding.web.tright.dao.impl;
import com.pangding.web.tright.dao.RoleTrightDao;
import com.pangding.web.tright.vo.RoleTrightRelation;
import com.yanzuoguang.dao.Impl.BaseDaoImpl;
import org.springframework.stereotype.Component;
@Component
public class RoleTrightDaoImpl extends BaseDaoImpl implements RoleTrightDao {
private static final String GET_PK_BY_ROLEID = "GET_PK_BY_ROLEID";
@Override
protected void init() {
register(RoleTrightRelation.class);
Table.add(GET_PK_BY_ROLEID,"select id from pd_role_authority where 1=1")
.add("roleId","and role_id = ?");
}
@Override
public String getPKByRoleId(String roleId) {
return this.queryFirst(String.class,GET_PK_BY_ROLEID,roleId);
}
}
...@@ -8,14 +8,22 @@ import org.springframework.stereotype.Component; ...@@ -8,14 +8,22 @@ import org.springframework.stereotype.Component;
import java.util.List; import java.util.List;
@Component @Component
public class TrightDaoImpl extends BaseDaoImpl implements TrightDao { public class TrightDaoImpl extends BaseDaoImpl implements TrightDao {
private static final String CHECK_VALID = "CHECK_VALID";
@Override @Override
public int save(TrightVo trightVo) { protected void init() {
return 0; register(TrightVo.class);
Table.add(CHECK_VALID,"select count(a.id) from pd_authority a where 1=1")
.add("name","and a.name = ?")
.add("url","and a.url = ?")
.add("id","and a.id <> ?");
} }
@Override @Override
public int update(TrightVo trightVo) { public int checkValid(TrightVo trightVo) {
return 0; return this.queryFirst(int.class,CHECK_VALID,trightVo);
} }
@Override @Override
...@@ -48,8 +56,5 @@ public class TrightDaoImpl extends BaseDaoImpl implements TrightDao { ...@@ -48,8 +56,5 @@ public class TrightDaoImpl extends BaseDaoImpl implements TrightDao {
return null; return null;
} }
@Override
protected void init() {
}
} }
package com.pangding.web.tright.dao.impl; package com.pangding.web.tright.dao.impl;
import com.pangding.web.tright.dao.UserDao; import com.pangding.web.tright.dao.UserDao;
import com.pangding.web.tright.dto.UserDto;
import com.pangding.web.tright.vo.UserRoleRelation; import com.pangding.web.tright.vo.UserRoleRelation;
import com.pangding.web.tright.vo.UserVo; import com.pangding.web.tright.vo.UserVo;
import com.yanzuoguang.dao.DaoConst; import com.yanzuoguang.dao.DaoConst;
...@@ -12,53 +13,40 @@ import org.springframework.stereotype.Component; ...@@ -12,53 +13,40 @@ import org.springframework.stereotype.Component;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID;
@Component @Component
public class UserDaoImpl extends BaseDaoImpl implements UserDao { public class UserDaoImpl extends BaseDaoImpl implements UserDao {
final String GET_USER = "GET_USER";
final String DELETE_USER_ROLE="deleteUserRole"; private static final String GET_USER = "GET_USER";
final String SAVE_USER_ROLE = "saveUserRoles"; private static final String DELETE_USER_ROLE="deleteUserRole";
// @Override private static final String SAVE_USER_ROLE = "saveUserRoles";
// public int saveUser(UserVo userVo) { private static final String GET_ALL_USERS = "GET_ALL_USERS";
// private static final String GET_ROLE_IDS = "GET_ROLE_IDS";
// String s = this.saveWith(userVo.getClass(),"insert into ",null); private static final String GET_USER_BY_ID = "GET_USER_BY_ID";
// System.out.println(s); private static final String GET_ROLE_BY_ROLEID = "GET_ROLE_BY_ROLEID";
// return 0;
// }
//
//
// @Override
// public int update(UserVo userVo) {
// return 0;
// }
//
// @Override
// public int deleteUserRole(Long userId) {
// return 0;
// }
//
// @Override
// public int saveUserRoles(Long userId, List<Long> roleIds) {
// return 0;
// }
//
// @Override
// public UserVo getById(Long id) {
// return null;
// }
//
@Override @Override
protected void init() { protected void init() {
register(UserVo.class); register(UserVo.class);
Table.add(GET_USER, "SELECT p.* FROM pd_user p WHERE 1=1 ") Table.add(GET_USER, "SELECT id,account,phone,status,remark,create_time,creator FROM pd_user WHERE 1=1 ")
.add("username", " AND p.user_name = ?"); .add("account", " AND account = ?");
Table.add(DELETE_USER_ROLE,"delete from pd_user_role_relation where 1=1") Table.add(DELETE_USER_ROLE,"delete from pd_user_role_relation where 1=1")
.add("tu_id","and tu_id = ?"); .add("userId","and user_id = ?");
Table.add(GET_ALL_USERS,"select id,account,phone,status,remark,create_time,creator from pd_user where 1=1");
Table.add(GET_ROLE_IDS,"select role_id from pd_user_role where 1=1")
.add("userId","and user_id = ?");
Table.add(GET_USER_BY_ID,"select id,account,phone,status,remark,create_time,creator from pd_user where 1=1")
.add("userId","and user_id = ?");
Table.add(GET_ROLE_BY_ROLEID,"select name from pd_role where 1=1")
.add("roleId","and id = ?");
} }
...@@ -67,22 +55,26 @@ public class UserDaoImpl extends BaseDaoImpl implements UserDao { ...@@ -67,22 +55,26 @@ public class UserDaoImpl extends BaseDaoImpl implements UserDao {
return this.queryFirst(UserVo.class, GET_USER, userVo); return this.queryFirst(UserVo.class, GET_USER, userVo);
} }
@Override @Override
public int deleteUserRole(UserRoleRelation userRoleRelation) { public List<UserVo> listUserVo() {
userRoleRelation.setTru_id(1l);
if (userRoleRelation.getTu_id()!=null) { return this.query(UserVo.class,GET_ALL_USERS,null);
return this.updateSql(DELETE_USER_ROLE, userRoleRelation);
}else{
return 0;
} }
@Override
public List<String> getRoleIdList(UserVo userVo) {
return this.query(String.class,GET_ROLE_IDS,userVo);
} }
@Override @Override
public int saveUserRoles(List<UserRoleRelation> userRoleRelations) { public String getRoleByRoleId(String roleId) {
//this.create(userRoleRelations); return this.queryFirst(String.class,GET_ROLE_BY_ROLEID,roleId);
for (UserRoleRelation userRoleRelation : userRoleRelations) {
//this.save(userRoleRelation);
} }
return 0;
@Override
public UserVo getUserById(String userId) {
return this.queryFirst(UserVo.class,GET_USER_BY_ID,userId);
} }
} }
package com.pangding.web.tright.dao.impl;
import com.pangding.web.tright.dao.UserRoleDao;
import com.pangding.web.tright.vo.UserRoleRelation;
import com.yanzuoguang.dao.Impl.BaseDaoImpl;
import org.springframework.stereotype.Component;
@Component
public class UserRoleDaoImpl extends BaseDaoImpl implements UserRoleDao {
private static final String GET_PK_BY_ROLEID = "GET_PK_BY_ROLEID";
@Override
protected void init() {
register(UserRoleRelation.class);
Table.add(GET_PK_BY_ROLEID,"select id from pd_user_role where 1=1")
.add("roleId","and role_id = ?");
}
@Override
public String getPKByRoleId(String roleId) {
return this.queryFirst(String.class,GET_PK_BY_ROLEID,roleId);
}
}
...@@ -6,13 +6,24 @@ import java.util.List; ...@@ -6,13 +6,24 @@ import java.util.List;
public class RoleDto extends RoleVo { public class RoleDto extends RoleVo {
private List<Long> trightIds; private List<String> trightIds;
public List<Long> getTrightIds() {
private List<String> trightNames;
public List<String> getTrightIds() {
return trightIds; return trightIds;
} }
public void setTrightIds(List<Long> trightIds) { public void setTrightIds(List<String> trightIds) {
this.trightIds = trightIds; this.trightIds = trightIds;
} }
public List<String> getTrightNames() {
return trightNames;
}
public void setTrightNames(List<String> trightNames) {
this.trightNames = trightNames;
}
} }
...@@ -6,13 +6,23 @@ import java.util.List; ...@@ -6,13 +6,23 @@ import java.util.List;
public class UserDto extends UserVo { public class UserDto extends UserVo {
private List<Long> roleIds; private List<String> roleIds;
public List<Long> getRoleIds() { private List<String> roles;
public List<String> getRoleIds() {
return roleIds; return roleIds;
} }
public void setRoleIds(List<Long> roleIds) { public void setRoleIds(List<String> roleIds) {
this.roleIds = roleIds; this.roleIds = roleIds;
} }
public List<String> getRoles() {
return roles;
}
public void setRoles(List<String> roles) {
this.roles = roles;
}
} }
package com.pangding.web.tright.service; package com.pangding.web.tright.service;
import com.pangding.web.tright.dto.RoleDto; import com.pangding.web.tright.dto.RoleDto;
import com.pangding.web.tright.vo.RoleVo;
import java.util.List;
public interface RoleService { public interface RoleService {
void saveRole(RoleDto roleDto); void saveRole(RoleVo roleVo);
RoleVo getRoleById(String id);
RoleVo getRoleByName(String name);
void roleAndTright(RoleDto roleDto);
Boolean checkNameExist(RoleVo roleVo);
List<RoleVo> getRoleVoList();
List<String> getTrightIdList(String roleId);
String getTrightNameByTrightId(String trightId);
RoleDto makeRoleDto(RoleVo roleVo,List<String> trightIdList,List<String> trightNameList);
void deleteRole(String roleId);
void deleteRoleUser(String roleId);
void deleteRoleTright(String roleId);
String getRoleUserPKByRoleId(String roleId);
void deleteRole(Long id); String getRoleTrightPKByRoleId(String roleId);
} }
...@@ -8,4 +8,6 @@ public interface TrightService { ...@@ -8,4 +8,6 @@ public interface TrightService {
void update(TrightVo trightVo); void update(TrightVo trightVo);
void delete(Long id); void delete(Long id);
Boolean checkValid(TrightVo trightVo);
} }
...@@ -3,13 +3,24 @@ package com.pangding.web.tright.service; ...@@ -3,13 +3,24 @@ package com.pangding.web.tright.service;
import com.pangding.web.tright.dto.UserDto; import com.pangding.web.tright.dto.UserDto;
import com.pangding.web.tright.vo.UserVo; import com.pangding.web.tright.vo.UserVo;
public interface UserService { import java.lang.reflect.Array;
import java.util.List;
UserVo saveUser(UserDto userDto); public interface UserService {
UserVo updateUser(UserDto userDto); void userAndRole(UserDto userDto);
UserVo getUser(UserVo userVo); UserVo getUser(UserVo userVo);
String passwordEncoder(String credentials, String salt); String passwordEncoder(String credentials, String salt);
List<UserVo> listUserVo();
List<String> listRoleIdList(UserVo userVo);
String getRoleByRoleId(String roleId);
UserDto makeUserDto(UserVo userVo,List<String> roleIdList,List<String> roleList);
UserVo getUserById(String userId);
} }
package com.pangding.web.tright.service.impl; package com.pangding.web.tright.service.impl;
import com.pangding.web.tright.dao.RoleDao; import com.pangding.web.tright.dao.RoleDao;
import com.pangding.web.tright.dao.RoleTrightDao;
import com.pangding.web.tright.dao.UserRoleDao;
import com.pangding.web.tright.dto.RoleDto; import com.pangding.web.tright.dto.RoleDto;
import com.pangding.web.tright.service.RoleService; import com.pangding.web.tright.service.RoleService;
import com.pangding.web.tright.vo.RoleTrightRelation;
import com.pangding.web.tright.vo.RoleVo; import com.pangding.web.tright.vo.RoleVo;
import com.pangding.web.tright.vo.UserRoleRelation;
import com.yanzuoguang.util.helper.CheckerHelper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID;
@Service @Service
public class RoleServiceImpl implements RoleService { public class RoleServiceImpl implements RoleService {
@Autowired @Autowired
RoleDao roleDao; RoleDao roleDao;
@Autowired
UserRoleDao userRoleDaoImpl;
@Autowired
RoleTrightDao roleTrightDaoImpl;
@Override @Override
public void saveRole(RoleDto roleDto) { public void saveRole(RoleVo roleVo) {
RoleVo role = roleDto; roleDao.create(roleVo);
if (role.getTrId() != null) {// 修改
RoleVo r = roleDao.getRole(role.getRoleName());
if (r != null && r.getTrId() != role.getTrId()) {
throw new IllegalArgumentException(role.getRoleName() + "已存在");
} }
roleDao.update(role); @Override
} else {// 新增 public RoleVo getRoleById(String id) {
RoleVo r = roleDao.getRole(role.getRoleName()); return roleDao.getRoleById(id);
if (r != null) {
throw new IllegalArgumentException(role.getRoleName() + "已存在");
} }
roleDao.save(role);
@Override
public RoleVo getRoleByName(String name) {
return roleDao.getRoleByName(name);
}
@Override
public void roleAndTright(RoleDto roleDto) {
List<String> trightIds = roleDto.getTrightIds();
for (String trightId : trightIds) {
RoleTrightRelation roleTrightRelation = new RoleTrightRelation();
roleTrightRelation.setTrightId(trightId);
roleTrightRelation.setRoleId(roleDto.getId());
roleTrightRelation.setId(UUID.randomUUID().toString());
roleTrightDaoImpl.create(roleTrightRelation);
} }
saveRoleTright(role.getTrId(), roleDto.getTrightIds());
} }
private void saveRoleTright(Long roleId, List<Long> trights) { @Override
roleDao.deleteRoleTright(roleId); public Boolean checkNameExist(RoleVo roleVo) {
trights.remove(0L); if (roleDao.checkNameExist(roleVo) > 0){return false;}
if (!CollectionUtils.isEmpty(trights)) { return true;
roleDao.saveRoleTright(roleId, trights); }
@Override
public List<RoleVo> getRoleVoList() {
return roleDao.getRoleVoList();
} }
@Override
public List<String> getTrightIdList(String roleId) {
return roleDao.getTrightIdList(roleId);
}
@Override
public String getTrightNameByTrightId(String trightId) {
return roleDao.getTrightNameByTrightId(trightId);
}
@Override
public RoleDto makeRoleDto(RoleVo roleVo, List<String> trightIdList, List<String> trightNameList) {
RoleDto roleDto = (RoleDto) roleVo;
roleDto.setTrightIds(trightIdList);
roleDto.setTrightNames(trightNameList);
return roleDto;
}
@Override
public void deleteRole(String roleId) {
roleDao.remove(roleId);
}
@Override
public void deleteRoleUser(String id) {
if (id != null && id != "") {
userRoleDaoImpl.remove(id);
}
}
@Override
public void deleteRoleTright(String id) {
if (id != null && id != "") {
roleTrightDaoImpl.remove(id);
}
}
@Override
public String getRoleUserPKByRoleId(String roleId) {
return userRoleDaoImpl.getPKByRoleId(roleId);
} }
@Override @Override
public void deleteRole(Long id) { public String getRoleTrightPKByRoleId(String roleId) {
roleDao.deleteRoleUser(id); return roleTrightDaoImpl.getPKByRoleId(roleId);
roleDao.deleteRole(id);
} }
} }
...@@ -13,7 +13,7 @@ public class TrightServiceImpl implements TrightService { ...@@ -13,7 +13,7 @@ public class TrightServiceImpl implements TrightService {
TrightDao trightDao; TrightDao trightDao;
@Override @Override
public void save(TrightVo trightVo) { public void save(TrightVo trightVo) {
trightDao.save(trightVo); trightDao.create(trightVo);
} }
@Override @Override
...@@ -21,6 +21,13 @@ public class TrightServiceImpl implements TrightService { ...@@ -21,6 +21,13 @@ public class TrightServiceImpl implements TrightService {
trightDao.update(trightVo); trightDao.update(trightVo);
} }
@Override
public Boolean checkValid(TrightVo trightVo) {
int checkResult = trightDao.checkValid(trightVo);
if(checkResult == 0){return true;}
else{return false;}
}
@Override @Override
public void delete(Long id) { public void delete(Long id) {
trightDao.deleteRoleTright(id); trightDao.deleteRoleTright(id);
......
...@@ -11,6 +11,7 @@ import org.springframework.util.CollectionUtils; ...@@ -11,6 +11,7 @@ import org.springframework.util.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID;
@Service @Service
public class UserServiceImpl implements UserService { public class UserServiceImpl implements UserService {
...@@ -19,27 +20,27 @@ public class UserServiceImpl implements UserService { ...@@ -19,27 +20,27 @@ public class UserServiceImpl implements UserService {
UserDao userDao; UserDao userDao;
@Override @Override
public UserVo saveUser(UserDto userDto) { public List<UserVo> listUserVo() {
UserVo userVo = userDto; // return userDao.listUser();
userDao.create(userVo); return userDao.listUserVo();
userAndRole(userDto);
return userVo;
} }
private void saveUserRoles(List<UserRoleRelation> userRoleRelations) { @Override
userDao.deleteUserRole(userRoleRelations.get(0)); public void userAndRole(UserDto userDto) {
if (!CollectionUtils.isEmpty(userRoleRelations)) {
userDao.saveUserRoles(userRoleRelations); List<String> roleIds = userDto.getRoleIds();//多个角色
}
for (String roleId : roleIds) {
UserRoleRelation userRoleRelation = new UserRoleRelation();
userRoleRelation.setRoleId(roleId);
userRoleRelation.setUserId(userDto.getId());
userRoleRelation.setId(UUID.randomUUID().toString());
userDao.create(userRoleRelation);
} }
@Override
public UserVo updateUser(UserDto userDto) {
userDao.update(userDto);
userAndRole(userDto);
return userDto;
} }
@Override @Override
public UserVo getUser(UserVo userVo) { public UserVo getUser(UserVo userVo) {
return userDao.getUser(userVo); return userDao.getUser(userVo);
...@@ -50,19 +51,26 @@ public class UserServiceImpl implements UserService { ...@@ -50,19 +51,26 @@ public class UserServiceImpl implements UserService {
return null; return null;
} }
private void userAndRole(UserDto userDto){ @Override
if (userDto.getRoleIds()!=null&&userDto.getRoleIds().size()!=0) { public List<String> listRoleIdList(UserVo userVo) {
List<Long> longs = userDto.getRoleIds();//多个角色 return userDao.getRoleIdList(userVo);
List<UserRoleRelation> userRoleRelations = new ArrayList<>();
//查询当前用户的ID
//UserVo userVo = userDao.getUser(userDto);
for (Long l : longs) {
UserRoleRelation userRoleRelation = new UserRoleRelation();
userRoleRelation.setTr_id(l);
userRoleRelation.setTu_id(userDto.getTuId());
userRoleRelations.add(userRoleRelation);
} }
saveUserRoles(userRoleRelations);
@Override
public UserDto makeUserDto(UserVo userVo, List<String> roleIdList, List<String> roleList) {
UserDto userDto = (UserDto) userVo;
userDto.setRoleIds(roleIdList);
userDto.setRoles(roleList);
return userDto;
} }
@Override
public String getRoleByRoleId(String roleId) {
return userDao.getRoleByRoleId(roleId);
}
@Override
public UserVo getUserById(String userId) {
return userDao.getUserById(userId);
} }
} }
package com.pangding.web.tright.vo;
import com.yanzuoguang.dao.TableAnnotation;
import java.io.Serializable;
@TableAnnotation("pd_role_authority")
public class RoleTrightRelation implements Serializable {
/*主键id*/
private String id;
@TableAnnotation("role_id")
/*角色id*/
private String roleId;
/*权限id*/
@TableAnnotation("authority_id")
private String trightId;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getRoleId() {
return roleId;
}
public void setRoleId(String roleId) {
this.roleId = roleId;
}
public String getTrightId() {
return trightId;
}
public void setTrightId(String trightId) {
this.trightId = trightId;
}
}
...@@ -7,49 +7,45 @@ import java.util.Date; ...@@ -7,49 +7,45 @@ import java.util.Date;
@TableAnnotation("pd_role") @TableAnnotation("pd_role")
public class RoleVo implements Serializable { public class RoleVo implements Serializable {
private Long trId;//主键ID
private Long parentTrId;//角色父ID
private String roleName;//角色名
private Date createTime;//创建时间
private String describe;//描述
public Long getTrId() { private String id;//主键id
return trId;
}
public void setTrId(Long trId) { private String pid;//父角色id
this.trId = trId;
} private String name;//角色名
public Long getParentTrId() { private String remark;//描述
return parentTrId;
public String getId() {
return id;
} }
public void setParentTrId(Long parentTrId) { public void setId(String id) {
this.parentTrId = parentTrId; this.id = id;
} }
public String getRoleName() { public String getPid() {
return roleName; return pid;
} }
public void setRoleName(String roleName) { public void setPid(String pid) {
this.roleName = roleName; this.pid = pid;
} }
public Date getCreateTime() { public String getName() {
return createTime; return name;
} }
public void setCreateTime(Date createTime) { public void setName(String name) {
this.createTime = createTime; this.name = name;
} }
public String getDescribe() { public String getRemark() {
return describe; return remark;
} }
public void setDescribe(String describe) { public void setRemark(String remark) {
this.describe = describe; this.remark = remark;
} }
} }
package com.pangding.web.tright.vo; package com.pangding.web.tright.vo;
import com.yanzuoguang.dao.TableAnnotation; import com.yanzuoguang.dao.TableAnnotation;
import com.yanzuoguang.util.helper.DateHelper;
import com.yanzuoguang.util.helper.StringHelper;
import com.yanzuoguang.util.vo.InitDao;
import java.io.Serializable; import java.io.Serializable;
import java.sql.Timestamp;
/** /**
* 权限表 * 权限表
*/ */
@TableAnnotation("pd_tright") @TableAnnotation("pd_authority")
public class TrightVo implements Serializable { public class TrightVo implements Serializable, InitDao {
private Long trId;//权限ID //主键id
private Long sysId;//系统ID private String id;
private Long moduleId;//上级模块ID //父权限id
private String moduleName;//模块名 private String pid;
private Integer menuOrFunc;//菜单/功能(1:菜单,2:功能) //权限名
private String alias;//权限别名 private String name;
private String requestURL;//请求URL //权限类型
private String requestJur;//请求权限(多个用,分割) private String type;
private Integer openWith;//打开方式(1:blankHTML,2:innerHTML,3:dialog) //别名
private String dialogTitle;//对话框标题 private String alias;
private Integer dialogWidth;//对话框宽度 //权限url
private Integer dialogHeight;//对话框高度 private String url;
private String operatOrField;//操作字段(表字段...) @TableAnnotation("open_mode")
//打开方式
private String openMode;
//描述
private String remark;
@TableAnnotation("create_time")
//创建时间
private Timestamp createTime;
public Long getTrId() { public String getId() {
return trId; return id;
} }
public void setTrId(Long trId) { public void setId(String id) {
this.trId = trId; this.id = id;
} }
public Long getSysId() { public String getPid() {
return sysId; return pid;
} }
public void setSysId(Long sysId) { public void setPid(String pid) {
this.sysId = sysId; this.pid = pid;
} }
public Long getModuleId() { public String getName() {
return moduleId; return name;
} }
public void setModuleId(Long moduleId) { public void setName(String name) {
this.moduleId = moduleId; this.name = name;
} }
public String getModuleName() { public String getType() {
return moduleName; return type;
} }
public void setModuleName(String moduleName) { public void setType(String type) {
this.moduleName = moduleName; this.type = type;
}
public Integer getMenuOrFunc() {
return menuOrFunc;
}
public void setMenuOrFunc(Integer menuOrFunc) {
this.menuOrFunc = menuOrFunc;
} }
public String getAlias() { public String getAlias() {
...@@ -71,59 +74,41 @@ public class TrightVo implements Serializable { ...@@ -71,59 +74,41 @@ public class TrightVo implements Serializable {
this.alias = alias; this.alias = alias;
} }
public String getRequestURL() { public String getUrl() {
return requestURL; return url;
}
public void setRequestURL(String requestURL) {
this.requestURL = requestURL;
}
public String getRequestJur() {
return requestJur;
}
public void setRequestJur(String requestJur) {
this.requestJur = requestJur;
}
public Integer getOpenWith() {
return openWith;
}
public void setOpenWith(Integer openWith) {
this.openWith = openWith;
} }
public String getDialogTitle() { public void setUrl(String url) {
return dialogTitle; this.url = url;
} }
public void setDialogTitle(String dialogTitle) { public String getOpenMode() {
this.dialogTitle = dialogTitle; return openMode;
} }
public Integer getDialogWidth() { public void setOpenMode(String openMode) {
return dialogWidth; this.openMode = openMode;
} }
public void setDialogWidth(Integer dialogWidth) { public String getRemark() {
this.dialogWidth = dialogWidth; return remark;
} }
public Integer getDialogHeight() { public void setRemark(String remark) {
return dialogHeight; this.remark = remark;
} }
public void setDialogHeight(Integer dialogHeight) { public Timestamp getCreateTime() {
this.dialogHeight = dialogHeight; return createTime;
} }
public String getOperatOrField() { public void setCreateTime(Timestamp createTime) {
return operatOrField; this.createTime = createTime;
} }
public void setOperatOrField(String operatOrField) { @Override
this.operatOrField = operatOrField; public void init() {
String createTimeString = StringHelper.getFirst(DateHelper.getDateTimeString(this.createTime), DateHelper.getNow());
this.createTime = Timestamp.valueOf(createTimeString);
} }
} }
...@@ -2,36 +2,40 @@ package com.pangding.web.tright.vo; ...@@ -2,36 +2,40 @@ package com.pangding.web.tright.vo;
import com.yanzuoguang.dao.TableAnnotation; import com.yanzuoguang.dao.TableAnnotation;
@TableAnnotation("pd_user_role_relation") import java.io.Serializable;
public class UserRoleRelation {
@TableAnnotation("tru_id") @TableAnnotation("pd_user_role")
private Long tru_id; public class UserRoleRelation implements Serializable {
@TableAnnotation("tr_id")
private Long tr_id; private String id;
@TableAnnotation("tu_id") @TableAnnotation("user_id")
private Long tu_id; /*用户id*/
private String userId;
public Long getTru_id() { @TableAnnotation("role_id")
return tru_id; /*角色id*/
private String roleId;
public String getId() {
return id;
} }
public void setTru_id(Long tru_id) { public void setId(String id) {
this.tru_id = tru_id; this.id = id;
} }
public Long getTr_id() { public String getUserId() {
return tr_id; return userId;
} }
public void setTr_id(Long tr_id) { public void setUserId(String userId) {
this.tr_id = tr_id; this.userId = userId;
} }
public Long getTu_id() { public String getRoleId() {
return tu_id; return roleId;
} }
public void setTu_id(Long tu_id) { public void setRoleId(String roleId) {
this.tu_id = tu_id; this.roleId = roleId;
} }
} }
...@@ -6,40 +6,44 @@ import com.yanzuoguang.util.helper.StringHelper; ...@@ -6,40 +6,44 @@ import com.yanzuoguang.util.helper.StringHelper;
import com.yanzuoguang.util.vo.InitDao; import com.yanzuoguang.util.vo.InitDao;
import java.io.Serializable; import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date; import java.util.Date;
@TableAnnotation("pd_user") @TableAnnotation("pd_user")
public class UserVo implements Serializable, InitDao { public class UserVo implements Serializable, InitDao {
@TableAnnotation("tu_id") /*主键id*/
private Long tuId;//主键ID private String id;
@TableAnnotation("user_name") /*账号*/
private String userName;//用户名 private String account;
private String password;//密码 /*密码*/
@TableAnnotation("phone_number") private String password;
private String phoneNumber;//手机号 /*手机号*/
private String phone;
/*状态*/
private String status;
/*描述*/
private String remark;
@TableAnnotation("create_time") @TableAnnotation("create_time")
private String createTime;//创建时间 /*创建时间*/
@TableAnnotation("login_time") private Timestamp createTime;
private String loginTime;//登录时间 /*创建人*/
@TableAnnotation("last_login_time") private String creator;
private String lastLoginTime;//上次登录时间
private Integer count;//登录次数
public Long getTuId() { public String getId() {
return tuId; return id;
} }
public void setTuId(Long tuId) { public void setId(String id) {
this.tuId = tuId; this.id = id;
} }
public String getUserName() { public String getAccount() {
return userName; return account;
} }
public void setUserName(String userName) { public void setAccount(String account) {
this.userName = userName; this.account = account;
} }
public String getPassword() { public String getPassword() {
...@@ -50,50 +54,49 @@ public class UserVo implements Serializable, InitDao { ...@@ -50,50 +54,49 @@ public class UserVo implements Serializable, InitDao {
this.password = password; this.password = password;
} }
public String getPhoneNumber() { public String getPhone() {
return phoneNumber; return phone;
} }
public void setPhoneNumber(String phoneNumber) { public void setPhone(String phone) {
this.phoneNumber = phoneNumber; this.phone = phone;
} }
public String getCreateTime() { public String getStatus() {
return createTime; return status;
} }
public void setCreateTime(String createTime) { public void setStatus(String status) {
this.createTime = createTime; this.status = status;
} }
public String getLoginTime() { public String getRemark() {
return loginTime; return remark;
} }
public void setLoginTime(String loginTime) { public void setRemark(String remark) {
this.loginTime = loginTime; this.remark = remark;
} }
public String getLastLoginTime() { public Timestamp getCreateTime() {
return lastLoginTime; return createTime;
} }
public void setLastLoginTime(String lastLoginTime) { public void setCreateTime(Timestamp createTime) {
this.lastLoginTime = lastLoginTime; this.createTime = createTime;
} }
public Integer getCount() { public String getCreator() {
return count; return creator;
} }
public void setCount(Integer count) { public void setCreator(String creator) {
this.count = count; this.creator = creator;
} }
@Override @Override
public void init() { public void init() {
this.createTime = StringHelper.getFirst(this.createTime, DateHelper.getNow()); String createTimeString = StringHelper.getFirst(DateHelper.getDateTimeString(this.createTime), DateHelper.getNow());
this.loginTime = StringHelper.getFirst(this.loginTime, DateHelper.getNow()); this.createTime = Timestamp.valueOf(createTimeString);
this.lastLoginTime = StringHelper.getFirst(this.lastLoginTime, DateHelper.getNow());
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment