-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prepare to add a feat for @Sql Annotation #2986
Comments
Hello @Lambert-Rao , I don't understand how p.s. |
Thank you for your reply, @harawata, here's the example in @Sql(id="userColumns",value="${alias}.id,${alias}.username,${alias}.password")
Integer sqlStatement();
@Select("select <include refid="userColumns"> from user_table where uid=#{userId}")
List<User> getUserInfo(@Param("alias") User userEntity, String userId);
@Select("select <include refid="userColumns"> from user_table oder by id desc")
List<User> getAllUserInfoDesc(@Param("alias") User userEntity); I put some sql statements in |
Okay. [1] |
Thanks, |
Hi,@Lambert-Rao String BASE_COLUMN_LIST = "id, username, password";
@Select("select" + BASE_COLUMN_LIST + " from user_table where id=#{userId}")
List<User> getUserInfo(String userId); |
@HuaJFrame static String TABLE_SQL = "user_info";
static String INSERT_SQL = "insert into " + TABLE_SQL;
static String SELECT_SQL = "select * from " + TABLE_SQL + " where ";
static String UPDATE_SQL = "update " + TABLE_SQL + "set "; And I use them like this:
But it's not convenient when the number of static String grows. Btw, in the future, we hope that we can use
that's one of the reason why we need p.s. |
Sorry, I don't quite understand here, if we use the static String TABLE_SQL = "user_info";
static String INSERT_SQL = "insert into " + TABLE_SQL;
static String SELECT_SQL = "select * from " + TABLE_SQL + " where ";
static String UPDATE_SQL = "update " + TABLE_SQL + "set "; Do we need to declare it like this for every SQL statement? If so, won’t the number also increase? @Sql(id="userColumns",value="${alias}.id,${alias}.username,${alias}.password")
Integer sqlStatement(); Can you give more detailed examples to let everyone know how to use Also, when using We need to consider whether it is worth spending more time to process These are some of my personal thoughts. Because I cannot fully appreciate its advantages, I have too many questions, so please forgive me. |
Feature request
I want to work on this to provide an
@Sql
AnnotationI have used Mybatis for a well, but I find it's not convenient that there is not an
@Sql
annotation for<sql>
just like@Insert
for<insert>
, so I want to add@Sql
and@Include
for a reuse of sql statement.I have post this on Google group
The text was updated successfully, but these errors were encountered: