SysDeptMapper.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  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.yijia.system.mapper.SysDeptMapper">
  6. <resultMap type="SysDept" id="SysDeptResult">
  7. <id property="deptId" column="dept_id" />
  8. <result property="parentId" column="parent_id" />
  9. <result property="ancestors" column="ancestors" />
  10. <result property="deptName" column="dept_name" />
  11. <result property="orderNum" column="order_num" />
  12. <result property="leader" column="leader" />
  13. <result property="phone" column="phone" />
  14. <result property="email" column="email" />
  15. <result property="status" column="status" />
  16. <result property="delFlag" column="del_flag" />
  17. <result property="parentName" column="parent_name" />
  18. <result property="createBy" column="create_by" />
  19. <result property="createTime" column="create_time" />
  20. <result property="updateBy" column="update_by" />
  21. <result property="updateTime" column="update_time" />
  22. <result property="jiBie" column="ji_bie" />
  23. <result property="deptAddress" column="dept_address" />
  24. <result property="oilGunNum" column="oil_gun_num" />
  25. <result property="stationPic" column="station_pic" />
  26. <result property="stationLongitude" column="station_longitude" />
  27. <result property="stationLatitude" column="station_latitude" />
  28. <result property="mno" column="mno" />
  29. <result property="discountSetting" column="discount_setting" />
  30. <result property="cardEnabledFlag" column="card_enabled_flag" />
  31. <result property="appId" column="app_id" />
  32. <result property="appSecret" column="app_secret" />
  33. <result property="gzhAppId" column="gzh_app_id" />
  34. <result property="gzhAppSecret" column="gzh_app_secret" />
  35. <result property="aliAppId" column="ali_app_id" />
  36. <result property="aliPublicKey" column="ali_public_key" />
  37. <result property="aliPrivateKey" column="ali_private_key" />
  38. <result property="aliEncryptKey" column="ali_encrypt_key" />
  39. <result property="image1" column="image1" />
  40. <result property="image2" column="image2" />
  41. <result property="image3" column="image3" />
  42. <result property="image4" column="image4" />
  43. <result property="image5" column="image5" />
  44. <result property="wsPrintFlag" column="ws_print_flag" />
  45. <result property="printSetting" column="print_setting" />
  46. <result property="notice" column="notice" />
  47. <result property="integralPrintFlag" column="integral_print_flag" />
  48. <result property="integralFlag" column="integral_flag" />
  49. <result property="integralRuleFlag" column="integral_rule_flag" />
  50. <result property="cardRuleFlag" column="card_rule_flag" />
  51. <result property="couponFlag" column="coupon_flag" />
  52. <result property="labelFlag" column="label_flag" />
  53. <result property="printDeviceType" column="print_device_type" />
  54. <result property="balance" column="balance" />
  55. <result property="isLngFlag" column="is_lng_flag" />
  56. <result property="city" column="city" />
  57. <result property="couponEnabledFlag" column="coupon_enabled_flag" />
  58. <result property="merchantNo" column="merchant_no" />
  59. <result property="terminalId" column="terminal_id" />
  60. <result property="yunKey" column="yun_key" />
  61. <result property="mnoArray" column="mno_array" />
  62. <result property="mnoProportion" column="mno_proportion" />
  63. <result property="mnoStatus" column="mno_status" />
  64. <result property="refundExaminStatus" column="refund_examin_status" />
  65. </resultMap>
  66. <sql id="selectDeptVo">
  67. select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,
  68. d.del_flag, d.create_by, d.create_time ,d.ji_bie, d.dept_address, d.oil_gun_num, d.station_pic, d.station_longitude,
  69. d.station_latitude, d.mno, discount_setting,card_enabled_flag,d.app_id, d.app_secret,gzh_app_id,gzh_app_secret,ali_app_id,gzh_app_secret,
  70. ali_app_id,ali_public_key,ali_private_key,ali_encrypt_key,image1,image2,image3,image4,image5,ws_print_flag,print_setting,notice,integral_print_flag,
  71. d.integral_flag,d.integral_rule_flag,d.card_rule_flag,d.coupon_flag,d.label_flag,d.print_device_type,d.balance,d.is_lng_flag,d.city,coupon_enabled_flag,
  72. d.merchant_no,d.terminal_id,d.yun_key,d.mno_array,mno_proportion,mno_status,refund_examin_status
  73. from sys_dept d
  74. </sql>
  75. <select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
  76. <include refid="selectDeptVo"/>
  77. where d.del_flag = '0'
  78. <if test="deptId != null">
  79. AND dept_id = #{deptId}
  80. </if>
  81. <if test="isLngFlag != null">
  82. AND is_lng_flag = #{isLngFlag}
  83. </if>
  84. <if test="jiBie != null">
  85. AND ji_bie = #{jiBie}
  86. </if>
  87. <if test="parentId != null and parentId != 0">
  88. AND parent_id = #{parentId}
  89. </if>
  90. <if test="orDeptId != null">
  91. AND ( dept_id = #{orDeptId} or parent_id = #{orDeptId} )
  92. </if>
  93. <if test="deptName != null and deptName != ''">
  94. AND dept_name like concat('%', #{deptName}, '%')
  95. </if>
  96. <if test="status != null and status != ''">
  97. AND status = #{status}
  98. </if>
  99. <if test="merchantNo != null and merchantNo != ''">
  100. AND merchant_no = #{merchantNo}
  101. </if>
  102. <if test="terminalId != null and terminalId != ''">
  103. AND terminal_id = #{terminalId}
  104. </if>
  105. <if test="yunKey != null and yunKey != ''">
  106. AND yun_key = #{yunKey}
  107. </if>
  108. <if test="mnoArray != null and mnoArray != ''">
  109. AND mno_array = #{mnoArray}
  110. </if>
  111. <if test="deptIdList != null ">
  112. and dept_id in
  113. <foreach item="item" index="index" collection="deptIdList"
  114. open="(" separator="," close=")">
  115. #{item}
  116. </foreach>
  117. </if>
  118. <!-- 数据范围过滤 -->
  119. ${params.dataScope}
  120. order by d.parent_id, d.order_num
  121. </select>
  122. <select id="queryDeptList" parameterType="SysDept" resultMap="SysDeptResult">
  123. <include refid="selectDeptVo"/>
  124. where d.del_flag = '0'
  125. <if test="deptId != null or parentId!=null">
  126. <trim prefixOverrides="or" prefix=" and (" suffix=")">
  127. <if test="parentId != null and parentId != null">
  128. or parent_id = #{parentId}
  129. </if>
  130. <if test="deptId != null and deptId != null">
  131. or dept_id = #{deptId}
  132. </if>
  133. </trim>
  134. </if>
  135. <!-- 数据范围过滤 -->
  136. ${params.dataScope}
  137. order by d.parent_id, d.order_num
  138. </select>
  139. <select id="selectDeptListByRoleId" resultType="Integer">
  140. select d.dept_id
  141. from sys_dept d
  142. left join sys_role_dept rd on d.dept_id = rd.dept_id
  143. where rd.role_id = #{roleId}
  144. <if test="deptCheckStrictly">
  145. and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
  146. </if>
  147. order by d.parent_id, d.order_num
  148. </select>
  149. <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
  150. <include refid="selectDeptVo"/>
  151. where dept_id = #{deptId}
  152. </select>
  153. <select id="checkDeptExistUser" parameterType="Long" resultType="int">
  154. select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
  155. </select>
  156. <select id="hasChildByDeptId" parameterType="Long" resultType="int">
  157. select count(1) from sys_dept
  158. where del_flag = '0' and parent_id = #{deptId} limit 1
  159. </select>
  160. <select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
  161. select * from sys_dept where find_in_set(#{deptId}, ancestors)
  162. </select>
  163. <select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
  164. select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
  165. </select>
  166. <select id="checkDeptNameUnique" resultMap="SysDeptResult">
  167. <include refid="selectDeptVo"/>
  168. where dept_name=#{deptName} and parent_id = #{parentId} limit 1
  169. </select>
  170. <!--调用存储过程-->
  171. <select id="getGroupInfo" resultMap="SysDeptResult">
  172. <include refid="selectDeptVo"/>
  173. <where>
  174. <if test="deptId != null ">
  175. AND dept_id = #{deptId}
  176. </if>
  177. <if test="parentId != null ">
  178. AND parent_id = #{parentId}
  179. </if>
  180. </where>
  181. </select>
  182. <!--添加代理人集团信息查询-->
  183. <select id="selectSysAgentList" parameterType="SysDept" resultMap="SysDeptResult">
  184. SELECT dept_id,dept_name from sys_dept where ji_bie = 1
  185. and dept_id not in (
  186. SELECT group_id from sys_agent
  187. <where>
  188. <if test="userId != null "> and user_id != #{userId}</if>
  189. </where>
  190. )
  191. </select>
  192. <!--查询代理人对应的集团下的站点信息-->
  193. <select id="selectDeptAgentList" parameterType="SysDept" resultMap="SysDeptResult">
  194. SELECT dept_id from sys_dept t
  195. where t.parent_id in (
  196. SELECT dept_id from sys_dept d join sys_agent a on d.dept_id =a.group_id
  197. where d.del_flag = '0'
  198. <if test="userId != null "> and a.user_id = #{userId}</if>
  199. <if test="isLngFlag != null">
  200. AND a.is_lng_flag = #{isLngFlag}
  201. </if>
  202. )
  203. and t.del_flag = '0'
  204. </select>
  205. <!--查询代理人对应的集团信息-->
  206. <select id="selectGroupAgentList" parameterType="SysDept" resultMap="SysDeptResult">
  207. SELECT dept_id,dept_name,integral_rule_flag,card_rule_flag,coupon_flag,label_flag
  208. from sys_dept d join sys_agent a on d.dept_id =a.group_id
  209. where d.del_flag = '0'
  210. <if test="userId != null "> and a.user_id = #{userId}</if>
  211. </select>
  212. <!--根据集团查询油站id-->
  213. <select id="searchDeptList" parameterType="SysDept" resultMap="SysDeptResult">
  214. SELECT dept_id,dept_name from sys_dept
  215. where del_flag = '0'
  216. <if test="parentId != null and parentId != 0">
  217. AND parent_id = #{parentId}
  218. </if>
  219. </select>
  220. <select id="selectGroupAndDeptList" parameterType="SysDept" resultMap="SysDeptResult">
  221. SELECT dept_id,dept_name
  222. from sys_dept
  223. where del_flag = '0'
  224. <if test="orDeptId != null">
  225. AND ( dept_id = #{orDeptId} or parent_id = #{orDeptId} )
  226. </if>
  227. </select>
  228. <!--查询集团及共享信息-->
  229. <select id="selectShareGroup" parameterType="SysDept" resultMap="SysDeptResult">
  230. select d.dept_id, d.parent_id, d.ancestors, d.dept_name,card_enabled_flag,d.app_id,d.integral_flag,d.integral_rule_flag,d.card_rule_flag,
  231. d.coupon_flag,d.label_flag,d.print_device_type,d.coupon_enabled_flag,d.refund_examin_status
  232. from sys_dept d
  233. where d.del_flag = '0'
  234. <if test="integralRuleFlag != null">
  235. AND integral_rule_flag = #{integralRuleFlag}
  236. </if>
  237. <if test="couponFlag != null">
  238. AND coupon_flag = #{couponFlag}
  239. </if>
  240. <if test="cardRuleFlag != null">
  241. AND card_rule_flag = #{cardRuleFlag}
  242. </if>
  243. <if test="cardRuleFlag != null">
  244. AND card_rule_flag = #{cardRuleFlag}
  245. </if>
  246. <if test="deptId != null">
  247. AND dept_id = #{deptId}
  248. </if>
  249. <if test="deptId != null">
  250. AND dept_id = #{deptId}
  251. </if>
  252. <if test="jiBie != null">
  253. AND ji_bie = #{jiBie}
  254. </if>
  255. <if test="orDeptId != null">
  256. AND ( dept_id = #{orDeptId} or parent_id = #{orDeptId} )
  257. </if>
  258. <if test="deptName != null and deptName != ''">
  259. AND dept_name like concat('%', #{deptName}, '%')
  260. </if>
  261. <if test="status != null and status != ''">
  262. AND status = #{status}
  263. </if>
  264. <if test="deptIdList != null ">
  265. and dept_id in
  266. <foreach item="item" index="index" collection="deptIdList"
  267. open="(" separator="," close=")">
  268. #{item}
  269. </foreach>
  270. </if>
  271. </select>
  272. <!--查询所有不共享的站点-->
  273. <select id="selectNotShareDept" parameterType="SysDept" resultMap="SysDeptResult">
  274. select d.dept_id, d.parent_id, d.ancestors, d.dept_name,card_enabled_flag,d.app_id,d.integral_flag,d.integral_rule_flag,d.card_rule_flag,
  275. d.coupon_flag,d.label_flag,d.print_device_type,d.coupon_enabled_flag,d.refund_examin_status
  276. from sys_dept d
  277. where d.del_flag = "0"
  278. and d.parent_id in (
  279. SELECT dept_id from sys_dept t
  280. where t.ji_bie ='1' and del_flag = "0"
  281. <if test="integralRuleFlag != null">
  282. AND integral_rule_flag = #{integralRuleFlag}
  283. </if>
  284. <if test="couponFlag != null">
  285. AND coupon_flag = #{couponFlag}
  286. </if>
  287. <if test="cardRuleFlag != null">
  288. AND card_rule_flag = #{cardRuleFlag}
  289. </if>
  290. )
  291. </select>
  292. <insert id="insertDept" parameterType="SysDept">
  293. insert into sys_dept(
  294. <if test="deptId != null and deptId != 0">dept_id,</if>
  295. <if test="parentId != null and parentId != 0">parent_id,</if>
  296. <if test="deptName != null and deptName != ''">dept_name,</if>
  297. <if test="ancestors != null and ancestors != ''">ancestors,</if>
  298. <if test="orderNum != null and orderNum != ''">order_num,</if>
  299. <if test="leader != null and leader != ''">leader,</if>
  300. <if test="phone != null and phone != ''">phone,</if>
  301. <if test="email != null and email != ''">email,</if>
  302. <if test="status != null">status,</if>
  303. <if test="createBy != null and createBy != ''">create_by,</if>
  304. <if test="jiBie != null">ji_bie,</if>
  305. <if test="deptAddress != null">dept_address,</if>
  306. <if test="oilGunNum != null">oil_gun_num,</if>
  307. <if test="stationPic != null">station_pic,</if>
  308. <if test="stationLongitude!= null">station_longitude,</if>
  309. <if test="stationLatitude != null">station_latitude,</if>
  310. <if test="mno != null">mno,</if>
  311. <if test="appId != null">app_id,</if>
  312. <if test="appSecret != null">app_secret,</if>
  313. <if test="discountSetting != null">discount_setting,</if>
  314. <if test="cardEnabledFlag != null">card_enabled_flag,</if>
  315. <if test="gzhAppId != null">gzh_app_id,</if>
  316. <if test="gzhAppSecret != null">gzh_app_secret,</if>
  317. <if test="aliAppId != null">ali_app_id,</if>
  318. <if test="aliPublicKey != null">ali_public_key,</if>
  319. <if test="aliPrivateKey != null">ali_private_key,</if>
  320. <if test="aliEncryptKey != null">ali_encrypt_key,</if>
  321. <if test="image1 != null">image1,</if>
  322. <if test="image2 != null">image2,</if>
  323. <if test="image3 != null">image3,</if>
  324. <if test="image4 != null">image4,</if>
  325. <if test="image5 != null">image5,</if>
  326. <if test="wsPrintFlag != null">ws_print_flag,</if>
  327. <if test="printSetting != null">print_setting,</if>
  328. <if test="notice != null">notice,</if>
  329. <if test="integralPrintFlag != null">integral_print_flag,</if>
  330. <if test="integralFlag != null">integral_flag,</if>
  331. <if test="integralRuleFlag != null">integral_rule_flag,</if>
  332. <if test="cardRuleFlag != null">card_rule_flag,</if>
  333. <if test="couponFlag != null">coupon_flag,</if>
  334. <if test="labelFlag != null">label_flag,</if>
  335. <if test="printDeviceType != null">print_device_type,</if>
  336. <if test="balance != null">balance,</if>
  337. <if test="city != null">city,</if>
  338. <if test="isLngFlag != null">is_lng_flag,</if>
  339. <if test="merchantNo != null">merchant_no,</if>
  340. <if test="terminalId != null">terminal_id,</if>
  341. <if test="yunKey != null">yun_key,</if>
  342. <if test="couponEnabledFlag != null">coupon_enabled_flag,</if>
  343. <if test="mnoArray != null">mno_array,</if>
  344. <if test="mnoProportion != null">mno_proportion,</if>
  345. <if test="mnoStatus != null">mno_status,</if>
  346. <if test="refundExaminStatus != null">refund_examin_status,</if>
  347. create_time
  348. )values(
  349. <if test="deptId != null and deptId != 0">#{deptId},</if>
  350. <if test="parentId != null and parentId != 0">#{parentId},</if>
  351. <if test="deptName != null and deptName != ''">#{deptName},</if>
  352. <if test="ancestors != null and ancestors != ''">#{ancestors},</if>
  353. <if test="orderNum != null and orderNum != ''">#{orderNum},</if>
  354. <if test="leader != null and leader != ''">#{leader},</if>
  355. <if test="phone != null and phone != ''">#{phone},</if>
  356. <if test="email != null and email != ''">#{email},</if>
  357. <if test="status != null">#{status},</if>
  358. <if test="createBy != null and createBy != ''">#{createBy},</if>
  359. <if test="jiBie != null">#{jiBie},</if>
  360. <if test="deptAddress != null">#{deptAddress},</if>
  361. <if test="oilGunNum != null">#{oilGunNum},</if>
  362. <if test="stationPic != null">#{stationPic},</if>
  363. <if test="stationLongitude!= null">#{stationLongitude},</if>
  364. <if test="stationLatitude != null">#{stationLatitude},</if>
  365. <if test="mno != null">#{mno},</if>
  366. <if test="appId != null">#{appId},</if>
  367. <if test="appSecret != null">#{appSecret},</if>
  368. <if test="discountSetting != null">#{discountSetting},</if>
  369. <if test="cardEnabledFlag != null">#{cardEnabledFlag},</if>
  370. <if test="gzhAppId != null">#{gzhAppId},</if>
  371. <if test="gzhAppSecret != null">#{gzhAppSecret},</if>
  372. <if test="aliAppId != null">#{aliAppId},</if>
  373. <if test="aliPublicKey != null">#{aliPublicKey},</if>
  374. <if test="aliPrivateKey != null">#{aliPrivateKey},</if>
  375. <if test="aliEncryptKey != null">#{aliEncryptKey},</if>
  376. <if test="image1 != null">#{image1},</if>
  377. <if test="image2 != null">#{image2},</if>
  378. <if test="image3 != null">#{image3},</if>
  379. <if test="image4 != null">#{image4},</if>
  380. <if test="image5 != null">#{image5},</if>
  381. <if test="wsPrintFlag != null">#{wsPrintFlag},</if>
  382. <if test="printSetting != null">#{printSetting},</if>
  383. <if test="notice != null">#{notice},</if>
  384. <if test="integralPrintFlag != null">#{integralPrintFlag},</if>
  385. <if test="integralFlag != null">#{integralFlag},</if>
  386. <if test="integralRuleFlag != null">#{integralRuleFlag},</if>
  387. <if test="cardRuleFlag != null">#{cardRuleFlag},</if>
  388. <if test="couponFlag != null">#{couponFlag},</if>
  389. <if test="labelFlag != null">#{labelFlag},</if>
  390. <if test="printDeviceType != null">#{printDeviceType},</if>
  391. <if test="balance != null">#{balance},</if>
  392. <if test="city != null">#{city},</if>
  393. <if test="isLngFlag != null">#{isLngFlag},</if>
  394. <if test="merchantNo != null">#{merchantNo},</if>
  395. <if test="terminalId != null">#{terminalId},</if>
  396. <if test="yunKey != null">#{yunKey},</if>
  397. <if test="couponEnabledFlag != null">#{couponEnabledFlag},</if>
  398. <if test="mnoArray != null">#{mnoArray},</if>
  399. <if test="mnoProportion != null">#{mnoProportion},</if>
  400. <if test="mnoStatus != null">#{mnoStatus},</if>
  401. <if test="refundExaminStatus != null">#{refundExaminStatus},</if>
  402. sysdate()
  403. )
  404. </insert>
  405. <update id="updateDept" parameterType="SysDept">
  406. update sys_dept
  407. <set>
  408. <if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
  409. <if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
  410. <if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
  411. <if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
  412. <if test="leader != null">leader = #{leader},</if>
  413. <if test="phone != null">phone = #{phone},</if>
  414. <if test="email != null">email = #{email},</if>
  415. <if test="status != null and status != ''">status = #{status},</if>
  416. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  417. <if test="jiBie != null">ji_bie = #{jiBie},</if>
  418. <if test="deptAddress!= null">dept_address = #{deptAddress},</if>
  419. <if test="oilGunNum != null">oil_gun_num = #{oilGunNum},</if>
  420. <if test="stationPic != null">station_pic = #{stationPic},</if>
  421. <if test="stationLongitude!= null">station_longitude = #{stationLongitude},</if>
  422. <if test="stationLatitude != null">station_latitude = #{stationLatitude},</if>
  423. <if test="mno != null">mno = #{mno},</if>
  424. <if test="appId != null">app_id = #{appId},</if>
  425. <if test="appSecret != null">app_secret = #{appSecret},</if>
  426. <if test="discountSetting != null">discount_setting= #{discountSetting},</if>
  427. <if test="cardEnabledFlag != null">card_enabled_flag= #{cardEnabledFlag},</if>
  428. <if test="gzhAppId != null">gzh_app_id= #{gzhAppId},</if>
  429. <if test="gzhAppSecret != null">gzh_app_secret= #{gzhAppSecret},</if>
  430. <if test="aliAppId != null">ali_app_id= #{aliAppId},</if>
  431. <if test="aliPublicKey != null">ali_public_key= #{aliPublicKey},</if>
  432. <if test="aliPrivateKey != null">ali_private_key= #{aliPrivateKey},</if>
  433. <if test="aliEncryptKey != null">ali_encrypt_key= #{aliEncryptKey},</if>
  434. <if test="image1 != null">image1= #{image1},</if>
  435. <if test="image2 != null">image2= #{image2},</if>
  436. <if test="image3 != null">image3= #{image3},</if>
  437. <if test="image4 != null">image4= #{image4},</if>
  438. <if test="image5 != null">image5= #{image5},</if>
  439. <if test="wsPrintFlag != null">ws_print_flag= #{wsPrintFlag},</if>
  440. <if test="printSetting != null">print_setting= #{printSetting},</if>
  441. <if test="notice != null">notice= #{notice},</if>
  442. <if test="integralPrintFlag != null">integral_print_flag= #{integralPrintFlag},</if>
  443. <if test="integralFlag != null">integral_flag= #{integralFlag},</if>
  444. <if test="integralRuleFlag != null">integral_rule_flag= #{integralRuleFlag},</if>
  445. <if test="cardRuleFlag != null">card_rule_flag= #{cardRuleFlag},</if>
  446. <if test="couponFlag != null">coupon_flag= #{couponFlag},</if>
  447. <if test="labelFlag != null">label_flag= #{labelFlag},</if>
  448. <if test="printDeviceType != null">print_device_type= #{printDeviceType},</if>
  449. <if test="balance != null">balance= #{balance},</if>
  450. <if test="city != null">city= #{city},</if>
  451. <if test="isLngFlag != null">is_lng_flag= #{isLngFlag},</if>
  452. <if test="merchantNo != null">merchant_no= #{merchantNo},</if>
  453. <if test="terminalId != null">terminal_id= #{terminalId},</if>
  454. <if test="yunKey != null">yun_key= #{yunKey},</if>
  455. <if test="couponEnabledFlag != null">coupon_enabled_flag= #{couponEnabledFlag},</if>
  456. <if test="mnoArray != null">mno_array= #{mnoArray},</if>
  457. <if test="mnoProportion != null">mno_proportion= #{mnoProportion},</if>
  458. <if test="mnoStatus != null">mno_status= #{mnoStatus},</if>
  459. <if test="refundExaminStatus != null">refund_examin_status= #{refundExaminStatus},</if>
  460. update_time = sysdate()
  461. </set>
  462. where dept_id = #{deptId}
  463. </update>
  464. <update id="updateDeptChildren" parameterType="java.util.List">
  465. update sys_dept set ancestors =
  466. <foreach collection="depts" item="item" index="index"
  467. separator=" " open="case dept_id" close="end">
  468. when #{item.deptId} then #{item.ancestors}
  469. </foreach>
  470. where dept_id in
  471. <foreach collection="depts" item="item" index="index"
  472. separator="," open="(" close=")">
  473. #{item.deptId}
  474. </foreach>
  475. </update>
  476. <update id="updateDeptStatus" parameterType="SysDept">
  477. update sys_dept
  478. <set>
  479. <if test="status != null and status != ''">status = #{status},</if>
  480. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  481. update_time = sysdate()
  482. </set>
  483. where dept_id in (${ancestors})
  484. </update>
  485. <delete id="deleteDeptById" parameterType="Long">
  486. update sys_dept set del_flag = '2' where dept_id = #{deptId}
  487. </delete>
  488. </mapper>