项目对标管理下的项目评价项管理,事业部管理功能开发
This commit is contained in:
parent
49f54afd11
commit
5421489e6a
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
|
@ -10,6 +11,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|||
* @author ruoyi
|
||||
*/
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
@MapperScan("com.bonus.system.**.dao")
|
||||
public class BusinessApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@
|
|||
<groupId>com.bonus</groupId>
|
||||
<artifactId>bonus-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,115 @@
|
|||
package com.bonus.system.basic.controller;
|
||||
|
||||
import com.bonus.common.annotation.Log;
|
||||
import com.bonus.common.constant.UserConstants;
|
||||
import com.bonus.common.core.controller.BaseController;
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.common.enums.BusinessType;
|
||||
import com.bonus.common.utils.StringUtils;
|
||||
import com.bonus.system.basic.domain.EvaluativeItems;
|
||||
import com.bonus.system.basic.service.EvaluativeItemsService;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目评价项信息
|
||||
*
|
||||
* @author lsun
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("basic/pro/evalItem")
|
||||
public class EvaluativeItemsController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private EvaluativeItemsService evaluativeItemsService;
|
||||
|
||||
/**
|
||||
* 获取项目评价项列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('basic:pro:evalItem:list')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(EvaluativeItems o)
|
||||
{
|
||||
List<EvaluativeItems> bean = evaluativeItemsService.selectEvalItemList(o);
|
||||
return success(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目评价项列表的下拉选
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('basic:pro:evalItem:list')")
|
||||
@GetMapping("/getSelectList")
|
||||
public AjaxResult getSelectList(EvaluativeItems o)
|
||||
{
|
||||
List<EvaluativeItems> bean = evaluativeItemsService.getSelectList(o);
|
||||
return success(bean);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据项目评价项编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('basic:pro:evalItem:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable Long id)
|
||||
{
|
||||
return success(evaluativeItemsService.selectEvalItemById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增项目评价项
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('basic:pro:evalItem:add')")
|
||||
@Log(title = "项目评价项管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody EvaluativeItems o)
|
||||
{
|
||||
if (!evaluativeItemsService.checkEvalItemNameUnique(o))
|
||||
{
|
||||
return error("新增项目评价项'" + o.getEvalName() + "'失败,项目评价项名称已存在");
|
||||
}
|
||||
o.setCreateUser(getUserId());
|
||||
return toAjax(evaluativeItemsService.insertEvalItem(o));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目评价项
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('basic:pro:evalItem:edit')")
|
||||
@Log(title = "项目评价项管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody EvaluativeItems o)
|
||||
{
|
||||
Long id = o.getId();
|
||||
if (!evaluativeItemsService.checkEvalItemNameUnique(o))
|
||||
{
|
||||
return error("修改项目评价项'" + o.getEvalName() + "'失败,项目评价项名称已存在");
|
||||
}
|
||||
else if (o.getParentId().equals(id))
|
||||
{
|
||||
return error("修改项目评价项'" + o.getEvalName() + "'失败,上级项目评价项不能是自己");
|
||||
}
|
||||
o.setUpdateUser(getUserId());
|
||||
return toAjax(evaluativeItemsService.updateEvalItem(o));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除项目评价项
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('basic:pro:evalItem:remove')")
|
||||
@Log(title = "项目评价项管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult remove(@PathVariable Long id)
|
||||
{
|
||||
if (evaluativeItemsService.hasChildByEvalItemId(id))
|
||||
{
|
||||
return warn("存在下级项目评价项,不允许删除");
|
||||
}
|
||||
return toAjax(evaluativeItemsService.deleteEvalItemById(id));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
package com.bonus.system.basic.controller;
|
||||
|
||||
import com.bonus.common.annotation.Log;
|
||||
import com.bonus.common.core.controller.BaseController;
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.common.core.page.TableDataInfo;
|
||||
import com.bonus.common.enums.BusinessType;
|
||||
import com.bonus.system.basic.domain.ProUint;
|
||||
import com.bonus.system.basic.service.ProUintService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目事业部管理
|
||||
*
|
||||
* @author lsun
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("basic/pro/proUint")
|
||||
public class ProUintController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ProUintService proUintService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('basic:pro:proUint:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ProUint o)
|
||||
{
|
||||
startPage();
|
||||
List<ProUint> list = proUintService.selectProUintList(o);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询详细
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('basic:pro:proUint:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable Long id)
|
||||
{
|
||||
return success(proUintService.selectProUintById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('basic:pro:proUint:add')")
|
||||
@Log(title = "项目事业部管理-新增", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody ProUint o)
|
||||
{
|
||||
if (!proUintService.checkProUintUnique(o))
|
||||
{
|
||||
return error("新增项目事业部管理'" + o.getUnitName() + "'失败,已存在");
|
||||
}
|
||||
if(!proUintService.checkDeptSort(o)){
|
||||
return error("新增项目事业部管理排序'" + o.getDeptSort() + "'失败,已存在");
|
||||
}
|
||||
o.setCreateUser(getUserId());
|
||||
return toAjax(proUintService.insertProUint(o));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('basic:pro:proUint:edit')")
|
||||
@Log(title = "项目事业部管理-修改", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody ProUint o)
|
||||
{
|
||||
if (!proUintService.checkProUintUnique(o))
|
||||
{
|
||||
return error("修改项目事业部管理'" + o.getUnitName() + "'失败,已存在");
|
||||
}
|
||||
if(!proUintService.checkDeptSort(o)){
|
||||
return error("修改项目事业部管理排序'" + o.getDeptSort() + "'失败,已存在");
|
||||
}
|
||||
o.setUpdateUser(getUserId());
|
||||
return toAjax(proUintService.updateProUint(o));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('basic:pro:proUint:remove')")
|
||||
@Log(title = "项目事业部管理-删除", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult remove(@PathVariable Long id)
|
||||
{
|
||||
if(!proUintService.checkPro(id)){
|
||||
return error("删除项目事业部管理失败,已存在项目信息");
|
||||
}
|
||||
proUintService.deleteProUintById(id);
|
||||
return success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
package com.bonus.system.basic.dao;
|
||||
|
||||
import com.bonus.system.basic.domain.EvaluativeItems;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目评价项 数据层
|
||||
*
|
||||
* @author lsun
|
||||
*/
|
||||
|
||||
@Mapper
|
||||
public interface EvaluativeItemsMapper
|
||||
{
|
||||
/**
|
||||
* 查询项目评价项数据
|
||||
*
|
||||
* @param o 项目评价项信息
|
||||
* @return 项目评价项信息集合
|
||||
*/
|
||||
public List<EvaluativeItems> selectEvalItemList(EvaluativeItems o);
|
||||
|
||||
/**
|
||||
* 根据项目评价项ID查询信息
|
||||
*
|
||||
* @param id 项目评价项ID
|
||||
* @return 项目评价项信息
|
||||
*/
|
||||
public EvaluativeItems selectEvalItemById(Long id);
|
||||
|
||||
/**
|
||||
* 是否存在子节点
|
||||
*
|
||||
* @param id 项目评价项ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int hasChildByEvalItemId(Long id);
|
||||
|
||||
/**
|
||||
* 校验项目评价项名称是否唯一
|
||||
*
|
||||
* @param evalName 项目评价项名称
|
||||
* @param parentId 父项目评价项ID
|
||||
* @return 结果
|
||||
*/
|
||||
public EvaluativeItems checkEvalItemNameUnique(@Param("evalName") String evalName, @Param("parentId") Long parentId);
|
||||
|
||||
/**
|
||||
* 新增项目评价项信息
|
||||
*
|
||||
* @param o 项目评价项信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEvalItem(EvaluativeItems o);
|
||||
|
||||
/**
|
||||
* 修改项目评价项信息
|
||||
*
|
||||
* @param o 项目评价项信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEvalItem(EvaluativeItems o);
|
||||
|
||||
/**
|
||||
* 删除项目评价项管理信息
|
||||
*
|
||||
* @param id 项目评价项ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEvalItemById(Long id);
|
||||
|
||||
/**
|
||||
* 获取项目评价项列表的下拉选
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
List<EvaluativeItems> getSelectList(EvaluativeItems o);
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
package com.bonus.system.basic.dao;
|
||||
|
||||
import com.bonus.system.basic.domain.ProUint;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目事业部管理 数据层
|
||||
*
|
||||
* @author lsun
|
||||
*/
|
||||
public interface ProUintMapper
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询
|
||||
*
|
||||
* @param o 信息
|
||||
* @return 集合信息
|
||||
*/
|
||||
public List<ProUint> selectProUintList(ProUint o);
|
||||
|
||||
/**
|
||||
* 根据ID查询信息
|
||||
*
|
||||
* @param id ID
|
||||
* @return
|
||||
*/
|
||||
public ProUint selectProUintById(Long id);
|
||||
|
||||
/**
|
||||
* 通过ID删除信息
|
||||
*
|
||||
* @param id ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteProUintById(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 新增信息
|
||||
*
|
||||
* @param o 信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertProUint(ProUint o);
|
||||
|
||||
/**
|
||||
* 修改信息
|
||||
*
|
||||
* @param o 信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateProUint(ProUint o);
|
||||
|
||||
/**
|
||||
* 校验称是否唯一
|
||||
*
|
||||
* @param unitName
|
||||
* @return 结果
|
||||
*/
|
||||
public ProUint checkProUintUnique(String unitName);
|
||||
|
||||
/**
|
||||
* 校验是否存在项目信息
|
||||
*
|
||||
* @param id
|
||||
* @return 结果
|
||||
*/
|
||||
ProUint checkPro(Long id);
|
||||
|
||||
/**
|
||||
* 校验部门排序是否唯一
|
||||
* @param deptSort
|
||||
* @return
|
||||
*/
|
||||
ProUint checkDeptSort(Integer deptSort);
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.bonus.system.basic.domain;
|
||||
|
||||
import com.bonus.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* 项目评价项表 tb_project_eval_item
|
||||
*
|
||||
* @author lsun
|
||||
*/
|
||||
@Data
|
||||
public class EvaluativeItems extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
/** 创建者 */
|
||||
private Long createUser;
|
||||
/** 更新者 */
|
||||
private Long updateUser;
|
||||
|
||||
/** 父部门ID */
|
||||
private Long parentId;
|
||||
|
||||
/** 分值 */
|
||||
private BigDecimal score;
|
||||
|
||||
/** 名称 */
|
||||
private String evalName;
|
||||
|
||||
/** 节点等级 */
|
||||
private Integer leve;
|
||||
|
||||
/** 删除标志(0代表存在 1代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.bonus.system.basic.domain;
|
||||
|
||||
import com.bonus.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* 项目事业部管理表 tb_project_uint
|
||||
*
|
||||
* @author lsun
|
||||
*/
|
||||
@Data
|
||||
public class ProUint extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
/** 创建者 */
|
||||
private Long createUser;
|
||||
/** 更新者 */
|
||||
private Long updateUser;
|
||||
|
||||
/** 事业部名称 */
|
||||
private String unitName;
|
||||
|
||||
/** 排序 */
|
||||
private Integer deptSort;
|
||||
|
||||
/** 删除标志(0代表存在 1代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
package com.bonus.system.basic.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.bonus.common.core.domain.TreeSelect;
|
||||
import com.bonus.system.basic.domain.EvaluativeItems;
|
||||
|
||||
/**
|
||||
* 项目评价管理 服务层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface EvaluativeItemsService
|
||||
{
|
||||
/**
|
||||
* 查询项目评价管理数据
|
||||
*
|
||||
* @param o 项目评价信息
|
||||
* @return 项目评价信息集合
|
||||
*/
|
||||
public List<EvaluativeItems> selectEvalItemList(EvaluativeItems o);
|
||||
|
||||
|
||||
/**
|
||||
* 根据项目评价ID查询信息
|
||||
*
|
||||
* @param id 项目评价ID
|
||||
* @return 项目评价信息
|
||||
*/
|
||||
public EvaluativeItems selectEvalItemById(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 是否存在项目评价子节点
|
||||
*
|
||||
* @param id 项目评价ID
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean hasChildByEvalItemId(Long id);
|
||||
|
||||
/**
|
||||
* 校验项目评价名称是否唯一
|
||||
*
|
||||
* @param o 项目评价信息
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkEvalItemNameUnique(EvaluativeItems o);
|
||||
|
||||
/**
|
||||
* 新增保存项目评价信息
|
||||
*
|
||||
* @param o 项目评价信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEvalItem(EvaluativeItems o);
|
||||
|
||||
/**
|
||||
* 修改保存项目评价信息
|
||||
*
|
||||
* @param o 项目评价信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEvalItem(EvaluativeItems o);
|
||||
|
||||
/**
|
||||
* 删除项目评价管理信息
|
||||
*
|
||||
* @param id 项目评价ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEvalItemById(Long id);
|
||||
|
||||
/**
|
||||
* 获取项目评价项列表的下拉选
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
List<EvaluativeItems> getSelectList(EvaluativeItems o);
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
package com.bonus.system.basic.service;
|
||||
|
||||
import com.bonus.system.basic.domain.ProUint;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目事业部管理 业务层
|
||||
*
|
||||
* @author lsun
|
||||
*/
|
||||
public interface ProUintService
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询
|
||||
*
|
||||
* @param o 信息
|
||||
* @return 集合信息
|
||||
*/
|
||||
public List<ProUint> selectProUintList(ProUint o);
|
||||
|
||||
/**
|
||||
* 根据ID查询信息
|
||||
*
|
||||
* @param id ID
|
||||
* @return
|
||||
*/
|
||||
public ProUint selectProUintById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除信息
|
||||
*
|
||||
* @param id 需要删除的ID
|
||||
*/
|
||||
public void deleteProUintById(Long id);
|
||||
|
||||
/**
|
||||
* 新增保存信息
|
||||
*
|
||||
* @param o 信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertProUint(ProUint o);
|
||||
|
||||
/**
|
||||
* 修改保存信息
|
||||
*
|
||||
* @param o 信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateProUint(ProUint o);
|
||||
|
||||
/**
|
||||
* 校验称是否唯一
|
||||
*
|
||||
* @param o
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkProUintUnique(ProUint o);
|
||||
|
||||
/**
|
||||
* 校验是否存在项目信息
|
||||
*/
|
||||
public boolean checkPro(Long id);
|
||||
|
||||
/**
|
||||
* 校验部门排序是否唯一
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
public boolean checkDeptSort(ProUint o);
|
||||
}
|
||||
|
|
@ -0,0 +1,167 @@
|
|||
package com.bonus.system.basic.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.bonus.system.basic.dao.EvaluativeItemsMapper;
|
||||
import com.bonus.system.basic.domain.EvaluativeItems;
|
||||
import com.bonus.system.basic.service.EvaluativeItemsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.common.annotation.DataScope;
|
||||
import com.bonus.common.constant.UserConstants;
|
||||
import com.bonus.common.core.domain.entity.SysUser;
|
||||
import com.bonus.common.exception.ServiceException;
|
||||
import com.bonus.common.utils.SecurityUtils;
|
||||
import com.bonus.common.utils.StringUtils;
|
||||
import com.bonus.common.utils.spring.SpringUtils;
|
||||
import com.bonus.system.mapper.SysRoleMapper;
|
||||
|
||||
/**
|
||||
* 项目评价管理 服务实现
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class EvaluativeItemsServiceImpl implements EvaluativeItemsService
|
||||
{
|
||||
@Autowired
|
||||
private EvaluativeItemsMapper evaluativeItemsMapper;
|
||||
|
||||
@Autowired
|
||||
private SysRoleMapper roleMapper;
|
||||
|
||||
/**
|
||||
* 查询项目评价管理数据
|
||||
*
|
||||
* @param dept 项目评价信息
|
||||
* @return 项目评价信息集合
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d")
|
||||
public List<EvaluativeItems> selectEvalItemList(EvaluativeItems dept)
|
||||
{
|
||||
return evaluativeItemsMapper.selectEvalItemList(dept);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据项目评价ID查询信息
|
||||
*
|
||||
* @param id 项目评价ID
|
||||
* @return 项目评价信息
|
||||
*/
|
||||
@Override
|
||||
public EvaluativeItems selectEvalItemById(Long id)
|
||||
{
|
||||
return evaluativeItemsMapper.selectEvalItemById(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 是否存在子节点
|
||||
*
|
||||
* @param id 项目评价ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean hasChildByEvalItemId(Long id)
|
||||
{
|
||||
int result = evaluativeItemsMapper.hasChildByEvalItemId(id);
|
||||
return result > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验项目评价名称是否唯一
|
||||
*
|
||||
* @param dept 项目评价信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean checkEvalItemNameUnique(EvaluativeItems dept)
|
||||
{
|
||||
Long id = StringUtils.isNull(dept.getId()) ? -1L : dept.getId();
|
||||
EvaluativeItems info = evaluativeItemsMapper.checkEvalItemNameUnique(dept.getEvalName(), dept.getParentId());
|
||||
if (StringUtils.isNotNull(info) && info.getId().longValue() != id.longValue())
|
||||
{
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存项目评价信息
|
||||
*
|
||||
* @param dept 项目评价信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEvalItem(EvaluativeItems dept)
|
||||
{
|
||||
return evaluativeItemsMapper.insertEvalItem(dept);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存项目评价信息
|
||||
*
|
||||
* @param dept 项目评价信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateEvalItem(EvaluativeItems dept)
|
||||
{
|
||||
EvaluativeItems newParentDept = evaluativeItemsMapper.selectEvalItemById(dept.getParentId());
|
||||
EvaluativeItems oldDept = evaluativeItemsMapper.selectEvalItemById(dept.getId());
|
||||
int result = evaluativeItemsMapper.updateEvalItem(dept);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除项目评价管理信息
|
||||
*
|
||||
* @param id 项目评价ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEvalItemById(Long id)
|
||||
{
|
||||
return evaluativeItemsMapper.deleteEvalItemById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目评价项列表的下拉选
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<EvaluativeItems> getSelectList(EvaluativeItems o) {
|
||||
return evaluativeItemsMapper.getSelectList( o);
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到子节点列表
|
||||
*/
|
||||
private List<EvaluativeItems> getChildList(List<EvaluativeItems> list, EvaluativeItems t)
|
||||
{
|
||||
List<EvaluativeItems> tlist = new ArrayList<EvaluativeItems>();
|
||||
Iterator<EvaluativeItems> it = list.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
EvaluativeItems n = (EvaluativeItems) it.next();
|
||||
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getId().longValue())
|
||||
{
|
||||
tlist.add(n);
|
||||
}
|
||||
}
|
||||
return tlist;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否有子节点
|
||||
*/
|
||||
private boolean hasChild(List<EvaluativeItems> list, EvaluativeItems t)
|
||||
{
|
||||
return getChildList(list, t).size() > 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
package com.bonus.system.basic.service.impl;
|
||||
|
||||
import com.bonus.common.constant.UserConstants;
|
||||
import com.bonus.common.utils.StringUtils;
|
||||
import com.bonus.system.basic.dao.ProUintMapper;
|
||||
import com.bonus.system.basic.domain.ProUint;
|
||||
import com.bonus.system.basic.service.ProUintService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目事业部管理 业务层处理
|
||||
*
|
||||
* @author lsun
|
||||
*/
|
||||
@Service
|
||||
public class ProUintServiceImpl implements ProUintService
|
||||
{
|
||||
@Autowired
|
||||
private ProUintMapper proUintMapper;
|
||||
|
||||
/**
|
||||
* 根据条件分页查询类型
|
||||
*
|
||||
* @param dictType 类型信息
|
||||
* @return 类型集合信息
|
||||
*/
|
||||
@Override
|
||||
public List<ProUint> selectProUintList(ProUint dictType)
|
||||
{
|
||||
return proUintMapper.selectProUintList(dictType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据类型ID查询信息
|
||||
*
|
||||
* @param dictId 类型ID
|
||||
* @return 类型
|
||||
*/
|
||||
@Override
|
||||
public ProUint selectProUintById(Long dictId)
|
||||
{
|
||||
return proUintMapper.selectProUintById(dictId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除类型信息
|
||||
*
|
||||
* @param id 需要删除的ID
|
||||
*/
|
||||
@Override
|
||||
public void deleteProUintById(Long id)
|
||||
{
|
||||
proUintMapper.deleteProUintById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存类型信息
|
||||
*
|
||||
* @param o 类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertProUint(ProUint o)
|
||||
{
|
||||
int row = proUintMapper.insertProUint(o);
|
||||
return row;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存类型信息
|
||||
*
|
||||
* @param o 类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int updateProUint(ProUint o)
|
||||
{
|
||||
int row = proUintMapper.updateProUint(o);
|
||||
return row;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验类型称是否唯一
|
||||
*
|
||||
* @param o 类型
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean checkProUintUnique(ProUint o)
|
||||
{
|
||||
Long id = StringUtils.isNull(o.getId()) ? -1L : o.getId();
|
||||
ProUint unitName = proUintMapper.checkProUintUnique(o.getUnitName());
|
||||
if (StringUtils.isNotNull(unitName) && unitName.getId().longValue() != id.longValue())
|
||||
{
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验是否存在项目信息
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public boolean checkPro(Long id)
|
||||
{
|
||||
ProUint o = proUintMapper.checkPro(id);
|
||||
if (StringUtils.isNotNull(o))
|
||||
{
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验部门排序是否唯一
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public boolean checkDeptSort(ProUint o) {
|
||||
Long id = StringUtils.isNull(o.getId()) ? -1L : o.getId();
|
||||
ProUint bean = proUintMapper.checkDeptSort(o.getDeptSort());
|
||||
if (StringUtils.isNotNull(bean) && bean.getId().longValue() != id.longValue())
|
||||
{
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.system.basic.dao.EvaluativeItemsMapper">
|
||||
|
||||
<sql id="selectEvaluativeItems">
|
||||
SELECT id,eval_name as evalName, parent_id as parentId,
|
||||
score, leve,
|
||||
create_time as createTime, create_user as createBy, update_time as updateTime,update_user as updateBy
|
||||
FROM tb_project_eval_item
|
||||
</sql>
|
||||
|
||||
<insert id="insertEvalItem">
|
||||
insert into tb_project_eval_item(
|
||||
<if test="evalName != null and evalName != '' ">eval_name,</if>
|
||||
<if test="parentId != null ">parent_id,</if>
|
||||
<if test="score != null and score != ''">score,</if>
|
||||
<if test="leve != null and leve != ''">leve,</if>
|
||||
<if test="createUser != null">create_user,</if>
|
||||
create_time,del_flag
|
||||
)values(
|
||||
<if test="evalName != null and evalName != ''">#{evalName},</if>
|
||||
<if test="parentId != null">#{parentId},</if>
|
||||
<if test="score != null and score != ''">#{score},</if>
|
||||
<if test="leve != null and leve != ''">#{leve},</if>
|
||||
<if test="createUser != null ">#{createUser},</if>
|
||||
sysdate(),'0'
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateEvalItem">
|
||||
update tb_project_eval_item
|
||||
<set>
|
||||
<if test="evalName != null and evalName != ''">eval_name = #{evalName},</if>
|
||||
<if test="parentId != null ">parent_id = #{parentId},</if>
|
||||
<if test="score != null and score != ''">score = #{score},</if>
|
||||
<if test="leve != null and leve != ''">leve = #{leve},</if>
|
||||
<if test="updateUser != null ">update_user = #{updateUser},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteEvalItemById">
|
||||
update tb_project_eval_item set del_flag = '1' where id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="selectEvalItemList" resultType="com.bonus.system.basic.domain.EvaluativeItems">
|
||||
<include refid="selectEvaluativeItems"/>
|
||||
WHERE del_flag = '0'
|
||||
<if test="evalName != null and evalName != ''">
|
||||
and eval_name like concat('%',#{evalName},'%')
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectEvalItemById" resultType="com.bonus.system.basic.domain.EvaluativeItems">
|
||||
<include refid="selectEvaluativeItems"/>
|
||||
WHERE del_flag = '0'
|
||||
AND id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="hasChildByEvalItemId" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*)
|
||||
FROM tb_project_eval_item
|
||||
WHERE del_flag = '0' AND parent_id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="checkEvalItemNameUnique" resultType="com.bonus.system.basic.domain.EvaluativeItems">
|
||||
<include refid="selectEvaluativeItems"/>
|
||||
where eval_name=#{evalName} and parent_id = #{parentId} and del_flag = '0' limit 1
|
||||
</select>
|
||||
|
||||
<select id="getSelectList" resultType="com.bonus.system.basic.domain.EvaluativeItems">
|
||||
SELECT id, eval_name AS evalName
|
||||
FROM tb_project_eval_item
|
||||
WHERE del_flag ='0' AND parent_id = '0'
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.system.basic.dao.ProUintMapper">
|
||||
|
||||
<sql id="selectProUintLVo">
|
||||
SELECT id,
|
||||
unit_name as unitName,
|
||||
dept_sort as deptSort,
|
||||
create_time as createTime,
|
||||
create_user as createUser,
|
||||
update_time as updateTime,
|
||||
update_user as updateUser,
|
||||
del_flag as delFlag
|
||||
FROM tb_project_uint
|
||||
</sql>
|
||||
<insert id="insertProUint">
|
||||
insert into tb_project_uint(
|
||||
<if test="unitName != null and unitName != ''">unit_name,</if>
|
||||
<if test="deptSort != null">dept_sort,</if>
|
||||
<if test="createUser != null">create_user,</if>
|
||||
create_time,del_flag
|
||||
)values(
|
||||
<if test="unitName != null and unitName != ''">#{unitName},</if>
|
||||
<if test="deptSort != null">#{deptSort},</if>
|
||||
<if test="createUser != null">#{createUser},</if>
|
||||
sysdate(),'0'
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateProUint">
|
||||
update tb_project_uint
|
||||
<set>
|
||||
<if test="unitName != null and unitName != ''">unit_name = #{unitName},</if>
|
||||
<if test="deptSort != null">dept_sort = #{deptSort},</if>
|
||||
<if test="updateUser != null">update_user = #{updateUser},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteProUintById">
|
||||
update tb_project_uint set del_flag = '1' where id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="selectProUintList" resultType="com.bonus.system.basic.domain.ProUint">
|
||||
<include refid="selectProUintLVo"/>
|
||||
where del_flag = '0'
|
||||
<if test="unitName != null and unitName != ''">
|
||||
AND unit_name like concat('%', #{unitName}, '%')
|
||||
</if>
|
||||
ORDER BY dept_sort desc
|
||||
</select>
|
||||
|
||||
<select id="selectProUintById" resultType="com.bonus.system.basic.domain.ProUint">
|
||||
<include refid="selectProUintLVo"/>
|
||||
where del_flag = '0' and id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="checkProUintUnique" resultType="com.bonus.system.basic.domain.ProUint">
|
||||
<include refid="selectProUintLVo"/>
|
||||
where del_flag = '0' and unit_name = #{unitName}
|
||||
</select>
|
||||
|
||||
<select id="checkPro" resultType="com.bonus.system.basic.domain.ProUint">
|
||||
SELECT * FROM tb_project
|
||||
WHERE del_flag = '0' AND unit_id = #{id} limit 1
|
||||
</select>
|
||||
|
||||
<select id="checkDeptSort" resultType="com.bonus.system.basic.domain.ProUint">
|
||||
<include refid="selectProUintLVo"/>
|
||||
where del_flag = '0' and dept_sort = #{deptSort}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue