根本就没有使用到user的方法
时间: 2023-08-07 18:05:27 浏览: 82
非常抱歉,我在之前的回答中出现了错误。如果你没有使用到`user`对象,那么你可以将相关的代码删除或者注释掉。以下是更新后的示例代码:
```java
List<TbModulePermissions> batchPermissions = new ArrayList<>();
TbModulePermissions mp1 = new TbModulePermissions();
mp1.setCreateTime(tbModuleInfo.getCreateTime());
mp1.setModuleId(tbModuleInfo.getModuleId());
mp1.setpId(0);
mp1.setSortId(tbModuleInfo.getSortId());
mp1.setStatus(tbModuleInfo.getModuleStatus());
mp1.setUpdateOpr(tbModuleInfo.getUpdateOpr());
mp1.setUpdateTime(tbModuleInfo.getUpdateTime());
mp1.setIsPerson(tbModuleInfo.getIsPerson());
batchPermissions.add(mp1);
String sql = "INSERT INTO tb_module_permissions ("
+ "create_time,module_id,p_id,"
+ "sort_id,status,update_opr,update_time,"
+ "is_person) "
+ "(SELECT "
+ "? ,? ,1,"
+ "? ,? ,? ,"
+ "? from tb_user_info where isDelete = 0 and instr(?, level) > 0 and instr(?, channel_id) > 0)";
int[] result = jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
@Override
public void setValues(PreparedStatement ps, int i) throws SQLException {
TbModulePermissions permissions = batchPermissions.get(i);
ps.setString(1, permissions.getCreateTime());
ps.setString(2, permissions.getModuleId());
ps.setString(3, permissions.getSortId());
ps.setString(4, permissions.getStatus());
ps.setString(5, permissions.getUpdateOpr());
ps.setString(6, permissions.getUpdateTime());
ps.setString(7, permissions.getLe());
ps.setString(8, permissions.getChannel());
}
@Override
public int getBatchSize() {
return batchPermissions.size();
}
});
if (result.length <= 0) {
return getSucessMap("省级模块添加失败");
}
log.info(tbModuleInfo.getModuleId() + "添加成功s=" + result.length);
return getSucessMap("添加成功");
```
在这个更新后的示例代码中,我删除了与`user`对象相关的代码,并做了必要的修改,以适应这些更改。如果你不需要使用`user`对象,可以直接删除或注释掉相关代码。
请确保在运行之前,已经正确配置了JdbcTemplate,并且引入了相关的依赖。如果还有其他问题,请随时提问。
阅读全文