35 lines
1.4 KiB
Java
35 lines
1.4 KiB
Java
|
|
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);
|
||
|
|
}
|
||
|
|
}
|