笔记
作者:互联网
1、登录笔记:
User user = this.getUser();
Set<String> stationIds = this.getStationIds(user);
2、sql拼接:
@Override
public JSONObject listDeviceByIds(IdsForm idsForm, Set<String> stationIds, String userId) {
StringBuffer sql = new StringBuffer();
sql.append("select d.s_id, d.s_name , d.s_device_code,dc.s_name as dc_name, sd.s_station_name, ");
sql.append(" srd.s_name as srd_name,d.s_address,d.d_enable_date,d.d_warranty_end_date, d.i_status ");
sql.append(" from rec_device d left join rec_device_category dc on d.s_device_category_id = dc.s_id ");
sql.append(" left join b_station_dict sd on d.s_station_id = sd.s_id ");
sql.append(" left join b_station_region_dict srd on d.s_station_region_id = srd.s_id ");
sql.append(" where 1=1 ");
Map<String, Object> param = new HashMap<>(2);
sql.append(" and d.s_id in (:ids) ");
param.put("ids", idsForm.getIds());
// if(!CollectionUtils.isEmpty(stationIds)) {
// sql.append(" and d.s_station_id in ( :stationIds) ");
// param.put("stationIds", stationIds);
// }
List<DeviceImportVO> list = deviceDao.findListBySql(DeviceImportVO.class, sql.toString(), param);
JSONObject jsonObject = new JSONObject();
jsonObject.put("content", list);
return jsonObject;
}
3、:
3、:
3、:
3、:
3、:
3、:
标签:name,stationIds,笔记,station,sql,id,append 来源: https://www.cnblogs.com/sensenh/p/16374187.html