DepartmentDao.xml 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.zglc.kg.dao.DepartmentDao">
  4. <!-- 可根据自己的需求,是否要使用 -->
  5. <resultMap type="com.zglc.kg.entity.DepartmentEntity" id="departmentMap">
  6. <result property="id" column="id"/>
  7. <result property="parentId" column="parent_id"/>
  8. <result property="parentName" column="parent_name"/>
  9. <result property="departmentName" column="department_name"/>
  10. <result property="masterId" column="master_id"/>
  11. <result property="masterName" column="master_name"/>
  12. <result property="remark" column="remark"/>
  13. </resultMap>
  14. <select id="listAll" resultMap="departmentMap">
  15. select *
  16. from t_department
  17. </select>
  18. <select id="listsub" parameterType="integer" resultMap="departmentMap">
  19. select *
  20. from t_department where parent_id =#{id , jdbcType=INTEGER}
  21. </select>
  22. <select id="findByName" parameterType="String" resultMap="departmentMap">
  23. select * from t_department where
  24. department_name like #{name}
  25. </select>
  26. </mapper>