Commit a0728e8d authored by alex yao's avatar alex yao

feat:智写案例接口

parent 18b65d9f
package cn.com.poc.writing.aggregate; package cn.com.poc.writing.aggregate;
import cn.com.poc.writing.dto.AiWritingExampleDto;
import cn.com.poc.writing.dto.AiWritingExampleTypeDto;
import java.util.List;
/** /**
* @author alex.yao * @author alex.yao
* @date 2025/6/20 * @date 2025/6/20
...@@ -19,4 +24,20 @@ public interface AiWritingService { ...@@ -19,4 +24,20 @@ public interface AiWritingService {
void call(String dialoguesId, String fileUrl, String input, Integer[] knowledgeIds, Long userId) throws Exception; void call(String dialoguesId, String fileUrl, String input, Integer[] knowledgeIds, Long userId) throws Exception;
/**
* 获取示例列表
*
* @param type 类型
* @return
*/
List<AiWritingExampleDto> example(String type) throws Exception;
/**
* 获取示例类型
*
* @return
*/
List<AiWritingExampleTypeDto> exampleType() throws Exception;
} }
...@@ -29,6 +29,12 @@ import cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelDema ...@@ -29,6 +29,12 @@ import cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelDema
import cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelResponse; import cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelResponse;
import cn.com.poc.thirdparty.service.LLMService; import cn.com.poc.thirdparty.service.LLMService;
import cn.com.poc.writing.aggregate.AiWritingService; import cn.com.poc.writing.aggregate.AiWritingService;
import cn.com.poc.writing.dto.AiWritingExampleDto;
import cn.com.poc.writing.dto.AiWritingExampleTypeDto;
import cn.com.poc.writing.entity.BizAiWritingExampleEntity;
import cn.com.poc.writing.entity.BizAiWritingExampleTypeEntity;
import cn.com.poc.writing.service.BizAiWritingExampleService;
import cn.com.poc.writing.service.BizAiWritingExampleTypeService;
import cn.com.yict.framemax.core.exception.BusinessException; import cn.com.yict.framemax.core.exception.BusinessException;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -41,6 +47,7 @@ import java.io.BufferedReader; ...@@ -41,6 +47,7 @@ import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -81,6 +88,12 @@ public class AiWritingServiceImpl implements AiWritingService { ...@@ -81,6 +88,12 @@ public class AiWritingServiceImpl implements AiWritingService {
@Resource @Resource
private DemandKnowledgeService demandKnowledgeService; private DemandKnowledgeService demandKnowledgeService;
@Resource
private BizAiWritingExampleService bizAiWritingExampleService;
@Resource
private BizAiWritingExampleTypeService bizAiWritingExampleTypeService;
@Override @Override
public void call(String dialoguesId, String fileUrl, String input, Integer[] knowledgeIds, Long userId) throws Exception { public void call(String dialoguesId, String fileUrl, String input, Integer[] knowledgeIds, Long userId) throws Exception {
...@@ -186,6 +199,43 @@ public class AiWritingServiceImpl implements AiWritingService { ...@@ -186,6 +199,43 @@ public class AiWritingServiceImpl implements AiWritingService {
} }
@Override
public List<AiWritingExampleDto> example(String type) throws Exception {
BizAiWritingExampleEntity bizAiWritingExample = new BizAiWritingExampleEntity();
if (!"ALL".equals(type)) {
bizAiWritingExample.setType(type);
}
List<BizAiWritingExampleEntity> exampleEntities = bizAiWritingExampleService.findByExample(bizAiWritingExample, null);
if (CollectionUtils.isEmpty(exampleEntities)) {
return Collections.emptyList();
}
return exampleEntities.stream().map(entity -> {
AiWritingExampleDto dto = new AiWritingExampleDto();
dto.setType(entity.getType());
dto.setTitle(entity.getTitle());
dto.setDescription(entity.getDescription());
dto.setQuestion(entity.getQuestion());
return dto;
}).collect(Collectors.toList());
}
@Override
public List<AiWritingExampleTypeDto> exampleType() throws Exception {
List<BizAiWritingExampleTypeEntity> entities = bizAiWritingExampleTypeService.findByExample(new BizAiWritingExampleTypeEntity(), null);
if (CollectionUtils.isEmpty(entities)) {
return Collections.emptyList();
}
return entities.stream().map(entity -> {
AiWritingExampleTypeDto dto = new AiWritingExampleTypeDto();
dto.setType(entity.getType());
dto.setName(entity.getName());
return dto;
}).collect(Collectors.toList());
}
private List<Message> buildMessages(String dialogsId, Long userId, String input, String fileUrl, List<KnowledgeContentResult> knowledgeContentResults) throws Exception { private List<Message> buildMessages(String dialogsId, Long userId, String input, String fileUrl, List<KnowledgeContentResult> knowledgeContentResults) throws Exception {
// 获取对话提示词 // 获取对话提示词
String promptCode = "AiWritingPrompt"; String promptCode = "AiWritingPrompt";
......
package cn.com.poc.writing.convert;
import cn.com.poc.writing.model.BizAiWritingExampleModel;
import cn.com.poc.writing.entity.BizAiWritingExampleEntity;
public class BizAiWritingExampleConvert {
public static BizAiWritingExampleEntity modelToEntity(BizAiWritingExampleModel model) {
BizAiWritingExampleEntity entity = new BizAiWritingExampleEntity();
entity.setId(model.getId());
entity.setType(model.getType());
entity.setTitle(model.getTitle());
entity.setDescription(model.getDescription());
entity.setQuestion(model.getQuestion());
return entity;
}
public static BizAiWritingExampleModel entityToModel(BizAiWritingExampleEntity entity) {
BizAiWritingExampleModel model = new BizAiWritingExampleModel();
model.setId(entity.getId());
model.setType(entity.getType());
model.setTitle(entity.getTitle());
model.setDescription(entity.getDescription());
model.setQuestion(entity.getQuestion());
return model;
}
}
\ No newline at end of file
package cn.com.poc.writing.convert;
import cn.com.poc.writing.model.BizAiWritingExampleTypeModel;
import cn.com.poc.writing.entity.BizAiWritingExampleTypeEntity;
public class BizAiWritingExampleTypeConvert {
public static BizAiWritingExampleTypeEntity modelToEntity(BizAiWritingExampleTypeModel model){
BizAiWritingExampleTypeEntity entity = new BizAiWritingExampleTypeEntity();
entity.setId(model.getId());
entity.setType(model.getType());
entity.setName(model.getName());
return entity;
}
public static BizAiWritingExampleTypeModel entityToModel(BizAiWritingExampleTypeEntity entity){
BizAiWritingExampleTypeModel model = new BizAiWritingExampleTypeModel();
model.setId(entity.getId());
model.setType(entity.getType());
model.setName(entity.getName());
return model;
}
}
\ No newline at end of file
package cn.com.poc.writing.dto;
/**
* @author alex.yao
* @date 2025/6/24
*/
public class AiWritingExampleDto {
/** type
*分类
*/
private java.lang.String type;
public java.lang.String getType(){
return this.type;
}
public void setType(java.lang.String type){
this.type = type;
}
/** title
*标题
*/
private java.lang.String title;
public java.lang.String getTitle(){
return this.title;
}
public void setTitle(java.lang.String title){
this.title = title;
}
/** description
*描述
*/
private java.lang.String description;
public java.lang.String getDescription(){
return this.description;
}
public void setDescription(java.lang.String description){
this.description = description;
}
/** question
*提问
*/
private java.lang.String question;
public java.lang.String getQuestion(){
return this.question;
}
public void setQuestion(java.lang.String question){
this.question = question;
}
}
package cn.com.poc.writing.dto;
public class AiWritingExampleTypeDto {
private static final long serialVersionUID = 1L;
/** type
*类型
*/
private String type;
public String getType(){
return this.type;
}
public void setType(String type){
this.type = type;
}
/** name
*名
*/
private String name;
public String getName(){
return this.name;
}
public void setName(String name){
this.name = name;
}
}
\ No newline at end of file
package cn.com.poc.writing.entity;
public class BizAiWritingExampleEntity {
private static final long serialVersionUID = 1L;
/** id
*
*/
private java.lang.Long id;
public java.lang.Long getId(){
return this.id;
}
public void setId(java.lang.Long id){
this.id = id;
}
/** type
*分类
*/
private java.lang.String type;
public java.lang.String getType(){
return this.type;
}
public void setType(java.lang.String type){
this.type = type;
}
/** title
*标题
*/
private java.lang.String title;
public java.lang.String getTitle(){
return this.title;
}
public void setTitle(java.lang.String title){
this.title = title;
}
/** description
*描述
*/
private java.lang.String description;
public java.lang.String getDescription(){
return this.description;
}
public void setDescription(java.lang.String description){
this.description = description;
}
/** question
*提问
*/
private java.lang.String question;
public java.lang.String getQuestion(){
return this.question;
}
public void setQuestion(java.lang.String question){
this.question = question;
}
}
\ No newline at end of file
package cn.com.poc.writing.entity;
public class BizAiWritingExampleTypeEntity {
private static final long serialVersionUID = 1L;
/** id
*
*/
private java.lang.Long id;
public java.lang.Long getId(){
return this.id;
}
public void setId(java.lang.Long id){
this.id = id;
}
/** type
*类型
*/
private java.lang.String type;
public java.lang.String getType(){
return this.type;
}
public void setType(java.lang.String type){
this.type = type;
}
/** name
*名
*/
private java.lang.String name;
public java.lang.String getName(){
return this.name;
}
public void setName(java.lang.String name){
this.name = name;
}
}
\ No newline at end of file
package cn.com.poc.writing.model;
import java.io.Serializable;
import cn.com.yict.framemax.data.model.BaseModelClass;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Id;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
/**
* Model class for biz_ai_writing_example
* AI-写作 例子
*/
@Entity
@Table(name = "biz_ai_writing_example")
@DynamicInsert
@DynamicUpdate
public class BizAiWritingExampleModel extends BaseModelClass implements Serializable {
private static final long serialVersionUID = 1L;
/** id
*
*/
private java.lang.Long id;
@Column(name = "id",length = 19)
@Id @GeneratedValue(strategy = GenerationType.AUTO)
public java.lang.Long getId(){
return this.id;
}
public void setId(java.lang.Long id){
this.id = id;
super.addValidField("id");
}
/** type
*分类
*/
private java.lang.String type;
@Column(name = "type",length = 100)
public java.lang.String getType(){
return this.type;
}
public void setType(java.lang.String type){
this.type = type;
super.addValidField("type");
}
/** title
*标题
*/
private java.lang.String title;
@Column(name = "title",length = 100)
public java.lang.String getTitle(){
return this.title;
}
public void setTitle(java.lang.String title){
this.title = title;
super.addValidField("title");
}
/** description
*描述
*/
private java.lang.String description;
@Column(name = "description",length = 100)
public java.lang.String getDescription(){
return this.description;
}
public void setDescription(java.lang.String description){
this.description = description;
super.addValidField("description");
}
/** question
*提问
*/
private java.lang.String question;
@Column(name = "question",length = 100)
public java.lang.String getQuestion(){
return this.question;
}
public void setQuestion(java.lang.String question){
this.question = question;
super.addValidField("question");
}
}
\ No newline at end of file
package cn.com.poc.writing.model;
import java.io.Serializable;
import cn.com.yict.framemax.data.model.BaseModelClass;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Id;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
/**
* Model class for biz_ai_writing_example_type
* AI写作分类
*/
@Entity
@Table(name = "biz_ai_writing_example_type")
@DynamicInsert
@DynamicUpdate
public class BizAiWritingExampleTypeModel extends BaseModelClass implements Serializable {
private static final long serialVersionUID = 1L;
/** id
*
*/
private java.lang.Long id;
@Column(name = "id",length = 19)
@Id @GeneratedValue(strategy = GenerationType.AUTO)
public java.lang.Long getId(){
return this.id;
}
public void setId(java.lang.Long id){
this.id = id;
super.addValidField("id");
}
/** type
*类型
*/
private java.lang.String type;
@Column(name = "type",length = 100)
public java.lang.String getType(){
return this.type;
}
public void setType(java.lang.String type){
this.type = type;
super.addValidField("type");
}
/** name
*名
*/
private java.lang.String name;
@Column(name = "name",length = 100)
public java.lang.String getName(){
return this.name;
}
public void setName(java.lang.String name){
this.name = name;
super.addValidField("name");
}
}
\ No newline at end of file
package cn.com.poc.writing.repository;
import cn.com.yict.framemax.data.repository.Repository;
import cn.com.poc.writing.model.BizAiWritingExampleModel;
public interface BizAiWritingExampleRepository extends Repository<BizAiWritingExampleModel,java.lang.Long> {
}
\ No newline at end of file
package cn.com.poc.writing.repository;
import cn.com.yict.framemax.data.repository.Repository;
import cn.com.poc.writing.model.BizAiWritingExampleTypeModel;
public interface BizAiWritingExampleTypeRepository extends Repository<BizAiWritingExampleTypeModel,java.lang.Long> {
}
\ No newline at end of file
package cn.com.poc.writing.rest; package cn.com.poc.writing.rest;
import cn.com.poc.writing.dto.AiWritingDto; import cn.com.poc.writing.dto.AiWritingDto;
import cn.com.poc.writing.dto.AiWritingExampleDto;
import cn.com.poc.writing.dto.AiWritingExampleTypeDto;
import cn.com.yict.framemax.core.rest.BaseRest; import cn.com.yict.framemax.core.rest.BaseRest;
import cn.com.yict.framemax.web.permission.Access; import cn.com.yict.framemax.web.permission.Access;
import cn.com.yict.framemax.web.permission.Permission; import cn.com.yict.framemax.web.permission.Permission;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/** /**
* @author alex.yao * @author alex.yao
...@@ -14,6 +19,10 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -14,6 +19,10 @@ import org.springframework.web.bind.annotation.RequestBody;
@Permission(Access.Safety) @Permission(Access.Safety)
public interface AiWritingRest extends BaseRest { public interface AiWritingRest extends BaseRest {
List<AiWritingExampleDto> example(@RequestParam String type) throws Exception;
void call(@RequestBody AiWritingDto aiWritingDto) throws Exception; void call(@RequestBody AiWritingDto aiWritingDto) throws Exception;
List<AiWritingExampleTypeDto> exampleType() throws Exception;
} }
...@@ -5,11 +5,14 @@ import cn.com.poc.common.utils.BlContext; ...@@ -5,11 +5,14 @@ import cn.com.poc.common.utils.BlContext;
import cn.com.poc.support.security.oauth.entity.UserBaseEntity; import cn.com.poc.support.security.oauth.entity.UserBaseEntity;
import cn.com.poc.writing.aggregate.AiWritingService; import cn.com.poc.writing.aggregate.AiWritingService;
import cn.com.poc.writing.dto.AiWritingDto; import cn.com.poc.writing.dto.AiWritingDto;
import cn.com.poc.writing.dto.AiWritingExampleDto;
import cn.com.poc.writing.dto.AiWritingExampleTypeDto;
import cn.com.poc.writing.rest.AiWritingRest; import cn.com.poc.writing.rest.AiWritingRest;
import cn.com.yict.framemax.core.exception.BusinessException; import cn.com.yict.framemax.core.exception.BusinessException;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
/** /**
* @author alex.yao * @author alex.yao
...@@ -35,4 +38,16 @@ public class AiWritingRestImpl implements AiWritingRest { ...@@ -35,4 +38,16 @@ public class AiWritingRestImpl implements AiWritingRest {
aiWritingDto.getInput(), aiWritingDto.getKnowledgeIds(), userBaseEntity.getUserId()); aiWritingDto.getInput(), aiWritingDto.getKnowledgeIds(), userBaseEntity.getUserId());
} }
@Override
public List<AiWritingExampleDto> example(String type) throws Exception {
Assert.notNull(type, "type is null");
return aiWritingService.example(type);
}
@Override
public List<AiWritingExampleTypeDto> exampleType() throws Exception {
return aiWritingService.exampleType();
}
} }
package cn.com.poc.writing.service;
import cn.com.yict.framemax.core.service.BaseService;
import cn.com.poc.writing.entity.BizAiWritingExampleEntity;
import cn.com.yict.framemax.data.model.PagingInfo;
import java.util.Collection;
import java.util.List;
public interface BizAiWritingExampleService extends BaseService {
BizAiWritingExampleEntity get(java.lang.Long id) throws Exception;
List<BizAiWritingExampleEntity> findByExample(BizAiWritingExampleEntity example,PagingInfo pagingInfo) throws Exception;
BizAiWritingExampleEntity save(BizAiWritingExampleEntity entity) throws Exception;
BizAiWritingExampleEntity update(BizAiWritingExampleEntity entity) throws Exception;
void deletedById(java.lang.Long id) throws Exception;
}
\ No newline at end of file
package cn.com.poc.writing.service;
import cn.com.yict.framemax.core.service.BaseService;
import cn.com.poc.writing.entity.BizAiWritingExampleTypeEntity;
import cn.com.yict.framemax.data.model.PagingInfo;
import java.util.Collection;
import java.util.List;
public interface BizAiWritingExampleTypeService extends BaseService {
BizAiWritingExampleTypeEntity get(java.lang.Long id) throws Exception;
List<BizAiWritingExampleTypeEntity> findByExample(BizAiWritingExampleTypeEntity example,PagingInfo pagingInfo) throws Exception;
BizAiWritingExampleTypeEntity save(BizAiWritingExampleTypeEntity entity) throws Exception;
BizAiWritingExampleTypeEntity update(BizAiWritingExampleTypeEntity entity) throws Exception;
void deletedById(java.lang.Long id) throws Exception;
}
\ No newline at end of file
package cn.com.poc.writing.service.impl;
import cn.com.yict.framemax.core.service.impl.BaseServiceImpl;
import cn.com.poc.writing.service.BizAiWritingExampleService;
import cn.com.poc.writing.model.BizAiWritingExampleModel;
import cn.com.poc.writing.entity.BizAiWritingExampleEntity;
import cn.com.poc.writing.convert.BizAiWritingExampleConvert;
import cn.com.poc.writing.repository.BizAiWritingExampleRepository;
import cn.com.yict.framemax.data.model.PagingInfo;
import org.springframework.stereotype.Service;
import org.apache.commons.collections4.CollectionUtils;
import java.util.ArrayList;
import java.util.stream.Collectors;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.util.Assert;
@Service
public class BizAiWritingExampleServiceImpl extends BaseServiceImpl
implements BizAiWritingExampleService {
@Resource
private BizAiWritingExampleRepository repository;
public BizAiWritingExampleEntity get(java.lang.Long id) throws Exception{
Assert.notNull(id);
BizAiWritingExampleModel model = this.repository.get(id);
if (model == null){
return null;
}
return BizAiWritingExampleConvert.modelToEntity(model);
}
public List<BizAiWritingExampleEntity> findByExample(BizAiWritingExampleEntity example,PagingInfo pagingInfo) throws Exception{
List<BizAiWritingExampleEntity> result = new ArrayList<BizAiWritingExampleEntity>();
BizAiWritingExampleModel model = new BizAiWritingExampleModel();
if (example != null){
model = BizAiWritingExampleConvert.entityToModel(example);
}
List<BizAiWritingExampleModel> models = this.repository.findByExample(model,pagingInfo);
if (CollectionUtils.isNotEmpty(models)) {
result = models.stream().map(BizAiWritingExampleConvert::modelToEntity).collect(Collectors.toList());
}
return result;
}
public BizAiWritingExampleEntity save(BizAiWritingExampleEntity entity) throws Exception{
Assert.notNull(entity);
entity.setId(null);
BizAiWritingExampleModel model = BizAiWritingExampleConvert.entityToModel(entity);
BizAiWritingExampleModel saveModel = this.repository.save(model);
return BizAiWritingExampleConvert.modelToEntity(saveModel);
}
public BizAiWritingExampleEntity update(BizAiWritingExampleEntity entity) throws Exception{
Assert.notNull(entity);
Assert.notNull(entity.getId(),"update pk can not be null");
BizAiWritingExampleModel model = this.repository.get(entity.getId());
if (entity.getType() != null){
model.setType(entity.getType());
}
if (entity.getTitle() != null){
model.setTitle(entity.getTitle());
}
if (entity.getDescription() != null){
model.setDescription(entity.getDescription());
}
if (entity.getQuestion() != null){
model.setQuestion(entity.getQuestion());
}
BizAiWritingExampleModel saveModel = this.repository.save(model);
return BizAiWritingExampleConvert.modelToEntity(saveModel);
}
public void deletedById(java.lang.Long id) throws Exception{
Assert.notNull(id);
BizAiWritingExampleModel model = this.repository.get(id);
if (model != null){
}
}
}
\ No newline at end of file
package cn.com.poc.writing.service.impl;
import cn.com.yict.framemax.core.service.impl.BaseServiceImpl;
import cn.com.poc.writing.service.BizAiWritingExampleTypeService;
import cn.com.poc.writing.model.BizAiWritingExampleTypeModel;
import cn.com.poc.writing.entity.BizAiWritingExampleTypeEntity;
import cn.com.poc.writing.convert.BizAiWritingExampleTypeConvert;
import cn.com.poc.writing.repository.BizAiWritingExampleTypeRepository;
import cn.com.yict.framemax.data.model.PagingInfo;
import org.springframework.stereotype.Service;
import org.apache.commons.collections4.CollectionUtils;
import java.util.ArrayList;
import java.util.stream.Collectors;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.util.Assert;
@Service
public class BizAiWritingExampleTypeServiceImpl extends BaseServiceImpl
implements BizAiWritingExampleTypeService {
@Resource
private BizAiWritingExampleTypeRepository repository;
public BizAiWritingExampleTypeEntity get(java.lang.Long id) throws Exception{
Assert.notNull(id);
BizAiWritingExampleTypeModel model = this.repository.get(id);
if (model == null){
return null;
}
return BizAiWritingExampleTypeConvert.modelToEntity(model);
}
public List<BizAiWritingExampleTypeEntity> findByExample(BizAiWritingExampleTypeEntity example,PagingInfo pagingInfo) throws Exception{
List<BizAiWritingExampleTypeEntity> result = new ArrayList<BizAiWritingExampleTypeEntity>();
BizAiWritingExampleTypeModel model = new BizAiWritingExampleTypeModel();
if (example != null){
model = BizAiWritingExampleTypeConvert.entityToModel(example);
}
List<BizAiWritingExampleTypeModel> models = this.repository.findByExample(model,pagingInfo);
if (CollectionUtils.isNotEmpty(models)) {
result = models.stream().map(BizAiWritingExampleTypeConvert::modelToEntity).collect(Collectors.toList());
}
return result;
}
public BizAiWritingExampleTypeEntity save(BizAiWritingExampleTypeEntity entity) throws Exception{
Assert.notNull(entity);
entity.setId(null);
BizAiWritingExampleTypeModel model = BizAiWritingExampleTypeConvert.entityToModel(entity);
BizAiWritingExampleTypeModel saveModel = this.repository.save(model);
return BizAiWritingExampleTypeConvert.modelToEntity(saveModel);
}
public BizAiWritingExampleTypeEntity update(BizAiWritingExampleTypeEntity entity) throws Exception{
Assert.notNull(entity);
Assert.notNull(entity.getId(),"update pk can not be null");
BizAiWritingExampleTypeModel model = this.repository.get(entity.getId());
if (entity.getType() != null){
model.setType(entity.getType());
}
if (entity.getName() != null){
model.setName(entity.getName());
}
BizAiWritingExampleTypeModel saveModel = this.repository.save(model);
return BizAiWritingExampleTypeConvert.modelToEntity(saveModel);
}
public void deletedById(java.lang.Long id) throws Exception{
Assert.notNull(id);
BizAiWritingExampleTypeModel model = this.repository.get(id);
if (model != null){
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment