1.编写属性文件参数
/boot-crm/config/crm.properties
customer_form_type=002
customer_industry_type=001
customer_level_type=004
2,想要控制层能够加载属性需要在Springmvc.xml中配置
<context:property-placeholder location=“classpath:crm.properties”/>
3.控制层中调用
/**
- 客户信息请求处理控制类
- @author lenovo
*/
@Controller
@RequestMapping(“customer”)
public class CustomerController {
@Autowired
private BaseDictService baseDictService;
@Value("${customer_form_type}")
private String customer_form_type;
@Value("${customer_industry_type}")
private String customer_industry_type;
@Value("${customer_level_type}")
private String customer_level_type;
@RequestMapping("list")
public String list(Model model ){
//查询来源
List<BaseDict> formType = baseDictService.getBaseDictByCode(customer_form_type);
for (BaseDict baseDict : formType) {
System.out.println(baseDict.getDict_item_name().toString());
}
//查询行业
List<BaseDict> industryType = baseDictService.getBaseDictByCode(customer_industry_type);
//查询级别
List<BaseDict> levelType = baseDictService.getBaseDictByCode(customer_level_type);
//设置数据模型返回
model.addAttribute("formType", formType);
model.addAttribute("industryType", industryType);
model.addAttribute("levelType", levelType);
return "customer/list";
}