提交 547144c8 编写于 作者: ibizdev's avatar ibizdev

xignzi006 发布系统代码

上级 65d39887
......@@ -58,4 +58,9 @@ public class mail_followersFallback implements mail_followersFeignClient{
return null;
}
public Page<Mail_followers> searchByRes(Mail_followersSearchContext context){
return null;
}
}
......@@ -56,4 +56,9 @@ public interface mail_followersFeignClient {
Page<Mail_followers> select();
@RequestMapping(method = RequestMethod.POST, value = "/mail_followers/searchbyres")
Page<Mail_followers> searchByRes(@RequestBody Mail_followersSearchContext context);
}
......@@ -84,6 +84,11 @@ public class mail_messageFallback implements mail_messageFeignClient{
return false;
}
public Page<Mail_message> searchByRes(Mail_messageSearchContext context){
return null;
}
public Page<Mail_message> searchDefault(Mail_messageSearchContext context){
return null;
}
......
......@@ -80,6 +80,11 @@ public interface mail_messageFeignClient {
@RequestMapping(method = RequestMethod.POST, value = "/mail_messages/searchbyres")
Page<Mail_message> searchByRes(@RequestBody Mail_messageSearchContext context);
@RequestMapping(method = RequestMethod.POST, value = "/mail_messages/searchdefault")
Page<Mail_message> searchDefault(@RequestBody Mail_messageSearchContext context);
......
......@@ -19,6 +19,7 @@ import com.alibaba.fastjson.JSONObject;
public interface Mail_followersMapper extends BaseMapper<Mail_followers>{
Page<Mail_followers> searchByRes(IPage page, @Param("srf") Mail_followersSearchContext context, @Param("ew") Wrapper<Mail_followers> wrapper) ;
@Override
Mail_followers selectById(Serializable id);
@Override
......
......@@ -19,6 +19,7 @@ import com.alibaba.fastjson.JSONObject;
public interface Mail_messageMapper extends BaseMapper<Mail_message>{
Page<Mail_message> searchByRes(IPage page, @Param("srf") Mail_messageSearchContext context, @Param("ew") Wrapper<Mail_message> wrapper) ;
Page<Mail_message> searchDefault(IPage page, @Param("srf") Mail_messageSearchContext context, @Param("ew") Wrapper<Mail_message> wrapper) ;
@Override
Mail_message selectById(Serializable id);
......
......@@ -33,6 +33,7 @@ public interface IMail_followersService extends IService<Mail_followers>{
boolean remove(Long key) ;
void removeBatch(Collection<Long> idList) ;
Mail_followers get(Long key) ;
Page<Mail_followers> searchByRes(Mail_followersSearchContext context) ;
/**
*自定义查询SQL
* @param sql select * from table where id =#{et.param}
......
......@@ -39,6 +39,7 @@ public interface IMail_messageService extends IService<Mail_message>{
Mail_message post_message(Mail_message et) ;
boolean save(Mail_message et) ;
void saveBatch(List<Mail_message> list) ;
Page<Mail_message> searchByRes(Mail_messageSearchContext context) ;
Page<Mail_message> searchDefault(Mail_messageSearchContext context) ;
List<Mail_message> selectByMailActivityTypeId(Long id) ;
void removeByMailActivityTypeId(Long id) ;
......
......@@ -156,6 +156,15 @@ public class Mail_followersServiceImpl extends EBSServiceImpl<Mail_followersMapp
/**
* 查询集合 ByRes
*/
@Override
public Page<Mail_followers> searchByRes(Mail_followersSearchContext context) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<Mail_followers> pages=baseMapper.searchByRes(context.getPages(),context,context.getSelectCond());
return new PageImpl<Mail_followers>(pages.getRecords(), context.getPageable(), pages.getTotal());
}
/**
......
......@@ -320,6 +320,15 @@ public class Mail_messageServiceImpl extends EBSServiceImpl<Mail_messageMapper,
}
/**
* 查询集合 ByRes
*/
@Override
public Page<Mail_message> searchByRes(Mail_messageSearchContext context) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<Mail_message> pages=baseMapper.searchByRes(context.getPages(),context,context.getSelectCond());
return new PageImpl<Mail_message>(pages.getRecords(), context.getPageable(), pages.getTotal());
}
/**
* 查询集合 数据集
*/
......
......@@ -28,5 +28,20 @@
<!--关系实体暴露select方法供主实体通过外键查询关系实体数据[实体关系名称:DER1N_MAIL_FOLLOWERS__MAIL_CHANNEL__CHANNEL_ID] -->
<!--关系实体暴露select方法供主实体通过外键查询关系实体数据[实体关系名称:DER1N_MAIL_FOLLOWERS__RES_PARTNER__PARTNER_ID] -->
<!--数据集合[ByRes]-->
<select id="searchByRes" parameterType="cn.ibizlab.businesscentral.core.odoo_mail.filter.Mail_followersSearchContext" resultMap="Mail_followersResultMap">
select t1.* from (
<include refid="ByRes" />
)t1
<where><if test="ew!=null and ew.sqlSegment!=null and !ew.emptyOfWhere">${ew.sqlSegment}</if></where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">${ew.sqlSegment}</if>
</select>
<!--数据查询[ByRes]-->
<sql id="ByRes" databaseId="postgresql">
<![CDATA[ SELECT t1.CHANNEL_ID, t21.NAME AS CHANNEL_ID_TEXT, t1.ID, t1.PARTNER_ID, t11.NAME AS PARTNER_ID_TEXT, t1.RES_ID, t1.RES_MODEL FROM MAIL_FOLLOWERS t1 LEFT JOIN RES_PARTNER t11 ON t1.PARTNER_ID = t11.ID LEFT JOIN MAIL_CHANNEL t21 ON t1.CHANNEL_ID = t21.ID
WHERE ( t1.RES_MODEL = #{srf.webcontext.res_model} AND t1.RES_ID = #{srf.webcontext.res_id} )
]]>
</sql>
</mapper>
......@@ -120,6 +120,15 @@
where write_uid=#{id}
</select>
<!--数据集合[ByRes]-->
<select id="searchByRes" parameterType="cn.ibizlab.businesscentral.core.odoo_mail.filter.Mail_messageSearchContext" resultMap="Mail_messageResultMap">
select t1.* from (
<include refid="ByRes" />
)t1
<where><if test="ew!=null and ew.sqlSegment!=null and !ew.emptyOfWhere">${ew.sqlSegment}</if></where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">${ew.sqlSegment}</if>
</select>
<!--数据集合[Default]-->
<select id="searchDefault" parameterType="cn.ibizlab.businesscentral.core.odoo_mail.filter.Mail_messageSearchContext" resultMap="Mail_messageResultMap">
select t1.* from (
......@@ -129,6 +138,12 @@
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">${ew.sqlSegment}</if>
</select>
<!--数据查询[ByRes]-->
<sql id="ByRes" databaseId="postgresql">
<![CDATA[ SELECT t1.ADD_SIGN, t1.AUTHOR_ID, t11.NAME AS AUTHOR_ID_TEXT, t1.CREATE_DATE, t1.CREATE_UID, t31.NAME AS CREATE_UID_TEXT, t1.DATE, t1.EMAIL_FROM, t1.ID, t1.MAIL_ACTIVITY_TYPE_ID, t41.NAME AS MAIL_ACTIVITY_TYPE_ID_TEXT, t1.MAIL_SERVER_ID, t1.MESSAGE_ID, t1.MESSAGE_TYPE, t1.MODEL, t1.MODERATION_STATUS, t1.MODERATOR_ID, t61.NAME AS MODERATOR_ID_TEXT, t1.NO_AUTO_THREAD, t1.PARENT_ID, t1.RECORD_NAME, t1.REPLY_TO, t1.RES_ID, t1.SUBJECT, t1.SUBTYPE_ID, t91.NAME AS SUBTYPE_ID_TEXT, t1.WEBSITE_PUBLISHED, t1.WRITE_DATE, t1.WRITE_UID, t81.NAME AS WRITE_UID_TEXT FROM MAIL_MESSAGE t1 LEFT JOIN RES_PARTNER t11 ON t1.AUTHOR_ID = t11.ID LEFT JOIN RES_USERS t21 ON t1.CREATE_UID = t21.ID LEFT JOIN RES_PARTNER t31 ON t21.PARTNER_ID = t31.ID LEFT JOIN MAIL_ACTIVITY_TYPE t41 ON t1.MAIL_ACTIVITY_TYPE_ID = t41.ID LEFT JOIN RES_USERS t51 ON t1.MODERATOR_ID = t51.ID LEFT JOIN RES_PARTNER t61 ON t51.PARTNER_ID = t61.ID LEFT JOIN RES_USERS t71 ON t1.WRITE_UID = t71.ID LEFT JOIN RES_PARTNER t81 ON t71.PARTNER_ID = t81.ID LEFT JOIN MAIL_MESSAGE_SUBTYPE t91 ON t1.SUBTYPE_ID = t91.ID
WHERE ( t1.MODEL = #{srf.webcontext.res_model} AND t1.RES_ID = #{srf.webcontext.res_id} )
]]>
</sql>
<!--数据查询[Default]-->
<sql id="Default" databaseId="postgresql">
<![CDATA[ SELECT t1.ADD_SIGN, t1.AUTHOR_ID, t11.NAME AS AUTHOR_ID_TEXT, t1.CREATE_DATE, t1.CREATE_UID, t31.NAME AS CREATE_UID_TEXT, t1.DATE, t1.EMAIL_FROM, t1.ID, t1.MAIL_ACTIVITY_TYPE_ID, t41.NAME AS MAIL_ACTIVITY_TYPE_ID_TEXT, t1.MAIL_SERVER_ID, t1.MESSAGE_ID, t1.MESSAGE_TYPE, t1.MODEL, t1.MODERATION_STATUS, t1.MODERATOR_ID, t61.NAME AS MODERATOR_ID_TEXT, t1.NO_AUTO_THREAD, t1.PARENT_ID, t1.RECORD_NAME, t1.REPLY_TO, t1.RES_ID, t1.SUBJECT, t1.SUBTYPE_ID, t91.NAME AS SUBTYPE_ID_TEXT, t1.WEBSITE_PUBLISHED, t1.WRITE_DATE, t1.WRITE_UID, t81.NAME AS WRITE_UID_TEXT FROM MAIL_MESSAGE t1 LEFT JOIN RES_PARTNER t11 ON t1.AUTHOR_ID = t11.ID LEFT JOIN RES_USERS t21 ON t1.CREATE_UID = t21.ID LEFT JOIN RES_PARTNER t31 ON t21.PARTNER_ID = t31.ID LEFT JOIN MAIL_ACTIVITY_TYPE t41 ON t1.MAIL_ACTIVITY_TYPE_ID = t41.ID LEFT JOIN RES_USERS t51 ON t1.MODERATOR_ID = t51.ID LEFT JOIN RES_PARTNER t61 ON t51.PARTNER_ID = t61.ID LEFT JOIN RES_USERS t71 ON t1.WRITE_UID = t71.ID LEFT JOIN RES_PARTNER t81 ON t71.PARTNER_ID = t81.ID LEFT JOIN MAIL_MESSAGE_SUBTYPE t91 ON t1.SUBTYPE_ID = t91.ID
......
package cn.ibizlab.businesscentral.core.dto;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.math.BigInteger;
import java.util.Map;
import java.util.HashMap;
import java.io.Serializable;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.alibaba.fastjson.annotation.JSONField;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import cn.ibizlab.businesscentral.util.domain.DTOBase;
import cn.ibizlab.businesscentral.util.domain.DTOClient;
import lombok.Data;
/**
* 服务DTO对象[Message_attachment_relDTO]
*/
@Data
public class Message_attachment_relDTO extends DTOBase implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 属性 [ID]
*
*/
@JSONField(name = "id")
@JsonProperty("id")
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 属性 [MESSAGE_ID]
*
*/
@JSONField(name = "message_id")
@JsonProperty("message_id")
@JsonSerialize(using = ToStringSerializer.class)
private Long messageId;
/**
* 属性 [ATTACHMENT_ID]
*
*/
@JSONField(name = "attachment_id")
@JsonProperty("attachment_id")
@JsonSerialize(using = ToStringSerializer.class)
private Long attachmentId;
/**
* 设置 [MESSAGE_ID]
*/
public void setMessageId(Long messageId){
this.messageId = messageId ;
this.modify("message_id",messageId);
}
/**
* 设置 [ATTACHMENT_ID]
*/
public void setAttachmentId(Long attachmentId){
this.attachmentId = attachmentId ;
this.modify("attachment_id",attachmentId);
}
}
package cn.ibizlab.businesscentral.core.mapping;
import org.mapstruct.*;
import cn.ibizlab.businesscentral.core.odoo_mail.domain.Message_attachment_rel;
import cn.ibizlab.businesscentral.core.dto.Message_attachment_relDTO;
import cn.ibizlab.businesscentral.util.domain.MappingBase;
import org.mapstruct.factory.Mappers;
@Mapper(componentModel = "spring", uses = {},implementationName="CoreMessage_attachment_relMapping",
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface Message_attachment_relMapping extends MappingBase<Message_attachment_relDTO, Message_attachment_rel> {
}
......@@ -108,6 +108,28 @@ public class Mail_followersResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Mail_followers-searchByRes-all')")
@ApiOperation(value = "获取ByRes", tags = {"文档关注者" } ,notes = "获取ByRes")
@RequestMapping(method= RequestMethod.GET , value="/mail_followers/fetchbyres")
public ResponseEntity<List<Mail_followersDTO>> fetchByRes(Mail_followersSearchContext context) {
Page<Mail_followers> domains = mail_followersService.searchByRes(context) ;
List<Mail_followersDTO> list = mail_followersMapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Mail_followers-searchByRes-all')")
@ApiOperation(value = "查询ByRes", tags = {"文档关注者" } ,notes = "查询ByRes")
@RequestMapping(method= RequestMethod.POST , value="/mail_followers/searchbyres")
public ResponseEntity<Page<Mail_followersDTO>> searchByRes(@RequestBody Mail_followersSearchContext context) {
Page<Mail_followers> domains = mail_followersService.searchByRes(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(mail_followersMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
}
......@@ -158,6 +158,28 @@ public class Mail_messageResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Mail_message-searchByRes-all') and hasPermission(#context,'iBizBusinessCentral-Mail_message-Get')")
@ApiOperation(value = "获取ByRes", tags = {"消息" } ,notes = "获取ByRes")
@RequestMapping(method= RequestMethod.GET , value="/mail_messages/fetchbyres")
public ResponseEntity<List<Mail_messageDTO>> fetchByRes(Mail_messageSearchContext context) {
Page<Mail_message> domains = mail_messageService.searchByRes(context) ;
List<Mail_messageDTO> list = mail_messageMapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Mail_message-searchByRes-all') and hasPermission(#context,'iBizBusinessCentral-Mail_message-Get')")
@ApiOperation(value = "查询ByRes", tags = {"消息" } ,notes = "查询ByRes")
@RequestMapping(method= RequestMethod.POST , value="/mail_messages/searchbyres")
public ResponseEntity<Page<Mail_messageDTO>> searchByRes(@RequestBody Mail_messageSearchContext context) {
Page<Mail_message> domains = mail_messageService.searchByRes(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(mail_messageMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Mail_message-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Mail_message-Get')")
@ApiOperation(value = "获取数据集", tags = {"消息" } ,notes = "获取数据集")
@RequestMapping(method= RequestMethod.GET , value="/mail_messages/fetchdefault")
......
......@@ -159,5 +159,135 @@ public class Mail_tracking_valueResource {
}
@PreAuthorize("hasPermission(this.mail_tracking_valueMapping.toDomain(#mail_tracking_valuedto),'iBizBusinessCentral-Mail_tracking_value-Create')")
@ApiOperation(value = "根据消息建立邮件跟踪值", tags = {"邮件跟踪值" }, notes = "根据消息建立邮件跟踪值")
@RequestMapping(method = RequestMethod.POST, value = "/mail_messages/{mail_message_id}/mail_tracking_values")
public ResponseEntity<Mail_tracking_valueDTO> createByMail_message(@PathVariable("mail_message_id") Long mail_message_id, @RequestBody Mail_tracking_valueDTO mail_tracking_valuedto) {
Mail_tracking_value domain = mail_tracking_valueMapping.toDomain(mail_tracking_valuedto);
domain.setMailMessageId(mail_message_id);
mail_tracking_valueService.create(domain);
Mail_tracking_valueDTO dto = mail_tracking_valueMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(this.mail_tracking_valueMapping.toDomain(#mail_tracking_valuedtos),'iBizBusinessCentral-Mail_tracking_value-Create')")
@ApiOperation(value = "根据消息批量建立邮件跟踪值", tags = {"邮件跟踪值" }, notes = "根据消息批量建立邮件跟踪值")
@RequestMapping(method = RequestMethod.POST, value = "/mail_messages/{mail_message_id}/mail_tracking_values/batch")
public ResponseEntity<Boolean> createBatchByMail_message(@PathVariable("mail_message_id") Long mail_message_id, @RequestBody List<Mail_tracking_valueDTO> mail_tracking_valuedtos) {
List<Mail_tracking_value> domainlist=mail_tracking_valueMapping.toDomain(mail_tracking_valuedtos);
for(Mail_tracking_value domain:domainlist){
domain.setMailMessageId(mail_message_id);
}
mail_tracking_valueService.createBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@VersionCheck(entity = "mail_tracking_value" , versionfield = "writeDate")
@PreAuthorize("hasPermission(this.mail_tracking_valueService.get(#mail_tracking_value_id),'iBizBusinessCentral-Mail_tracking_value-Update')")
@ApiOperation(value = "根据消息更新邮件跟踪值", tags = {"邮件跟踪值" }, notes = "根据消息更新邮件跟踪值")
@RequestMapping(method = RequestMethod.PUT, value = "/mail_messages/{mail_message_id}/mail_tracking_values/{mail_tracking_value_id}")
public ResponseEntity<Mail_tracking_valueDTO> updateByMail_message(@PathVariable("mail_message_id") Long mail_message_id, @PathVariable("mail_tracking_value_id") Long mail_tracking_value_id, @RequestBody Mail_tracking_valueDTO mail_tracking_valuedto) {
Mail_tracking_value domain = mail_tracking_valueMapping.toDomain(mail_tracking_valuedto);
domain.setMailMessageId(mail_message_id);
domain.setId(mail_tracking_value_id);
mail_tracking_valueService.update(domain);
Mail_tracking_valueDTO dto = mail_tracking_valueMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(this.mail_tracking_valueService.getMailTrackingValueByEntities(this.mail_tracking_valueMapping.toDomain(#mail_tracking_valuedtos)),'iBizBusinessCentral-Mail_tracking_value-Update')")
@ApiOperation(value = "根据消息批量更新邮件跟踪值", tags = {"邮件跟踪值" }, notes = "根据消息批量更新邮件跟踪值")
@RequestMapping(method = RequestMethod.PUT, value = "/mail_messages/{mail_message_id}/mail_tracking_values/batch")
public ResponseEntity<Boolean> updateBatchByMail_message(@PathVariable("mail_message_id") Long mail_message_id, @RequestBody List<Mail_tracking_valueDTO> mail_tracking_valuedtos) {
List<Mail_tracking_value> domainlist=mail_tracking_valueMapping.toDomain(mail_tracking_valuedtos);
for(Mail_tracking_value domain:domainlist){
domain.setMailMessageId(mail_message_id);
}
mail_tracking_valueService.updateBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasPermission(this.mail_tracking_valueService.get(#mail_tracking_value_id),'iBizBusinessCentral-Mail_tracking_value-Remove')")
@ApiOperation(value = "根据消息删除邮件跟踪值", tags = {"邮件跟踪值" }, notes = "根据消息删除邮件跟踪值")
@RequestMapping(method = RequestMethod.DELETE, value = "/mail_messages/{mail_message_id}/mail_tracking_values/{mail_tracking_value_id}")
public ResponseEntity<Boolean> removeByMail_message(@PathVariable("mail_message_id") Long mail_message_id, @PathVariable("mail_tracking_value_id") Long mail_tracking_value_id) {
return ResponseEntity.status(HttpStatus.OK).body(mail_tracking_valueService.remove(mail_tracking_value_id));
}
@PreAuthorize("hasPermission(this.mail_tracking_valueService.getMailTrackingValueByIds(#ids),'iBizBusinessCentral-Mail_tracking_value-Remove')")
@ApiOperation(value = "根据消息批量删除邮件跟踪值", tags = {"邮件跟踪值" }, notes = "根据消息批量删除邮件跟踪值")
@RequestMapping(method = RequestMethod.DELETE, value = "/mail_messages/{mail_message_id}/mail_tracking_values/batch")
public ResponseEntity<Boolean> removeBatchByMail_message(@RequestBody List<Long> ids) {
mail_tracking_valueService.removeBatch(ids);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PostAuthorize("hasPermission(this.mail_tracking_valueMapping.toDomain(returnObject.body),'iBizBusinessCentral-Mail_tracking_value-Get')")
@ApiOperation(value = "根据消息获取邮件跟踪值", tags = {"邮件跟踪值" }, notes = "根据消息获取邮件跟踪值")
@RequestMapping(method = RequestMethod.GET, value = "/mail_messages/{mail_message_id}/mail_tracking_values/{mail_tracking_value_id}")
public ResponseEntity<Mail_tracking_valueDTO> getByMail_message(@PathVariable("mail_message_id") Long mail_message_id, @PathVariable("mail_tracking_value_id") Long mail_tracking_value_id) {
Mail_tracking_value domain = mail_tracking_valueService.get(mail_tracking_value_id);
Mail_tracking_valueDTO dto = mail_tracking_valueMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "根据消息获取邮件跟踪值草稿", tags = {"邮件跟踪值" }, notes = "根据消息获取邮件跟踪值草稿")
@RequestMapping(method = RequestMethod.GET, value = "/mail_messages/{mail_message_id}/mail_tracking_values/getdraft")
public ResponseEntity<Mail_tracking_valueDTO> getDraftByMail_message(@PathVariable("mail_message_id") Long mail_message_id) {
Mail_tracking_value domain = new Mail_tracking_value();
domain.setMailMessageId(mail_message_id);
return ResponseEntity.status(HttpStatus.OK).body(mail_tracking_valueMapping.toDto(mail_tracking_valueService.getDraft(domain)));
}
@ApiOperation(value = "根据消息检查邮件跟踪值", tags = {"邮件跟踪值" }, notes = "根据消息检查邮件跟踪值")
@RequestMapping(method = RequestMethod.POST, value = "/mail_messages/{mail_message_id}/mail_tracking_values/checkkey")
public ResponseEntity<Boolean> checkKeyByMail_message(@PathVariable("mail_message_id") Long mail_message_id, @RequestBody Mail_tracking_valueDTO mail_tracking_valuedto) {
return ResponseEntity.status(HttpStatus.OK).body(mail_tracking_valueService.checkKey(mail_tracking_valueMapping.toDomain(mail_tracking_valuedto)));
}
@PreAuthorize("hasPermission(this.mail_tracking_valueMapping.toDomain(#mail_tracking_valuedto),'iBizBusinessCentral-Mail_tracking_value-Save')")
@ApiOperation(value = "根据消息保存邮件跟踪值", tags = {"邮件跟踪值" }, notes = "根据消息保存邮件跟踪值")
@RequestMapping(method = RequestMethod.POST, value = "/mail_messages/{mail_message_id}/mail_tracking_values/save")
public ResponseEntity<Boolean> saveByMail_message(@PathVariable("mail_message_id") Long mail_message_id, @RequestBody Mail_tracking_valueDTO mail_tracking_valuedto) {
Mail_tracking_value domain = mail_tracking_valueMapping.toDomain(mail_tracking_valuedto);
domain.setMailMessageId(mail_message_id);
return ResponseEntity.status(HttpStatus.OK).body(mail_tracking_valueService.save(domain));
}
@PreAuthorize("hasPermission(this.mail_tracking_valueMapping.toDomain(#mail_tracking_valuedtos),'iBizBusinessCentral-Mail_tracking_value-Save')")
@ApiOperation(value = "根据消息批量保存邮件跟踪值", tags = {"邮件跟踪值" }, notes = "根据消息批量保存邮件跟踪值")
@RequestMapping(method = RequestMethod.POST, value = "/mail_messages/{mail_message_id}/mail_tracking_values/savebatch")
public ResponseEntity<Boolean> saveBatchByMail_message(@PathVariable("mail_message_id") Long mail_message_id, @RequestBody List<Mail_tracking_valueDTO> mail_tracking_valuedtos) {
List<Mail_tracking_value> domainlist=mail_tracking_valueMapping.toDomain(mail_tracking_valuedtos);
for(Mail_tracking_value domain:domainlist){
domain.setMailMessageId(mail_message_id);
}
mail_tracking_valueService.saveBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Mail_tracking_value-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Mail_tracking_value-Get')")
@ApiOperation(value = "根据消息获取数据集", tags = {"邮件跟踪值" } ,notes = "根据消息获取数据集")
@RequestMapping(method= RequestMethod.GET , value="/mail_messages/{mail_message_id}/mail_tracking_values/fetchdefault")
public ResponseEntity<List<Mail_tracking_valueDTO>> fetchMail_tracking_valueDefaultByMail_message(@PathVariable("mail_message_id") Long mail_message_id,Mail_tracking_valueSearchContext context) {
context.setN_mail_message_id_eq(mail_message_id);
Page<Mail_tracking_value> domains = mail_tracking_valueService.searchDefault(context) ;
List<Mail_tracking_valueDTO> list = mail_tracking_valueMapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Mail_tracking_value-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Mail_tracking_value-Get')")
@ApiOperation(value = "根据消息查询数据集", tags = {"邮件跟踪值" } ,notes = "根据消息查询数据集")
@RequestMapping(method= RequestMethod.POST , value="/mail_messages/{mail_message_id}/mail_tracking_values/searchdefault")
public ResponseEntity<Page<Mail_tracking_valueDTO>> searchMail_tracking_valueDefaultByMail_message(@PathVariable("mail_message_id") Long mail_message_id, @RequestBody Mail_tracking_valueSearchContext context) {
context.setN_mail_message_id_eq(mail_message_id);
Page<Mail_tracking_value> domains = mail_tracking_valueService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(mail_tracking_valueMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
}
package cn.ibizlab.businesscentral.core.rest;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.ServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.http.HttpStatus;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.validation.annotation.Validated;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import cn.ibizlab.businesscentral.core.dto.*;
import cn.ibizlab.businesscentral.core.mapping.*;
import cn.ibizlab.businesscentral.core.odoo_mail.domain.Message_attachment_rel;
import cn.ibizlab.businesscentral.core.odoo_mail.service.IMessage_attachment_relService;
import cn.ibizlab.businesscentral.core.odoo_mail.filter.Message_attachment_relSearchContext;
import cn.ibizlab.businesscentral.util.annotation.VersionCheck;
@Slf4j
@Api(tags = {"消息附件" })
@RestController("Core-message_attachment_rel")
@RequestMapping("")
public class Message_attachment_relResource {
@Autowired
public IMessage_attachment_relService message_attachment_relService;
@Autowired
@Lazy
public Message_attachment_relMapping message_attachment_relMapping;
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Message_attachment_rel-Create-all')")
@ApiOperation(value = "新建消息附件", tags = {"消息附件" }, notes = "新建消息附件")
@RequestMapping(method = RequestMethod.POST, value = "/message_attachment_rels")
public ResponseEntity<Message_attachment_relDTO> create(@Validated @RequestBody Message_attachment_relDTO message_attachment_reldto) {
Message_attachment_rel domain = message_attachment_relMapping.toDomain(message_attachment_reldto);
message_attachment_relService.create(domain);
Message_attachment_relDTO dto = message_attachment_relMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Message_attachment_rel-Create-all')")
@ApiOperation(value = "批量新建消息附件", tags = {"消息附件" }, notes = "批量新建消息附件")
@RequestMapping(method = RequestMethod.POST, value = "/message_attachment_rels/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<Message_attachment_relDTO> message_attachment_reldtos) {
message_attachment_relService.createBatch(message_attachment_relMapping.toDomain(message_attachment_reldtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Message_attachment_rel-Update-all')")
@ApiOperation(value = "更新消息附件", tags = {"消息附件" }, notes = "更新消息附件")
@RequestMapping(method = RequestMethod.PUT, value = "/message_attachment_rels/{message_attachment_rel_id}")
public ResponseEntity<Message_attachment_relDTO> update(@PathVariable("message_attachment_rel_id") Long message_attachment_rel_id, @RequestBody Message_attachment_relDTO message_attachment_reldto) {
Message_attachment_rel domain = message_attachment_relMapping.toDomain(message_attachment_reldto);
domain .setId(message_attachment_rel_id);
message_attachment_relService.update(domain );
Message_attachment_relDTO dto = message_attachment_relMapping.toDto(domain );
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Message_attachment_rel-Update-all')")
@ApiOperation(value = "批量更新消息附件", tags = {"消息附件" }, notes = "批量更新消息附件")
@RequestMapping(method = RequestMethod.PUT, value = "/message_attachment_rels/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<Message_attachment_relDTO> message_attachment_reldtos) {
message_attachment_relService.updateBatch(message_attachment_relMapping.toDomain(message_attachment_reldtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Message_attachment_rel-Remove-all')")
@ApiOperation(value = "删除消息附件", tags = {"消息附件" }, notes = "删除消息附件")
@RequestMapping(method = RequestMethod.DELETE, value = "/message_attachment_rels/{message_attachment_rel_id}")
public ResponseEntity<Boolean> remove(@PathVariable("message_attachment_rel_id") Long message_attachment_rel_id) {
return ResponseEntity.status(HttpStatus.OK).body(message_attachment_relService.remove(message_attachment_rel_id));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Message_attachment_rel-Remove-all')")
@ApiOperation(value = "批量删除消息附件", tags = {"消息附件" }, notes = "批量删除消息附件")
@RequestMapping(method = RequestMethod.DELETE, value = "/message_attachment_rels/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<Long> ids) {
message_attachment_relService.removeBatch(ids);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Message_attachment_rel-Get-all')")
@ApiOperation(value = "获取消息附件", tags = {"消息附件" }, notes = "获取消息附件")
@RequestMapping(method = RequestMethod.GET, value = "/message_attachment_rels/{message_attachment_rel_id}")
public ResponseEntity<Message_attachment_relDTO> get(@PathVariable("message_attachment_rel_id") Long message_attachment_rel_id) {
Message_attachment_rel domain = message_attachment_relService.get(message_attachment_rel_id);
Message_attachment_relDTO dto = message_attachment_relMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "获取消息附件草稿", tags = {"消息附件" }, notes = "获取消息附件草稿")
@RequestMapping(method = RequestMethod.GET, value = "/message_attachment_rels/getdraft")
public ResponseEntity<Message_attachment_relDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(message_attachment_relMapping.toDto(message_attachment_relService.getDraft(new Message_attachment_rel())));
}
@ApiOperation(value = "检查消息附件", tags = {"消息附件" }, notes = "检查消息附件")
@RequestMapping(method = RequestMethod.POST, value = "/message_attachment_rels/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody Message_attachment_relDTO message_attachment_reldto) {
return ResponseEntity.status(HttpStatus.OK).body(message_attachment_relService.checkKey(message_attachment_relMapping.toDomain(message_attachment_reldto)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Message_attachment_rel-Save-all')")
@ApiOperation(value = "保存消息附件", tags = {"消息附件" }, notes = "保存消息附件")
@RequestMapping(method = RequestMethod.POST, value = "/message_attachment_rels/save")
public ResponseEntity<Boolean> save(@RequestBody Message_attachment_relDTO message_attachment_reldto) {
return ResponseEntity.status(HttpStatus.OK).body(message_attachment_relService.save(message_attachment_relMapping.toDomain(message_attachment_reldto)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Message_attachment_rel-Save-all')")
@ApiOperation(value = "批量保存消息附件", tags = {"消息附件" }, notes = "批量保存消息附件")
@RequestMapping(method = RequestMethod.POST, value = "/message_attachment_rels/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<Message_attachment_relDTO> message_attachment_reldtos) {
message_attachment_relService.saveBatch(message_attachment_relMapping.toDomain(message_attachment_reldtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Message_attachment_rel-searchDefault-all')")
@ApiOperation(value = "获取数据集", tags = {"消息附件" } ,notes = "获取数据集")
@RequestMapping(method= RequestMethod.GET , value="/message_attachment_rels/fetchdefault")
public ResponseEntity<List<Message_attachment_relDTO>> fetchDefault(Message_attachment_relSearchContext context) {
Page<Message_attachment_rel> domains = message_attachment_relService.searchDefault(context) ;
List<Message_attachment_relDTO> list = message_attachment_relMapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Message_attachment_rel-searchDefault-all')")
@ApiOperation(value = "查询数据集", tags = {"消息附件" } ,notes = "查询数据集")
@RequestMapping(method= RequestMethod.POST , value="/message_attachment_rels/searchdefault")
public ResponseEntity<Page<Message_attachment_relDTO>> searchDefault(@RequestBody Message_attachment_relSearchContext context) {
Page<Message_attachment_rel> domains = message_attachment_relService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(message_attachment_relMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册