| | |
| | | package com.vci.web.controller; |
| | | |
| | | import com.vci.dto.OsEnumDTO; |
| | | import com.vci.starter.web.annotation.controller.VciUnCheckRight; |
| | | import com.vci.starter.web.annotation.log.VciBusinessLog; |
| | | import com.vci.starter.web.pagemodel.BaseQueryObject; |
| | |
| | | import com.vci.pagemodel.KeyValue; |
| | | import com.vci.pagemodel.OsEnumItemVO; |
| | | import com.vci.pagemodel.OsEnumVO; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | | import com.vci.web.service.OsEnumServiceI; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | private OsEnumServiceI enumService; |
| | | |
| | | /** |
| | | * 日志 |
| | | */ |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | /** |
| | | * 获取枚举的下拉框 |
| | | * @param comboxKey 枚举的名称 |
| | | * @return 枚举的下拉值 |
| | |
| | | return BaseResult.success(enumService.getEnum(comboxKey)); |
| | | } |
| | | |
| | | /** |
| | | * 参照枚举列表 |
| | | * @param baseQueryObject 查询条件 |
| | | * @return 列表的内容 |
| | | */ |
| | | @GetMapping( "/referDataGrid") |
| | | @VciBusinessLog(operateName = "参照枚举列表") |
| | | public DataGrid<OsEnumVO> referDataGrid(BaseQueryObject baseQueryObject){ |
| | | return enumService.referDataGrid(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); |
| | | } |
| | | |
| | | /** |
| | | * 获取枚举的明细 |
| | | * @param pkEnum 枚举的主键 |
| | | * @return 枚举的选项 |
| | | */ |
| | | @GetMapping("/gridEnumItemByOid") |
| | | @VciBusinessLog(operateName = "获取枚举的明细") |
| | | public DataGrid<OsEnumItemVO> gridEnumItemByOid(String pkEnum){ |
| | | return enumService.gridEnumItemByOid(pkEnum); |
| | | } |
| | | |
| | | /** |
| | | * 获取数据的密级 |
| | |
| | | |
| | | /** |
| | | * 枚举列表 |
| | | * @param baseQueryObject 查询条件 |
| | | * @param enumName 查询条件name |
| | | * @return 列表的内容 |
| | | */ |
| | | @GetMapping( "/gridEnum") |
| | | @GetMapping( "/getEnumTypeList") |
| | | @VciBusinessLog(operateName = "枚举列表") |
| | | public DataGrid<OsEnumVO> gridEnum(BaseQueryObject baseQueryObject){ |
| | | return enumService.referDataGrid(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); |
| | | @VciUnCheckRight |
| | | public BaseResult<List<OsEnumVO>> getEnumTypeList(String enumName) { |
| | | try { |
| | | return BaseResult.dataList(enumService.getEnumTypeList(enumName)); |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "枚举管理列表查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取枚举的明细 |
| | | * @param pkEnum 枚举的主键 |
| | | * @return 枚举的选项 |
| | | * 添加单条枚举 |
| | | * @param osEnumDTO |
| | | * @return 列表的内容 |
| | | */ |
| | | @GetMapping("/gridEnumItemByOid") |
| | | @VciBusinessLog(operateName = "获取枚举的明细") |
| | | public DataGrid<OsEnumItemVO> gridEnumItemByOid(String pkEnum){ |
| | | return enumService.gridEnumItemByOid(pkEnum); |
| | | @PostMapping( "/addEnumType") |
| | | @VciBusinessLog(operateName = "添加枚举") |
| | | @VciUnCheckRight |
| | | public BaseResult addEnumType(@RequestBody OsEnumDTO osEnumDTO) { |
| | | try { |
| | | return enumService.addEnumType(osEnumDTO) ? BaseResult.success("枚举类型添加成功!"):BaseResult.fail("枚举类型添加失败!"); |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "增加枚举类型时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 修改单条枚举(带修改枚举项功能) |
| | | * @param osEnumDTO |
| | | * @return 列表的内容 |
| | | */ |
| | | @PutMapping( "/updateEnumType") |
| | | @VciBusinessLog(operateName = "修改枚举") |
| | | @VciUnCheckRight |
| | | public BaseResult updateEnumType(@RequestBody OsEnumDTO osEnumDTO) { |
| | | try { |
| | | return enumService.updateEnumType(osEnumDTO) ? BaseResult.success("枚举类型修改成功!"):BaseResult.fail("枚举类型修改失败!"); |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "修改枚举类型时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除枚举 |
| | | * @param osEnumDTOS |
| | | * @return 列表的内容 |
| | | */ |
| | | @DeleteMapping( "/deleteEnumTypes") |
| | | @VciBusinessLog(operateName = "删除枚举") |
| | | @VciUnCheckRight |
| | | public BaseResult deleteEnumTypes(@RequestBody List<OsEnumDTO> osEnumDTOS) { |
| | | try { |
| | | return enumService.deleteEnumTypes(osEnumDTOS) ? BaseResult.success("枚举类型删除成功!"):BaseResult.fail("枚举类型删除失败!"); |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "删除枚举类型时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查看枚举的使用范围 |
| | | * @param enumName |
| | | * @return 列表的内容 |
| | | */ |
| | | @GetMapping( "/getUsedEnumList") |
| | | @VciBusinessLog(operateName = "查看枚举的使用范围") |
| | | @VciUnCheckRight |
| | | public BaseResult getUsedEnumList(String enumName) { |
| | | try { |
| | | return BaseResult.dataList(enumService.getUsedEnumList(enumName)); |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "获取枚举的使用范围时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | } |