| | |
| | | import com.vci.ubcs.omd.service.IBtmTypeService; |
| | | import com.vci.ubcs.omd.vo.BtmTypeVO; |
| | | import com.vci.ubcs.omd.wrapper.BtmTypeWrapper; |
| | | import com.vci.ubcs.starter.web.pagemodel.BaseQueryObject; |
| | | import com.vci.ubcs.starter.web.pagemodel.PageHelper; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.cglib.beans.BeanMap; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | |
| | | |
| | | private final IBtmTypeService btmTypeService; |
| | | |
| | | private final String DOMAIN = "domain"; |
| | | |
| | | |
| | | /** |
| | | * 参照获取业务类型详情信息 |
| | |
| | | /** |
| | | * 参照列表查询 |
| | | * |
| | | * @param condition 查询条件 |
| | | * @param query 分页条件 |
| | | * @param domain 领域值 |
| | | * @param baseQueryObject 查询条件对象 |
| | | * @return 查询结果 |
| | | */ |
| | | @Override |
| | | @GetMapping(GET_REF_PAGE) |
| | | public R<IPage<BtmTypeVO>> getRefPage(Map<String, Object> condition, Query query, String domain) { |
| | | Func.requireNotNull(domain,"领域值"); |
| | | IPage<BtmType> page = btmTypeService.page(Condition.getPage(query), Condition.getQueryWrapper(condition, BtmType.class).lambda().eq(BtmType::getDomain, domain).orderByAsc(BtmType::getId)); |
| | | @PostMapping(GET_REF_PAGE) |
| | | public R<IPage<BtmTypeVO>> getRefPage(BaseQueryObject baseQueryObject) { |
| | | Map<String, String> conditionMap = baseQueryObject.getConditionMap(); |
| | | if (conditionMap == null){ |
| | | conditionMap = new HashMap<>(16); |
| | | } |
| | | if (!conditionMap.containsKey(DOMAIN)){ |
| | | return R.fail("领域值不能为空"); |
| | | } |
| | | PageHelper pageHelper = baseQueryObject.getPageHelper(); |
| | | if (pageHelper == null){ |
| | | pageHelper = new PageHelper(-1); |
| | | } |
| | | String domainValue = conditionMap.get(DOMAIN); |
| | | VciBaseUtil.alertNotNull(domainValue,"领域值"); |
| | | conditionMap.remove(DOMAIN); |
| | | BtmType queryObj = new BtmType(); |
| | | BeanMap.create(queryObj).putAll(conditionMap); |
| | | Query query = new Query(); |
| | | query.setSize(pageHelper.getLimit()); |
| | | query.setCurrent(pageHelper.getPage()); |
| | | IPage<BtmType> page = btmTypeService.page(Condition.getPage(query), Condition.getQueryWrapper(queryObj).lambda().eq(BtmType::getDomain, domainValue).orderByAsc(BtmType::getId)); |
| | | IPage<BtmTypeVO> pageVO = new Page<>(); |
| | | BeanUtil.copy(page,pageVO); |
| | | pageVO.setRecords(BtmTypeWrapper.build().listEntityVO(page.getRecords())); |
| | |
| | | |
| | | /** |
| | | * 参照列表查询 |
| | | * |
| | | * @param condition 查询条件 |
| | | * @param domain 领域值 |
| | | * @param baseQueryObject 查询条件对象 |
| | | * @return 查询结果 |
| | | */ |
| | | @Override |
| | | @GetMapping(GET_REF) |
| | | public R<List<BtmTypeVO>> getRef(Map<String, Object> condition, String domain) { |
| | | Func.requireNotNull(domain,"领域值"); |
| | | List<BtmType> list = btmTypeService.list(Condition.getQueryWrapper(condition, BtmType.class).lambda().eq(BtmType::getDomain, domain).orderByAsc(BtmType::getId)); |
| | | @PostMapping(GET_REF) |
| | | public R<List<BtmTypeVO>> getRef(BaseQueryObject baseQueryObject) { |
| | | Map<String, String> conditionMap = baseQueryObject.getConditionMap(); |
| | | if (conditionMap == null){ |
| | | conditionMap = new HashMap<>(16); |
| | | } |
| | | if (!conditionMap.containsKey(DOMAIN)){ |
| | | return R.fail("领域值不能为空"); |
| | | } |
| | | String domainValue = conditionMap.get(DOMAIN); |
| | | VciBaseUtil.alertNotNull(domainValue,"领域值"); |
| | | conditionMap.remove(DOMAIN); |
| | | BtmType queryObj = new BtmType(); |
| | | BeanMap.create(queryObj).putAll(conditionMap); |
| | | List<BtmType> list = btmTypeService.list(Condition.getQueryWrapper(queryObj).lambda().eq(BtmType::getDomain, domainValue).orderByAsc(BtmType::getId)); |
| | | return R.data(BtmTypeWrapper.build().listEntityVO(list)); |
| | | } |
| | | |
| | |
| | | * @return 业务对象 |
| | | */ |
| | | @Override |
| | | @GetMapping(GET_BY_IDS) |
| | | @PostMapping(GET_BY_IDS) |
| | | public R<List<BtmTypeVO>> selectByIdCollection(List<String> ids) { |
| | | Func.requireNotNull(ids,"业务类型英文名称"); |
| | | List<BtmTypeVO> voList = BtmTypeWrapper.build().listEntityVO( |
| | |
| | | * @return 业务类型列表,如果有不存在的不会返回,全部不存在的则返回空列表 |
| | | */ |
| | | @Override |
| | | @GetMapping(GET_BY_OIDS) |
| | | public R<List<BtmTypeVO>> listBtmTypeByOidCollection(Collection<String> pkBtmTypeCollection) { |
| | | @PostMapping(GET_BY_OIDS) |
| | | public R<List<BtmTypeVO>> listBtmTypeByOidCollection(List<String> pkBtmTypeCollection) { |
| | | Func.requireNotNull(pkBtmTypeCollection,"业务类型主键"); |
| | | List<BtmTypeVO> voList = BtmTypeWrapper.build().listEntityVO( |
| | | Optional.ofNullable(btmTypeService.list( |