controller:
private ResponseDTO buildResponse(HttpServletRequest request, MaterialSearchParameter param, String responseMessage) throws Exception { Map<String, Object> tokenMap = this.tokenUtils.getTokenMap(request); String tokenCompanyCode = MapUtils.getString(tokenMap, TokenConstants.COMPANY_CODE, ""); param.setCompanyCode(tokenCompanyCode); PageInfo<Material> searchPage = this.materialService.listMaterial(param); Map<String, Object> dropDown = this.buildDropDownMap(tokenCompanyCode); Map<String, Object> resultMap = new HashMap<>(); resultMap.put(Constants.CONSOLE_SEARCH_PAGE, searchPage); resultMap.put("dropDown", dropDown); return ResponseDTO.createBySuccessMessageData("", responseMessage, resultMap); } private Map<String, Object> buildDropDownMap(String tokenCompanyCode) { Map<String, Object> dropDownMap = new HashMap<>(); List<Map<String, Object>> factoryList = this.factoryMasterService.dropDownList(); List<Map<String, Object>> destinationList = this.originMasterService.dropDownList(tokenCompanyCode); dropDownMap.put("factoryList", factoryList); dropDownMap.put("destinationList", destinationList); return dropDownMap; }
service:
public List<Map<String, Object>> dropDownList() { return this.factoryMasterMapper.dropDownList(); }
mapper:
List<Map<String, Object>> dropDownList();
xml:
<select id="dropDownList" resultType="java.util.HashMap" parameterType="Object">
select m33ftycod "code", m33ftycod "value", m33lngengdsc "factoryEngDesc", m33lngchidsc "factoryChiDesc" from mem33
</select>
angular页面:
service.ts:
/** Properties */
dropDown = {
factoryList: [],
};
html:
<span [formGroupName]="index"> <mat-select [(value)]="element.origin" formControlName="origin" style="min-width: 50px"> <mat-option value="Undef.">Undef.</mat-option> <mat-option [value]="option.code" *ngFor="let option of mrService.dropDown.factoryList"> {{option.value}} </mat-option> </mat-select> </span>