Commit 8216dfb5 authored by yanzg's avatar yanzg

修改实体位置

parent 2ad34e83
...@@ -9,6 +9,7 @@ import com.yanzuoguang.util.exception.CodeException; ...@@ -9,6 +9,7 @@ import com.yanzuoguang.util.exception.CodeException;
import com.yanzuoguang.util.helper.DateHelper; import com.yanzuoguang.util.helper.DateHelper;
import com.yanzuoguang.util.helper.StringHelper; import com.yanzuoguang.util.helper.StringHelper;
import com.yanzuoguang.util.vo.*; import com.yanzuoguang.util.vo.*;
import org.omg.CORBA.StringHolder;
import java.util.*; import java.util.*;
...@@ -661,12 +662,15 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao { ...@@ -661,12 +662,15 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
} }
String md5Field = this.table.getTable().getMD5KeyName(); String md5Field = this.table.getTable().getMD5KeyName();
String md5From = StringHelper.isEmpty(md5Field) ? StringHelper.EMPTY : ObjectHelper.getString(model, md5Field);
// 获取前台分组的MD5标识 // 获取前台分组的MD5标识
String md5 = this.getMd5(DaoConst.GROUP_QUERY, model); String md5 = md5From;
if (StringHelper.isEmpty(md5)) {
md5 = this.getMd5(DaoConst.GROUP_QUERY, model);
}
if (!StringHelper.isEmpty(md5Field)) { if (!StringHelper.isEmpty(md5Field)) {
ObjectHelper.set(model, md5Field, md5); ObjectHelper.set(model, md5Field, md5);
} }
if (this.table.getTable().getKeyType() == String.class) { if (this.table.getTable().getKeyType() == String.class) {
this.setKeyString(model, md5); this.setKeyString(model, md5);
} }
......
...@@ -7,6 +7,7 @@ import com.yanzuoguang.db.DbExecute; ...@@ -7,6 +7,7 @@ import com.yanzuoguang.db.DbExecute;
import com.yanzuoguang.mq.dao.MessageDao; import com.yanzuoguang.mq.dao.MessageDao;
import com.yanzuoguang.mq.vo.MessageVo; import com.yanzuoguang.mq.vo.MessageVo;
import com.yanzuoguang.util.vo.MapRow; import com.yanzuoguang.util.vo.MapRow;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.HashMap; import java.util.HashMap;
...@@ -19,7 +20,7 @@ import java.util.Map; ...@@ -19,7 +20,7 @@ import java.util.Map;
* @author 颜佐光 * @author 颜佐光
*/ */
@Component @Component
public class MessageDaoImpl extends BaseDaoImpl implements MessageDao { public class MessageDaoImpl extends BaseDaoImpl implements MessageDao, InitializingBean {
private static final String UPDATE_BATCH_SQL = "UPDATE_BATCH_SQL"; private static final String UPDATE_BATCH_SQL = "UPDATE_BATCH_SQL";
private static final String QUERY_TABLE_SQL = "SHOW TABLES LIKE 'queue_message'"; private static final String QUERY_TABLE_SQL = "SHOW TABLES LIKE 'queue_message'";
private static final String CREATE_TABLE_SQL = "CREATE TABLE `queue_message` ( " + private static final String CREATE_TABLE_SQL = "CREATE TABLE `queue_message` ( " +
...@@ -50,11 +51,21 @@ public class MessageDaoImpl extends BaseDaoImpl implements MessageDao { ...@@ -50,11 +51,21 @@ public class MessageDaoImpl extends BaseDaoImpl implements MessageDao {
"SET a.BatchId = ?,a.HandleTime=DATE_ADD(NOW(),INTERVAL 5 MINUTE) ", "batchId"); "SET a.BatchId = ?,a.HandleTime=DATE_ADD(NOW(),INTERVAL 5 MINUTE) ", "batchId");
} }
/**
* Invoked by a BeanFactory after it has set all bean properties supplied
* (and satisfied BeanFactoryAware and ApplicationContextAware).
* <p>This method allows the bean instance to perform initialization only
* possible when all bean properties have been set and to throw an
* exception in the event of misconfiguration.
*
* @throws Exception in the event of misconfiguration (such
* as failure to set an essential property) or if initialization fails.
*/
@Override @Override
protected void initExecute(DbExecute db) { public void afterPropertiesSet() throws Exception {
List<MapRow> tables = db.query(MessageDaoImpl.class, "QUERY_TABLE_SQL", QUERY_TABLE_SQL); List<MapRow> tables = this.getDb().query(MessageDaoImpl.class, "QUERY_TABLE_SQL", QUERY_TABLE_SQL);
if (tables.isEmpty()) { if (tables.isEmpty()) {
db.update(MessageDaoImpl.class, "CREATE_TABLE_SQL", CREATE_TABLE_SQL); this.getDb().update(MessageDaoImpl.class, "CREATE_TABLE_SQL", CREATE_TABLE_SQL);
} }
} }
......
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