ObjectDigitalMapper.xml 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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.persagy.dmp.rwd.digital.dao.ObjectDigitalMapper">
  6. <resultMap id="BaseResultMap" type="com.persagy.dmp.digital.entity.ObjectDigital">
  7. <id property="id" column="id" jdbcType="VARCHAR"/>
  8. <result property="name" column="name" jdbcType="VARCHAR"/>
  9. <result property="localId" column="local_id" jdbcType="VARCHAR"/>
  10. <result property="localName" column="local_name" jdbcType="VARCHAR"/>
  11. <result property="groupCode" column="group_code" jdbcType="VARCHAR"/>
  12. <result property="projectId" column="project_id" jdbcType="VARCHAR"/>
  13. <result property="objType" column="obj_type" jdbcType="VARCHAR"/>
  14. <result property="classCode" column="class_code" jdbcType="VARCHAR"/>
  15. <result property="grouping" column="grouping" jdbcType="INTEGER"/>
  16. <result property="infos" column="infos" jdbcType="VARCHAR" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>
  17. <result property="virtualCodes" column="virtual_codes" jdbcType="VARCHAR" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>
  18. <result property="createApp" column="create_app" jdbcType="VARCHAR"/>
  19. <result property="updateApp" column="update_app" jdbcType="VARCHAR"/>
  20. <result property="creator" column="creator" jdbcType="VARCHAR"/>
  21. <result property="creationTime" column="creation_time" jdbcType="CHAR"/>
  22. <result property="modifier" column="modifier" jdbcType="VARCHAR"/>
  23. <result property="modifiedTime" column="modified_time" jdbcType="CHAR"/>
  24. <result property="valid" column="valid" jdbcType="TINYINT"/>
  25. <result property="ts" column="ts" jdbcType="TIMESTAMP"/>
  26. </resultMap>
  27. <resultMap id="count" type="com.persagy.dmp.digital.entity.ObjectDigital">
  28. <result property="totalCount" column="totalCount" jdbcType="INTEGER"/>
  29. </resultMap>
  30. <sql id="Base_Column_List">
  31. id,`name`,local_id,
  32. local_name,group_code,project_id,
  33. obj_type,class_code,grouping,
  34. infos,virtual_codes,create_app,
  35. update_app,creator,creation_time,
  36. modifier,modified_time,valid,
  37. ts
  38. </sql>
  39. <select id="queryObjectDigitalsByProjectId" resultMap="BaseResultMap,count">
  40. SELECT DISTINCT SQL_CALC_FOUND_ROWS
  41. *
  42. FROM dt_object dto
  43. WHERE 1=1
  44. <if test="param.projectId!=null and param.projectId.length>0">
  45. AND dto.project_id=#{param.projectId}
  46. </if>
  47. <if test="param.objTypes!=null and param.objTypes.size()>0">
  48. <foreach collection="param.objTypes" open="AND dto.obj_type IN(" close=")" separator="," item="objType">
  49. #{objType}
  50. </foreach>
  51. </if>
  52. <if test="param.classCodes!=null and param.classCodes.size()>0">
  53. <foreach collection="param.classCodes" open="AND ( " close=")" separator=" OR " item="classCode">
  54. dto.class_code LIKE CONCAT(#{classCode},'%')
  55. </foreach>
  56. </if>
  57. <if test="param.keyword!=null and param.keyword.length>0">
  58. AND dto.local_name LIKE CONCAT('%',#{param.keyword},'%')
  59. </if>
  60. <choose>
  61. <when test="param.validSet!=null and param.validSet.size()>0">
  62. <foreach collection="param.validSet" open="AND dto.valid IN(" close=")" separator="," item="valid">
  63. #{valid}
  64. </foreach>
  65. </when>
  66. <otherwise>
  67. AND dto.valid = TRUE
  68. </otherwise>
  69. </choose>
  70. <if test="param.createTimeScope!=null">
  71. <if test="param.createTimeScope.startEq!=null and param.createTimeScope.startEq.length>0">
  72. AND dto.creation_time&gt;=#{param.createTimeScope.startEq}
  73. </if>
  74. <if test="param.createTimeScope.endEq!=null and param.createTimeScope.endEq.length>0">
  75. AND dto.creation_time&lt;=#{param.createTimeScope.endEq}
  76. </if>
  77. </if>
  78. <if test="skip!=null and skip!=null and size!=0">
  79. limit #{skip},#{size}
  80. </if>
  81. ;
  82. SELECT FOUND_ROWS() AS totalCount;
  83. </select>
  84. </mapper>