|
楼主 |
发表于 2018-2-6 16:20:35
|
显示全部楼层
经过反编译com.jeecg.chat.service.impl.ImServiceImpl后看到以下代码部分
public List<P3ImTSBaseUser> getUsers()
{
List<P3ImTSBaseUser> imTSUsers = new ArrayList();
try
{
MiniDaoHandler minidaoConfig = (MiniDaoHandler)ApplicationContextUtil.getContext().getBean(MiniDaoHandler.class);
if ("sqlserver".equals(minidaoConfig.getDbType())) {
imTSUsers = getUsersSqlServer();
} else {
imTSUsers = getUsersOrcl();
}
}
catch (Exception e)
{
this.log.error("数据库不兼容:" + e.toString());
}
return imTSUsers;
}
还有com.jeecg.chat.dao.ImDao的代码
@Sql("select a.id,a.realname,d.imsign,a.userkey,a.username ,c.org_code as departid ,SUBSTR(c.org_code,1,3) as maindepartid ,d.portrait from t_s_base_user a , t_s_user_org b ,t_s_depart c ,t_s_user d where a.ID =b.user_id and b.org_id=c.id and a.ID=d.id")
public abstract List<P3ImTSBaseUser> getUsers();
@Sql("select a.id,a.realname,d.imsign,a.userkey,a.username ,c.org_code as departid ,SUBSTRING(c.org_code,1,3) as maindepartid ,d.portrait from t_s_base_user a , t_s_user_org b ,t_s_depart c ,t_s_user d where a.ID =b.user_id and b.org_id=c.id and a.ID=d.id")
public abstract List<P3ImTSBaseUser> getUsersSqlServer();
那就是说如果修改了数据库为sqlserver后,系统通过MiniDaoHandler 来捕捉数据库类型后来执行相应的数据库语句。
找到jeecg/scr/main/resources/spring-minidao.xml
<!-- MiniDao动态代理类 -->
<bean id="miniDaoHandler" class="org.jeecgframework.minidao.factory.MiniDaoBeanScannerConfigurer">
<!-- 是使用什么字母做关键字Map的关键字 默认值origin 即和sql保持一致,lower小写(推荐),upper 大写 -->
<property name="keyType" value="lower"></property>
<!-- 格式化sql -->
<property name="formatSql" value="false"></property>
<!-- 输出sql -->
<property name="showSql" value="false"></property>
<!-- 数据库类型 mysql/postgresql/oracle/sqlserver -->
<property name="dbType" value="mysql"></property>
把mysql改成sqlserver,问题顺利解决 |
|