SSM, an entire sql statement is passed in to report an error.

A whole sql statement is passed in to report an error. If you want to understand the cause of this problem,

method:

public List < daily_defray_total > complexSqlQuery (String sql) {
return ddtMapper.complexSqlQuery (sql);
}

pass in the whole sql: here

String defrayTotalSql = " SELECT * FROM daily_defray_total ";
    List<daily_defray_total> dailyDefrayTotalList = dailyDefrayTotalMapper.complexSqlQuery(defrayTotalSql);



in the xml file, both 1 and 2 have tried
1
< select id= "complexSqlQuery" resultMap= "BaseResultMap" parameterType= "String" >-sharp {0}
< / select >

2
< select id= "complexSqlQuery" resultMap= "BaseResultMap" parameterType= "java.lang.String" >-sharp {sql,jdbcType=VARCHAR}
< / select >

error

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near""SELECT * FROM daily_defray_total""at line 1

is it really a grammatical error, or is it not introduced at all

Ssm
Mar.05,2021

The

SQL statement does not use the * sign, but the field of the table,
String defrayTotalSql = "SELECT u_id FROM daily_defray_total";

< select id= "complexSqlQuery" resultMap= "BaseResultMap" parameterType= "String" >
${value}
< / select >


1. I haven't seen the parameter type is String,. It seems that there is only java.lang.String.
2. Pass a parameter you want to receive with a parameter.

Menu