|
@@ -40,13 +40,15 @@ public class SampleLisController {
|
|
|
|
|
|
@Operation(summary = "获取检测指标")
|
|
|
@GetMapping("/target")
|
|
|
- public R<List<CheckItem>> getLisItem(@RequestParam(required = false) String name) {
|
|
|
- String sql = "select id, name, eng_name, unit from dbo.HT_DICT_ITEM where status=1 and type=0 %s order by id desc";
|
|
|
+ public R<List<CheckItem>> getLisItem(@RequestParam Long machineId,
|
|
|
+ @RequestParam(required = false) String name) {
|
|
|
+ String sql = "select di.id, di.name, mi.eng_name, mi.unit from dbo.HT_MACHINE_ITEM mi " +
|
|
|
+ "left join dbo.HT_DICT_ITEM di on mi.ITEM_ID = di.ID " +
|
|
|
+ "where mi.status=1 and mi.machine_id=" + machineId;
|
|
|
if (StrUtil.isNotBlank(name)) {
|
|
|
- sql = String.format(sql, "and name like '%" + name + "%'");
|
|
|
- } else {
|
|
|
- sql = String.format(sql, "");
|
|
|
+ sql += " and di.name like '%" + name + "%'";
|
|
|
}
|
|
|
+ sql += " order by mi.id desc";
|
|
|
List<Entity> entities = lisDb.query(sql);
|
|
|
List<CheckItem> checkItems = entities.stream()
|
|
|
.map(entity -> entity.toBeanWithCamelCase(new CheckItem()))
|