1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- package com.imed.costaccount.web;
- import java.util.Arrays;
- import com.imed.costaccount.common.util.PageUtils;
- import com.imed.costaccount.common.util.Result;
- import com.imed.costaccount.model.Hospital;
- import com.imed.costaccount.model.User;
- import com.imed.costaccount.model.dto.HosptailDto;
- import com.imed.costaccount.service.HosptailService;
- import com.sun.xml.internal.bind.v2.TODO;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import org.apache.shiro.SecurityUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- /**
- * 医院表
- *
- * @author KCYG
- * @date 2021-07-26 08:52:56
- */
- @RestController
- @RequestMapping("/costAccount/hosptail")
- @Api(tags = "医院相关操作")
- public class HosptailController {
- @Autowired
- private HosptailService hosptailService;
- // /**
- // * 列表
- // */
- // @RequestMapping("/list")
- // public Result list(@RequestParam Map<String, Object> params){
- // PageUtils page = hosptailService.queryPage(params);
- // return CommonResponse.success(page);
- // }
- /**
- * 用户信息列表查询 分页查询
- * @return
- */
- @GetMapping("/list")
- @ApiOperation("分页查询医院信息")
- public Result list(@RequestParam(defaultValue = "1", value = "page") Integer page,
- @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
- @RequestParam(value = "name",required = false) String name){
- User user = (User) SecurityUtils.getSubject().getPrincipal();
- Integer hospId = user.getHospId();
- PageUtils pageUtils = hosptailService.queryList(page,pageSize,hospId,name);
- return Result.ok(pageUtils);
- }
- /**
- * 信息
- */
- @GetMapping("/getById")
- @ApiOperation("根据Id查询医院信息")
- public Result info(Integer id){
- Hospital hospital = hosptailService.getById(id);
- return Result.ok(hospital);
- }
- /**
- * 保存
- */
- @PostMapping("/save")
- @ApiOperation("保存医院信息")
- public Result save(@RequestBody HosptailDto hosptailDto){
- hosptailService.saveHosptail(hosptailDto);
- return Result.ok();
- }
- /**
- * 修改
- * 修改的操作是作废新增
- */
- @PutMapping("/update")
- @ApiOperation("修改医院信息")
- public Result update(@RequestBody HosptailDto hosptailDto){
- // 作废操作
- hosptailService.updateByHosptail(hosptailDto);
- return Result.ok();
- }
- /**
- * 删除
- */
- @DeleteMapping("/delete")
- @ApiOperation("删除医院信息")
- public Result delete(@RequestBody Integer[] ids){
- hosptailService.removeByIds(Arrays.asList(ids));
- return Result.ok();
- }
- }
|