AttendanceClassesAttrServiceDaoImplMapper.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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="attendanceClassesAttrServiceDaoImpl">
  6. <!-- 保存考勤班组属性信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessAttendanceClassesAttrInfo" parameterType="Map">
  8. insert into business_attendance_classes_attr(
  9. classes_id,attr_id,operate,spec_cd,store_id,b_id,value
  10. ) values (
  11. #{classesId},#{attrId},#{operate},#{specCd},#{storeId},#{bId},#{value}
  12. )
  13. </insert>
  14. <!-- 查询考勤班组属性信息(Business) add by wuxw 2018-07-03 -->
  15. <select id="getBusinessAttendanceClassesAttrInfo" parameterType="Map" resultType="Map">
  16. select t.classes_id,t.classes_id classesId,t.attr_id,t.attr_id attrId,t.operate,t.spec_cd,t.spec_cd
  17. specCd,t.store_id,t.store_id storeId,t.b_id,t.b_id bId,t.value
  18. from business_attendance_classes_attr t
  19. where 1 =1
  20. <if test="classesId !=null and classesId != ''">
  21. and t.classes_id= #{classesId}
  22. </if>
  23. <if test="attrId !=null and attrId != ''">
  24. and t.attr_id= #{attrId}
  25. </if>
  26. <if test="operate !=null and operate != ''">
  27. and t.operate= #{operate}
  28. </if>
  29. <if test="specCd !=null and specCd != ''">
  30. and t.spec_cd= #{specCd}
  31. </if>
  32. <if test="storeId !=null and storeId != ''">
  33. and t.store_id= #{storeId}
  34. </if>
  35. <if test="bId !=null and bId != ''">
  36. and t.b_id= #{bId}
  37. </if>
  38. <if test="value !=null and value != ''">
  39. and t.value= #{value}
  40. </if>
  41. </select>
  42. <!-- 保存考勤班组属性信息至 instance表中 add by wuxw 2018-07-03 -->
  43. <insert id="saveAttendanceClassesAttrInfoInstance" parameterType="Map">
  44. insert into attendance_classes_attr(
  45. classes_id,attr_id,spec_cd,status_cd,store_id,b_id,value
  46. ) select t.classes_id,t.attr_id,t.spec_cd,'0',t.store_id,t.b_id,t.value from business_attendance_classes_attr t
  47. where 1=1
  48. <if test="classesId !=null and classesId != ''">
  49. and t.classes_id= #{classesId}
  50. </if>
  51. <if test="attrId !=null and attrId != ''">
  52. and t.attr_id= #{attrId}
  53. </if>
  54. and t.operate= 'ADD'
  55. <if test="specCd !=null and specCd != ''">
  56. and t.spec_cd= #{specCd}
  57. </if>
  58. <if test="storeId !=null and storeId != ''">
  59. and t.store_id= #{storeId}
  60. </if>
  61. <if test="bId !=null and bId != ''">
  62. and t.b_id= #{bId}
  63. </if>
  64. <if test="value !=null and value != ''">
  65. and t.value= #{value}
  66. </if>
  67. </insert>
  68. <!-- 查询考勤班组属性信息 add by wuxw 2018-07-03 -->
  69. <select id="getAttendanceClassesAttrInfo" parameterType="Map" resultType="Map">
  70. select t.classes_id,t.classes_id classesId,t.attr_id,t.attr_id attrId,t.spec_cd,t.spec_cd
  71. specCd,t.status_cd,t.status_cd statusCd,t.store_id,t.store_id storeId,t.b_id,t.b_id bId,t.value,
  72. td.name
  73. from attendance_classes_attr t
  74. LEFT JOIN t_dict td on t.spec_cd = td.status_cd and td.table_name = 'attendance_classes_attr' and td.table_columns = 'spec_cd'
  75. where 1 =1
  76. <if test="classesId !=null and classesId != ''">
  77. and t.classes_id= #{classesId}
  78. </if>
  79. <if test="classesIds !=null ">
  80. and t.classes_id in
  81. <foreach collection="classesIds" item="item" index="index" open="(" close=")" separator=",">
  82. #{item}
  83. </foreach>
  84. </if>
  85. <if test="attrId !=null and attrId != ''">
  86. and t.attr_id= #{attrId}
  87. </if>
  88. <if test="specCd !=null and specCd != ''">
  89. and t.spec_cd= #{specCd}
  90. </if>
  91. <if test="statusCd !=null and statusCd != ''">
  92. and t.status_cd= #{statusCd}
  93. </if>
  94. <if test="storeId !=null and storeId != ''">
  95. and t.store_id= #{storeId}
  96. </if>
  97. <if test="bId !=null and bId != ''">
  98. and t.b_id= #{bId}
  99. </if>
  100. <if test="value !=null and value != ''">
  101. and t.value= #{value}
  102. </if>
  103. order by t.create_time desc
  104. <if test="page != -1 and page != null ">
  105. limit #{page}, #{row}
  106. </if>
  107. </select>
  108. <!-- 修改考勤班组属性信息 add by wuxw 2018-07-03 -->
  109. <update id="updateAttendanceClassesAttrInfoInstance" parameterType="Map">
  110. update attendance_classes_attr t set t.status_cd = #{statusCd}
  111. <if test="newBId != null and newBId != ''">
  112. ,t.b_id = #{newBId}
  113. </if>
  114. <if test="classesId !=null and classesId != ''">
  115. , t.classes_id= #{classesId}
  116. </if>
  117. <if test="specCd !=null and specCd != ''">
  118. , t.spec_cd= #{specCd}
  119. </if>
  120. <if test="storeId !=null and storeId != ''">
  121. , t.store_id= #{storeId}
  122. </if>
  123. <if test="value !=null and value != ''">
  124. , t.value= #{value}
  125. </if>
  126. where 1=1
  127. <if test="attrId !=null and attrId != ''">
  128. and t.attr_id= #{attrId}
  129. </if>
  130. <if test="bId !=null and bId != ''">
  131. and t.b_id= #{bId}
  132. </if>
  133. </update>
  134. <!-- 查询考勤班组属性数量 add by wuxw 2018-07-03 -->
  135. <select id="queryAttendanceClassesAttrsCount" parameterType="Map" resultType="Map">
  136. select count(1) count
  137. from attendance_classes_attr t
  138. where 1 =1
  139. <if test="classesId !=null and classesId != ''">
  140. and t.classes_id= #{classesId}
  141. </if>
  142. <if test="classesIds !=null ">
  143. and t.classes_id in
  144. <foreach collection="classesIds" item="item" index="index" open="(" close=")" separator=",">
  145. #{item}
  146. </foreach>
  147. </if>
  148. <if test="attrId !=null and attrId != ''">
  149. and t.attr_id= #{attrId}
  150. </if>
  151. <if test="specCd !=null and specCd != ''">
  152. and t.spec_cd= #{specCd}
  153. </if>
  154. <if test="statusCd !=null and statusCd != ''">
  155. and t.status_cd= #{statusCd}
  156. </if>
  157. <if test="storeId !=null and storeId != ''">
  158. and t.store_id= #{storeId}
  159. </if>
  160. <if test="bId !=null and bId != ''">
  161. and t.b_id= #{bId}
  162. </if>
  163. <if test="value !=null and value != ''">
  164. and t.value= #{value}
  165. </if>
  166. </select>
  167. </mapper>