parent
b435e6390c
commit
beba4cc024
8 changed files with 231 additions and 3 deletions
@ -0,0 +1,56 @@ |
||||
package com.yipin.liuwanr.controller; |
||||
|
||||
import com.yipin.liuwanr.service.OrganizationRelationshipService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.util.StringUtils; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.HashMap; |
||||
|
||||
@RestController |
||||
@RequestMapping("user") |
||||
public class OrganizationRelationshipController { |
||||
|
||||
@Autowired |
||||
private OrganizationRelationshipService organizationRelationshipService; |
||||
|
||||
@GetMapping("/list") |
||||
Response updateState(@RequestParam Integer userId) { |
||||
Response resp = new Response(); |
||||
if(StringUtils.isEmpty(userId)){ |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("用户信息不完整"); |
||||
}else{ |
||||
HashMap<String, Object> ret = organizationRelationshipService.getByuserId(userId); |
||||
int status = (int) ret.get("retcode"); |
||||
if (200 == status) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
} |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
@DeleteMapping("/delete") |
||||
Response delorganizationRelationship(@RequestParam Integer organizationRelationshipId) { |
||||
Response resp = new Response(); |
||||
if(StringUtils.isEmpty(organizationRelationshipId)){ |
||||
resp.setStatus(300); |
||||
resp.setErrmessage("组织关系信息为空"); |
||||
}else{ |
||||
HashMap<String, Object> ret = organizationRelationshipService.deleteByorganizationRelationshipId(organizationRelationshipId); |
||||
int status = (int) ret.get("retcode"); |
||||
if (200 == status) { |
||||
resp.setStatus(status); |
||||
resp.setMessage(ret.get("retvalue")); |
||||
} else { |
||||
resp.setStatus(status); |
||||
resp.setErrmessage(ret.get("retvalue").toString()); |
||||
} |
||||
} |
||||
return resp; |
||||
} |
||||
} |
@ -0,0 +1,86 @@ |
||||
package com.yipin.liuwanr.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
/** |
||||
* 组织关系 |
||||
*/ |
||||
@Accessors(chain = true) |
||||
@Data |
||||
@TableName("hr_organization_relationship") |
||||
public class OrganizationRelationship { |
||||
|
||||
/** |
||||
* 组织关系Id |
||||
*/ |
||||
@TableId |
||||
private Integer organizationrelationshipid; |
||||
/** |
||||
* 绑定用戶Id |
||||
*/ |
||||
private Integer userid; |
||||
/** |
||||
* 绑定平台Id |
||||
*/ |
||||
private Integer platformid; |
||||
/** |
||||
* 绑定学校Id |
||||
*/ |
||||
private Integer schoolid; |
||||
/** |
||||
* 绑定学校名称 |
||||
*/ |
||||
private String schoolname; |
||||
/** |
||||
* 绑定角色Id |
||||
*/ |
||||
private Integer roleid; |
||||
/** |
||||
* 工号学号 |
||||
*/ |
||||
private String worknumber; |
||||
/** |
||||
* 一级部门Id |
||||
*/ |
||||
private Integer onedepartmentid; |
||||
/** |
||||
* 一级部门名称 |
||||
*/ |
||||
private String onedepartmentname; |
||||
/** |
||||
* 二级部门Id |
||||
*/ |
||||
private Integer twodepartmentid; |
||||
/** |
||||
* 二级部门名称 |
||||
*/ |
||||
private String twodepartmentname; |
||||
/** |
||||
* 专业id |
||||
*/ |
||||
private Integer professionalid; |
||||
/** |
||||
* 专业名称 |
||||
*/ |
||||
private String professionalname; |
||||
/** |
||||
* 年级Id |
||||
*/ |
||||
private Integer gradeid; |
||||
/** |
||||
* 年级名称 |
||||
*/ |
||||
private String gradename; |
||||
/** |
||||
* 班级Id |
||||
*/ |
||||
private Integer classid; |
||||
/** |
||||
* 班级名称 |
||||
*/ |
||||
private String classname; |
||||
|
||||
} |
@ -0,0 +1,23 @@ |
||||
package com.yipin.liuwanr.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.yipin.liuwanr.entity.OrganizationRelationship; |
||||
import org.apache.ibatis.annotations.Delete; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Select; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Mapper |
||||
public interface OrganizationRelationshipMapper { |
||||
|
||||
@Select("select organizationRelationshipId,schoolName,professionalName,gradeName,className,workNumber,roleId " + |
||||
"from hr_organization_relationship where userId=#{userId} ") |
||||
List<OrganizationRelationship> getByuserId(Integer userId); |
||||
|
||||
|
||||
@Delete("delete from hr_organization_relationship where organizationRelationshipId =#{organizationRelationshipId}") |
||||
boolean deleteByorganizationRelationshipId(Integer organizationRelationshipId); |
||||
|
||||
|
||||
} |
@ -0,0 +1,52 @@ |
||||
package com.yipin.liuwanr.service; |
||||
|
||||
import com.yipin.liuwanr.entity.OrganizationRelationship; |
||||
import com.yipin.liuwanr.entity.Student; |
||||
import com.yipin.liuwanr.mapper.OrganizationRelationshipMapper; |
||||
import org.jboss.logging.Logger; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
|
||||
@Service("organizationRelationshipService") |
||||
public class OrganizationRelationshipService { |
||||
|
||||
@Autowired |
||||
private OrganizationRelationshipMapper organizationRelationshipMapper; |
||||
|
||||
private static Logger logger = Logger.getLogger(OrganizationRelationshipService.class); |
||||
|
||||
|
||||
public HashMap<String, Object> getByuserId(Integer userId) { |
||||
HashMap<String, Object> resp = new HashMap<String, Object>(); |
||||
try { |
||||
List<OrganizationRelationship> relationships = organizationRelationshipMapper.getByuserId(userId); |
||||
resp.put("retcode", 200); |
||||
resp.put("retvalue", relationships); |
||||
} catch (Exception e) { |
||||
logger.error(e.getMessage()); |
||||
resp.put("retcode", 500); |
||||
resp.put("retvalue", "Inquiry Failed"); |
||||
return resp; |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
public HashMap<String, Object> deleteByorganizationRelationshipId(Integer organizationRelationshipId) { |
||||
HashMap<String, Object> resp = new HashMap<String, Object>(); |
||||
try { |
||||
boolean result = organizationRelationshipMapper.deleteByorganizationRelationshipId(organizationRelationshipId); |
||||
resp.put("retcode", 200); |
||||
resp.put("retvalue", result); |
||||
} catch (Exception e) { |
||||
logger.error(e.getMessage()); |
||||
resp.put("retcode", 500); |
||||
resp.put("retvalue", "DELATE Failed"); |
||||
return resp; |
||||
} |
||||
return resp; |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue