PrjProjectroleDao.xml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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.liang.dao.PrjProjectroleDao">
  4. <resultMap type="com.liang.entity.PrjProjectrole" id="PrjProjectroleMap">
  5. <result property="id" column="ID" jdbcType="INTEGER"/>
  6. <result property="mc" column="MC" jdbcType="VARCHAR"/>
  7. </resultMap>
  8. <!--查询单个-->
  9. <select id="queryById" resultMap="PrjProjectroleMap">
  10. select ID,
  11. MC
  12. from prj_projectRole
  13. where ID = #{id}
  14. </select>
  15. <!--查询指定行数据-->
  16. <select id="queryAllByLimit" resultMap="PrjProjectroleMap">
  17. select
  18. ID, MC
  19. from prj_projectRole
  20. <where>
  21. <if test="id != null">
  22. and ID = #{id}
  23. </if>
  24. <if test="mc != null and mc != ''">
  25. and MC = #{mc}
  26. </if>
  27. </where>
  28. limit #{pageable.offset}, #{pageable.pageSize}
  29. </select>
  30. <!--统计总行数-->
  31. <select id="count" resultType="java.lang.Long">
  32. select count(1)
  33. from prj_projectRole
  34. <where>
  35. <if test="id != null">
  36. and ID = #{id}
  37. </if>
  38. <if test="mc != null and mc != ''">
  39. and MC = #{mc}
  40. </if>
  41. </where>
  42. </select>
  43. <!--新增所有列-->
  44. <insert id="insert" keyProperty="id" useGeneratedKeys="true">
  45. insert into prj_projectRole(MC)
  46. values (#{mc})
  47. </insert>
  48. <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
  49. insert into prj_projectRole(MC)
  50. values
  51. <foreach collection="entities" item="entity" separator=",">
  52. (#{entity.mc})
  53. </foreach>
  54. </insert>
  55. <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
  56. insert into prj_projectRole(MC)
  57. values
  58. <foreach collection="entities" item="entity" separator=",">
  59. (#{entity.mc})
  60. </foreach>
  61. on duplicate key update
  62. MC = values(MC)
  63. </insert>
  64. <!--通过主键修改数据-->
  65. <update id="update">
  66. update prj_projectRole
  67. <set>
  68. <if test="mc != null and mc != ''">
  69. MC = #{mc}
  70. </if>
  71. </set>
  72. where ID = #{id}
  73. </update>
  74. <!--通过主键删除-->
  75. <delete id="deleteById">
  76. delete
  77. from prj_projectRole
  78. where ID = #{id}
  79. </delete>
  80. <!--获取项目角色-->
  81. <select id="getProjectRole" resultType="map">
  82. select CONVERT(varchar (255), id) as code, MC as name
  83. from prj_projectRole
  84. </select>
  85. </mapper>