gunshi-project-ss/src/main/java/com/gunshi/project/xyt/controller/ICommonUpdateByIdWithAttach...

35 lines
1.4 KiB
Java
Raw Normal View History

2024-07-08 10:05:02 +08:00
package com.gunshi.project.xyt.controller;
import com.gunshi.core.result.R;
import com.gunshi.db.dao.BaseDao;
import com.gunshi.db.dao.IMapper;
import com.gunshi.project.xyt.service.AbstractModelWithAttachService;
import com.gunshi.project.xyt.validate.markers.Update;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
*
*
* @author lyf
* @version 1.0.0
* @since 2024-02-19
*/
public interface ICommonUpdateByIdWithAttach<Model extends AbstractModelWithAttachService.GetFileIds, AutoMapper extends IMapper<Model>, AutoDao extends BaseDao<AutoMapper, Model>,
AttachModel, AttachModelAutoMapper extends IMapper<AttachModel>, AttachModelAutoDao extends BaseDao<AttachModelAutoMapper, AttachModel>> {
AbstractModelWithAttachService<Model,AutoMapper,AutoDao,AttachModel, AttachModelAutoMapper, AttachModelAutoDao> getModelService();
void customSetFieldForUpdate(Model model);
@Operation(summary = "实体类修改")
@PostMapping("/update")
default R<Model> commonUpdateById(@Validated(Update.class) @RequestBody Model model) {
customSetFieldForUpdate(model);
boolean result = getModelService().updateById(model);
return R.ok(result ? model : null);
}
}