Selaa lähdekoodia

新增了一个模块的正删改查

lwh 1 kuukausi sitten
vanhempi
commit
5d9e1130ed

+ 53 - 0
yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/controller/admin/museuminfo/MuseumInfoController.java

@@ -0,0 +1,53 @@
+package cn.iocoder.yudao.module.museum.controller.admin.museuminfo;
+
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.module.museum.controller.admin.museuminfo.vo.MuseumInfoRespVO;
+import cn.iocoder.yudao.module.museum.controller.admin.museuminfo.vo.MuseumInfoSaveVO;
+import cn.iocoder.yudao.module.museum.dal.database.museuminfo.MuseumInfoDO;
+import cn.iocoder.yudao.module.museum.service.museuminfo.MuseumInfoService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+@Tag(name = "博物馆-标本库")
+@RestController
+@RequestMapping("/museum/info")
+@Validated
+public class MuseumInfoController {
+
+    @Resource
+    private MuseumInfoService museumInfoService;
+
+    @PostMapping("/create")
+    @Operation(summary = "新增标本")
+    public Integer createMuseumInfo(@RequestBody MuseumInfoSaveVO saveVO){
+        return museumInfoService.createMuseumInfo(saveVO);
+    }
+
+    @PutMapping("/update")
+    @Operation(summary = "更新标本")
+    public CommonResult<Boolean> updateMuseumInfo(@RequestBody MuseumInfoSaveVO saveVO){
+         museumInfoService.updateMuseumInfo(saveVO);
+         return CommonResult.success(true);
+    }
+
+    @DeleteMapping("/delete")
+    @Operation(summary = "删除标本")
+    public CommonResult<Boolean> deleteMuseumInfo(@RequestParam("id") Integer id){
+        museumInfoService.deleteMuseumInfo(id);
+        return CommonResult.success(true);
+    }
+
+    @GetMapping("/get")
+    @Operation(summary = "查找标本")
+    public CommonResult<MuseumInfoRespVO> getMuseumInfo(@RequestParam("id") Integer id){
+        MuseumInfoDO result = museumInfoService.selectMuseumInfo(id);
+        MuseumInfoRespVO result1 = BeanUtils.toBean(result,MuseumInfoRespVO.class);
+      return CommonResult.success(result1);
+    }
+
+}

+ 54 - 0
yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/controller/admin/museuminfo/vo/MuseumInfoRespVO.java

@@ -0,0 +1,54 @@
+package cn.iocoder.yudao.module.museum.controller.admin.museuminfo.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Schema(description = "博物馆-标本信息 Resp VO")
+@Data
+public class MuseumInfoRespVO {
+
+    private Integer id;
+
+    @Schema(description = "标本编号")
+    private String sampleId;
+
+    private Integer sampleType;
+
+    private String place;
+
+    private String chineseName;
+
+    private String englishName;
+
+    private String internationName;
+
+    private Integer keepType;
+
+    private String  local;
+
+    private LocalDateTime bronTime ;
+
+    private String bronPlace;
+
+    private LocalDateTime findTime;
+
+    private String size;
+
+    private Long weight;
+
+    private String origin;
+
+    private String offerMan;
+
+    private String charater;
+
+    private String condition;
+
+    private String joinTime;
+
+    private String useWay;
+
+    private String tip;
+}

+ 54 - 0
yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/controller/admin/museuminfo/vo/MuseumInfoSaveVO.java

@@ -0,0 +1,54 @@
+package cn.iocoder.yudao.module.museum.controller.admin.museuminfo.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Schema(description = "博物馆-标本信息 save VO")
+@Data
+public class MuseumInfoSaveVO {
+
+    private Integer id;
+
+    @Schema(description = "标本编号")
+    private String sampleId;
+
+    private Integer sampleType;
+
+    private String place;
+
+    private String chineseName;
+
+    private String englishName;
+
+    private String internationName;
+
+    private Integer keepType;
+
+    private String  local;
+
+    private LocalDateTime bronTime ;
+
+    private String bronPlace;
+
+    private LocalDateTime findTime;
+
+    private String size;
+
+    private Long weight;
+
+    private String origin;
+
+    private String offerMan;
+
+    private String charater;
+
+    private String condition;
+
+    private String joinTime;
+
+    private String useWay;
+
+    private String tip;
+}

+ 66 - 0
yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/dal/database/museuminfo/MuseumInfoDO.java

