未测试
parent
5a91556e68
commit
77981c02f5
|
@ -0,0 +1,131 @@
|
||||||
|
package HomeWork.controller;
|
||||||
|
|
||||||
|
import HomeWork.common.core.domain.R;
|
||||||
|
import HomeWork.domain.*;
|
||||||
|
import HomeWork.service.PeopleService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/people")
|
||||||
|
public class PeopleController {
|
||||||
|
@Autowired
|
||||||
|
private PeopleService peopleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员库
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public R<List<People>> people() {
|
||||||
|
List<People> people = peopleService.list();
|
||||||
|
return R.ok(people);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加人员库
|
||||||
|
* @param people
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public R add(@RequestBody People people) {
|
||||||
|
peopleService.add(people);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除人员库
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/delete/{id}")
|
||||||
|
public R delete(@PathVariable Integer id) {
|
||||||
|
R r = peopleService.delete(id);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人员库
|
||||||
|
* @param people
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
@PutMapping("/upd")
|
||||||
|
public R upd(@RequestBody People people) {
|
||||||
|
peopleService.upd(people);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过人员id查询库里面的人员信息
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
@GetMapping("/one/{id}")
|
||||||
|
public R<PeopleOne> oneList(@PathVariable Integer id) {
|
||||||
|
PeopleOne people = peopleService.one(id);
|
||||||
|
return R.ok(people);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过人员库的人员数获取所有人员库的图片
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
@GetMapping("/img/{id}")
|
||||||
|
public R<List<ImgsEntity>> img(@PathVariable Integer id) {
|
||||||
|
List<ImgsEntity> people = peopleService.imgList(id);
|
||||||
|
return R.ok(people);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过图片id回显数据
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
@GetMapping("/personage/{id}")
|
||||||
|
public R<Personage> personage(@PathVariable Integer id) {
|
||||||
|
Personage people = peopleService.PersonageById(id);
|
||||||
|
return R.ok(people);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人员数据
|
||||||
|
* @param personage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PutMapping("/updPersonage")
|
||||||
|
public R updPersonage(@RequestBody Personage personage) {
|
||||||
|
peopleService.updPersonage(personage);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 民族下拉框
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
@GetMapping("/nationList")
|
||||||
|
public R<List<Nation>> nationList() {
|
||||||
|
List<Nation> people = peopleService.nationList();
|
||||||
|
return R.ok(people);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 身份证下拉框
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
@GetMapping("/IdentityDocumentList")
|
||||||
|
public R<List<IdentityDocument>> IdentityDocumentList() {
|
||||||
|
List<IdentityDocument> people = peopleService.IdentityDocumentList();
|
||||||
|
return R.ok(people);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -52,4 +52,6 @@ public class TreeController {
|
||||||
return R.ok(treeVos);
|
return R.ok(treeVos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package HomeWork.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class IdentityDocument {
|
||||||
|
private Integer id;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package HomeWork.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ImgsEntity {
|
||||||
|
private Integer id;
|
||||||
|
private String img;
|
||||||
|
private Integer peopleOneId;
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package HomeWork.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class Nation {
|
||||||
|
private Integer id;
|
||||||
|
private String name;
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package HomeWork.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class People {
|
||||||
|
private Integer id;
|
||||||
|
private String libraryName;
|
||||||
|
private Integer tissueId;
|
||||||
|
private Date createTime;
|
||||||
|
private String createName;
|
||||||
|
private Integer number;
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package HomeWork.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PeopleOne {
|
||||||
|
private Integer id;
|
||||||
|
private Integer typeId;
|
||||||
|
private Integer peopleId;
|
||||||
|
private People people;
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package HomeWork.domain;
|
||||||
|
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class Personage {
|
||||||
|
private Integer id;
|
||||||
|
private String name;
|
||||||
|
private Integer sex;
|
||||||
|
private Date birthday;
|
||||||
|
private Integer nationId;
|
||||||
|
private Integer identityDocumentId;
|
||||||
|
private String idCard;
|
||||||
|
private String address;
|
||||||
|
private String remark;
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package HomeWork.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class Tissue {
|
||||||
|
private Integer id;
|
||||||
|
private String name;
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package HomeWork.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class Type {
|
||||||
|
private Integer id;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package HomeWork.mapper;
|
||||||
|
|
||||||
|
import HomeWork.domain.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface PeopleMapper {
|
||||||
|
List<People> list();
|
||||||
|
|
||||||
|
void add(People people);
|
||||||
|
|
||||||
|
void delete(Integer id);
|
||||||
|
|
||||||
|
void upd(People people);
|
||||||
|
|
||||||
|
PeopleOne findById(Integer id);
|
||||||
|
|
||||||
|
PeopleOne one(Integer id);
|
||||||
|
|
||||||
|
List<ImgsEntity> imgList(Integer id);
|
||||||
|
|
||||||
|
People findPeopleBy(Integer id);
|
||||||
|
|
||||||
|
Personage findPersonageById(Integer id);
|
||||||
|
|
||||||
|
void updPersonage(Personage personage);
|
||||||
|
|
||||||
|
List<Nation> nationList();
|
||||||
|
|
||||||
|
|
||||||
|
List<IdentityDocument> IdentityDocumentList();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package HomeWork.service;
|
||||||
|
|
||||||
|
import HomeWork.common.core.domain.R;
|
||||||
|
import HomeWork.domain.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface PeopleService {
|
||||||
|
List<People> list();
|
||||||
|
|
||||||
|
void add(People people);
|
||||||
|
|
||||||
|
R delete(Integer id);
|
||||||
|
|
||||||
|
void upd(People people);
|
||||||
|
|
||||||
|
PeopleOne one(Integer id);
|
||||||
|
|
||||||
|
List<ImgsEntity> imgList(Integer id);
|
||||||
|
|
||||||
|
Personage PersonageById(Integer id);
|
||||||
|
|
||||||
|
void updPersonage(Personage personage);
|
||||||
|
|
||||||
|
List<Nation> nationList();
|
||||||
|
|
||||||
|
|
||||||
|
List<IdentityDocument> IdentityDocumentList();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
package HomeWork.service.impl;
|
||||||
|
|
||||||
|
import HomeWork.common.core.domain.R;
|
||||||
|
import HomeWork.domain.*;
|
||||||
|
import HomeWork.mapper.PeopleMapper;
|
||||||
|
import HomeWork.service.PeopleService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class PeopleServiceImpl implements PeopleService {
|
||||||
|
@Autowired
|
||||||
|
private PeopleMapper peopleMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<People> list() {
|
||||||
|
return peopleMapper.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void add(People people) {
|
||||||
|
people.setCreateTime(new Date());
|
||||||
|
//TODO 通过请求头部获取当前登录用户
|
||||||
|
peopleMapper.add(people);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R delete(Integer id) {
|
||||||
|
if (peopleMapper.findById(id)!=null){
|
||||||
|
return R.fail("正有布控任务");
|
||||||
|
}
|
||||||
|
peopleMapper.delete(id);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void upd(People people) {
|
||||||
|
peopleMapper.upd(people);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PeopleOne one(Integer id) {
|
||||||
|
People peopleBy = peopleMapper.findPeopleBy(id);
|
||||||
|
PeopleOne peopleOnes = peopleMapper.one(id);
|
||||||
|
peopleOnes.setPeople(peopleBy);
|
||||||
|
return peopleOnes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ImgsEntity> imgList(Integer id) {
|
||||||
|
return peopleMapper.imgList(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Personage PersonageById(Integer id) {
|
||||||
|
return peopleMapper.findPersonageById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updPersonage(Personage personage) {
|
||||||
|
peopleMapper.updPersonage(personage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Nation> nationList() {
|
||||||
|
return peopleMapper.nationList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<IdentityDocument> IdentityDocumentList() {
|
||||||
|
return peopleMapper.IdentityDocumentList();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="HomeWork.mapper.PeopleMapper">
|
||||||
|
<insert id="add">
|
||||||
|
insert into people
|
||||||
|
values (0,#{libraryName},#{tissueId},#{createTime},#{createName},#{number})
|
||||||
|
</insert>
|
||||||
|
<update id="upd">
|
||||||
|
update people
|
||||||
|
set libraryName=#{libraryName},tissueId=#{tissueId},createTime=#{createTime},createName=#{createName},number=#{number}
|
||||||
|
where id=#{id}
|
||||||
|
</update>
|
||||||
|
<update id="updPersonage">
|
||||||
|
update personage
|
||||||
|
set name=#{name},sex=#{sex},nation_id=#{nation},birthday=#{birthday},id_card=#{idCard},address=#{address},remark=#{remark}
|
||||||
|
,identity_document_id=#{identityDocumentId}
|
||||||
|
where id=#{id}
|
||||||
|
</update>
|
||||||
|
<delete id="delete">
|
||||||
|
delete from people where id=#{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="list" resultType="HomeWork.domain.People">
|
||||||
|
select * from people
|
||||||
|
</select>
|
||||||
|
<select id="findById" resultType="HomeWork.domain.PeopleOne">
|
||||||
|
select * from people where people_id=#{id}
|
||||||
|
</select>
|
||||||
|
<select id="one" resultType="HomeWork.domain.PeopleOne">
|
||||||
|
select * from people where people_id=#{id}
|
||||||
|
</select>
|
||||||
|
<select id="imgList" resultType="HomeWork.domain.ImgsEntity">
|
||||||
|
select * from imgs where people_one_id=#{id}
|
||||||
|
</select>
|
||||||
|
<select id="findPeopleBy" resultType="HomeWork.domain.People">
|
||||||
|
select * from people where id=#{id}
|
||||||
|
</select>
|
||||||
|
<select id="findPersonageById" resultType="HomeWork.domain.Personage">
|
||||||
|
select * from personage where id=#{id}
|
||||||
|
</select>
|
||||||
|
<select id="nationList" resultType="HomeWork.domain.Nation">
|
||||||
|
select * from nation
|
||||||
|
</select>
|
||||||
|
<select id="IdentityDocumentList" resultType="HomeWork.domain.IdentityDocument">
|
||||||
|
select * from identity_document
|
||||||
|
</select>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue