SysReportFormMapper.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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.xinxin.topro.sysservice.dao.mysqlmapper.SysReportFormMapper" >
  4. <resultMap id="BaseResultMap" type="com.xinxin.topro.sysservice.dao.mysqlmodel.SysReportForm" >
  5. <id column="srf_id" property="srfId" jdbcType="INTEGER" />
  6. <result column="HI_ID" property="hiId" jdbcType="INTEGER" />
  7. <result column="srf_code" property="srfCode" jdbcType="VARCHAR" />
  8. <result column="srf_name" property="srfName" jdbcType="VARCHAR" />
  9. <result column="srf_sup_id" property="srfSupId" jdbcType="INTEGER" />
  10. <result column="srf_description" property="srfDescription" jdbcType="VARCHAR" />
  11. <result column="srf_url" property="srfUrl" jdbcType="VARCHAR" />
  12. <result column="srf_recordor" property="srfRecordor" jdbcType="VARCHAR" />
  13. <result column="srf_record_Time" property="srfRecordTime" jdbcType="TIMESTAMP" />
  14. <result column="srf_operator" property="srfOperator" jdbcType="VARCHAR" />
  15. <result column="srf_operate_Time" property="srfOperateTime" jdbcType="TIMESTAMP" />
  16. <result column="srf_is_del" property="srfIsDel" jdbcType="INTEGER" />
  17. </resultMap>
  18. <resultMap id="VO_Map" type="com.xinxin.topro.sysservice.vo.SysReportFormVO" extends="BaseResultMap">
  19. <result column="supName" property="supName" jdbcType="VARCHAR" />
  20. <result column="operator" property="operator" jdbcType="VARCHAR" />
  21. <result column="childCount" property="childCount" jdbcType="INTEGER" />
  22. </resultMap>
  23. <sql id="Base_Column_List" >
  24. srf_id, HI_ID, srf_code, srf_name, srf_sup_id, srf_description, srf_url, srf_recordor,
  25. srf_record_Time, srf_operator, srf_operate_Time, srf_is_del
  26. </sql>
  27. <select id="selectByCondition" parameterType="com.xinxin.topro.sysservice.dao.mysqlmodel.SysReportForm" resultMap="VO_Map">
  28. select
  29. srf_id,srf_code,srf_name,srf_sup_id,srf_description,srf_url,srf_operate_Time,srf_is_del,
  30. (select ui.UI_Name from sys_userinfo ui where b.HI_ID = ui.HI_ID and ui.UI_Code = b.srf_operator limit 1) operator,
  31. (select rf.srf_name from sys_report_form rf where rf.srf_id = b.srf_sup_id) supName
  32. from sys_report_form b
  33. where (b.HI_ID = #{hiId,jdbcType=INTEGER} or b.HI_ID = 0)
  34. <if test="srfIsDel != null">
  35. and b.srf_is_del = 0
  36. </if>
  37. <if test="srfId != null">
  38. and b.srf_id = #{srfId,jdbcType=INTEGER}
  39. </if>
  40. order by b.srf_record_Time
  41. </select>
  42. <insert id="insert" parameterType="com.xinxin.topro.sysservice.dao.mysqlmodel.SysReportForm" useGeneratedKeys="true" keyProperty="srfId" keyColumn="srf_id">
  43. insert into sys_report_form (HI_ID, srf_code,
  44. srf_name, srf_sup_id, srf_description,
  45. srf_url, srf_recordor, srf_record_Time,
  46. srf_operator, srf_operate_Time, srf_is_del
  47. )
  48. values (#{hiId,jdbcType=INTEGER}, #{srfCode,jdbcType=VARCHAR},
  49. #{srfName,jdbcType=VARCHAR}, #{srfSupId,jdbcType=INTEGER}, #{srfDescription,jdbcType=VARCHAR},
  50. #{srfUrl,jdbcType=VARCHAR}, #{srfRecordor,jdbcType=VARCHAR}, now(),
  51. #{srfOperator,jdbcType=VARCHAR}, now(), 0
  52. )
  53. </insert>
  54. <update id="updateByPrimaryKeySelective" parameterType="com.xinxin.topro.sysservice.dao.mysqlmodel.SysReportForm" >
  55. update sys_report_form
  56. <set >
  57. <if test="srfCode != null" >
  58. srf_code = #{srfCode,jdbcType=VARCHAR},
  59. </if>
  60. <if test="srfName != null" >
  61. srf_name = #{srfName,jdbcType=VARCHAR},
  62. </if>
  63. <if test="srfSupId != null" >
  64. srf_sup_id = #{srfSupId,jdbcType=INTEGER},
  65. </if>
  66. <if test="srfDescription != null" >
  67. srf_description = #{srfDescription,jdbcType=VARCHAR},
  68. </if>
  69. <if test="srfUrl != null" >
  70. srf_url = #{srfUrl,jdbcType=VARCHAR},
  71. </if>
  72. <if test="srfOperator != null" >
  73. srf_operator = #{srfOperator,jdbcType=VARCHAR},
  74. </if>
  75. <if test="srfIsDel != null" >
  76. srf_is_del = #{srfIsDel,jdbcType=INTEGER},
  77. </if>
  78. srf_operate_Time = now()
  79. </set>
  80. where srf_id = #{srfId,jdbcType=INTEGER}
  81. </update>
  82. <select id="selectByAccess" resultMap="VO_Map">
  83. select <include refid="Base_Column_List"/>,
  84. (select count(1) from sys_report_form sr where sr.srf_sup_id = srf.srf_id and sr.srf_is_del = 0 and sr.HI_ID = srf.HI_ID) childCount
  85. from sys_report_form srf
  86. where srf.srf_is_del = 0
  87. and (srf.HI_ID = #{hiId,jdbcType=INTEGER} or srf.HI_ID = 0)
  88. <if test="uiCode != null and uiCode != ''">
  89. and exists(select 1 from sys_report_form_user ru where ru.srfu_is_del = 0 and ru.srf_id = srf.srf_id and ru.ui_code = #{uiCode,jdbcType=INTEGER})
  90. </if>
  91. </select>
  92. </mapper>