Commit cfb2b6d8 authored by 廖旭伟's avatar 廖旭伟

删除项目后删除项目数据

parent 072069f2
...@@ -4,9 +4,17 @@ import com.mortals.framework.exception.AppException; ...@@ -4,9 +4,17 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.goview.dao.GoviewProjectDao; import com.mortals.xhx.module.goview.dao.GoviewProjectDao;
import com.mortals.xhx.module.goview.model.GoviewProjectDataEntity;
import com.mortals.xhx.module.goview.model.GoviewProjectDataQuery;
import com.mortals.xhx.module.goview.model.GoviewProjectEntity; import com.mortals.xhx.module.goview.model.GoviewProjectEntity;
import com.mortals.xhx.module.goview.service.GoviewProjectDataService;
import com.mortals.xhx.module.goview.service.GoviewProjectService; import com.mortals.xhx.module.goview.service.GoviewProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/** /**
* GoviewProjectService * GoviewProjectService
* 项目 service实现 * 项目 service实现
...@@ -17,9 +25,26 @@ import org.springframework.stereotype.Service; ...@@ -17,9 +25,26 @@ import org.springframework.stereotype.Service;
@Service("goviewProjectService") @Service("goviewProjectService")
public class GoviewProjectServiceImpl extends AbstractCRUDServiceImpl<GoviewProjectDao, GoviewProjectEntity, Long> implements GoviewProjectService { public class GoviewProjectServiceImpl extends AbstractCRUDServiceImpl<GoviewProjectDao, GoviewProjectEntity, Long> implements GoviewProjectService {
@Autowired
private GoviewProjectDataService goviewProjectDataService;
@Override @Override
protected void saveBefore(GoviewProjectEntity entity, Context context) throws AppException { protected void saveBefore(GoviewProjectEntity entity, Context context) throws AppException {
this.validData(entity, context); this.validData(entity, context);
entity.setState(-1); entity.setState(-1);
} }
@Override
protected void removeAfter(Long[] ids, Context context, int result) throws AppException {
List<Long> projectIdList = new ArrayList<>();
for(Long id:ids){
projectIdList.add(id);
}
List<GoviewProjectDataEntity> list = goviewProjectDataService.find(new GoviewProjectDataQuery().projectIdList(projectIdList));
List<Long> dataIds = new ArrayList<>();
for(GoviewProjectDataEntity item:list){
dataIds.add(item.getId());
}
goviewProjectDataService.remove(dataIds.toArray(new Long[dataIds.size()]),context);
}
} }
\ No newline at end of file
...@@ -152,7 +152,6 @@ public class GoviewProjectAPi extends BaseJsonBodyController { ...@@ -152,7 +152,6 @@ public class GoviewProjectAPi extends BaseJsonBodyController {
} }
@PostMapping({"edit"}) @PostMapping({"edit"})
@RepeatSubmit
public String editNew(@RequestBody GoviewProjectEntity entity) { public String editNew(@RequestBody GoviewProjectEntity entity) {
Map<String, Object> model = new HashMap(); Map<String, Object> model = new HashMap();
Context context = this.getContext(); Context context = this.getContext();
...@@ -187,7 +186,6 @@ public class GoviewProjectAPi extends BaseJsonBodyController { ...@@ -187,7 +186,6 @@ public class GoviewProjectAPi extends BaseJsonBodyController {
} }
@PostMapping({"rename"}) @PostMapping({"rename"})
@RepeatSubmit
public String rename(@RequestBody GoviewProjectEntity entity) { public String rename(@RequestBody GoviewProjectEntity entity) {
Map<String, Object> model = new HashMap(); Map<String, Object> model = new HashMap();
Context context = this.getContext(); Context context = this.getContext();
...@@ -233,7 +231,6 @@ public class GoviewProjectAPi extends BaseJsonBodyController { ...@@ -233,7 +231,6 @@ public class GoviewProjectAPi extends BaseJsonBodyController {
* @return * @return
*/ */
@PostMapping({"publish"}) @PostMapping({"publish"})
@RepeatSubmit
public String publish(@RequestBody GoviewProjectEntity entity) { public String publish(@RequestBody GoviewProjectEntity entity) {
Map<String, Object> model = new HashMap(); Map<String, Object> model = new HashMap();
Context context = this.getContext(); Context context = this.getContext();
...@@ -278,7 +275,6 @@ public class GoviewProjectAPi extends BaseJsonBodyController { ...@@ -278,7 +275,6 @@ public class GoviewProjectAPi extends BaseJsonBodyController {
} }
@RequestMapping(value = {"getData"},method = {RequestMethod.GET}) @RequestMapping(value = {"getData"},method = {RequestMethod.GET})
@UnAuth
public Rest<Object> getData(Long projectId, ModelMap map) { public Rest<Object> getData(Long projectId, ModelMap map) {
Rest<Object> ret = new Rest(); Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap(); Map<String, Object> model = new HashMap();
...@@ -311,7 +307,6 @@ public class GoviewProjectAPi extends BaseJsonBodyController { ...@@ -311,7 +307,6 @@ public class GoviewProjectAPi extends BaseJsonBodyController {
} }
@PostMapping({"save/data"}) @PostMapping({"save/data"})
@RepeatSubmit
public String saveData(GoviewProjectDataEntity entity) { public String saveData(GoviewProjectDataEntity entity) {
Map<String, Object> model = new HashMap(); Map<String, Object> model = new HashMap();
Context context = this.getContext(); Context context = this.getContext();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment