# Conflicts: # src/main/java/com/yipin/liuwanr/entity/OrganizationRelationship.javamaster
commit
fce3cccd0d
7 changed files with 145 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,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