ThingyearSettingMapper.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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.huaxu.dao.ThingyearSettingMapper">
  6. <resultMap type="ThingyearSettingEntity" id="ThingyearSettingResult">
  7. <result property="id" column="id"/>
  8. <result property="tenantId" column="tenant_id"/>
  9. <result property="companyOrgId" column="company_org_id"/>
  10. <result property="deptOrgId" column="dept_org_id"/>
  11. <result property="thingType" column="thing_type"/>
  12. <result property="thingYearType" column="thing_year_type"/>
  13. <result property="thingCount" column="thing_count"/>
  14. <result property="remark" column="remark"/>
  15. <result property="status" column="status"/>
  16. <result property="dateCreate" column="date_create"/>
  17. <result property="createBy" column="create_by"/>
  18. <result property="dateUpdate" column="date_update"/>
  19. <result property="updateBy" column="update_by"/>
  20. </resultMap>
  21. <!-- 实体栏位 -->
  22. <sql id="thingyearSettingColumns">
  23. a.id as "id" ,
  24. a.tenant_id as "tenantId" ,
  25. a.company_org_id as "companyOrgId" ,
  26. a.dept_org_id as "deptOrgId" ,
  27. a.thing_type as "thingType" ,
  28. a.thing_year_type as "thingYearType" ,
  29. a.thing_count as "thingCount" ,
  30. a.remark as "remark" ,
  31. a.status as "status" ,
  32. a.date_create as "dateCreate" ,
  33. a.create_by as "createBy" ,
  34. a.date_update as "dateUpdate" ,
  35. a.update_by as "updateBy"
  36. </sql>
  37. <!-- 根据主键获取实体 -->
  38. <select id="findThingyearSettingById" resultType="com.huaxu.entity.ThingyearSettingEntity">
  39. SELECT
  40. <include refid="thingyearSettingColumns"/>
  41. FROM sms_thingyear_setting a
  42. WHERE a.id = #{id} and a.status=1
  43. </select>
  44. <!-- 根据获取实体List -->
  45. <select id="findList" resultType="com.huaxu.entity.ThingyearSettingEntity">
  46. SELECT
  47. <include refid="thingyearSettingColumns"/>
  48. FROM sms_thingyear_setting a
  49. <where>
  50. a.status=1
  51. <if test="thingyearSetting.tenantId != null and thingyearSetting.tenantId != ''">and a.tenant_id = #{thingyearSetting.tenantId}</if>
  52. <if test="thingyearSetting.thingType != null ">and a.thing_type = #{thingyearSetting.thingType}</if>
  53. <if test="thingyearSetting.userType!=null and thingyearSetting.userType!=-999 and thingyearSetting.userType!=-9999 and thingyearSetting.programItems != null and thingyearSetting.programItems.size() > 0">
  54. <if test="thingyearSetting.permissonType == 5 or thingyearSetting.permissonType == 2">
  55. and ( a.DEPT_ORG_ID in
  56. <foreach collection="thingyearSetting.programItems" item="item" open="(" close=")" separator=",">
  57. #{item.orgId}
  58. </foreach>
  59. or
  60. a.COMPANY_ORG_ID in
  61. <foreach collection="v.programItems" item="item" open="(" close=")" separator=",">
  62. #{item.orgId}
  63. </foreach>
  64. )
  65. </if>
  66. <if test="thingyearSetting.permissonType == 4 or thingyearSetting.permissonType == 3">
  67. and a.DEPT_ORG_ID in
  68. <foreach collection="thingyearSetting.programItems" item="item" open="(" close=")" separator=",">
  69. #{item.orgId}
  70. </foreach>
  71. </if>
  72. <if test="thingyearSetting.permissonType == 1">
  73. and a.COMPANY_ORG_ID in
  74. <foreach collection="thingyearSetting.programItems" item="item" open="(" close=")" separator=",">
  75. #{item.orgId}
  76. </foreach>
  77. and (a.DEPT_ORG_ID is null or a.DEPT_ORG_ID =0)
  78. </if>
  79. </if>
  80. </where>
  81. </select>
  82. <!-- 根据获取实体 page -->
  83. <select id="findPage" resultType="com.huaxu.entity.ThingyearSettingEntity">
  84. SELECT
  85. <include refid="thingyearSettingColumns"/>
  86. FROM sms_thingyear_setting a
  87. <where>
  88. a.status=1
  89. <if test="thingyearSetting.tenantId != null and thingyearSetting.tenantId != ''">and a.tenant_id =
  90. #{thingyearSetting.tenantId}
  91. </if>
  92. <if test="thingyearSetting.thingType != null ">and a.thing_type = #{thingyearSetting.thingType}</if>
  93. </where>
  94. </select>
  95. </mapper>