|
|
@@ -106,13 +106,21 @@ public class NewsService implements INewsService {
|
|
|
// --- 情况 B:前端传了具体的用户ID列表 ---
|
|
|
// 遍历列表,为每个用户插入一条记录
|
|
|
for (String targetUserId : scopeUserIds) {
|
|
|
- String insertSql = "INSERT INTO t_ggfwb (id_, create_by_, create_time_, gong_gao_id_, gong_gao_lei_xing, gong_gao_mu_biao_) " +
|
|
|
- "VALUES ('%s', '%s', NOW(), '%s', '%s', '%s')";
|
|
|
+ String insertSql= "";
|
|
|
+ if(targetUserId.length()>0){
|
|
|
+ insertSql = "INSERT INTO t_ggfwb (id_, create_by_, create_time_, gong_gao_id_, gong_gao_lei_xing, gong_gao_mu_biao_) " +
|
|
|
+ "VALUES ('%s', '%s', NOW(), '%s', '%s', '%s')";
|
|
|
+ } else {
|
|
|
+ insertSql = "INSERT INTO t_ggfwb (id_, create_by_, create_time_, gong_gao_id_, gong_gao_lei_xing, gong_gao_mu_biao_) " +
|
|
|
+ "VALUES ('%s', '%s', NOW(), '%s', 'ALL', 'ALL')";
|
|
|
+ }
|
|
|
+ if(!insertSql.equals("")){
|
|
|
+ // 生成ID并格式化SQL
|
|
|
+ String id = UniqueIdUtil.getId();
|
|
|
+ insertSql = String.format(insertSql, id, currentUserId, newsId, newsType, targetUserId);
|
|
|
+ commonDao.execute(insertSql);
|
|
|
+ }
|
|
|
|
|
|
- // 生成ID并格式化SQL
|
|
|
- String id = UniqueIdUtil.getId();
|
|
|
- insertSql = String.format(insertSql, id, currentUserId, newsId, newsType, targetUserId);
|
|
|
- commonDao.execute(insertSql);
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e){
|