Home > Back-end >  MyBatis XML filtering based on conditions in the quarter
MyBatis XML filtering based on conditions in the quarter

Time:05-13

Now I have a table t_gdxx_pf, a field in the table for PFSJ (score), now I need a quarter time according to the score the field to filter query, how to write the SQL in XML? Seek counsel,

CodePudding user response:

CodePudding user response:

Condition judgment, the field front-end dispute shall pass, if go if it is not empty, or an empty string in the SQL, does not perform the if it is empty or an empty string in the SQL

CodePudding user response:

Their business processes, the quarter and start time and end time;
Or choose the when, oneself write in XML; Suggest that the first

CodePudding user response:

On the second floor can probably write it for me?

CodePudding user response:

Data in table format, the incoming data formats, specific filtering rules, database version to write clearly

CodePudding user response:

Select * from t_gdxx_pf t where 1=1
And f.p FSJ=# {PFSJ, jdbcType=INTEGER}


JdbcType according to your database type to write

If the front preach the PFSJ go if the inside of the SQL, did not check all, very simple

CodePudding user response:

PFSJ is just a point in time, you query parameter is a range, so the XML only need to do a pfsj> Start time and PFSJ & lt; End time of writing, you into the reference object defined start time and end time attribute, the front will start time to end time as incoming parameters, as for the time range, can consider to the front to start time according to the quarter end time to the back end, can the front quarter turn several backend, which is relatively rigid, subsequent demand change the backend must change

Your needs are regulatory requirements, and no special, general treatment
  • Related