属性文件抽取

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";
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值