FormulaMapper.xml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.predict.mapper.FormulaMapper">
  6. <resultMap type="Formula" id="FormulaResult">
  7. <result property="formulaNo" column="formula_no"/>
  8. <result property="formulaName" column="formula_name"/>
  9. <result property="formulaDesc" column="formula_desc"/>
  10. <result property="period" column="period"/>
  11. <result property="paraCount" column="para_count"/>
  12. <result property="ifvalid" column="ifvalid"/>
  13. </resultMap>
  14. <sql id="selectFormulaVo">
  15. select formula_no, formula_name, formula_desc, period, para_count, ifvalid from formula
  16. </sql>
  17. <select id="selectFormulaList" parameterType="Formula" resultMap="FormulaResult">
  18. select
  19. fo.*,
  20. emi1.item_name as "periodName",
  21. emi2.item_name as "ifvalidName"
  22. from
  23. formula fo
  24. left join enum_menu_item emi1 on emi1.item_val = fo.period and emi1.menu_no = 41
  25. left join enum_menu_item emi2 on emi2.item_val = fo.ifvalid and emi2.menu_no = 10
  26. <where>
  27. <if test="formulaNo != null ">and fo.formula_no = #{formulaNo}</if>
  28. <if test="formulaName != null and formulaName != ''">and fo.formula_name like concat(concat('%',
  29. #{formulaName}), '%')
  30. </if>
  31. <if test="formulaDesc != null and formulaDesc != ''">and fo.formula_desc = #{formulaDesc}</if>
  32. <if test="period != null ">and fo.period = #{period}</if>
  33. <if test="paraCount != null ">and fo.para_count = #{paraCount}</if>
  34. <if test="ifvalid != null ">and fo.ifvalid = #{ifvalid}</if>
  35. </where>
  36. </select>
  37. <select id="selectFormulaById" parameterType="Long" resultMap="FormulaResult">
  38. <include refid="selectFormulaVo"/>
  39. where formula_no = #{formulaNo}
  40. </select>
  41. </mapper>