소스 검색

内容管理区分分类

yanliming 1 년 전
부모
커밋
57c646e630

+ 4 - 0
common/src/main/java/com/jpsoft/employment/modules/base/entity/LoveProject.java

@@ -65,5 +65,9 @@ public class LoveProject {
 	@Transient
 	@ApiModelProperty(value = "回馈方式")
 	private String[] feedbackMethodArray;
+
+
+	@ApiModelProperty(value = "类型(1:爱心项目,2:爱心捐献,3:志愿者,4:爱心帮扶)")
+	private String typeN;
 	
 		}

+ 1 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/WishInfoService.java

@@ -11,6 +11,7 @@ public interface WishInfoService {
 	boolean exist(String id);
 	int insert(WishInfo model);
 	int insertAndAspirations(WishInfo model);
+	int updateAndAspirations(WishInfo model);
 	int update(WishInfo model);
 	int delete(String id);
 	List<WishInfo> list();

+ 37 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/impl/WishInfoServiceImpl.java

@@ -5,6 +5,7 @@ import java.util.Map;
 import java.util.UUID;
 import javax.annotation.Resource;
 
+import com.jpsoft.employment.modules.base.dao.StudentAspirationsDAO;
 import com.jpsoft.employment.modules.base.entity.StudentAspirations;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
@@ -21,6 +22,9 @@ public class WishInfoServiceImpl implements WishInfoService {
 	@Resource(name="wishInfoDAO")
 	private WishInfoDAO wishInfoDAO;
 
+	@Resource(name="studentAspirationsDAO")
+	private StudentAspirationsDAO studentAspirationsDAO;
+
 	@Override
 	public WishInfo get(String id) {
 		// TODO Auto-generated method stub
@@ -47,6 +51,8 @@ public class WishInfoServiceImpl implements WishInfoService {
 				studentAspirations.setCreateBy(model.getCreateBy());
 				studentAspirations.setWishInfoId(model.getId());
 
+
+				studentAspirationsDAO.insert(studentAspirations);
 			}
 		}
 
@@ -59,6 +65,37 @@ public class WishInfoServiceImpl implements WishInfoService {
 		return wishInfoDAO.update(model);		
 	}
 
+
+	@Override
+	public int updateAndAspirations(WishInfo model){
+		int count = wishInfoDAO.update(model);
+		if(count>0){
+			List<StudentAspirations> curStudentAspirationsList = studentAspirationsDAO.findByWish(model.getId());
+
+			for (StudentAspirations studentAspirations:curStudentAspirationsList) {
+				studentAspirations.setDelFlag(true);
+				studentAspirations.setUpdateBy(model.getUpdateBy());
+				studentAspirations.setUpdateTime(model.getUpdateTime());
+
+				studentAspirationsDAO.update(studentAspirations);
+			}
+
+			List<StudentAspirations> newStudentAspirationsList = model.getStudentAspirationsList();
+
+			for (StudentAspirations studentAspirations:newStudentAspirationsList) {
+				studentAspirations.setId(UUID.randomUUID().toString());
+				studentAspirations.setDelFlag(false);
+				studentAspirations.setCreateTime(model.getCreateTime());
+				studentAspirations.setCreateBy(model.getCreateBy());
+				studentAspirations.setWishInfoId(model.getId());
+
+				studentAspirationsDAO.insert(studentAspirations);
+			}
+		}
+
+		return count;
+	}
+
 	@Override
 	public int delete(String id) {
 		// TODO Auto-generated method stub

+ 3 - 0
common/src/main/resources/mapper/base/LoveProject.xml

@@ -108,6 +108,9 @@
 			<if test="searchParams.title != null">
 				and title_ like #{searchParams.title}
 			</if>
+			<if test="searchParams.type != null">
+				and type_ = #{searchParams.type}
+			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">
 	        ${sort.name} ${sort.order}

+ 18 - 1
web/src/main/java/com/jpsoft/employment/modules/base/controller/LoveProjectController.java

@@ -6,6 +6,7 @@ import com.jpsoft.employment.modules.common.utils.PojoUtils;
 import com.jpsoft.employment.modules.common.dto.Sort;
 import com.jpsoft.employment.modules.base.entity.LoveProject;
 import com.jpsoft.employment.modules.base.service.LoveProjectService;
+import com.jpsoft.employment.modules.sys.service.DataDictionaryService;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -25,6 +26,9 @@ public class LoveProjectController {
     @Autowired
     private LoveProjectService loveProjectService;
 
+    @Autowired
+    private DataDictionaryService dataDictionaryService;
+
 
     @ApiOperation(value = "创建空记录")
     @GetMapping("create")
@@ -217,7 +221,7 @@ public class LoveProjectController {
     @ApiOperation(value = "列表")
     @RequestMapping(value = "pageList", method = RequestMethod.POST)
     public MessageResult<Map> pageList(
-            String title,
+            String title,String type,
             @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
             @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,
             HttpServletRequest request) {
@@ -237,9 +241,22 @@ public class LoveProjectController {
             searchParams.put("title", title + "%");
         }
 
+        if (StringUtils.isNotEmpty(type)) {
+            searchParams.put("type", type);
+        }
+
 
         Page<LoveProject> page = loveProjectService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
 
+        for (LoveProject loveProject:page) {
+            if(StringUtils.isNotEmpty(loveProject.getType())){
+                String categoryN = dataDictionaryService.findNameByCatalogNameAndValue("内容类型",loveProject.getType());
+                if(StringUtils.isNotEmpty(categoryN)){
+                    loveProject.setTypeN(categoryN);
+                }
+            }
+        }
+
 
         msgResult.setResult(true);
         msgResult.setData(PojoUtils.pageWrapper(page));

+ 10 - 1
web/src/main/java/com/jpsoft/employment/modules/base/controller/WishInfoController.java

@@ -2,6 +2,7 @@ package com.jpsoft.employment.modules.base.controller;
 
 import com.github.pagehelper.Page;
 import com.jpsoft.employment.modules.base.entity.StudentAspirations;
+import com.jpsoft.employment.modules.base.service.StudentAspirationsService;
 import com.jpsoft.employment.modules.common.dto.MessageResult;
 import com.jpsoft.employment.modules.common.utils.PojoUtils;
 import com.jpsoft.employment.modules.common.dto.Sort;
@@ -27,6 +28,9 @@ public class WishInfoController {
     @Autowired
     private WishInfoService wishInfoService;
 
+    @Autowired
+    private StudentAspirationsService studentAspirationsService;
+
     @Autowired
     private DataDictionaryService dataDictionaryService;
 	
@@ -89,6 +93,11 @@ public class WishInfoController {
             WishInfo wishInfo = wishInfoService.get(id);
 
             if (wishInfo != null) {
+                List<StudentAspirations> studentAspirationsList = studentAspirationsService.findByWish(wishInfo.getId());
+                if(studentAspirationsList!=null){
+                    wishInfo.setStudentAspirationsList(studentAspirationsList);
+                }
+
                 msgResult.setResult(true);
                 msgResult.setData(wishInfo);
             } else {
@@ -115,7 +124,7 @@ public class WishInfoController {
 		    wishInfo.setUpdateBy(subject);
             wishInfo.setUpdateTime(new Date());
 		
-            int affectCount = wishInfoService.update(wishInfo);
+            int affectCount = wishInfoService.updateAndAspirations(wishInfo);
 
             if (affectCount > 0) {
                 msgResult.setResult(true);