diff --git a/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/controller/ResearchProjectInformationController.java b/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/controller/ResearchProjectInformationController.java new file mode 100644 index 00000000..7404bc44 --- /dev/null +++ b/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/controller/ResearchProjectInformationController.java @@ -0,0 +1,108 @@ +/** + * Copyright 2023 UESTC + */ + +package com.dkha.researchProjectInformation.controller; + +import com.dkha.commons.tools.constant.Constant; +import com.dkha.commons.tools.page.PageData; +import com.dkha.commons.tools.excel.ExcelUtils; +import com.dkha.commons.tools.utils.Result; +import com.dkha.commons.tools.validator.AssertUtils; +import com.dkha.commons.tools.validator.ValidatorUtils; +import com.dkha.commons.tools.validator.group.AddGroup; +import com.dkha.commons.tools.validator.group.UpdateGroup; +import com.dkha.commons.tools.validator.group.DefaultGroup; +import com.dkha.researchProjectInformation.dto.ResearchProjectInformationDTO; +import com.dkha.researchProjectInformation.excel.ResearchProjectInformationExcel; +import com.dkha.researchProjectInformation.service.ResearchProjectInformationService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 科研项目信息 + * + * @author li.zhan 719901725@qq.com + * @since v1.0.0 2024-01-09 + */ +@RestController +@RequestMapping("researchProjectInformation") +@Api(tags="科研项目信息") +public class ResearchProjectInformationController { + @Autowired + private ResearchProjectInformationService researchProjectInformationService; + + @GetMapping("page") + @ApiOperation("分页") + @ApiImplicitParams({ + @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , + @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , + @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , + @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") + }) + public Result> page(@ApiIgnore @RequestParam Map params){ + PageData page = researchProjectInformationService.page(params); + + return new Result>().ok(page); + } + + @GetMapping("{id}") + @ApiOperation("信息") + public Result get(@PathVariable("id") String id){ + ResearchProjectInformationDTO data = researchProjectInformationService.get(id); + + return new Result().ok(data); + } + + @PostMapping + @ApiOperation("保存") + public Result save(@RequestBody ResearchProjectInformationDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + + researchProjectInformationService.save(dto); + + return new Result(); + } + + @PutMapping + @ApiOperation("修改") + public Result update(@RequestBody ResearchProjectInformationDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + + researchProjectInformationService.update(dto); + + return new Result(); + } + + @DeleteMapping + @ApiOperation("删除") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + + researchProjectInformationService.delete(ids); + + return new Result(); + } + + @GetMapping("export") + @ApiOperation("导出") + public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception { + List list = researchProjectInformationService.list(params); + + ExcelUtils.exportExcelToTarget(response, null, list, ResearchProjectInformationExcel.class); + } + +} \ No newline at end of file diff --git a/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/dao/ResearchProjectInformationDao.java b/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/dao/ResearchProjectInformationDao.java new file mode 100644 index 00000000..87bc221b --- /dev/null +++ b/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/dao/ResearchProjectInformationDao.java @@ -0,0 +1,20 @@ +/** + * Copyright 2023 UESTC + */ + +package com.dkha.researchProjectInformation.dao; + +import com.dkha.commons.mybatis.dao.BaseDao; +import com.dkha.researchProjectInformation.entity.ResearchProjectInformationEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 科研项目信息 + * + * @author li.zhan 719901725@qq.com + * @since v1.0.0 2024-01-09 + */ +@Mapper +public interface ResearchProjectInformationDao extends BaseDao { + +} \ No newline at end of file diff --git a/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/dto/ResearchProjectInformationDTO.java b/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/dto/ResearchProjectInformationDTO.java new file mode 100644 index 00000000..241b29e7 --- /dev/null +++ b/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/dto/ResearchProjectInformationDTO.java @@ -0,0 +1,44 @@ +/** + * Copyright 2023 UESTC + */ + +package com.dkha.researchProjectInformation.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 科研项目信息 + * + * @author li.zhan 719901725@qq.com + * @since v1.0.0 2024-01-09 + */ +@Data +@ApiModel(value = "科研项目信息") +public class ResearchProjectInformationDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键ID") + private Long id; + + @ApiModelProperty(value = "科研编号") + private String researchId; + + @ApiModelProperty(value = "项目编号") + private String projectId; + + @ApiModelProperty(value = "预算余额") + private Double budgetBalance; + + @ApiModelProperty(value = "创建人") + private String creator; + + @ApiModelProperty(value = "创建时间") + private Date createDate; + +} \ No newline at end of file diff --git a/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/entity/ResearchProjectInformationEntity.java b/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/entity/ResearchProjectInformationEntity.java new file mode 100644 index 00000000..195fcf1d --- /dev/null +++ b/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/entity/ResearchProjectInformationEntity.java @@ -0,0 +1,45 @@ +/** + * Copyright 2023 UESTC + */ + +package com.dkha.researchProjectInformation.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.dkha.commons.mybatis.entity.BaseEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 科研项目信息 + * + * @author li.zhan 719901725@qq.com + * @since v1.0.0 2024-01-09 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("zhyy_research_project_information") +public class ResearchProjectInformationEntity extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 科研编号 + */ + private String researchId; + /** + * 项目编号 + */ + private String projectId; + /** + * 预算余额 + */ + private Double budgetBalance; + + /** + * 创建时间 + */ + private Date createDate; +} \ No newline at end of file diff --git a/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/excel/ResearchProjectInformationExcel.java b/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/excel/ResearchProjectInformationExcel.java new file mode 100644 index 00000000..e92d122e --- /dev/null +++ b/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/excel/ResearchProjectInformationExcel.java @@ -0,0 +1,31 @@ +/** + * Copyright 2023 UESTC + */ + +package com.dkha.researchProjectInformation.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 科研项目信息 + * + * @author li.zhan 719901725@qq.com + * @since v1.0.0 2024-01-09 + */ +@Data +public class ResearchProjectInformationExcel { + @Excel(name = "主键ID") + private Long id; + @Excel(name = "科研编号") + private String researchId; + @Excel(name = "项目编号") + private String projectId; + @Excel(name = "预算余额") + private Double budgetBalance; + @Excel(name = "创建时间") + private Date createDate; + +} \ No newline at end of file diff --git a/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/redis/ResearchProjectInformationRedis.java b/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/redis/ResearchProjectInformationRedis.java new file mode 100644 index 00000000..463bf4f6 --- /dev/null +++ b/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/redis/ResearchProjectInformationRedis.java @@ -0,0 +1,34 @@ +/** + * Copyright 2023 UESTC + */ + +package com.dkha.researchProjectInformation.redis; + +import com.dkha.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 科研项目信息 + * + * @author li.zhan 719901725@qq.com + * @since v1.0.0 2024-01-09 + */ +@Component +public class ResearchProjectInformationRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/service/ResearchProjectInformationService.java b/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/service/ResearchProjectInformationService.java new file mode 100644 index 00000000..7533df91 --- /dev/null +++ b/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/service/ResearchProjectInformationService.java @@ -0,0 +1,33 @@ +/** + * Copyright 2023 UESTC + */ + +package com.dkha.researchProjectInformation.service; + +import com.dkha.commons.mybatis.service.BaseService; +import com.dkha.commons.tools.page.PageData; +import com.dkha.researchProjectInformation.dto.ResearchProjectInformationDTO; +import com.dkha.researchProjectInformation.entity.ResearchProjectInformationEntity; +import java.util.List; +import java.util.Map; + +/** + * 科研项目信息 + * + * @author li.zhan 719901725@qq.com + * @since v1.0.0 2024-01-09 + */ +public interface ResearchProjectInformationService extends BaseService { + + PageData page(Map params); + + List list(Map params); + + ResearchProjectInformationDTO get(String id); + + void save(ResearchProjectInformationDTO dto); + + void update(ResearchProjectInformationDTO dto); + + void delete(String[] ids); +} \ No newline at end of file diff --git a/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/service/impl/ResearchProjectInformationServiceImpl.java b/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/service/impl/ResearchProjectInformationServiceImpl.java new file mode 100644 index 00000000..272374ea --- /dev/null +++ b/back/dkha-sz-main/dkha-module/dkha-system/dkha-system-server/src/main/java/com/dkha/researchProjectInformation/service/impl/ResearchProjectInformationServiceImpl.java @@ -0,0 +1,106 @@ +/** + * Copyright 2023 UESTC + */ + +package com.dkha.researchProjectInformation.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.dkha.commons.mybatis.service.impl.BaseServiceImpl; +import com.dkha.commons.tools.constant.Constant; +import com.dkha.commons.tools.page.PageData; +import com.dkha.commons.tools.utils.ConvertUtils; +import com.dkha.researchProjectInformation.dao.ResearchProjectInformationDao; +import com.dkha.researchProjectInformation.dto.ResearchProjectInformationDTO; +import com.dkha.researchProjectInformation.entity.ResearchProjectInformationEntity; +import com.dkha.researchProjectInformation.redis.ResearchProjectInformationRedis; +import com.dkha.researchProjectInformation.service.ResearchProjectInformationService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 科研项目信息 + * + * @author li.zhan 719901725@qq.com + * @since v1.0.0 2024-01-09 + */ +@Service +public class ResearchProjectInformationServiceImpl extends BaseServiceImpl implements ResearchProjectInformationService { + @Autowired + private ResearchProjectInformationRedis researchProjectInformationRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, Constant.CREATE_DATE, false), + getWrapper(params) + ); + + return getPageData(page, ResearchProjectInformationDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ResearchProjectInformationDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get("id"); + String researchId = (String)params.get("researchId"); + String projectId = (String)params.get("projectId"); + String startTime = (String)params.get("startTime"); + String endTime = (String)params.get("endTime"); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), "id", id); + wrapper.like(StringUtils.isNotBlank(researchId), "research_id", researchId); + wrapper.like(StringUtils.isNotBlank(projectId), "project_id", projectId); + wrapper.gt(StringUtils.isNotBlank(startTime),"create_date",startTime); + wrapper.lt(StringUtils.isNotBlank(endTime),"create_date",endTime); + //wrapper.eq(Constant.DEL_FLAG, DelFlagEnum.NORMAL.value()); + + return wrapper; + } + + @Override + public ResearchProjectInformationDTO get(String id) { + ResearchProjectInformationEntity entity = baseDao.selectById(id); + + return ConvertUtils.sourceToTarget(entity, ResearchProjectInformationDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(ResearchProjectInformationDTO dto) { + ResearchProjectInformationEntity entity = ConvertUtils.sourceToTarget(dto, ResearchProjectInformationEntity.class); + + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ResearchProjectInformationDTO dto) { + ResearchProjectInformationEntity entity = ConvertUtils.sourceToTarget(dto, ResearchProjectInformationEntity.class); + + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + //逻辑删除 + //logicDelete(ids, ResearchProjectInformationEntity.class); + + //物理删除 + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/front/dkha-web-sz-main/src/views/modules/researchProjectInformation/researchprojectinformation-add-or-update.vue b/front/dkha-web-sz-main/src/views/modules/researchProjectInformation/researchprojectinformation-add-or-update.vue new file mode 100644 index 00000000..eb40394d --- /dev/null +++ b/front/dkha-web-sz-main/src/views/modules/researchProjectInformation/researchprojectinformation-add-or-update.vue @@ -0,0 +1,100 @@ + + + diff --git a/front/dkha-web-sz-main/src/views/modules/researchProjectInformation/researchprojectinformation.vue b/front/dkha-web-sz-main/src/views/modules/researchProjectInformation/researchprojectinformation.vue new file mode 100644 index 00000000..c5e9e309 --- /dev/null +++ b/front/dkha-web-sz-main/src/views/modules/researchProjectInformation/researchprojectinformation.vue @@ -0,0 +1,88 @@ + + +