File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
base/src/main/java/com/tinyengine/it/dynamic/service Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 44import com .tinyengine .it .common .context .LoginUserContext ;
55import com .tinyengine .it .dynamic .dao .ModelDataDao ;
66import com .tinyengine .it .dynamic .dto .*;
7+ import com .tinyengine .it .model .entity .Model ;
78import com .tinyengine .it .service .material .ModelService ;
89import jakarta .transaction .Transactional ;
910import org .springframework .beans .factory .annotation .Autowired ;
@@ -112,7 +113,18 @@ public Map<String, Object> insert(DynamicInsert dto) {
112113 Map <String , Object > params = new HashMap <>();
113114 params .put ("tableName" , tableName );
114115 params .put ("data" , dto .getParams ());
116+
117+
115118 String userId = loginUserContext .getLoginUserId ();
119+ if ( userId == null || userId .trim ().isEmpty ()) {
120+ List <Model > modelList = modelService .getModelByName (dto .getNameEn ());
121+ if ( modelList .isEmpty ()) {
122+ throw new IllegalArgumentException ("模型不存在: " + dto .getNameEn ());
123+ }else {
124+ userId =modelList .get (0 ).getCreatedBy ();
125+ }
126+ }
127+
116128 // 添加系统字段
117129 dto .getParams ().put ("created_by" , userId );
118130 dto .getParams ().put ("updated_by" , userId );
You can’t perform that action at this time.
0 commit comments