@@ -0,0 +1,66 @@
+package cn.iocoder.yudao.module.museum.dal.database.museuminfo;
+
+import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.*;
+
+import java.time.LocalDateTime;
+
+/**
+ * 博物馆的标本库
+ *
+ * @author 芋道源码
+ */
+@TableName(value = "museum_info", autoResultMap = true) // 由于 SQL Server 的 system_user 是关键字,所以使用 system_users
+@Data
+@Builder
+@EqualsAndHashCode(callSuper = true)
+@NoArgsConstructor
+@AllArgsConstructor
+public class MuseumInfoDO extends BaseDO {
+
+    @TableId
+    private Integer id;
+
+    private String sampleId;
+
+    private Integer sampleType;
+
+    private String place;
+
+    private String chineseName;
+
+    private String englishName;
+
+    private String internationName;
+
+    private Integer keepType;
+
+    private String  local;
+
+    private LocalDateTime bronTime ;
+
+    private String bronPlace;
+
+    private LocalDateTime findTime;
+
+    private String size;
+
+    private Long weight;
+
+    private String origin;
+
+    private String offerMan;
+
+    private String charater;
+
+    private String condition;
+
+    private String joinTime;
+
+    private String useWay;
+
+    private String tip;
+
+}

+ 22 - 0
yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/dal/mysql/museuminfo/MuseumInfoMapper.java

@@ -0,0 +1,22 @@
+package cn.iocoder.yudao.module.museum.dal.mysql.museuminfo;
+
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.module.museum.dal.database.museuminfo.MuseumInfoDO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+
+@Mapper
+public interface MuseumInfoMapper extends BaseMapperX<MuseumInfoDO> {
+
+    @Update("UPDATE museum_info SET sample_type=#{sampleType}, place=#{place} WHERE id =#{id}")
+    void updateMuseumInfo(MuseumInfoDO museumInfoDO);
+
+    @Update("UPDATE museum_info SET deleted=1  WHERE id =#{id}")
+    void deleteMuseumInfo(Integer id);
+
+    @Select("SELECT * FROM museum_info WHERE id = #{id} AND deleted =0 ")
+    MuseumInfoDO selectMuseumInfoById(@Param("id") Integer id);
+
+}

+ 29 - 0
yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/service/museuminfo/MuseumInfoService.java

@@ -0,0 +1,29 @@
+package cn.iocoder.yudao.module.museum.service.museuminfo;
+
+import cn.iocoder.yudao.module.museum.controller.admin.museuminfo.vo.MuseumInfoSaveVO;
+import cn.iocoder.yudao.module.museum.dal.database.museuminfo.MuseumInfoDO;
+import org.springframework.stereotype.Service;
+
+@Service
+public interface MuseumInfoService {
+   /**
+    * 创建标本
+   * */
+   Integer createMuseumInfo(MuseumInfoSaveVO saveVO);
+
+   /**
+    * 更新标本
+    * */
+   void updateMuseumInfo(MuseumInfoSaveVO saveVO);
+
+   /**
+    * 删除标本
+    * */
+   void deleteMuseumInfo(Integer id);
+
+
+   /**
+    * 查询标本
+    * */
+   MuseumInfoDO selectMuseumInfo(Integer id);
+}

+ 38 - 0
yudao-module-museum/yudao-module-museum-biz/src/main/java/cn/iocoder/yudao/module/museum/service/museuminfo/MuseumInfoServiceImpl.java

@@ -0,0 +1,38 @@
+package cn.iocoder.yudao.module.museum.service.museuminfo;
+
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.module.museum.controller.admin.museuminfo.vo.MuseumInfoSaveVO;
+import cn.iocoder.yudao.module.museum.dal.database.museuminfo.MuseumInfoDO;
+import cn.iocoder.yudao.module.museum.dal.mysql.museuminfo.MuseumInfoMapper;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+@Service
+public  class  MuseumInfoServiceImpl implements MuseumInfoService {
+
+   @Resource
+   private MuseumInfoMapper museumInfoMapper;
+
+   @Override
+   public Integer createMuseumInfo(MuseumInfoSaveVO saveVO){
+     return museumInfoMapper.insert(BeanUtils.toBean(saveVO, MuseumInfoDO.class));
+   }
+
+   @Override
+   public void updateMuseumInfo(MuseumInfoSaveVO saveVO){
+      museumInfoMapper.updateMuseumInfo(BeanUtils.toBean(saveVO,MuseumInfoDO.class));
+   }
+
+   @Override
+   public void deleteMuseumInfo(Integer id){
+//      museumInfoMapper.deleteMuseumInfo(id);
+      museumInfoMapper.deleteById(id);
+   }
+
+   @Override
+   public MuseumInfoDO selectMuseumInfo(Integer id){
+      return museumInfoMapper.selectMuseumInfoById(id);
+   }
+
+}

+ 1 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java

@@ -43,6 +43,7 @@ public class UserController {
 
     @Resource
     private AdminUserService userService;
+
     @Resource
     private DeptService deptService;