Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Will Yu
@yulewei
@abel533 您好,请教下,MGB 官方开始支持最新的 Mybatis Dynamic SQL,通用 Mapper 是否打算支持呢? http://www.mybatis.org/generator/generatedobjects/dynamicSql.html
liutianshu77
@liutianshu77
@yulewei 最新的 Mybatis Dynamic SQL 增加了什么东西?
林伟武
@RudolphBrown
hi,有个问题想求助一下,困扰了一天多..
在生成的mapper加@Repository注解,然而并没有被识别到.
image.png
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!-- 注入sqlSessionFactory -->
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
<!-- 给出需要扫描Dao接口包 -->
<property name="basePackage" value="com.loyotech.microservice_admin_api.dao" />
<!-- 需要修改包扫描 -->
image.png
林伟武
@RudolphBrown
可以帮帮我吗?项目比较急,项目组又没有做java web的前辈.
Liuzh
@abel533
@RudolphBrown 必须通过 MapperScannerConfigurer 方式扫描。
林伟武
@RudolphBrown
@abel533 谢谢,已经解决了,原本用XML扫描不知道为什么没有读到,后来使用@Mapper注解让SpringBoot抓取到了.
Akhilesh Tyagi
@tyagiakhilesh
Hello, I am trying to call a function (in postgresql) using java annotation from mapper.
something like : @Select(value = "SELECT fractionAssigned(staging_${tenantId}, #{jobRunId}, #{workUnitId}) AS returnedValueAlias") double fractionAssigned(@Param("tenantId") final String tenantId, @Param("jobRunId") final long jobRunId, @Param("workUnitId") final long workUnitId);
But it is not working
Tried this as well. @Select("SELECT fractionAssigned(staging_${tenantId}, #{jobRunId}, #{workUnitId}")
liutianshu77
@liutianshu77
还有foreignera
474846718
@474846718
有哪位大神用过通用mapper插件码
image.png
使用聚合example 就不起作用了
只能查到AggregateCondition().aggregateBy()指定的列
Liuzh
@abel533
@474846718 不如在github提个issue
southrivers
@southrivers
有人吗?
我在用mybatis的时候报了一个错误,排查了半天依然没有结果
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
仔细对照过mapper.xml,dao,namespace没有问题啊
Liuzh
@abel533
@southrivers 有一种可能是打包缺xml,或者没有扫描xml路径。
Do Nhu Vy
@donhuvy
hello
I generate by MyBatis generator

```package com.donhuvy.model;

import java.io.Serializable;
import java.math.BigDecimal;

public class Ccy implements Serializable {
private Long currencyId;

private Object currencyName;

private BigDecimal exchangeRate;

private Short exchangeRateOperator;

private Short isActive;

private Object caAccount;

private Object baAccount;

private Object prefix;

private Object ccyName;

private Object decimalSeperate;

private Object afterDecimal;

private Object subfix;

private BigDecimal convertRate;

private Object prefixEng;

private Object ccyNameEng;

private Object decimalSeperateEng;

private Object afterDecimalEng;

private Object subfixEng;

private BigDecimal convertRateEng;

private Object prefixDefault;

private Object ccyNameDefault;

private Object decimalSeperateDefault;

private Object afterDecimalDefault;

private Object subfixDefault;

private BigDecimal convertRateDefault;

private Object prefixDefaultEng;

private Object ccyNameDefaultEng;

private Object decimalSeperateDefaultEng;

private Object afterDecimalDefaultEng;

private Object subfixDefaultEng;

private BigDecimal convertRateDefaultEng;

private BigDecimal exampleAmount;

private BigDecimal sortOrder;

private String valueOfMoney;

private Object createdDate;

private Object createdBy;

private Object modifiedDate;

private Object modifiedBy;

private static final long serialVersionUID = 1L;

public Long getCurrencyId() {
    return currencyId;
}

public void setCurrencyId(Long currencyId) {
    this.currencyId = currencyId;
}

public Object getCurrencyName() {
    return currencyName;
}

public void setCurrencyName(Object currencyName) {
    this.currencyName = currencyName;
}

public BigDecimal getExchangeRate() {
    return exchangeRate;
}

public void setExchangeRate(BigDecimal exchangeRate) {
    this.exchangeRate = exchangeRate;
}

public Short getExchangeRateOperator() {
    return exchangeRateOperator;
}

public void setExchangeRateOperator(Short exchangeRateOperator) {
    this.exchangeRateOperator = exchangeRateOperator;
}

public Short getIsActive() {
    return isActive;
}

public void setIsActive(Short isActive) {
    this.isActive = isActive;
}

public Object getCaAccount() {
    return caAccount;
}

public void setCaAccount(Object caAccount) {
    this.caAccount = caAccount;
}

public Object getBaAccount() {
    return baAccount;
}

public void setBaAccount(Object baAccount) {
    this.baAccount = baAccount;
}

public Object getPrefix() {
    return prefix;
}

public void setPrefix(Object prefix) {
    this.prefix = prefix;
}

public Object getCcyName() {
    return ccyName;
}

public void setCcyName(Object ccyName) {
    this.ccyName = ccyName;
}

public Object getDecimalSeperate() {
    return decimalSeperate;
}

public void setDecimalSeperate(Object decimalSeperate) {
    this.decimalSeperate = decimalSeperate;
}

public Object getAfterDecimal() {
    return afterDecimal;
}

public void setAfterDecimal(Object afterDecimal) {
    this.afterDecimal = afterDecimal;
}

public Object getSubfix() {
    return subfix;
}

public void setSubfix(Object subfix) {
    this.subfix = subfix;
}

public BigDecimal getConvertRate() {
    return convertRate;
}

public void setConvertRate(BigDecimal convertRate) {
    this.convertRate = convertRate;
}

public Object getPrefixEng() {
    return prefixEng;
}

public void setPrefixEng(Object prefixEng) {
    this.prefixEng = prefixEng;
}

public Object getCcyNameEng() {
    return ccyNameEng;
}

public void setCcyNameEng(Object ccyNameEng) {
    this.ccyNameEng = ccyNameEng;
}

```

but private Object caAccount;
I hope it is private String caAccount;
I don't know how to config
Liuzh
@abel533
@donhuvy<table> 元素内配置列的类型。
Andrija Kovačević
@jddipqd_twitter
Hi
Does anyone know if it is possible to use bind inside a foreach loop?
I have something like this
<bind name="keywordList" value="params.keyword.split(' OR ')" />
<foreach collection="keywordList" item="keywordSingle" open="AND (" close=")" separator=" OR ">
    <bind name="keywordLike" value="'%' + keywordSingle + '%'" />
    (
        p.name LIKE #{keywordLike}
        OR p.internal_id LIKE #{keywordLike}
        OR p.sku LIKE #{keywordLike}
    )
</foreach>
Andrija Kovačević
@jddipqd_twitter
However, the bind inside foreach doesn't seem to work properly, as in the generated query I only get the last element of the splitted array
Am I doing something wrong or this is not possible?
Liuzh
@abel533
@jddipqd_twitter Because your bind name is the same
Brandon
@JavaMonkey_twitter
I am currently working in a code base where our DAO layer is implemented using mybatis mapper interfaces using the mapper annotations to define the SQL interactions. I have a general DAO interface that I need to implemented with mybatis. How is that done? Can someone point me to documentation or an example of a concrete mapper that implements a generalized interaface?
Liuzh
@abel533
@JavaMonkey_twitter in mybatis 3.5.4+, ProviderSqlSource add a additional parameter ProviderContext.if you want a common dao, have a look at https://github.com/abel533/Mapper.
bhshawon
@bhshawon
Hi guys, is the list of supported databases documented anywhere?
474846718
@474846718
@abel533 大佬请问通用mapper好用还是 mybatis plus好用?
mp已经升级到java 8了
1254042329
@1254042329

The error may involve com.example.zfproj.wechat.dao.WeChatClassificationMapper.selectByExample-Inline

The error occurred while setting parameters

SQL: select ID, CODE, NAME, TYPE_NAME, CREATE_BY, CREATE_DATE, UPDATE_BY, UPDATE_DATE, REMARKS, DEL_FLAG from T_SMDP_PSP_TAGS WHERE ( DEL_FLAG = ? ) LIMIT ?

Cause: java.sql.SQLSyntaxErrorException: ORA-00933: SQL 命令未正确结束

; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: ORA-00933: SQL 命令未正确结束
] with root cause

java.sql.SQLSyntaxErrorException: ORA-00933: SQL 命令未正确结束

Who knows this question?
锐哥
@itflash
weekendsqls 怎么使用or? builder.orwhere不起作用
@abel533