|
|
@@ -0,0 +1,96 @@
|
|
|
+package cn.hnthyy.thmz.controller.mz;
|
|
|
+
|
|
|
+
|
|
|
+import cn.hnthyy.thmz.Utils.R;
|
|
|
+import cn.hnthyy.thmz.Utils.Tools;
|
|
|
+import cn.hnthyy.thmz.entity.his.mz.AHospital;
|
|
|
+import cn.hnthyy.thmz.service.his.mz.AHospitalService;
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * (AHospital)表控制层
|
|
|
+ *
|
|
|
+ * @author lihong
|
|
|
+ * @since 2023-12-28 10:49:46
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("aHospital")
|
|
|
+public class AHospitalController {
|
|
|
+ /**
|
|
|
+ * 服务对象
|
|
|
+ */
|
|
|
+ @Resource
|
|
|
+ private AHospitalService service;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页查询所有数据
|
|
|
+ *
|
|
|
+ * @param page 分页对象
|
|
|
+ * @param aHospital 查询实体
|
|
|
+ * @return 所有数据
|
|
|
+ */
|
|
|
+ @PostMapping("/selectAll")
|
|
|
+ public R selectAll(Page<AHospital> page, AHospital aHospital) {
|
|
|
+ Page<AHospital> result = service.page(page, new QueryWrapper<>(aHospital));
|
|
|
+ Tools.trimCollectionStrField(result.getRecords());
|
|
|
+ return R.ok().put("data", result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过主键查询单条数据
|
|
|
+ *
|
|
|
+ * @param id 主键
|
|
|
+ * @return 单条数据
|
|
|
+ */
|
|
|
+ @GetMapping("/selectById")
|
|
|
+ public R selectById(String id) {
|
|
|
+ return R.ok().put("data", BeanUtil.trimStrFields(service.getById(id)));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增数据
|
|
|
+ *
|
|
|
+ * @param aHospital 实体对象
|
|
|
+ * @return 新增结果
|
|
|
+ */
|
|
|
+ @PostMapping("/save")
|
|
|
+ public R save(@RequestBody List<AHospital> aHospital) {
|
|
|
+ service.saveBatch(aHospital);
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改数据
|
|
|
+ *
|
|
|
+ * @param aHospital 实体对象
|
|
|
+ * @return 修改结果
|
|
|
+ */
|
|
|
+ @PostMapping("/update")
|
|
|
+ public R update(@RequestBody AHospital aHospital) {
|
|
|
+ service.updateById(aHospital);
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除数据
|
|
|
+ *
|
|
|
+ * @param idList 主键结合
|
|
|
+ * @return 删除结果
|
|
|
+ */
|
|
|
+ @PostMapping("/deleteByIds")
|
|
|
+ public R delete(@RequestBody List<String> idList) {
|
|
|
+ service.removeByIds(idList);
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+}
|
|
|
+
|