提交 18699dea 编写于 作者: ibizdev's avatar ibizdev

xignzi006 发布系统代码

上级 c4dc8c95
......@@ -58,4 +58,27 @@ public class mail_message_subtypeFallback implements mail_message_subtypeFeignCl
return null;
}
public Mail_message_subtype getDraft(){
return null;
}
public Boolean checkKey(Mail_message_subtype mail_message_subtype){
return false;
}
public Boolean save(Mail_message_subtype mail_message_subtype){
return false;
}
public Boolean saveBatch(List<Mail_message_subtype> mail_message_subtypes){
return false;
}
public Page<Mail_message_subtype> searchDefault(Mail_message_subtypeSearchContext context){
return null;
}
}
......@@ -56,4 +56,24 @@ public interface mail_message_subtypeFeignClient {
Page<Mail_message_subtype> select();
@RequestMapping(method = RequestMethod.GET, value = "/mail_message_subtypes/getdraft")
Mail_message_subtype getDraft();
@RequestMapping(method = RequestMethod.POST, value = "/mail_message_subtypes/checkkey")
Boolean checkKey(@RequestBody Mail_message_subtype mail_message_subtype);
@RequestMapping(method = RequestMethod.POST, value = "/mail_message_subtypes/save")
Boolean save(@RequestBody Mail_message_subtype mail_message_subtype);
@RequestMapping(method = RequestMethod.POST, value = "/mail_message_subtypes/savebatch")
Boolean saveBatch(@RequestBody List<Mail_message_subtype> mail_message_subtypes);
@RequestMapping(method = RequestMethod.POST, value = "/mail_message_subtypes/searchdefault")
Page<Mail_message_subtype> searchDefault(@RequestBody Mail_message_subtypeSearchContext context);
}
......@@ -27,6 +27,76 @@ import cn.ibizlab.businesscentral.core.odoo_mail.domain.Mail_message_subtype;
@Data
public class Mail_message_subtypeSearchContext extends QueryWrapperContext<Mail_message_subtype> {
private String n_name_like;//[消息类型]
public void setN_name_like(String n_name_like) {
this.n_name_like = n_name_like;
if(!ObjectUtils.isEmpty(this.n_name_like)){
this.getSearchCond().like("name", n_name_like);
}
}
private String n_write_uid_text_eq;//[最后更新者]
public void setN_write_uid_text_eq(String n_write_uid_text_eq) {
this.n_write_uid_text_eq = n_write_uid_text_eq;
if(!ObjectUtils.isEmpty(this.n_write_uid_text_eq)){
this.getSearchCond().eq("write_uid_text", n_write_uid_text_eq);
}
}
private String n_write_uid_text_like;//[最后更新者]
public void setN_write_uid_text_like(String n_write_uid_text_like) {
this.n_write_uid_text_like = n_write_uid_text_like;
if(!ObjectUtils.isEmpty(this.n_write_uid_text_like)){
this.getSearchCond().like("write_uid_text", n_write_uid_text_like);
}
}
private String n_create_uid_text_eq;//[创建人]
public void setN_create_uid_text_eq(String n_create_uid_text_eq) {
this.n_create_uid_text_eq = n_create_uid_text_eq;
if(!ObjectUtils.isEmpty(this.n_create_uid_text_eq)){
this.getSearchCond().eq("create_uid_text", n_create_uid_text_eq);
}
}
private String n_create_uid_text_like;//[创建人]
public void setN_create_uid_text_like(String n_create_uid_text_like) {
this.n_create_uid_text_like = n_create_uid_text_like;
if(!ObjectUtils.isEmpty(this.n_create_uid_text_like)){
this.getSearchCond().like("create_uid_text", n_create_uid_text_like);
}
}
private String n_parent_id_text_eq;//[上级]
public void setN_parent_id_text_eq(String n_parent_id_text_eq) {
this.n_parent_id_text_eq = n_parent_id_text_eq;
if(!ObjectUtils.isEmpty(this.n_parent_id_text_eq)){
this.getSearchCond().eq("parent_id_text", n_parent_id_text_eq);
}
}
private String n_parent_id_text_like;//[上级]
public void setN_parent_id_text_like(String n_parent_id_text_like) {
this.n_parent_id_text_like = n_parent_id_text_like;
if(!ObjectUtils.isEmpty(this.n_parent_id_text_like)){
this.getSearchCond().like("parent_id_text", n_parent_id_text_like);
}
}
private Long n_write_uid_eq;//[最后更新者]
public void setN_write_uid_eq(Long n_write_uid_eq) {
this.n_write_uid_eq = n_write_uid_eq;
if(!ObjectUtils.isEmpty(this.n_write_uid_eq)){
this.getSearchCond().eq("write_uid", n_write_uid_eq);
}
}
private Long n_create_uid_eq;//[创建人]
public void setN_create_uid_eq(Long n_create_uid_eq) {
this.n_create_uid_eq = n_create_uid_eq;
if(!ObjectUtils.isEmpty(this.n_create_uid_eq)){
this.getSearchCond().eq("create_uid", n_create_uid_eq);
}
}
private Long n_parent_id_eq;//[上级]
public void setN_parent_id_eq(Long n_parent_id_eq) {
this.n_parent_id_eq = n_parent_id_eq;
if(!ObjectUtils.isEmpty(this.n_parent_id_eq)){
this.getSearchCond().eq("parent_id", n_parent_id_eq);
}
}
/**
* 启用快速搜索
......
......@@ -19,6 +19,7 @@ import com.alibaba.fastjson.JSONObject;
public interface Mail_message_subtypeMapper extends BaseMapper<Mail_message_subtype>{
Page<Mail_message_subtype> searchDefault(IPage page, @Param("srf") Mail_message_subtypeSearchContext context, @Param("ew") Wrapper<Mail_message_subtype> wrapper) ;
@Override
Mail_message_subtype selectById(Serializable id);
@Override
......@@ -61,4 +62,10 @@ public interface Mail_message_subtypeMapper extends BaseMapper<Mail_message_subt
@Delete("${sql}")
boolean deleteBySQL(@Param("sql") String sql, @Param("et")Map param);
List<Mail_message_subtype> selectByParentId(@Param("id") Serializable id) ;
List<Mail_message_subtype> selectByCreateUid(@Param("id") Serializable id) ;
List<Mail_message_subtype> selectByWriteUid(@Param("id") Serializable id) ;
}
......@@ -33,6 +33,17 @@ public interface IMail_message_subtypeService extends IService<Mail_message_subt
boolean remove(Long key) ;
void removeBatch(Collection<Long> idList) ;
Mail_message_subtype get(Long key) ;
Mail_message_subtype getDraft(Mail_message_subtype et) ;
boolean checkKey(Mail_message_subtype et) ;
boolean save(Mail_message_subtype et) ;
void saveBatch(List<Mail_message_subtype> list) ;
Page<Mail_message_subtype> searchDefault(Mail_message_subtypeSearchContext context) ;
List<Mail_message_subtype> selectByParentId(Long id) ;
void removeByParentId(Long id) ;
List<Mail_message_subtype> selectByCreateUid(Long id) ;
void removeByCreateUid(Long id) ;
List<Mail_message_subtype> selectByWriteUid(Long id) ;
void removeByWriteUid(Long id) ;
/**
*自定义查询SQL
* @param sql select * from table where id =#{et.param}
......
......@@ -128,7 +128,89 @@ public class Mail_message_subtypeServiceImpl extends ServiceImpl<Mail_message_su
return et;
}
@Override
public Mail_message_subtype getDraft(Mail_message_subtype et) {
fillParentData(et);
return et;
}
@Override
public boolean checkKey(Mail_message_subtype et) {
return (!ObjectUtils.isEmpty(et.getId()))&&(!Objects.isNull(this.getById(et.getId())));
}
@Override
@Transactional
public boolean save(Mail_message_subtype et) {
if(!saveOrUpdate(et))
return false;
return true;
}
@Override
@Transactional
public boolean saveOrUpdate(Mail_message_subtype et) {
if (null == et) {
return false;
} else {
return checkKey(et) ? this.update(et) : this.create(et);
}
}
@Override
@Transactional
public boolean saveBatch(Collection<Mail_message_subtype> list) {
list.forEach(item->fillParentData(item));
saveOrUpdateBatch(list,batchSize);
return true;
}
@Override
@Transactional
public void saveBatch(List<Mail_message_subtype> list) {
list.forEach(item->fillParentData(item));
saveOrUpdateBatch(list,batchSize);
}
@Override
public List<Mail_message_subtype> selectByParentId(Long id) {
return baseMapper.selectByParentId(id);
}
@Override
public void removeByParentId(Long id) {
this.remove(new QueryWrapper<Mail_message_subtype>().eq("parent_id",id));
}
@Override
public List<Mail_message_subtype> selectByCreateUid(Long id) {
return baseMapper.selectByCreateUid(id);
}
@Override
public void removeByCreateUid(Long id) {
this.remove(new QueryWrapper<Mail_message_subtype>().eq("create_uid",id));
}
@Override
public List<Mail_message_subtype> selectByWriteUid(Long id) {
return baseMapper.selectByWriteUid(id);
}
@Override
public void removeByWriteUid(Long id) {
this.remove(new QueryWrapper<Mail_message_subtype>().eq("write_uid",id));
}
/**
* 查询集合 数据集
*/
@Override
public Page<Mail_message_subtype> searchDefault(Mail_message_subtypeSearchContext context) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<Mail_message_subtype> pages=baseMapper.searchDefault(context.getPages(),context,context.getSelectCond());
return new PageImpl<Mail_message_subtype>(pages.getRecords(), context.getPageable(), pages.getTotal());
}
......
......@@ -4,6 +4,9 @@
<mapper namespace="cn.ibizlab.businesscentral.core.odoo_mail.mapper.Mail_message_subtypeMapper">
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性-->
<select id="selectById" resultMap="Mail_message_subtypeResultMap" databaseId="postgresql">
<![CDATA[select t1.* from (SELECT t1.CREATE_DATE, t1.CREATE_UID, t41.NAME AS CREATE_UID_TEXT, t1.DEFAULT, t1.DESCRIPTION, t1.HIDDEN, t1.ID, t1.INTERNAL, t1.NAME, t1.PARENT_ID, t51.NAME AS PARENT_ID_TEXT, t1.RELATION_FIELD, t1.RES_MODEL, t1.SEQUENCE, t1.WRITE_DATE, t1.WRITE_UID, t21.NAME AS WRITE_UID_TEXT FROM MAIL_MESSAGE_SUBTYPE t1 LEFT JOIN RES_USERS t11 ON t1.WRITE_UID = t11.ID LEFT JOIN RES_PARTNER t21 ON t11.PARTNER_ID = t21.ID LEFT JOIN RES_USERS t31 ON t1.CREATE_UID = t31.ID LEFT JOIN RES_PARTNER t41 ON t31.PARTNER_ID = t41.ID LEFT JOIN MAIL_MESSAGE_SUBTYPE t51 ON t1.PARENT_ID = t51.ID ) t1 where id=#{id}]]>
</select>
<!--通过mybatis将查询结果注入到entity中,通过配置autoMapping="true"由mybatis自动处理映射关系 -->
<resultMap id="Mail_message_subtypeResultMap" type="cn.ibizlab.businesscentral.core.odoo_mail.domain.Mail_message_subtype" autoMapping="true">
......@@ -32,8 +35,45 @@
</resultMap>
<!--关系实体暴露select方法供主实体通过外键查询关系实体数据[实体关系名称:DER1N_MAIL_MESSAGE_SUBTYPE__MAIL_MESSAGE_SUBTYPE__PARENT_ID] -->
<select id="selectByParentId" resultMap="Mail_message_subtypeResultMap">
select t1.* from (
<include refid="Default" />
) t1
where parent_id=#{id}
</select>
<!--关系实体暴露select方法供主实体通过外键查询关系实体数据[实体关系名称:DER1N_MAIL_MESSAGE_SUBTYPE__RES_USERS__CREATE_UID] -->
<select id="selectByCreateUid" resultMap="Mail_message_subtypeResultMap">
select t1.* from (
<include refid="Default" />
) t1
where create_uid=#{id}
</select>
<!--关系实体暴露select方法供主实体通过外键查询关系实体数据[实体关系名称:DER1N_MAIL_MESSAGE_SUBTYPE__RES_USERS__WRITE_UID] -->
<select id="selectByWriteUid" resultMap="Mail_message_subtypeResultMap">
select t1.* from (
<include refid="Default" />
) t1
where write_uid=#{id}
</select>
<!--数据集合[Default]-->
<select id="searchDefault" parameterType="cn.ibizlab.businesscentral.core.odoo_mail.filter.Mail_message_subtypeSearchContext" resultMap="Mail_message_subtypeResultMap">
select t1.* from (
<include refid="Default" />
)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]-->
<sql id="Default" databaseId="postgresql">
<![CDATA[ SELECT t1.CREATE_DATE, t1.CREATE_UID, t41.NAME AS CREATE_UID_TEXT, t1.DEFAULT, t1.HIDDEN, t1.ID, t1.INTERNAL, t1.NAME, t1.PARENT_ID, t51.NAME AS PARENT_ID_TEXT, t1.RELATION_FIELD, t1.RES_MODEL, t1.SEQUENCE, t1.WRITE_DATE, t1.WRITE_UID, t21.NAME AS WRITE_UID_TEXT FROM MAIL_MESSAGE_SUBTYPE t1 LEFT JOIN RES_USERS t11 ON t1.WRITE_UID = t11.ID LEFT JOIN RES_PARTNER t21 ON t11.PARTNER_ID = t21.ID LEFT JOIN RES_USERS t31 ON t1.CREATE_UID = t31.ID LEFT JOIN RES_PARTNER t41 ON t31.PARTNER_ID = t41.ID LEFT JOIN MAIL_MESSAGE_SUBTYPE t51 ON t1.PARENT_ID = t51.ID
]]>
</sql>
<!--数据查询[View]-->
<sql id="View" databaseId="postgresql">
<![CDATA[ SELECT t1.CREATE_DATE, t1.CREATE_UID, t41.NAME AS CREATE_UID_TEXT, t1.DEFAULT, t1.DESCRIPTION, t1.HIDDEN, t1.ID, t1.INTERNAL, t1.NAME, t1.PARENT_ID, t51.NAME AS PARENT_ID_TEXT, t1.RELATION_FIELD, t1.RES_MODEL, t1.SEQUENCE, t1.WRITE_DATE, t1.WRITE_UID, t21.NAME AS WRITE_UID_TEXT FROM MAIL_MESSAGE_SUBTYPE t1 LEFT JOIN RES_USERS t11 ON t1.WRITE_UID = t11.ID LEFT JOIN RES_PARTNER t21 ON t11.PARTNER_ID = t21.ID LEFT JOIN RES_USERS t31 ON t1.CREATE_UID = t31.ID LEFT JOIN RES_PARTNER t41 ON t31.PARTNER_ID = t41.ID LEFT JOIN MAIL_MESSAGE_SUBTYPE t51 ON t1.PARENT_ID = t51.ID
]]>
</sql>
</mapper>
......@@ -109,6 +109,55 @@ public class Mail_message_subtypeResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "获取消息子类型草稿", tags = {"消息子类型" }, notes = "获取消息子类型草稿")
@RequestMapping(method = RequestMethod.GET, value = "/mail_message_subtypes/getdraft")
public ResponseEntity<Mail_message_subtypeDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(mail_message_subtypeMapping.toDto(mail_message_subtypeService.getDraft(new Mail_message_subtype())));
}
@ApiOperation(value = "检查消息子类型", tags = {"消息子类型" }, notes = "检查消息子类型")
@RequestMapping(method = RequestMethod.POST, value = "/mail_message_subtypes/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody Mail_message_subtypeDTO mail_message_subtypedto) {
return ResponseEntity.status(HttpStatus.OK).body(mail_message_subtypeService.checkKey(mail_message_subtypeMapping.toDomain(mail_message_subtypedto)));
}
@PreAuthorize("hasPermission(this.mail_message_subtypeMapping.toDomain(#mail_message_subtypedto),'iBizBusinessCentral-Mail_message_subtype-Save')")
@ApiOperation(value = "保存消息子类型", tags = {"消息子类型" }, notes = "保存消息子类型")
@RequestMapping(method = RequestMethod.POST, value = "/mail_message_subtypes/save")
public ResponseEntity<Boolean> save(@RequestBody Mail_message_subtypeDTO mail_message_subtypedto) {
return ResponseEntity.status(HttpStatus.OK).body(mail_message_subtypeService.save(mail_message_subtypeMapping.toDomain(mail_message_subtypedto)));
}
@PreAuthorize("hasPermission(this.mail_message_subtypeMapping.toDomain(#mail_message_subtypedtos),'iBizBusinessCentral-Mail_message_subtype-Save')")
@ApiOperation(value = "批量保存消息子类型", tags = {"消息子类型" }, notes = "批量保存消息子类型")
@RequestMapping(method = RequestMethod.POST, value = "/mail_message_subtypes/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<Mail_message_subtypeDTO> mail_message_subtypedtos) {
mail_message_subtypeService.saveBatch(mail_message_subtypeMapping.toDomain(mail_message_subtypedtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Mail_message_subtype-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Mail_message_subtype-Get')")
@ApiOperation(value = "获取数据集", tags = {"消息子类型" } ,notes = "获取数据集")
@RequestMapping(method= RequestMethod.GET , value="/mail_message_subtypes/fetchdefault")
public ResponseEntity<List<Mail_message_subtypeDTO>> fetchDefault(Mail_message_subtypeSearchContext context) {
Page<Mail_message_subtype> domains = mail_message_subtypeService.searchDefault(context) ;
List<Mail_message_subtypeDTO> list = mail_message_subtypeMapping.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_subtype-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Mail_message_subtype-Get')")
@ApiOperation(value = "查询数据集", tags = {"消息子类型" } ,notes = "查询数据集")
@RequestMapping(method= RequestMethod.POST , value="/mail_message_subtypes/searchdefault")
public ResponseEntity<Page<Mail_message_subtypeDTO>> searchDefault(@RequestBody Mail_message_subtypeSearchContext context) {
Page<Mail_message_subtype> domains = mail_message_subtypeService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(mail_message_subtypeMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册