MajorProductionAllotMapper.xml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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.dayou.mapper.MajorProductionAllotMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.dayou.entity.MajorProductionAllot">
  6. <result column="id" property="id" />
  7. <result column="deleted" property="deleted" />
  8. <result column="created" property="created" />
  9. <result column="modified" property="modified" />
  10. <result column="major_production_id" property="majorProductionId" />
  11. <result column="user_id" property="userId" />
  12. <result column="ratio" property="ratio" />
  13. <result column="is_principal" property="isPrincipal" />
  14. </resultMap>
  15. <!-- 通用查询结果列 -->
  16. <sql id="Base_Column_List">
  17. id,
  18. deleted,
  19. created,
  20. modified,
  21. major_production_id, user_id, ratio, is_principal
  22. </sql>
  23. <select id="getList" parameterType="java.lang.Long" resultType="com.dayou.entity.MajorProductionAllot">
  24. SELECT
  25. mpa.id,
  26. mpa.major_production_id,
  27. mpa.user_id,
  28. mpa.ratio,
  29. mpa.is_principal,
  30. u.NAME AS userName
  31. FROM
  32. major_production_allot mpa
  33. LEFT JOIN user u ON u.id = mpa.user_id
  34. WHERE
  35. mpa.deleted = 0 and mpa.major_production_id = #{productionId}
  36. ORDER BY
  37. mpa.is_principal DESC
  38. </select>
  39. <select id="findMembers" parameterType="java.lang.Long" resultType="com.dayou.entity.Major">
  40. SELECT
  41. principal_id , members from major where id = (select major_id from major_production where id = #{productionId})
  42. </select>
  43. <select id="blankAllot" parameterType="java.util.List" resultType="com.dayou.entity.MajorProductionAllot">
  44. SELECT name as userName,id as userId from user where id in (
  45. <foreach collection="members" item="item" index="index" separator=",">
  46. #{item}
  47. </foreach>
  48. )
  49. </select>
  50. <delete id="deleteByMajorProductionId" parameterType="java.lang.Long">
  51. delete from major_production_allot where major_production_id = #{productionId}
  52. </delete>
  53. </mapper>