controller:
@RestController
public class Data {
@Autowired
DataMapper dataMapper;
@GetMapping("/companysoftusage/{compname}")
//只返回查询出来的字段
public List<Map<String, Object>> getCompanySoftUsage(@PathVariable("compname") String compname) {
return dataMapper.getProgramUsageNumberByCompany( compname);
}
}
mapper:
@Mapper
public interface DataMapper {
@Select("select count(d.p) numbers, concat(d.n,'(v',REPLACE(REPLACE(d.v, ',', '.'),' ',''),')') as pname from d where d.c = #{compname} group by p ,n,v order by count(p) asc;")
public List<Map<String, Object>> getProgramUsageNumberByCompany(String compname);
}
获取多个变量
@RequestMapping("show5/{id}/{name}")
public String test5(@PathVariable("id") Long ids ,@PathVariable("name") String names) ;