|
|
|
@ -1,17 +1,21 @@ |
|
|
|
|
package org.jeecg.modules.demo.projectType.controller; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions; |
|
|
|
|
import org.jeecg.common.api.vo.Result; |
|
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog; |
|
|
|
|
import org.jeecg.common.system.base.controller.JeecgController; |
|
|
|
|
import org.jeecg.common.system.query.QueryGenerator; |
|
|
|
|
import org.jeecg.modules.demo.annual.entity.Annual; |
|
|
|
|
import org.jeecg.modules.demo.annual.service.IAnnualService; |
|
|
|
|
import org.jeecg.modules.demo.projectType.entity.ProjectType; |
|
|
|
|
import org.jeecg.modules.demo.projectType.service.IProjectTypeService; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
@ -21,6 +25,7 @@ import org.springframework.web.servlet.ModelAndView; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @Description: 项目类型 |
|
|
|
@ -36,6 +41,9 @@ public class ProjectTypeController extends JeecgController<ProjectType, IProject |
|
|
|
|
@Autowired |
|
|
|
|
private IProjectTypeService projectTypeService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private IAnnualService iAnnualService; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 分页列表查询 |
|
|
|
|
* |
|
|
|
@ -70,6 +78,10 @@ public class ProjectTypeController extends JeecgController<ProjectType, IProject |
|
|
|
|
@PostMapping(value = "/add") |
|
|
|
|
public Result<String> add(@RequestBody ProjectType projectType) { |
|
|
|
|
projectType.setStatus(projectType.getStatus_dictText()); |
|
|
|
|
if (StrUtil.isNotBlank(projectType.getAnnualId())) { |
|
|
|
|
Annual annual = iAnnualService.getById(projectType.getAnnualId()); |
|
|
|
|
projectType.setAnnualName(annual.getAnnualName()); |
|
|
|
|
} |
|
|
|
|
projectTypeService.save(projectType); |
|
|
|
|
return Result.OK("添加成功!"); |
|
|
|
|
} |
|
|
|
@ -86,9 +98,13 @@ public class ProjectTypeController extends JeecgController<ProjectType, IProject |
|
|
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) |
|
|
|
|
public Result<String> edit(@RequestBody ProjectType projectType) { |
|
|
|
|
projectType.setStatus(projectType.getStatus_dictText()); |
|
|
|
|
if(projectType.getStatus().equals("0")){ |
|
|
|
|
if (projectType.getStatus().equals("0")) { |
|
|
|
|
projectType.setAnnualId(""); |
|
|
|
|
} |
|
|
|
|
if (StrUtil.isNotBlank(projectType.getAnnualId())) { |
|
|
|
|
Annual annual = iAnnualService.getById(projectType.getAnnualId()); |
|
|
|
|
projectType.setAnnualName(annual.getAnnualName()); |
|
|
|
|
} |
|
|
|
|
projectTypeService.updateById(projectType); |
|
|
|
|
return Result.OK("编辑成功!"); |
|
|
|
|
} |
|
|
|
@ -148,6 +164,12 @@ public class ProjectTypeController extends JeecgController<ProjectType, IProject |
|
|
|
|
return Result.OK(projectType); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/getProjectTypeList") |
|
|
|
|
public Result<List<ProjectType>> getProjectTypeList() { |
|
|
|
|
List<ProjectType> list = projectTypeService.list(new LambdaQueryWrapper<ProjectType>().eq(ProjectType::getStatus, "1")); |
|
|
|
|
return Result.OK(list); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 导出excel |
|
|
|
|
* |
|
|
|
|