SimpleTreeCodeDao.xml 626 B

1234567891011121314151617
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC
  3. "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.persagy.fm.mybatis.dao.SimpleTreeCodeDao">
  6. <select id="getMaxCode" resultType="java.lang.String">
  7. select max(${innerCodeField}) as code
  8. from ${tableName}
  9. where ${innerCodeField} like '${parentCode}_____'
  10. </select>
  11. <select id="updateSubTreeCode">
  12. update ${tableName} set ${innerCodeField} = (concat('${parentCode}',substr(${innerCodeField},${oldParentCode.length()+1})))
  13. where ${innerCodeField} like '${oldParentCode}%'
  14. </select>
  15. </mapper>