SysDeptMapper.xml 23 KB

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