parent
38d3257df9
commit
3622e643d6
@ -0,0 +1,93 @@ |
|||||||
|
package com.dxhy.core.controller.mailGather; |
||||||
|
|
||||||
|
import com.dxhy.common.controller.AbstractController; |
||||||
|
import com.dxhy.common.utils.Base64Encoding; |
||||||
|
import com.dxhy.common.utils.R; |
||||||
|
import com.dxhy.core.model.mailGather.EmailMaintainVo; |
||||||
|
import com.dxhy.core.service.mailGather.EmailMaintainService; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.springframework.http.ResponseEntity; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* (EmailMaintain)表控制层 |
||||||
|
* |
||||||
|
* @author makejava |
||||||
|
* @since 2023-03-23 08:39:46 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequestMapping("emailMaintain") |
||||||
|
public class EmailMaintainController extends AbstractController { |
||||||
|
/** |
||||||
|
* 服务对象 |
||||||
|
*/ |
||||||
|
@Resource |
||||||
|
private EmailMaintainService emailMaintainService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* |
||||||
|
* @param pramsMap 筛选条件 |
||||||
|
* @return 查询结果 |
||||||
|
*/ |
||||||
|
@GetMapping("/queryByPage") |
||||||
|
public ResponseEntity<R> queryByPage(@RequestBody Map<String, Object> pramsMap) { |
||||||
|
// 入参统一在入口处理
|
||||||
|
pramsMap.put("dbName", getUserInfo().getDbName()); |
||||||
|
// List<String> gfshList = new ArrayList<>();
|
||||||
|
// if (!"99".equals(pramsMap.get("gfsh")) && pramsMap.get("gfsh") != null && !"".equals(pramsMap.get("gfsh"))) {
|
||||||
|
// gfshList.add(pramsMap.get("gfsh").toString());
|
||||||
|
// } else {
|
||||||
|
// gfshList = UserInfoUtil.getGfshAll(getUserInfo().getOrg());
|
||||||
|
// if (gfshList.size() == 0) {
|
||||||
|
// return ResponseEntity.ok(R.ok().put("data", ""));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// pramsMap.put("gfsh", gfshList);
|
||||||
|
if (pramsMap.get("username") == null || "".equals(pramsMap.get("username"))) { |
||||||
|
return ResponseEntity.ok(R.error("收件人姓名不能为空!")); |
||||||
|
} |
||||||
|
return ResponseEntity.ok(R.ok().put("data",this.emailMaintainService.queryByPage(pramsMap))); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增数据 |
||||||
|
* |
||||||
|
* @param emailMaintain 实体 |
||||||
|
* @return 新增结果 |
||||||
|
*/ |
||||||
|
@PostMapping("/add") |
||||||
|
public ResponseEntity<R> add(@RequestBody EmailMaintainVo emailMaintain) { |
||||||
|
if(StringUtils.isBlank(emailMaintain.getEmailPassword()) || StringUtils.isBlank(emailMaintain.getEmailAddress()) ){ |
||||||
|
return ResponseEntity.ok(R.error("邮箱地址/密码不能为空!")); |
||||||
|
}else { |
||||||
|
String encode = Base64Encoding.encode(emailMaintain.getEmailPassword()); |
||||||
|
emailMaintain.setEmailPassword(encode); |
||||||
|
} |
||||||
|
boolean insert = this.emailMaintainService.insert(emailMaintain); |
||||||
|
if(insert){ |
||||||
|
return ResponseEntity.ok(R.ok()); |
||||||
|
} |
||||||
|
return ResponseEntity.ok(R.error()); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 编辑数据 |
||||||
|
* |
||||||
|
* @param emailMaintain 实体 |
||||||
|
* @return 编辑结果 |
||||||
|
*/ |
||||||
|
@PostMapping("/edit") |
||||||
|
public ResponseEntity<R> edit(EmailMaintainVo emailMaintain) { |
||||||
|
boolean b = emailMaintainService.update(emailMaintain); |
||||||
|
if(b){ |
||||||
|
return ResponseEntity.ok(R.ok()); |
||||||
|
} |
||||||
|
return ResponseEntity.ok(R.error()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
@ -0,0 +1,53 @@ |
|||||||
|
package com.dxhy.core.controller.mailGather; |
||||||
|
|
||||||
|
import com.dxhy.common.controller.AbstractController; |
||||||
|
import com.dxhy.common.utils.R; |
||||||
|
import com.dxhy.core.service.mailGather.MailGatherLogService; |
||||||
|
import org.springframework.http.ResponseEntity; |
||||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* (MailGatherLog)表控制层 |
||||||
|
* |
||||||
|
* @author makejava |
||||||
|
* @since 2023-03-23 08:42:35 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequestMapping("mailGatherLog") |
||||||
|
public class MailGatherLogController extends AbstractController { |
||||||
|
/** |
||||||
|
* 服务对象 |
||||||
|
*/ |
||||||
|
@Resource |
||||||
|
private MailGatherLogService mailGatherLogService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* |
||||||
|
* @param pramsMap 筛选条件 |
||||||
|
* @return 查询结果 |
||||||
|
*/ |
||||||
|
@PostMapping("/queryByPage") |
||||||
|
public ResponseEntity<R> queryByPage(@RequestBody Map<String, Object> pramsMap) { |
||||||
|
|
||||||
|
pramsMap.put("dbName", getUserInfo().getDbName()); |
||||||
|
if (pramsMap.get("username") == null || "".equals(pramsMap.get("username"))) { |
||||||
|
return ResponseEntity.ok(R.error("收件人姓名不能为空!")); |
||||||
|
} |
||||||
|
if (pramsMap.get("parseStart") == null || "".equals(pramsMap.get("parseStart"))) { |
||||||
|
return ResponseEntity.ok(R.error("开始日期不能为空!")); |
||||||
|
} |
||||||
|
if (pramsMap.get("parseEnd") == null || "".equals(pramsMap.get("parseEnd"))) { |
||||||
|
return ResponseEntity.ok(R.error("结束日期不能为空!")); |
||||||
|
} |
||||||
|
return ResponseEntity.ok(R.ok().put("data",this.mailGatherLogService.queryByPage(pramsMap))); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
@ -0,0 +1,81 @@ |
|||||||
|
package com.dxhy.core.dao.mailGather; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.dxhy.core.model.mailGather.EmailMaintainVo; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
|
||||||
|
@Mapper |
||||||
|
public interface EmailMaintainDao extends BaseMapper<EmailMaintainVo> { |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 通过ID查询单条数据 |
||||||
|
* |
||||||
|
* @param id 主键 |
||||||
|
* @return 实例对象 |
||||||
|
*/ |
||||||
|
EmailMaintainVo queryById(String id); |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询指定行数据 |
||||||
|
* |
||||||
|
* @param pramsMap 查询条件 |
||||||
|
* @return 对象列表 |
||||||
|
*/ |
||||||
|
List<EmailMaintainVo> queryAllByLimit(Map<String, Object> pramsMap); |
||||||
|
|
||||||
|
/** |
||||||
|
* 统计总行数 |
||||||
|
* |
||||||
|
* @param emailMaintainVo 查询条件 |
||||||
|
* @return 总行数 |
||||||
|
*/ |
||||||
|
long count(EmailMaintainVo emailMaintainVo); |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增数据 |
||||||
|
* |
||||||
|
* @param emailMaintainVo 实例对象 |
||||||
|
* @return 影响行数 |
||||||
|
*/ |
||||||
|
int insert(EmailMaintainVo emailMaintainVo); |
||||||
|
|
||||||
|
/** |
||||||
|
* 批量新增数据(MyBatis原生foreach方法) |
||||||
|
* |
||||||
|
* @param entities List<EmailMaintainVo> 实例对象列表 |
||||||
|
* @return 影响行数 |
||||||
|
*/ |
||||||
|
int insertBatch(@Param("entities") List<EmailMaintainVo> entities); |
||||||
|
|
||||||
|
/** |
||||||
|
* 批量新增或按主键更新数据(MyBatis原生foreach方法) |
||||||
|
* |
||||||
|
* @param entities List<EmailMaintainVo> 实例对象列表 |
||||||
|
* @return 影响行数 |
||||||
|
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 |
||||||
|
*/ |
||||||
|
int insertOrUpdateBatch(@Param("entities") List<EmailMaintainVo> entities); |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改数据 |
||||||
|
* |
||||||
|
* @param emailMaintainVo 实例对象 |
||||||
|
* @return 影响行数 |
||||||
|
*/ |
||||||
|
int update(EmailMaintainVo emailMaintainVo); |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过主键删除数据 |
||||||
|
* |
||||||
|
* @param id 主键 |
||||||
|
* @return 影响行数 |
||||||
|
*/ |
||||||
|
int deleteById(String id); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,80 @@ |
|||||||
|
package com.dxhy.core.dao.mailGather; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.dxhy.core.model.mailGather.MailGatherLogVo; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
|
||||||
|
@Mapper |
||||||
|
public interface MailGatherLogDao extends BaseMapper<MailGatherLogVo> { |
||||||
|
/** |
||||||
|
* 通过ID查询单条数据 |
||||||
|
* |
||||||
|
* @param id 主键 |
||||||
|
* @return 实例对象 |
||||||
|
*/ |
||||||
|
MailGatherLogVo queryById(String id); |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询指定行数据 |
||||||
|
* |
||||||
|
* @param mailGatherLogVo 查询条件 |
||||||
|
* @param pageable 分页对象 |
||||||
|
* @return 对象列表 |
||||||
|
*/ |
||||||
|
List<MailGatherLogVo> queryAllByLimit(Map<String, Object> pramsMap); |
||||||
|
|
||||||
|
/** |
||||||
|
* 统计总行数 |
||||||
|
* |
||||||
|
* @param mailGatherLogVo 查询条件 |
||||||
|
* @return 总行数 |
||||||
|
*/ |
||||||
|
long count(MailGatherLogVo mailGatherLogVo); |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增数据 |
||||||
|
* |
||||||
|
* @param mailGatherLogVo 实例对象 |
||||||
|
* @return 影响行数 |
||||||
|
*/ |
||||||
|
int insert(MailGatherLogVo mailGatherLogVo); |
||||||
|
|
||||||
|
/** |
||||||
|
* 批量新增数据(MyBatis原生foreach方法) |
||||||
|
* |
||||||
|
* @param entities List<MailGatherLogVo> 实例对象列表 |
||||||
|
* @return 影响行数 |
||||||
|
*/ |
||||||
|
int insertBatch(@Param("entities") List<MailGatherLogVo> entities); |
||||||
|
|
||||||
|
/** |
||||||
|
* 批量新增或按主键更新数据(MyBatis原生foreach方法) |
||||||
|
* |
||||||
|
* @param entities List<MailGatherLogVo> 实例对象列表 |
||||||
|
* @return 影响行数 |
||||||
|
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 |
||||||
|
*/ |
||||||
|
int insertOrUpdateBatch(@Param("entities") List<MailGatherLogVo> entities); |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改数据 |
||||||
|
* |
||||||
|
* @param mailGatherLogVo 实例对象 |
||||||
|
* @return 影响行数 |
||||||
|
*/ |
||||||
|
int update(MailGatherLogVo mailGatherLogVo); |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过主键删除数据 |
||||||
|
* |
||||||
|
* @param id 主键 |
||||||
|
* @return 影响行数 |
||||||
|
*/ |
||||||
|
int deleteById(String id); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,29 @@ |
|||||||
|
package com.dxhy.core.model.mailGather; |
||||||
|
|
||||||
|
import com.dxhy.core.model.CommonDTO; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
|
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class EmailMaintainVo extends CommonDTO { |
||||||
|
|
||||||
|
public String id; |
||||||
|
|
||||||
|
public String deptId; |
||||||
|
|
||||||
|
public String deptName; |
||||||
|
|
||||||
|
public String username; |
||||||
|
|
||||||
|
public String userId; |
||||||
|
public String emailAddress; |
||||||
|
public String emailPassword; |
||||||
|
public String delStatus; |
||||||
|
|
||||||
|
public Date createTime; |
||||||
|
public Date modifyTime; |
||||||
|
} |
@ -0,0 +1,29 @@ |
|||||||
|
package com.dxhy.core.model.mailGather; |
||||||
|
|
||||||
|
|
||||||
|
import com.dxhy.core.model.CommonDTO; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
@Data |
||||||
|
public class MailGatherLogVo extends CommonDTO { |
||||||
|
|
||||||
|
private String id; |
||||||
|
//主题
|
||||||
|
private String subject; |
||||||
|
private String fromAddress; |
||||||
|
private String receiveAddress; |
||||||
|
private String sentDate; |
||||||
|
private String fileType; |
||||||
|
private String fpdm; |
||||||
|
private String fphm; |
||||||
|
private String msgUid; |
||||||
|
private String ocrType; |
||||||
|
private String errorMsg; |
||||||
|
private String fileName; |
||||||
|
private Date createTime; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,48 @@ |
|||||||
|
package com.dxhy.core.service.mailGather; |
||||||
|
|
||||||
|
import com.dxhy.core.model.mailGather.EmailMaintainVo; |
||||||
|
|
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
public interface EmailMaintainService { |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过ID查询单条数据 |
||||||
|
* |
||||||
|
* @param id 主键 |
||||||
|
* @return 实例对象 |
||||||
|
*/ |
||||||
|
EmailMaintainVo queryById(String id); |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* |
||||||
|
* @param pramsMap 筛选条件 |
||||||
|
* @return 查询结果 |
||||||
|
*/ |
||||||
|
String queryByPage(Map<String, Object> pramsMap); |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增数据 |
||||||
|
* |
||||||
|
* @param emailMaintain 实例对象 |
||||||
|
* @return 实例对象 |
||||||
|
*/ |
||||||
|
boolean insert(EmailMaintainVo emailMaintain); |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改数据 |
||||||
|
* |
||||||
|
* @param emailMaintain 实例对象 |
||||||
|
* @return 实例对象 |
||||||
|
*/ |
||||||
|
boolean update(EmailMaintainVo emailMaintain); |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过主键删除数据 |
||||||
|
* |
||||||
|
* @param id 主键 |
||||||
|
* @return 是否成功 |
||||||
|
*/ |
||||||
|
boolean deleteById(String id); |
||||||
|
} |
@ -0,0 +1,49 @@ |
|||||||
|
package com.dxhy.core.service.mailGather; |
||||||
|
|
||||||
|
import com.dxhy.core.model.mailGather.MailGatherLogVo; |
||||||
|
|
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
public interface MailGatherLogService { |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过ID查询单条数据 |
||||||
|
* |
||||||
|
* @param id 主键 |
||||||
|
* @return 实例对象 |
||||||
|
*/ |
||||||
|
MailGatherLogVo queryById(String id); |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* |
||||||
|
* @param pramsMap 筛选条件 |
||||||
|
* @return 查询结果 |
||||||
|
*/ |
||||||
|
String queryByPage(Map<String, Object> pramsMap); |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增数据 |
||||||
|
* |
||||||
|
* @param mailGatherLog 实例对象 |
||||||
|
* @return 实例对象 |
||||||
|
*/ |
||||||
|
MailGatherLogVo insert(MailGatherLogVo mailGatherLog); |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改数据 |
||||||
|
* |
||||||
|
* @param mailGatherLog 实例对象 |
||||||
|
* @return 实例对象 |
||||||
|
*/ |
||||||
|
MailGatherLogVo update(MailGatherLogVo mailGatherLog); |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过主键删除数据 |
||||||
|
* |
||||||
|
* @param id 主键 |
||||||
|
* @return 是否成功 |
||||||
|
*/ |
||||||
|
boolean deleteById(String id); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,108 @@ |
|||||||
|
package com.dxhy.core.service.mailGather.impl; |
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.codec.Base64; |
||||||
|
import cn.hutool.core.util.IdUtil; |
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.dxhy.core.dao.mailGather.EmailMaintainDao; |
||||||
|
import com.dxhy.core.model.mailGather.EmailMaintainVo; |
||||||
|
import com.dxhy.core.service.mailGather.EmailMaintainService; |
||||||
|
import com.github.pagehelper.PageHelper; |
||||||
|
import com.github.pagehelper.PageInfo; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
@Service |
||||||
|
public class EmailMaintainServiceImpl implements EmailMaintainService { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private EmailMaintainDao emailMaintainDao; |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过ID查询单条数据 |
||||||
|
* |
||||||
|
* @param id 主键 |
||||||
|
* @return 实例对象 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public EmailMaintainVo queryById(String id) { |
||||||
|
return this.emailMaintainDao.queryById(id); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* @param pramsMap 筛选条件 |
||||||
|
* @return 查询结果 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public String queryByPage(Map<String, Object> pramsMap) { |
||||||
|
List<Object> returnList = new ArrayList<>(); |
||||||
|
JSONObject json = new JSONObject(); |
||||||
|
int curr = (int)pramsMap.get("curr"); |
||||||
|
int size = (int)pramsMap.get("size"); |
||||||
|
PageHelper.startPage(curr, size); |
||||||
|
List<EmailMaintainVo> emailMaintainVos = emailMaintainDao.queryAllByLimit(pramsMap); |
||||||
|
PageInfo<EmailMaintainVo> pageInfo = new PageInfo<>(emailMaintainVos); |
||||||
|
// 设置记录总数
|
||||||
|
json.put("total", pageInfo.getTotal()); |
||||||
|
json.put("datalist", returnList); |
||||||
|
String jsonString = null; |
||||||
|
if (json != null) { |
||||||
|
log.debug("返回结果:{}", json.toJSONString()); |
||||||
|
jsonString = Base64.encode(json.toJSONString()); |
||||||
|
} |
||||||
|
return jsonString; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增数据 |
||||||
|
* |
||||||
|
* @param emailMaintain 实例对象 |
||||||
|
* @return 实例对象 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public boolean insert(EmailMaintainVo emailMaintain) { |
||||||
|
if(StringUtils.isEmpty(emailMaintain.getId())){ |
||||||
|
emailMaintain.setId(IdUtil.nanoId()); |
||||||
|
} |
||||||
|
if(StringUtils.isEmpty(emailMaintain.getDelStatus())){ |
||||||
|
emailMaintain.setId("0"); |
||||||
|
} |
||||||
|
emailMaintain.setCreateTime(new Date()); |
||||||
|
emailMaintain.setModifyTime(new Date()); |
||||||
|
int insert = this.emailMaintainDao.insert(emailMaintain); |
||||||
|
return insert > 0; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改数据 |
||||||
|
* |
||||||
|
* @param emailMaintain 实例对象 |
||||||
|
* @return 实例对象 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public boolean update(EmailMaintainVo emailMaintain) { |
||||||
|
emailMaintain.setModifyTime(new Date()); |
||||||
|
int update = this.emailMaintainDao.update(emailMaintain); |
||||||
|
return update > 0 ; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过主键删除数据 |
||||||
|
* |
||||||
|
* @param id 主键 |
||||||
|
* @return 是否成功 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public boolean deleteById(String id) { |
||||||
|
return this.emailMaintainDao.deleteById(id) > 0; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,98 @@ |
|||||||
|
package com.dxhy.core.service.mailGather.impl; |
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.codec.Base64; |
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.dxhy.core.dao.mailGather.MailGatherLogDao; |
||||||
|
import com.dxhy.core.model.mailGather.MailGatherLogVo; |
||||||
|
import com.dxhy.core.service.mailGather.MailGatherLogService; |
||||||
|
import com.github.pagehelper.PageHelper; |
||||||
|
import com.github.pagehelper.PageInfo; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
@Service |
||||||
|
public class MailGatherLogServiceImpl implements MailGatherLogService { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private MailGatherLogDao mailGatherLogDao; |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过ID查询单条数据 |
||||||
|
* |
||||||
|
* @param id 主键 |
||||||
|
* @return 实例对象 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public MailGatherLogVo queryById(String id) { |
||||||
|
return this.mailGatherLogDao.queryById(id); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* |
||||||
|
* @param pramsMap 筛选条件 |
||||||
|
* @return 查询结果 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public String queryByPage(Map<String, Object> pramsMap) { |
||||||
|
|
||||||
|
List<Object> returnList = new ArrayList<>(); |
||||||
|
JSONObject json = new JSONObject(); |
||||||
|
int curr = (int)pramsMap.get("curr"); |
||||||
|
int size = (int)pramsMap.get("size"); |
||||||
|
PageHelper.startPage(curr, size); |
||||||
|
List<MailGatherLogVo> emailMaintainVos = mailGatherLogDao.queryAllByLimit(pramsMap); |
||||||
|
PageInfo<MailGatherLogVo> pageInfo = new PageInfo<>(emailMaintainVos); |
||||||
|
// 设置记录总数
|
||||||
|
json.put("total", pageInfo.getTotal()); |
||||||
|
json.put("datalist", returnList); |
||||||
|
String jsonString = null; |
||||||
|
if (json != null) { |
||||||
|
log.debug("返回结果:{}", json.toJSONString()); |
||||||
|
jsonString = Base64.encode(json.toJSONString()); |
||||||
|
} |
||||||
|
return jsonString; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增数据 |
||||||
|
* |
||||||
|
* @param mailGatherLog 实例对象 |
||||||
|
* @return 实例对象 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public MailGatherLogVo insert(MailGatherLogVo mailGatherLog) { |
||||||
|
this.mailGatherLogDao.insert(mailGatherLog); |
||||||
|
return mailGatherLog; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改数据 |
||||||
|
* |
||||||
|
* @param mailGatherLog 实例对象 |
||||||
|
* @return 实例对象 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public MailGatherLogVo update(MailGatherLogVo mailGatherLog) { |
||||||
|
this.mailGatherLogDao.update(mailGatherLog); |
||||||
|
return this.queryById(mailGatherLog.getId()); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过主键删除数据 |
||||||
|
* |
||||||
|
* @param id 主键 |
||||||
|
* @return 是否成功 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public boolean deleteById(String id) { |
||||||
|
return this.mailGatherLogDao.deleteById(id) > 0; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,146 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
<mapper namespace="com.dxhy.core.dao.mailGather.EmailMaintainDao"> |
||||||
|
|
||||||
|
<resultMap type="com.dxhy.core.model.mailGather.EmailMaintainVo" id="EmailMaintainMap"> |
||||||
|
<result property="id" column="id" jdbcType="VARCHAR"/> |
||||||
|
<result property="deptId" column="dept_id" jdbcType="VARCHAR"/> |
||||||
|
<result property="deptName" column="dept_name" jdbcType="VARCHAR"/> |
||||||
|
<result property="username" column="username" jdbcType="VARCHAR"/> |
||||||
|
<result property="userId" column="user_id" jdbcType="VARCHAR"/> |
||||||
|
<result property="emailAddress" column="email_address" jdbcType="VARCHAR"/> |
||||||
|
<result property="emailPassword" column="email_password" jdbcType="VARCHAR"/> |
||||||
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
||||||
|
<result property="delStatus" column="del_status" jdbcType="VARCHAR"/> |
||||||
|
<result property="modifyTime" column="modify_time" jdbcType="TIMESTAMP"/> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
<!--查询单个--> |
||||||
|
<select id="queryById" resultMap="EmailMaintainMap"> |
||||||
|
select |
||||||
|
id, dept_id, dept_name, username, user_id, email_address, email_password, create_time, del_status, modify_time |
||||||
|
from email_maintain |
||||||
|
where id = #{id} |
||||||
|
</select> |
||||||
|
|
||||||
|
<!--查询指定行数据--> |
||||||
|
<select id="queryAllByLimit" resultMap="EmailMaintainMap" parameterType="java.util.Map"> |
||||||
|
select |
||||||
|
id, dept_id, dept_name, username, user_id, email_address, create_time, del_status, modify_time |
||||||
|
from email_maintain |
||||||
|
<where> |
||||||
|
<if test="deptId != null and deptId != ''"> |
||||||
|
and dept_id = #{deptId} |
||||||
|
</if> |
||||||
|
<if test="username != null and username != ''"> |
||||||
|
and username = #{username} |
||||||
|
</if> |
||||||
|
</where> |
||||||
|
</select> |
||||||
|
|
||||||
|
<!--统计总行数--> |
||||||
|
<select id="count" resultType="java.lang.Long"> |
||||||
|
select count(1) |
||||||
|
from email_maintain |
||||||
|
<where> |
||||||
|
<if test="id != null and id != ''"> |
||||||
|
and id = #{id} |
||||||
|
</if> |
||||||
|
<if test="deptId != null and deptId != ''"> |
||||||
|
and dept_id = #{deptId} |
||||||
|
</if> |
||||||
|
<if test="deptName != null and deptName != ''"> |
||||||
|
and dept_name = #{deptName} |
||||||
|
</if> |
||||||
|
<if test="username != null and username != ''"> |
||||||
|
and username = #{username} |
||||||
|
</if> |
||||||
|
<if test="userId != null and userId != ''"> |
||||||
|
and user_id = #{userId} |
||||||
|
</if> |
||||||
|
<if test="emailAddress != null and emailAddress != ''"> |
||||||
|
and email_address = #{emailAddress} |
||||||
|
</if> |
||||||
|
<if test="emailPassword != null and emailPassword != ''"> |
||||||
|
and email_password = #{emailPassword} |
||||||
|
</if> |
||||||
|
<if test="createTime != null"> |
||||||
|
and create_time = #{createTime} |
||||||
|
</if> |
||||||
|
<if test="delStatus != null and delStatus != ''"> |
||||||
|
and del_status = #{delStatus} |
||||||
|
</if> |
||||||
|
<if test="modifyTime != null"> |
||||||
|
and modify_time = #{modifyTime} |
||||||
|
</if> |
||||||
|
</where> |
||||||
|
</select> |
||||||
|
|
||||||
|
<!--新增所有列--> |
||||||
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true"> |
||||||
|
insert into email_maintain(dept_id, dept_name, username, user_id, email_address, email_password, create_time, del_status, modify_time) |
||||||
|
values (#{deptId}, #{deptName}, #{username}, #{userId}, #{emailAddress}, #{emailPassword}, #{createTime}, #{delStatus}, #{modifyTime}) |
||||||
|
</insert> |
||||||
|
|
||||||
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true"> |
||||||
|
insert into email_maintain(dept_id, dept_name, username, user_id, email_address, email_password, create_time, del_status, modify_time) |
||||||
|
values |
||||||
|
<foreach collection="entities" item="entity" separator=","> |
||||||
|
(#{entity.deptId}, #{entity.deptName}, #{entity.username}, #{entity.userId}, #{entity.emailAddress}, #{entity.emailPassword}, #{entity.createTime}, #{entity.delStatus}, #{entity.modifyTime}) |
||||||
|
</foreach> |
||||||
|
</insert> |
||||||
|
|
||||||
|
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true"> |
||||||
|
insert into email_maintain(dept_id, dept_name, username, user_id, email_address, email_password, create_time, del_status, modify_time) |
||||||
|
values |
||||||
|
<foreach collection="entities" item="entity" separator=","> |
||||||
|
(#{entity.deptId}, #{entity.deptName}, #{entity.username}, #{entity.userId}, #{entity.emailAddress}, #{entity.emailPassword}, #{entity.createTime}, #{entity.delStatus}, #{entity.modifyTime}) |
||||||
|
</foreach> |
||||||
|
on duplicate key update |
||||||
|
dept_id = values(dept_id), |
||||||
|
dept_name = values(dept_name), |
||||||
|
username = values(username), |
||||||
|
user_id = values(user_id), |
||||||
|
email_address = values(email_address), |
||||||
|
email_password = values(email_password), |
||||||
|
create_time = values(create_time), |
||||||
|
del_status = values(del_status), |
||||||
|
modify_time = values(modify_time) |
||||||
|
</insert> |
||||||
|
|
||||||
|
<!--通过主键修改数据--> |
||||||
|
<update id="update"> |
||||||
|
update email_maintain |
||||||
|
<set> |
||||||
|
<if test="deptId != null and deptId != ''"> |
||||||
|
dept_id = #{deptId}, |
||||||
|
</if> |
||||||
|
<if test="deptName != null and deptName != ''"> |
||||||
|
dept_name = #{deptName}, |
||||||
|
</if> |
||||||
|
<if test="username != null and username != ''"> |
||||||
|
username = #{username}, |
||||||
|
</if> |
||||||
|
<if test="userId != null and userId != ''"> |
||||||
|
user_id = #{userId}, |
||||||
|
</if> |
||||||
|
<if test="emailAddress != null and emailAddress != ''"> |
||||||
|
email_address = #{emailAddress}, |
||||||
|
</if> |
||||||
|
<if test="emailPassword != null and emailPassword != ''"> |
||||||
|
email_password = #{emailPassword}, |
||||||
|
</if> |
||||||
|
<if test="delStatus != null and delStatus != ''"> |
||||||
|
del_status = #{delStatus}, |
||||||
|
</if> |
||||||
|
</set> |
||||||
|
where id = #{id} |
||||||
|
</update> |
||||||
|
|
||||||
|
<!--通过主键删除--> |
||||||
|
<delete id="deleteById"> |
||||||
|
delete from email_maintain where id = #{id} |
||||||
|
</delete> |
||||||
|
|
||||||
|
</mapper> |
||||||
|
|
@ -0,0 +1,204 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
<mapper namespace="com.dxhy.core.dao.mailGather.MailGatherLogDao"> |
||||||
|
|
||||||
|
<resultMap type="com.dxhy.core.model.mailGather.MailGatherLogVo" id="MailGatherLogMap"> |
||||||
|
<result property="id" column="id" jdbcType="VARCHAR"/> |
||||||
|
<result property="subject" column="subject" jdbcType="VARCHAR"/> |
||||||
|
<result property="fromAddress" column="from_address" jdbcType="VARCHAR"/> |
||||||
|
<result property="receiveAddress" column="receive_address" jdbcType="VARCHAR"/> |
||||||
|
<result property="sentDate" column="sent_date" jdbcType="VARCHAR"/> |
||||||
|
<result property="fileType" column="file_type" jdbcType="VARCHAR"/> |
||||||
|
<result property="fpdm" column="fpdm" jdbcType="VARCHAR"/> |
||||||
|
<result property="fphm" column="fphm" jdbcType="VARCHAR"/> |
||||||
|
<result property="msgUid" column="msg_uid" jdbcType="VARCHAR"/> |
||||||
|
<result property="ocrType" column="ocr_type" jdbcType="VARCHAR"/> |
||||||
|
<result property="errorMsg" column="error_msg" jdbcType="VARCHAR"/> |
||||||
|
<result property="fileName" column="file_name" jdbcType="VARCHAR"/> |
||||||
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
<!--查询单个--> |
||||||
|
<select id="queryById" resultMap="MailGatherLogMap"> |
||||||
|
select |
||||||
|
id, subject, from_address, receive_address, sent_date, file_type, fpdm, fphm, msg_uid, ocr_type, error_msg, file_name, create_time |
||||||
|
from mail_gather_log |
||||||
|
where id = #{id} |
||||||
|
</select> |
||||||
|
|
||||||
|
<!--查询指定行数据--> |
||||||
|
<select id="queryAllByLimit" resultMap="MailGatherLogMap" parameterType="java.util.Map"> |
||||||
|
select |
||||||
|
id, subject, from_address, receive_address, sent_date, file_type, fpdm, fphm, msg_uid, ocr_type, error_msg, file_name, create_time |
||||||
|
from mail_gather_log |
||||||
|
<where> |
||||||
|
<if test="fromAddress != null and fromAddress != ''"> |
||||||
|
and from_address = #{fromAddress} |
||||||
|
</if> |
||||||
|
<if test="receiveAddress != null and receiveAddress != ''"> |
||||||
|
and receive_address = #{receiveAddress} |
||||||
|
</if> |
||||||
|
<if test="sentDate != null and sentDate != ''"> |
||||||
|
and sent_date = #{sentDate} |
||||||
|
</if> |
||||||
|
<if test="fileType != null and fileType != ''"> |
||||||
|
and file_type = #{fileType} |
||||||
|
</if> |
||||||
|
<if test="fpdm != null and fpdm != ''"> |
||||||
|
and fpdm = #{fpdm} |
||||||
|
</if> |
||||||
|
<if test="fphm != null and fphm != ''"> |
||||||
|
and fphm = #{fphm} |
||||||
|
</if> |
||||||
|
<if test="msgUid != null and msgUid != ''"> |
||||||
|
and msg_uid = #{msgUid} |
||||||
|
</if> |
||||||
|
<if test="ocrType != null and ocrType != ''"> |
||||||
|
and ocr_type = #{ocrType} |
||||||
|
</if> |
||||||
|
<if test="errorMsg != null and errorMsg != ''"> |
||||||
|
and error_msg = #{errorMsg} |
||||||
|
</if> |
||||||
|
<if test="fileName != null and fileName != ''"> |
||||||
|
and file_name = #{fileName} |
||||||
|
</if> |
||||||
|
<if test="createTime != null"> |
||||||
|
and create_time = #{createTime} |
||||||
|
</if> |
||||||
|
</where> |
||||||
|
limit #{pageable.offset}, #{pageable.pageSize} |
||||||
|
</select> |
||||||
|
|
||||||
|
<!--统计总行数--> |
||||||
|
<select id="count" resultType="java.lang.Long"> |
||||||
|
select count(1) |
||||||
|
from mail_gather_log |
||||||
|
<where> |
||||||
|
<if test="id != null and id != ''"> |
||||||
|
and id = #{id} |
||||||
|
</if> |
||||||
|
<if test="subject != null and subject != ''"> |
||||||
|
and subject = #{subject} |
||||||
|
</if> |
||||||
|
<if test="fromAddress != null and fromAddress != ''"> |
||||||
|
and from_address = #{from} |
||||||
|
</if> |
||||||
|
<if test="receiveAddress != null and receiveAddress != ''"> |
||||||
|
and receive_address = #{receiveAddress} |
||||||
|
</if> |
||||||
|
<if test="sentDate != null and sentDate != ''"> |
||||||
|
and sent_date = #{sentDate} |
||||||
|
</if> |
||||||
|
<if test="fileType != null and fileType != ''"> |
||||||
|
and file_type = #{fileType} |
||||||
|
</if> |
||||||
|
<if test="fpdm != null and fpdm != ''"> |
||||||
|
and fpdm = #{fpdm} |
||||||
|
</if> |
||||||
|
<if test="fphm != null and fphm != ''"> |
||||||
|
and fphm = #{fphm} |
||||||
|
</if> |
||||||
|
<if test="msgUid != null and msgUid != ''"> |
||||||
|
and msg_uid = #{msgUid} |
||||||
|
</if> |
||||||
|
<if test="ocrType != null and ocrType != ''"> |
||||||
|
and ocr_type = #{ocrType} |
||||||
|
</if> |
||||||
|
<if test="errorMsg != null and errorMsg != ''"> |
||||||
|
and error_msg = #{errorMsg} |
||||||
|
</if> |
||||||
|
<if test="fileName != null and fileName != ''"> |
||||||
|
and file_name = #{fileName} |
||||||
|
</if> |
||||||
|
<if test="createTime != null"> |
||||||
|
and create_time = #{createTime} |
||||||
|
</if> |
||||||
|
</where> |
||||||
|
</select> |
||||||
|
|
||||||
|
<!--新增所有列--> |
||||||
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true"> |
||||||
|
insert into mail_gather_log(subject, from_address, receive_address, sent_date, file_type, fpdm, fphm, msg_uid, ocr_type, error_msg, file_name, create_time) |
||||||
|
values (#{subject}, #{fromAddress}, #{receiveAddress}, #{sentDate}, #{fileType}, #{fpdm}, #{fphm}, #{msgUid}, #{ocrType}, #{errorMsg}, #{fileName}, #{createTime}) |
||||||
|
</insert> |
||||||
|
|
||||||
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true"> |
||||||
|
insert into mail_gather_log(subject, from_address, receive_address, sent_date, file_type, fpdm, fphm, msg_uid, ocr_type, error_msg, file_name, create_time) |
||||||
|
values |
||||||
|
<foreach collection="entities" item="entity" separator=","> |
||||||
|
(#{entity.subject}, #{entity.fromAddress}, #{entity.receiveAddress}, #{entity.sentDate}, #{entity.fileType}, #{entity.fpdm}, #{entity.fphm}, #{entity.msgUid}, #{entity.ocrType}, #{entity.errorMsg}, #{entity.fileName}, #{entity.createTime}) |
||||||
|
</foreach> |
||||||
|
</insert> |
||||||
|
|
||||||
|
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true"> |
||||||
|
insert into mail_gather_log(subject, from_address, receive_address, sent_date, file_type, fpdm, fphm, msg_uid, ocr_type, error_msg, file_name, create_time) |
||||||
|
values |
||||||
|
<foreach collection="entities" item="entity" separator=","> |
||||||
|
(#{entity.subject}, #{entity.fromAddress}, #{entity.receiveAddress}, #{entity.sentDate}, #{entity.fileType}, #{entity.fpdm}, #{entity.fphm}, #{entity.msgUid}, #{entity.ocrType}, #{entity.errorMsg}, #{entity.fileName}, #{entity.createTime}) |
||||||
|
</foreach> |
||||||
|
on duplicate key update |
||||||
|
subject = values(subject), |
||||||
|
from_address = values(fromAddress), |
||||||
|
receive_address = values(receive_address), |
||||||
|
sent_date = values(sent_date), |
||||||
|
file_type = values(file_type), |
||||||
|
fpdm = values(fpdm), |
||||||
|
fphm = values(fphm), |
||||||
|
msg_uid = values(msg_uid), |
||||||
|
ocr_type = values(ocr_type), |
||||||
|
error_msg = values(error_msg), |
||||||
|
file_name = values(file_name), |
||||||
|
create_time = values(create_time) |
||||||
|
</insert> |
||||||
|
|
||||||
|
<!--通过主键修改数据--> |
||||||
|
<update id="update"> |
||||||
|
update mail_gather_log |
||||||
|
<set> |
||||||
|
<if test="subject != null and subject != ''"> |
||||||
|
subject = #{subject}, |
||||||
|
</if> |
||||||
|
<if test="fromAddress != null and fromAddress != ''"> |
||||||
|
from_address = #{fromAddress}, |
||||||
|
</if> |
||||||
|
<if test="receiveAddress != null and receiveAddress != ''"> |
||||||
|
receive_address = #{receiveAddress}, |
||||||
|
</if> |
||||||
|
<if test="sentDate != null and sentDate != ''"> |
||||||
|
sent_date = #{sentDate}, |
||||||
|
</if> |
||||||
|
<if test="fileType != null and fileType != ''"> |
||||||
|
file_type = #{fileType}, |
||||||
|
</if> |
||||||
|
<if test="fpdm != null and fpdm != ''"> |
||||||
|
fpdm = #{fpdm}, |
||||||
|
</if> |
||||||
|
<if test="fphm != null and fphm != ''"> |
||||||
|
fphm = #{fphm}, |
||||||
|
</if> |
||||||
|
<if test="msgUid != null and msgUid != ''"> |
||||||
|
msg_uid = #{msgUid}, |
||||||
|
</if> |
||||||
|
<if test="ocrType != null and ocrType != ''"> |
||||||
|
ocr_type = #{ocrType}, |
||||||
|
</if> |
||||||
|
<if test="errorMsg != null and errorMsg != ''"> |
||||||
|
error_msg = #{errorMsg}, |
||||||
|
</if> |
||||||
|
<if test="fileName != null and fileName != ''"> |
||||||
|
file_name = #{fileName}, |
||||||
|
</if> |
||||||
|
<if test="createTime != null"> |
||||||
|
create_time = #{createTime}, |
||||||
|
</if> |
||||||
|
</set> |
||||||
|
where id = #{id} |
||||||
|
</update> |
||||||
|
|
||||||
|
<!--通过主键删除--> |
||||||
|
<delete id="deleteById"> |
||||||
|
delete from mail_gather_log where id = #{id} |
||||||
|
</delete> |
||||||
|
|
||||||
|
</mapper> |
||||||
|
|
Loading…
Reference in new issue