api,models consultant.py已更新完毕
This commit is contained in:
+5
-7
@@ -9,8 +9,7 @@ router = APIRouter()
|
|||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
path="/consultants",
|
path="/consultants",
|
||||||
tags=['顾问管理模块']
|
tags=['顾问管理模块'],summary='顾问模糊分页查询')
|
||||||
)
|
|
||||||
def read_consultants(
|
def read_consultants(
|
||||||
db: Session = Depends(get_db),
|
db: Session = Depends(get_db),
|
||||||
page:int=1,
|
page:int=1,
|
||||||
@@ -22,7 +21,7 @@ def read_consultants(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
@router.post("/consultants", response_model=ConsultantResponse,tags=['顾问管理模块'])
|
@router.post("/consultants", response_model=ConsultantResponse,tags=['顾问管理模块'],summary='顾问增加')
|
||||||
def create_consultant(
|
def create_consultant(
|
||||||
obj_in: ConsultantCreate,
|
obj_in: ConsultantCreate,
|
||||||
db: Session = Depends(get_db)
|
db: Session = Depends(get_db)
|
||||||
@@ -30,7 +29,7 @@ def create_consultant(
|
|||||||
return dao_consultant.create_consultant(db, obj_in)
|
return dao_consultant.create_consultant(db, obj_in)
|
||||||
|
|
||||||
|
|
||||||
@router.get("/consultants/{id}", response_model=ConsultantResponse,tags=['顾问管理模块'])
|
@router.get("/consultants/{id}", response_model=ConsultantResponse,tags=['顾问管理模块'],summary='顾问查询')
|
||||||
def read_consultant(id: int, db: Session = Depends(get_db)):
|
def read_consultant(id: int, db: Session = Depends(get_db)):
|
||||||
res = dao_consultant.get_consultant_by_id(db, cid=id)
|
res = dao_consultant.get_consultant_by_id(db, cid=id)
|
||||||
if res is None:
|
if res is None:
|
||||||
@@ -41,8 +40,7 @@ def read_consultant(id: int, db: Session = Depends(get_db)):
|
|||||||
@router.put(
|
@router.put(
|
||||||
path="/consultants/{id}",
|
path="/consultants/{id}",
|
||||||
response_model=ConsultantResponse,
|
response_model=ConsultantResponse,
|
||||||
tags=['顾问管理模块']
|
tags=['顾问管理模块'],summary='顾问更新')
|
||||||
)
|
|
||||||
def update_consultant(
|
def update_consultant(
|
||||||
id: int,
|
id: int,
|
||||||
obj_in: ConsultantUpdate,
|
obj_in: ConsultantUpdate,
|
||||||
@@ -57,7 +55,7 @@ def update_consultant(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
@router.delete("/consultants/{id}", response_model=ConsultantResponse,tags=['顾问管理模块'])
|
@router.delete("/consultants/{id}", response_model=ConsultantResponse,tags=['顾问管理模块'],summary='顾问删除')
|
||||||
def delete_consultant(id: int, db: Session = Depends(get_db)):
|
def delete_consultant(id: int, db: Session = Depends(get_db)):
|
||||||
res = dao_consultant.delete_consultant(db, cid=id)
|
res = dao_consultant.delete_consultant(db, cid=id)
|
||||||
if res is None:
|
if res is None:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class Consultant(Base):
|
|||||||
id = Column(Integer, primary_key=True, autoincrement=True, comment="主键")
|
id = Column(Integer, primary_key=True, autoincrement=True, comment="主键")
|
||||||
consultant_no = Column(String(50), unique=True, nullable=False, comment="顾问编号")
|
consultant_no = Column(String(50), unique=True, nullable=False, comment="顾问编号")
|
||||||
consultant_name = Column(String(50), nullable=False, comment="顾问姓名")
|
consultant_name = Column(String(50), nullable=False, comment="顾问姓名")
|
||||||
phone = Column(String(11), nullable=True, comment="联系电话")
|
phone = Column(String(20), nullable=True, comment="联系电话")
|
||||||
email = Column(String(100), nullable=True, comment="邮箱")
|
email = Column(String(100), nullable=True, comment="邮箱")
|
||||||
remark = Column(String(255), nullable=True, comment="备注")
|
remark = Column(String(255), nullable=True, comment="备注")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user