Commit 3bcb3cab01f926f45f1bc55601e23ef74c70943b

Authored by fangcheng
1 parent 4ce5f4e489
Exists in master

修改日志级别、用户登录相关接口

Showing 8 changed files with 91 additions and 2 deletions

parent/base.common/src/main/java/com/lyms/base/common/dao/user/UsersMapper.java View file @ 3bcb3ca
1 1 package com.lyms.base.common.dao.user;
2 2  
3 3 import java.io.Serializable;
  4 +import java.util.List;
4 5  
5 6 import org.springframework.stereotype.Repository;
6 7  
... ... @@ -19,6 +20,8 @@
19 20 public interface UsersMapper extends BaseMapper<Users> {
20 21  
21 22 public Integer deleteLogicById(Serializable id);
  23 +
  24 + public List<Users> getUsersByOrgId(Serializable orgid);
22 25  
23 26 }
parent/base.common/src/main/java/com/lyms/base/common/dao/user/UsersMapper.xml View file @ 3bcb3ca
... ... @@ -34,5 +34,13 @@
34 34 <sql id="Base_Column_List">
35 35 ID AS id, TYPE AS type, ORG_ID AS orgId, DEPT_ID AS deptId, NAME AS name, ACCOUNT AS account, PWD AS pwd, PHONE AS phone, IFDEL AS ifdel, ENABLE AS enable, REMARKS AS remarks, LAST_LOGIN_TIME AS lastLoginTime, FOREIGN_ID AS foreignId, OTHER_ACCOUNT AS otherAccount, EMPLOYEE_ID AS employeeId, EXPIR_TIME AS expirTime, LEVEL AS level, AVATAR AS avatar, WORK_TIME AS workTime, GOOD_AT AS goodAt,CREATE_ID AS createId, CREATE_TIME AS createTime, MODIFY_ID AS modifyId, MODIFY_TIME AS modifyTime
36 36 </sql>
  37 +
  38 +
  39 + <!-- 根据orgId获取机构用户列表-->
  40 + <select id="getUsersByOrgId" resultMap="BaseResultMap">
  41 + select
  42 + <include refid="Base_Column_List"></include>
  43 + from SYS_USERS t where t.ORG_ID = #{orgid}
  44 + </select>
37 45 </mapper>
parent/base.common/src/main/java/com/lyms/base/common/service/user/UsersService.java View file @ 3bcb3ca
... ... @@ -94,6 +94,17 @@
94 94 * <li>修改时间:
95 95 */
96 96 public List<String> getRoleIdListByUserid(String uid);
  97 +
  98 + /**
  99 + * <li>@Description:根据OrgId获取用户
  100 + * <li>@param orgid
  101 + * <li>@return
  102 + * <li>创建人:方承
  103 + * <li>创建时间:2017年4月17日
  104 + * <li>修改人:
  105 + * <li>修改时间:
  106 + */
  107 + public List<Users> getUsersByOrgId(Serializable orgid);
97 108  
98 109 }
parent/base.common/src/main/java/com/lyms/base/common/service/user/impl/UsersServiceImpl.java View file @ 3bcb3ca
... ... @@ -192,5 +192,10 @@
192 192 return roleIdList;
193 193 }
194 194  
  195 + @Override
  196 + public List<Users> getUsersByOrgId(Serializable orgid) {
  197 + return baseMapper.getUsersByOrgId(orgid);
  198 + }
  199 +
195 200 }
parent/hospital.web/src/main/java/com/lyms/hospital/controller/LoginController.java View file @ 3bcb3ca
... ... @@ -25,6 +25,7 @@
25 25 import com.lyms.base.common.service.role.RolesService;
26 26 import com.lyms.base.common.service.user.UsersService;
27 27 import com.lyms.hospital.service.token.TokenService;
  28 +import com.lyms.util.DateTimeUtils;
28 29 import com.lyms.util.InstanceUtils;
29 30 import com.lyms.util.MD5Utils;
30 31 import com.lyms.web.bean.AjaxResult;
31 32  
... ... @@ -129,10 +130,13 @@
129 130 List<Permissions> permissions = permissionsService.getUserPermission(users.getId());
130 131 Organizations org = organizationsService.selectById(users.getOrgId());
131 132 result.put("token", token);
  133 + users.setLastLoginTime(DateTimeUtils.getNow());
132 134 result.put("user",users);
133 135 result.put("roles",roles);
134 136 result.put("organization",org);
135   - result.put("organizations",org);
  137 + List<Organizations> orgs = InstanceUtils.newArrayList();
  138 + orgs.add(org);
  139 + result.put("organizations",orgs);
136 140 result.put("permissions", permissions);
137 141 result.put("watermark", "water");
138 142 ajaxResult.setData(result);
parent/hospital.web/src/main/java/com/lyms/hospital/controller/SysConfController.java View file @ 3bcb3ca
  1 +package com.lyms.hospital.controller;
  2 +
  3 +import org.springframework.web.bind.annotation.RequestMapping;
  4 +import org.springframework.web.bind.annotation.ResponseBody;
  5 +import org.springframework.web.bind.annotation.RestController;
  6 +
  7 +import com.lyms.util.DateTimeUtils;
  8 +import com.lyms.web.controller.BaseController;
  9 +
  10 +import io.swagger.annotations.Api;
  11 +import io.swagger.annotations.ApiOperation;
  12 +
  13 +@RestController
  14 +@Api(value = "/api", description = "登录的相关操作")
  15 +public class SysConfController extends BaseController {
  16 +
  17 + @ApiOperation(value = "系统时间", notes = "系统时间")
  18 + @RequestMapping(value = "/cTime")
  19 + @ResponseBody
  20 + public String testLogin() {
  21 + return String.valueOf(DateTimeUtils.getNow().getTime());
  22 + }
  23 +
  24 +}
parent/hospital.web/src/main/java/com/lyms/hospital/controller/user/UserController.java View file @ 3bcb3ca
  1 +package com.lyms.hospital.controller.user;
  2 +
  3 +import org.springframework.beans.factory.annotation.Autowired;
  4 +import org.springframework.web.bind.annotation.RequestMapping;
  5 +import org.springframework.web.bind.annotation.RequestParam;
  6 +import org.springframework.web.bind.annotation.ResponseBody;
  7 +import org.springframework.web.bind.annotation.RestController;
  8 +
  9 +import com.lyms.base.common.service.user.UsersService;
  10 +import com.lyms.web.bean.AjaxResult;
  11 +import com.lyms.web.controller.BaseController;
  12 +
  13 +import io.swagger.annotations.Api;
  14 +import io.swagger.annotations.ApiImplicitParam;
  15 +import io.swagger.annotations.ApiImplicitParams;
  16 +import io.swagger.annotations.ApiOperation;
  17 +
  18 +@RestController
  19 +@RequestMapping(value = "/user")
  20 +@Api(value = "/api", description = "用户相关操作")
  21 +public class UserController extends BaseController {
  22 +
  23 + @Autowired
  24 + private UsersService usersService;
  25 +
  26 + @ApiOperation(value = "测试登录", notes = "测试登录说明")
  27 + @ApiImplicitParams(@ApiImplicitParam(name = "hospitalId", value = "机构ID", required = true, dataType = "String"))
  28 + @RequestMapping(value = "/getUsersByOrgId")
  29 + @ResponseBody
  30 + public AjaxResult testLogin(@RequestParam(value = "hospitalId") String hospitalId,AjaxResult ajaxResult) {
  31 + ajaxResult.setSuccess(true).setStatus("200").setData(usersService.getUsersByOrgId(hospitalId));
  32 + return ajaxResult;
  33 + }
  34 +}
parent/hospital.web/src/main/resources/logback.xml View file @ 3bcb3ca
... ... @@ -19,7 +19,7 @@
19 19 </appender>
20 20  
21 21 <!-- project default level -->
22   - <logger name="com.lyms" level="INFO"/>
  22 + <logger name="com.lyms" level="DEBUG"/>
23 23  
24 24 <!-- root -->
25 25 <root level="INFO">