TableFieldMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.izouma.awesomeadmin.dao.TableFieldMapper" >
  4. <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.TableField" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="name" property="name" jdbcType="VARCHAR" />
  7. <result column="remark" property="remark" jdbcType="VARCHAR" />
  8. <result column="jdbcType" property="jdbcType" jdbcType="VARCHAR" />
  9. <result column="javaType" property="javaType" jdbcType="VARCHAR" />
  10. <result column="length" property="length" jdbcType="INTEGER" />
  11. <result column="decimalPlaces" property="decimalPlaces" jdbcType="INTEGER" />
  12. <result column="defaultValue" property="defaultValue" jdbcType="VARCHAR" />
  13. <result column="notNull" property="notNull" jdbcType="BIT" />
  14. <result column="primaryKey" property="primaryKey" jdbcType="BIT" />
  15. <result column="autoIncrease" property="autoIncrease" jdbcType="BIT" />
  16. <result column="showInList" property="showInList" jdbcType="BIT" />
  17. <result column="showInForm" property="showInForm" jdbcType="BIT" />
  18. <result column="searchable" property="searchable" jdbcType="BIT" />
  19. <result column="formType" property="formType" jdbcType="VARCHAR" />
  20. <result column="searchMethod" property="searchMethod" jdbcType="VARCHAR" />
  21. <result column="required" property="required" jdbcType="BIT" />
  22. <result column="validate" property="validate" jdbcType="BIT" />
  23. <result column="minLength" property="minLength" jdbcType="INTEGER" />
  24. <result column="maxLength" property="maxLength" jdbcType="INTEGER" />
  25. <result column="min" property="min" jdbcType="VARCHAR" />
  26. <result column="max" property="max" jdbcType="VARCHAR" />
  27. <result column="validatorType" property="validatorType" jdbcType="VARCHAR" />
  28. </resultMap>
  29. <sql id="Base_Column_List" >
  30. id, 'name', remark, jdbcType, javaType, 'length', decimalPlaces, defaultValue, notNull, primaryKey, autoIncrease, showInList, showInForm, searchable, formType, searchMethod, required, validate, minLength, maxLength, 'min','max', validatorType
  31. </sql>
  32. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  33. select
  34. <include refid="Base_Column_List" />
  35. from table_field
  36. where id = #{id,jdbcType=INTEGER}
  37. </select>
  38. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  39. delete from table_field
  40. where id = #{id,jdbcType=INTEGER}
  41. </delete>
  42. <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.TableField" useGeneratedKeys="true" keyProperty="id">
  43. insert into table_field
  44. <trim prefix="(" suffix=")" suffixOverrides="," >
  45. <if test="id != null" >
  46. id,
  47. </if>
  48. <if test="name != null" >
  49. name,
  50. </if>
  51. <if test="remark != null" >
  52. remark,
  53. </if>
  54. <if test="jdbcType != null" >
  55. jdbcType,
  56. </if>
  57. <if test="javaType != null" >
  58. javaType,
  59. </if>
  60. <if test="length != null" >
  61. length,
  62. </if>
  63. <if test="decimalPlaces != null" >
  64. decimalPlaces,
  65. </if>
  66. <if test="defaultValue != null" >
  67. defaultValue,
  68. </if>
  69. <if test="notNull != null" >
  70. notNull,
  71. </if>
  72. <if test="primaryKey != null" >
  73. primaryKey,
  74. </if>
  75. <if test="autoIncrease != null" >
  76. autoIncrease,
  77. </if>
  78. <if test="showInList != null" >
  79. showInList,
  80. </if>
  81. <if test="showInForm != null" >
  82. showInForm,
  83. </if>
  84. <if test="searchable != null" >
  85. searchable,
  86. </if>
  87. <if test="formType != null" >
  88. formType,
  89. </if>
  90. <if test="searchMethod != null" >
  91. searchMethod,
  92. </if>
  93. <if test="required != null" >
  94. required,
  95. </if>
  96. <if test="validate != null" >
  97. validate,
  98. </if>
  99. <if test="minLength != null" >
  100. minLength,
  101. </if>
  102. <if test="maxLength != null" >
  103. maxLength,
  104. </if>
  105. <if test="min != null" >
  106. min,
  107. </if>
  108. <if test="max != null" >
  109. max,
  110. </if>
  111. <if test="validatorType != null" >
  112. validatorType,
  113. </if>
  114. </trim>
  115. <trim prefix="values (" suffix=")" suffixOverrides="," >
  116. <if test="id != null" >
  117. #{id,jdbcType=INTEGER},
  118. </if>
  119. <if test="name != null" >
  120. #{name,jdbcType=VARCHAR},
  121. </if>
  122. <if test="remark != null" >
  123. #{remark,jdbcType=VARCHAR},
  124. </if>
  125. <if test="jdbcType != null" >
  126. #{jdbcType,jdbcType=VARCHAR},
  127. </if>
  128. <if test="javaType != null" >
  129. #{javaType,jdbcType=VARCHAR},
  130. </if>
  131. <if test="length != null" >
  132. #{length,jdbcType=INTEGER},
  133. </if>
  134. <if test="decimalPlaces != null" >
  135. #{decimalPlaces,jdbcType=INTEGER},
  136. </if>
  137. <if test="defaultValue != null" >
  138. #{defaultValue,jdbcType=VARCHAR},
  139. </if>
  140. <if test="notNull != null" >
  141. #{notNull,jdbcType=BIT},
  142. </if>
  143. <if test="primaryKey != null" >
  144. #{primaryKey,jdbcType=BIT},
  145. </if>
  146. <if test="autoIncrease != null" >
  147. #{autoIncrease,jdbcType=BIT},
  148. </if>
  149. <if test="showInList != null" >
  150. #{showInList,jdbcType=BIT},
  151. </if>
  152. <if test="showInForm != null" >
  153. #{showInForm,jdbcType=BIT},
  154. </if>
  155. <if test="searchable != null" >
  156. #{searchable,jdbcType=BIT},
  157. </if>
  158. <if test="formType != null" >
  159. #{formType,jdbcType=VARCHAR},
  160. </if>
  161. <if test="searchMethod != null" >
  162. #{searchMethod,jdbcType=VARCHAR},
  163. </if>
  164. <if test="required != null" >
  165. #{required,jdbcType=BIT},
  166. </if>
  167. <if test="validate != null" >
  168. #{validate,jdbcType=BIT},
  169. </if>
  170. <if test="minLength != null" >
  171. #{minLength,jdbcType=INTEGER},
  172. </if>
  173. <if test="maxLength != null" >
  174. #{maxLength,jdbcType=INTEGER},
  175. </if>
  176. <if test="min != null" >
  177. #{min,jdbcType=VARCHAR},
  178. </if>
  179. <if test="max != null" >
  180. #{max,jdbcType=VARCHAR},
  181. </if>
  182. <if test="validatorType != null" >
  183. #{validatorType,jdbcType=VARCHAR},
  184. </if>
  185. </trim>
  186. </insert>
  187. <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.TableField" >
  188. update table_field
  189. <set >
  190. <if test="name != null" >
  191. name = #{name,jdbcType=VARCHAR},
  192. </if>
  193. <if test="remark != null" >
  194. remark = #{remark,jdbcType=VARCHAR},
  195. </if>
  196. <if test="jdbcType != null" >
  197. jdbcType = #{jdbcType,jdbcType=VARCHAR},
  198. </if>
  199. <if test="javaType != null" >
  200. javaType = #{javaType,jdbcType=VARCHAR},
  201. </if>
  202. <if test="length != null" >
  203. length = #{length,jdbcType=INTEGER},
  204. </if>
  205. <if test="decimalPlaces != null" >
  206. decimalPlaces = #{decimalPlaces,jdbcType=INTEGER},
  207. </if>
  208. <if test="defaultValue != null" >
  209. defaultValue = #{defaultValue,jdbcType=VARCHAR},
  210. </if>
  211. <if test="notNull != null" >
  212. notNull = #{notNull,jdbcType=BIT},
  213. </if>
  214. <if test="primaryKey != null" >
  215. primaryKey = #{primaryKey,jdbcType=BIT},
  216. </if>
  217. <if test="autoIncrease != null" >
  218. autoIncrease = #{autoIncrease,jdbcType=BIT},
  219. </if>
  220. <if test="showInList != null" >
  221. showInList = #{showInList,jdbcType=BIT},
  222. </if>
  223. <if test="showInForm != null" >
  224. showInForm = #{showInForm,jdbcType=BIT},
  225. </if>
  226. <if test="searchable != null" >
  227. searchable = #{searchable,jdbcType=BIT},
  228. </if>
  229. <if test="formType != null" >
  230. formType = #{formType,jdbcType=VARCHAR},
  231. </if>
  232. <if test="searchMethod != null" >
  233. searchMethod = #{searchMethod,jdbcType=VARCHAR},
  234. </if>
  235. <if test="required != null" >
  236. required = #{required,jdbcType=BIT},
  237. </if>
  238. <if test="validate != null" >
  239. validate = #{validate,jdbcType=BIT},
  240. </if>
  241. <if test="minLength != null" >
  242. minLength = #{minLength,jdbcType=INTEGER},
  243. </if>
  244. <if test="maxLength != null" >
  245. maxLength = #{maxLength,jdbcType=INTEGER},
  246. </if>
  247. <if test="min != null" >
  248. min = #{min,jdbcType=VARCHAR},
  249. </if>
  250. <if test="max != null" >
  251. max = #{max,jdbcType=VARCHAR},
  252. </if>
  253. <if test="validatorType != null" >
  254. validatorType = #{validatorType,jdbcType=VARCHAR},
  255. </if>
  256. </set>
  257. where id = #{id,jdbcType=INTEGER}
  258. </update>
  259. <select id="queryTableFieldsByPage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.TableField">
  260. select <include refid="Base_Column_List"/> from table_field
  261. <where>
  262. and del_flag = 'N'
  263. <if test="record.id != null and !&quot;&quot;.equals(record.id)">
  264. and id = #{record.id}
  265. </if>
  266. <if test="record.name != null and !&quot;&quot;.equals(record.name)">
  267. and name = #{record.name}
  268. </if>
  269. <if test="record.remark != null and !&quot;&quot;.equals(record.remark)">
  270. and remark = #{record.remark}
  271. </if>
  272. <if test="record.jdbcType != null and !&quot;&quot;.equals(record.jdbcType)">
  273. and jdbcType = #{record.jdbcType}
  274. </if>
  275. <if test="record.javaType != null and !&quot;&quot;.equals(record.javaType)">
  276. and javaType = #{record.javaType}
  277. </if>
  278. <if test="record.length != null and !&quot;&quot;.equals(record.length)">
  279. and length = #{record.length}
  280. </if>
  281. <if test="record.decimalPlaces != null and !&quot;&quot;.equals(record.decimalPlaces)">
  282. and decimalPlaces = #{record.decimalPlaces}
  283. </if>
  284. <if test="record.defaultValue != null and !&quot;&quot;.equals(record.defaultValue)">
  285. and defaultValue = #{record.defaultValue}
  286. </if>
  287. <if test="record.notNull != null and !&quot;&quot;.equals(record.notNull)">
  288. and notNull = #{record.notNull}
  289. </if>
  290. <if test="record.primaryKey != null and !&quot;&quot;.equals(record.primaryKey)">
  291. and primaryKey = #{record.primaryKey}
  292. </if>
  293. <if test="record.autoIncrease != null and !&quot;&quot;.equals(record.autoIncrease)">
  294. and autoIncrease = #{record.autoIncrease}
  295. </if>
  296. <if test="record.showInList != null and !&quot;&quot;.equals(record.showInList)">
  297. and showInList = #{record.showInList}
  298. </if>
  299. <if test="record.showInForm != null and !&quot;&quot;.equals(record.showInForm)">
  300. and showInForm = #{record.showInForm}
  301. </if>
  302. <if test="record.searchable != null and !&quot;&quot;.equals(record.searchable)">
  303. and searchable = #{record.searchable}
  304. </if>
  305. <if test="record.formType != null and !&quot;&quot;.equals(record.formType)">
  306. and formType = #{record.formType}
  307. </if>
  308. <if test="record.searchMethod != null and !&quot;&quot;.equals(record.searchMethod)">
  309. and searchMethod = #{record.searchMethod}
  310. </if>
  311. <if test="record.required != null and !&quot;&quot;.equals(record.required)">
  312. and required = #{record.required}
  313. </if>
  314. <if test="record.validate != null and !&quot;&quot;.equals(record.validate)">
  315. and validate = #{record.validate}
  316. </if>
  317. <if test="record.minLength != null and !&quot;&quot;.equals(record.minLength)">
  318. and minLength = #{record.minLength}
  319. </if>
  320. <if test="record.maxLength != null and !&quot;&quot;.equals(record.maxLength)">
  321. and maxLength = #{record.maxLength}
  322. </if>
  323. <if test="record.min != null and !&quot;&quot;.equals(record.min)">
  324. and min = #{record.min}
  325. </if>
  326. <if test="record.max != null and !&quot;&quot;.equals(record.max)">
  327. and max = #{record.max}
  328. </if>
  329. <if test="record.validatorType != null and !&quot;&quot;.equals(record.validatorType)">
  330. and validatorType = #{record.validatorType}
  331. </if>
  332. </where>
  333. order by id desc
  334. </select>
  335. <select id="queryAllTableField" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.TableField">
  336. select <include refid="Base_Column_List"/> from table_field
  337. <where>
  338. and del_flag = 'N'
  339. <if test="id != null and !&quot;&quot;.equals(id)">
  340. and id = #{id}
  341. </if>
  342. <if test="name != null and !&quot;&quot;.equals(name)">
  343. and name = #{name}
  344. </if>
  345. <if test="remark != null and !&quot;&quot;.equals(remark)">
  346. and remark = #{remark}
  347. </if>
  348. <if test="jdbcType != null and !&quot;&quot;.equals(jdbcType)">
  349. and jdbcType = #{jdbcType}
  350. </if>
  351. <if test="javaType != null and !&quot;&quot;.equals(javaType)">
  352. and javaType = #{javaType}
  353. </if>
  354. <if test="length != null and !&quot;&quot;.equals(length)">
  355. and length = #{length}
  356. </if>
  357. <if test="decimalPlaces != null and !&quot;&quot;.equals(decimalPlaces)">
  358. and decimalPlaces = #{decimalPlaces}
  359. </if>
  360. <if test="defaultValue != null and !&quot;&quot;.equals(defaultValue)">
  361. and defaultValue = #{defaultValue}
  362. </if>
  363. <if test="notNull != null and !&quot;&quot;.equals(notNull)">
  364. and notNull = #{notNull}
  365. </if>
  366. <if test="primaryKey != null and !&quot;&quot;.equals(primaryKey)">
  367. and primaryKey = #{primaryKey}
  368. </if>
  369. <if test="autoIncrease != null and !&quot;&quot;.equals(autoIncrease)">
  370. and autoIncrease = #{autoIncrease}
  371. </if>
  372. <if test="showInList != null and !&quot;&quot;.equals(showInList)">
  373. and showInList = #{showInList}
  374. </if>
  375. <if test="showInForm != null and !&quot;&quot;.equals(showInForm)">
  376. and showInForm = #{showInForm}
  377. </if>
  378. <if test="searchable != null and !&quot;&quot;.equals(searchable)">
  379. and searchable = #{searchable}
  380. </if>
  381. <if test="formType != null and !&quot;&quot;.equals(formType)">
  382. and formType = #{formType}
  383. </if>
  384. <if test="searchMethod != null and !&quot;&quot;.equals(searchMethod)">
  385. and searchMethod = #{searchMethod}
  386. </if>
  387. <if test="required != null and !&quot;&quot;.equals(required)">
  388. and required = #{required}
  389. </if>
  390. <if test="validate != null and !&quot;&quot;.equals(validate)">
  391. and validate = #{validate}
  392. </if>
  393. <if test="minLength != null and !&quot;&quot;.equals(minLength)">
  394. and minLength = #{minLength}
  395. </if>
  396. <if test="maxLength != null and !&quot;&quot;.equals(maxLength)">
  397. and maxLength = #{maxLength}
  398. </if>
  399. <if test="min != null and !&quot;&quot;.equals(min)">
  400. and min = #{min}
  401. </if>
  402. <if test="max != null and !&quot;&quot;.equals(max)">
  403. and max = #{max}
  404. </if>
  405. <if test="validatorType != null and !&quot;&quot;.equals(validatorType)">
  406. and validatorType = #{validatorType}
  407. </if>
  408. </where>
  409. order by id desc
  410. </select>
  411. <select id="queryTableField" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.TableField">
  412. select <include refid="Base_Column_List"/> from table_field
  413. <where>
  414. and del_flag = 'N'
  415. <if test="id != null and !&quot;&quot;.equals(id)">
  416. and id = #{id}
  417. </if>
  418. <if test="name != null and !&quot;&quot;.equals(name)">
  419. and name = #{name}
  420. </if>
  421. <if test="remark != null and !&quot;&quot;.equals(remark)">
  422. and remark = #{remark}
  423. </if>
  424. <if test="jdbcType != null and !&quot;&quot;.equals(jdbcType)">
  425. and jdbcType = #{jdbcType}
  426. </if>
  427. <if test="javaType != null and !&quot;&quot;.equals(javaType)">
  428. and javaType = #{javaType}
  429. </if>
  430. <if test="length != null and !&quot;&quot;.equals(length)">
  431. and length = #{length}
  432. </if>
  433. <if test="decimalPlaces != null and !&quot;&quot;.equals(decimalPlaces)">
  434. and decimalPlaces = #{decimalPlaces}
  435. </if>
  436. <if test="defaultValue != null and !&quot;&quot;.equals(defaultValue)">
  437. and defaultValue = #{defaultValue}
  438. </if>
  439. <if test="notNull != null and !&quot;&quot;.equals(notNull)">
  440. and notNull = #{notNull}
  441. </if>
  442. <if test="primaryKey != null and !&quot;&quot;.equals(primaryKey)">
  443. and primaryKey = #{primaryKey}
  444. </if>
  445. <if test="autoIncrease != null and !&quot;&quot;.equals(autoIncrease)">
  446. and autoIncrease = #{autoIncrease}
  447. </if>
  448. <if test="showInList != null and !&quot;&quot;.equals(showInList)">
  449. and showInList = #{showInList}
  450. </if>
  451. <if test="showInForm != null and !&quot;&quot;.equals(showInForm)">
  452. and showInForm = #{showInForm}
  453. </if>
  454. <if test="searchable != null and !&quot;&quot;.equals(searchable)">
  455. and searchable = #{searchable}
  456. </if>
  457. <if test="formType != null and !&quot;&quot;.equals(formType)">
  458. and formType = #{formType}
  459. </if>
  460. <if test="searchMethod != null and !&quot;&quot;.equals(searchMethod)">
  461. and searchMethod = #{searchMethod}
  462. </if>
  463. <if test="required != null and !&quot;&quot;.equals(required)">
  464. and required = #{required}
  465. </if>
  466. <if test="validate != null and !&quot;&quot;.equals(validate)">
  467. and validate = #{validate}
  468. </if>
  469. <if test="minLength != null and !&quot;&quot;.equals(minLength)">
  470. and minLength = #{minLength}
  471. </if>
  472. <if test="maxLength != null and !&quot;&quot;.equals(maxLength)">
  473. and maxLength = #{maxLength}
  474. </if>
  475. <if test="min != null and !&quot;&quot;.equals(min)">
  476. and min = #{min}
  477. </if>
  478. <if test="max != null and !&quot;&quot;.equals(max)">
  479. and max = #{max}
  480. </if>
  481. <if test="validatorType != null and !&quot;&quot;.equals(validatorType)">
  482. and validatorType = #{validatorType}
  483. </if>
  484. </where>
  485. LIMIT 1
  486. </select>
  487. <update id="delete">
  488. UPDATE table_field SET del_flag = 'Y'
  489. <where>
  490. AND id = #{id}
  491. </where>
  492. </update>
  493. </mapper>