xinyb
3 天以前 3b74e3df72726e188d36393ecfd7964d095ef7e8
src/com/yc/crm/mail/service/MailImpl.java
@@ -250,7 +250,7 @@
                    "read_Flag,(case when (isnull(handle_time,'') <> '' and isnull(handle_time,'') < getdate()) then 1 else 0 end) as handle," +
                    "handle_time,sender_time,receiving_time from t482101H ";
            sql += " where isnull(handle_time,'') <> '' and isnull(handle_time,'') < getdate()";
            sql += " and userCode=" + GridUtils.prossSqlParm(userCode) + " and receiver like '%" + email + "%'";
            sql += " and userCode=" + GridUtils.prossSqlParm(userCode) ;//+ " and receiver like '%" + email + "%'";//不需要带邮箱地址
            sql += " order by docCode asc \n";
            sql += " OFFSET (" + page + " - 1) * " + limit + " ROWS FETCH NEXT " + limit + " ROWS ONLY";
            return jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(t482101HList.class));
@@ -338,7 +338,7 @@
    public void updateRead(String docCode, boolean status) {
        String sql = " set nocount on \n";
        try {
            sql += "declare @docCode varchar(200) ='" + docCode + "' \n";
            sql += "declare @docCode varchar(1000) ='" + docCode + "' \n";
            sql += "update t482101H set read_flag=" + (status ? 1 : 0) + " where docCode in (select list from GetInStr(@docCode))\n";
            sql += "select @@ROWCOUNT";
            jdbcTemplate.queryForObject(sql, Integer.class);
@@ -506,16 +506,18 @@
        try {
            sql += "select count(*) from t482101H ";
            sql += " where userCode=" + GridUtils.prossSqlParm(userCode);
            sql += " and isnull(delete_Flag,0) = 0 ";//未删除的
            if (mailType < 3) {
                sql += " and mailType=" + mailType;//0:草稿箱 1:收件箱 2:发件箱
            }
            if (mailType == 3) {//待处理邮件
                sql += " and isnull(handle_time,'') <> '' and isnull(handle_time,'') < getdate() ";
            }
            if (StringUtils.isNotBlank(email)) {
                if (mailType == 1) {
                    sql += " and receiver like '%" + email + "%'";
                } else if (mailType == 2) {
                    sql += " and sender =" + GridUtils.prossSqlParm(email);
                } else if (mailType == 3) {
                    sql += " and isnull(handle_time,'') <> '' and isnull(handle_time,'') < getdate() ";
                }
            }
            if (isNoRead) {//0表示未读,1表示已读