From fb5882e262e460678079304c30e49cc6a8cd04c9 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期一, 30 十月 2023 17:46:08 +0800
Subject: [PATCH] 代码提交
---
ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceDonateannexServiceImpl.java | 67 ++++++++++++++++------
ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceDonateannex.java | 41 ++++++++++---
ruoyi-project/src/main/resources/mapper/project/ServiceDonateannexMapper.xml | 7 +-
ruoyi-project/src/main/java/com/ruoyi/project/service/IServiceDonateannexService.java | 12 ++-
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonateannexController.java | 47 +++++++++------
5 files changed, 120 insertions(+), 54 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonateannexController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonateannexController.java
index 5094ec7..3e3ea5d 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonateannexController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonateannexController.java
@@ -3,11 +3,13 @@
import java.util.Arrays;
import java.util.List;
+import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.project.domain.vo.DonateAnnexVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@@ -28,15 +30,14 @@
/**
* 鎹愮尞闄勪欢Controller
- *
+ *
* @author ruoyi
* @date 2021-11-11
*/
@Api("闄勪欢绠$悊")
@RestController
@RequestMapping("/project/donateannex")
-public class ServiceDonateannexController extends BaseController
-{
+public class ServiceDonateannexController extends BaseController {
@Autowired
private IServiceDonateannexService serviceDonateannexService;
@@ -46,16 +47,14 @@
@ApiOperation("闄勪欢绠$悊鍒楄〃")
//@PreAuthorize("@ss.hasPermi('project:donateannex:list')")
@GetMapping("/list")
- public TableDataInfo list(ServiceDonateannex serviceDonateannex)
- {
+ public TableDataInfo list(ServiceDonateannex serviceDonateannex) {
startPage();
List<ServiceDonateannex> list = serviceDonateannexService.queryList(serviceDonateannex);
return getDataTable(list);
}
@GetMapping("/listnew")
- public TableDataInfo listnew(DonateAnnexVO donateAnnexVO)
- {
+ public TableDataInfo listnew(DonateAnnexVO donateAnnexVO) {
startPage();
List<DonateAnnexVO> list = serviceDonateannexService.selectVOList(donateAnnexVO);
return getDataTable(list);
@@ -69,8 +68,7 @@
//@PreAuthorize("@ss.hasPermi('project:donateannex:export')")
@Log(title = "鎹愮尞闄勪欢", businessType = BusinessType.EXPORT)
@GetMapping("/export")
- public AjaxResult export(ServiceDonateannex serviceDonateannex)
- {
+ public AjaxResult export(ServiceDonateannex serviceDonateannex) {
List<ServiceDonateannex> list = serviceDonateannexService.queryList(serviceDonateannex);
ExcelUtil<ServiceDonateannex> util = new ExcelUtil<ServiceDonateannex>(ServiceDonateannex.class);
return util.exportExcel(list, "鎹愮尞闄勪欢鏁版嵁");
@@ -82,8 +80,7 @@
@ApiOperation("閫氳繃id鑾峰緱鎹愮尞闄勪欢淇℃伅")
//@PreAuthorize("@ss.hasPermi('project:donateannex:query')")
@GetMapping(value = "/{id}")
- public AjaxResult getInfo(@PathVariable("id") Long id)
- {
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(serviceDonateannexService.getById(id));
}
@@ -93,11 +90,10 @@
@ApiOperation("鏂板鎹愮尞闄勪欢淇℃伅")
//@PreAuthorize("@ss.hasPermi('project:donateannex:add')")
@Log(title = "鎹愮尞闄勪欢", businessType = BusinessType.INSERT)
- @PostMapping
+ @PostMapping("/add")
@RepeatSubmit
- public AjaxResult add(@RequestBody ServiceDonateannex serviceDonateannex)
- {
- return toAjax(serviceDonateannexService.save(serviceDonateannex));
+ public AjaxResult add(@RequestBody List<ServiceDonateannex> serviceDonateannexs) {
+ return toAjax(serviceDonateannexService.saveData(serviceDonateannexs));
}
/**
@@ -107,10 +103,22 @@
//@PreAuthorize("@ss.hasPermi('project:donateannex:edit')")
@Log(title = "鎹愮尞闄勪欢", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
- @RepeatSubmit
- public AjaxResult edit(@RequestBody ServiceDonateannex serviceDonateannex)
- {
+ @RepeatSubmit
+ public AjaxResult edit(@RequestBody ServiceDonateannex serviceDonateannex) {
return toAjax(serviceDonateannexService.updateById(serviceDonateannex));
+ }
+
+
+ /**
+ * 淇敼鎹愮尞闄勪欢
+ */
+ @ApiOperation("淇敼娼滃湪鎹愮尞銆佷鸡鐞嗗鏌ャ�佸畬鎴愮櫥璁般�佸尰瀛﹁瘎浼伴檮浠朵俊鎭�")
+ //@PreAuthorize("@ss.hasPermi('project:donateannex:edit')")
+ @Log(title = "鎹愮尞闄勪欢", businessType = BusinessType.UPDATE)
+ @PostMapping("/editannexfiles")
+ @RepeatSubmit
+ public AjaxResult editannexfiles(@RequestBody List<ServiceDonateannex> serviceDonateannexs) {
+ return toAjax(serviceDonateannexService.updateOrSave(serviceDonateannexs));
}
/**
@@ -120,8 +128,7 @@
//@PreAuthorize("@ss.hasPermi('project:donateannex:remove')")
@Log(title = "鎹愮尞闄勪欢", businessType = BusinessType.DELETE)
@GetMapping("/remove/{ids}")
- public AjaxResult remove(@PathVariable Long[] ids)
- {
+ public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(serviceDonateannexService.removeByIds(Arrays.asList(ids)));
}
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceDonateannex.java b/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceDonateannex.java
index e8a99a1..858d6f2 100644
--- a/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceDonateannex.java
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceDonateannex.java
@@ -10,44 +10,67 @@
/**
* 鎹愮尞闄勪欢瀵硅薄 service_donateannex
- *
+ *
* @author ruoyi
* @date 2021-11-11
*/
@Data
@ApiModel("鎹愮尞闄勪欢")
-public class ServiceDonateannex extends BaseEntity
-{
+public class ServiceDonateannex extends BaseEntity {
private static final long serialVersionUID = 1L;
- /** $column.columnComment */
+ /**
+ * $column.columnComment
+ */
@ApiModelProperty("$column.columnComment")
//鏁版嵁搴撹嚜澧炴敼鎴怈TableId(type = IdType.AUTO)
@TableId(type = IdType.AUTO)
private Long id;
- /** 鍏宠仈service_donatebaseinfo琛ㄧ殑ID */
+ /**
+ * 鍏宠仈service_donatebaseinfo琛ㄧ殑ID
+ */
@ApiModelProperty("鍏宠仈service_donatebaseinfo琛ㄧ殑ID")
private Long infoid;
- /** 鎹愮尞鑰呯紪鍙� */
+ /**
+ * 鎹愮尞鑰呯紪鍙�
+ */
@ApiModelProperty("鎹愮尞鑰呯紪鍙�")
@Excel(name = "鎹愮尞鑰呯紪鍙�")
private String donorno;
- /** 闄勪欢鍚嶇О */
+ /**
+ * 闄勪欢鍚嶇О
+ */
@ApiModelProperty("闄勪欢鍚嶇О")
@Excel(name = "闄勪欢鍚嶇О")
private String annexname;
- /** 闄勪欢缂栧彿 */
+ /**
+ * 闄勪欢缂栧彿
+ */
@ApiModelProperty("闄勪欢缂栧彿")
@Excel(name = "闄勪欢缂栧彿")
private String annexno;
- /** 闄勪欢璺緞 */
+ /**
+ * 闄勪欢璺緞
+ */
@ApiModelProperty("闄勪欢璺緞")
private String annexurl;
+ /**
+ * 闄勪欢绫诲瀷
+ */
+ @ApiModelProperty("闄勪欢绫诲瀷")
+ private Integer annexfilestype;
+
+ /**
+ * 闄勪欢绫诲瀷
+ */
+ @ApiModelProperty("闄勪欢绫诲瀷")
+ private Integer delFlag;
+
}
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/service/IServiceDonateannexService.java b/ruoyi-project/src/main/java/com/ruoyi/project/service/IServiceDonateannexService.java
index 62c708c..56061a7 100644
--- a/ruoyi-project/src/main/java/com/ruoyi/project/service/IServiceDonateannexService.java
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/service/IServiceDonateannexService.java
@@ -1,26 +1,30 @@
package com.ruoyi.project.service;
import java.util.List;
+
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.project.domain.ServiceDonateannex;
import com.ruoyi.project.domain.vo.DonateAnnexVO;
/**
* 鎹愮尞闄勪欢Service鎺ュ彛
- *
+ *
* @author ruoyi
* @date 2021-11-11
*/
-public interface IServiceDonateannexService extends IService<ServiceDonateannex>
-{
+public interface IServiceDonateannexService extends IService<ServiceDonateannex> {
/**
* 鏌ヨ鎹愮尞闄勪欢鍒楄〃
- *
+ *
* @param serviceDonateannex 鎹愮尞闄勪欢
* @return 鎹愮尞闄勪欢闆嗗悎
*/
public List<ServiceDonateannex> queryList(ServiceDonateannex serviceDonateannex);
+ public Boolean updateOrSave(List<ServiceDonateannex> serviceDonateannexs);
+
List<DonateAnnexVO> selectVOList(DonateAnnexVO donateAnnexVO);
+
+ Boolean saveData(List<ServiceDonateannex> serviceDonateannexs);
}
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceDonateannexServiceImpl.java b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceDonateannexServiceImpl.java
index 004273c..dffb8ea 100644
--- a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceDonateannexServiceImpl.java
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceDonateannexServiceImpl.java
@@ -4,6 +4,7 @@
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.project.domain.vo.DonateAnnexVO;
@@ -12,68 +13,98 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
import java.util.ArrayList;
import java.util.Map;
+
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.project.mapper.ServiceDonateannexMapper;
import com.ruoyi.project.domain.ServiceDonateannex;
import com.ruoyi.project.service.IServiceDonateannexService;
+import org.springframework.transaction.annotation.Transactional;
/**
* 鎹愮尞闄勪欢Service涓氬姟灞傚鐞�
- *
+ *
* @author ruoyi
* @date 2021-11-11
*/
@Service
-public class ServiceDonateannexServiceImpl extends ServiceImpl<ServiceDonateannexMapper, ServiceDonateannex> implements IServiceDonateannexService
-{
+public class ServiceDonateannexServiceImpl extends ServiceImpl<ServiceDonateannexMapper, ServiceDonateannex> implements IServiceDonateannexService {
@Autowired
ServiceDonateannexMapper serviceDonateannexMapper;
/**
* 鏌ヨ鎹愮尞闄勪欢鍒楄〃
- *
+ *
* @param serviceDonateannex 鎹愮尞闄勪欢
* @return 鎹愮尞闄勪欢
*/
@Override
public List<ServiceDonateannex> queryList(ServiceDonateannex serviceDonateannex) {
LambdaQueryWrapper<ServiceDonateannex> wrappers = Wrappers.lambdaQuery();
- if (serviceDonateannex.getInfoid() != null){
- wrappers.eq(ServiceDonateannex::getInfoid ,serviceDonateannex.getInfoid());
+ if (serviceDonateannex.getInfoid() != null) {
+ wrappers.eq(ServiceDonateannex::getInfoid, serviceDonateannex.getInfoid());
}
- if (StringUtils.isNotBlank(serviceDonateannex.getDonorno())){
- wrappers.eq(ServiceDonateannex::getDonorno ,serviceDonateannex.getDonorno());
+ if (StringUtils.isNotBlank(serviceDonateannex.getDonorno())) {
+ wrappers.eq(ServiceDonateannex::getDonorno, serviceDonateannex.getDonorno());
}
- if (StringUtils.isNotBlank(serviceDonateannex.getAnnexname())){
- wrappers.like(ServiceDonateannex::getAnnexname ,serviceDonateannex.getAnnexname());
+ if (StringUtils.isNotBlank(serviceDonateannex.getAnnexname())) {
+ wrappers.like(ServiceDonateannex::getAnnexname, serviceDonateannex.getAnnexname());
}
- if (StringUtils.isNotBlank(serviceDonateannex.getAnnexno())){
- wrappers.eq(ServiceDonateannex::getAnnexno ,serviceDonateannex.getAnnexno());
+ if (StringUtils.isNotBlank(serviceDonateannex.getAnnexno())) {
+ wrappers.eq(ServiceDonateannex::getAnnexno, serviceDonateannex.getAnnexno());
}
- if (StringUtils.isNotBlank(serviceDonateannex.getAnnexurl())){
- wrappers.eq(ServiceDonateannex::getAnnexurl ,serviceDonateannex.getAnnexurl());
+ if (StringUtils.isNotBlank(serviceDonateannex.getAnnexurl())) {
+ wrappers.eq(ServiceDonateannex::getAnnexurl, serviceDonateannex.getAnnexurl());
}
return this.list(wrappers);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean updateOrSave(List<ServiceDonateannex> serviceDonateannexs) {
+ for (ServiceDonateannex serviceDonateannex : serviceDonateannexs) {
+ if (serviceDonateannex.getInfoid() == null || serviceDonateannex.getAnnexfilestype() == null) {
+ throw new BaseException("璇锋鏌ヤ富琛╥d鍜岄檮浠剁被鍨嬫槸鍚︿负绌猴紒");
+ }
+ if (serviceDonateannex.getId() == null) {
+ this.save(serviceDonateannex);
+ } else {
+ boolean b = this.updateById(serviceDonateannex);
+ }
+ }
+ return true;
}
@Override
public List<DonateAnnexVO> selectVOList(DonateAnnexVO donateAnnexVO) {
SysUser user = SecurityUtils.getLoginUser().getUser();
- List <SysRole> l = user.getRoles();
+ List<SysRole> l = user.getRoles();
Boolean b = false;
- for(SysRole r : l){
- if(r.getRoleId().longValue() == 3){
+ for (SysRole r : l) {
+ if (r.getRoleId().longValue() == 3) {
b = true;
}
}
- if(b){
+ if (b) {
donateAnnexVO.setCreate_by(user.getUserName());
}
return serviceDonateannexMapper.selectVOList(donateAnnexVO);
}
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean saveData(List<ServiceDonateannex> serviceDonateannexs) {
+ for (ServiceDonateannex serviceDonateannex : serviceDonateannexs) {
+ if (serviceDonateannex.getInfoid() == null || serviceDonateannex.getAnnexfilestype() == null) {
+ throw new BaseException("涓昏〃id鎴栭檮浠剁被鍨婭D涓虹┖锛岃妫�鏌ュ悗鍐嶄繚瀛�");
+ }
+ this.save(serviceDonateannex);
+ }
+ return true;
+ }
+
}
diff --git a/ruoyi-project/src/main/resources/mapper/project/ServiceDonateannexMapper.xml b/ruoyi-project/src/main/resources/mapper/project/ServiceDonateannexMapper.xml
index 0fb75f9..c82246a 100644
--- a/ruoyi-project/src/main/resources/mapper/project/ServiceDonateannexMapper.xml
+++ b/ruoyi-project/src/main/resources/mapper/project/ServiceDonateannexMapper.xml
@@ -3,12 +3,12 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.mapper.ServiceDonateannexMapper">
-
+
<resultMap type="com.ruoyi.project.domain.ServiceDonateannex" id="ServiceDonateannexResult">
<result property="id" column="ID" />
<result property="infoid" column="InfoID" />
<result property="donorno" column="DonorNo" />
- <result property="del_flag" column="del_flag" />
+ <result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
@@ -16,10 +16,11 @@
<result property="annexname" column="AnnexName" />
<result property="annexno" column="AnnexNo" />
<result property="annexurl" column="AnnexUrl" />
+ <result property="annexfilestype" column="AnnexfilesType" />
</resultMap>
<sql id="selectServiceDonateannexVo">
- select ID, InfoID, DonorNo, del_flag, create_by, create_time, update_by, update_time, AnnexName, AnnexNo, AnnexUrl from service_donateannex
+ select ID, InfoID, DonorNo, del_flag, create_by, create_time, update_by, update_time, AnnexName, AnnexNo, AnnexUrl,AnnexfilesType from service_donateannex
</sql>
<select id="selectServiceDonateannexList" parameterType="com.ruoyi.project.domain.ServiceDonateannex" resultMap="ServiceDonateannexResult">
--
Gitblit v1.9.3