1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.dayou.mapper.MajorProductionAllotMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.dayou.entity.MajorProductionAllot">
- <result column="id" property="id" />
- <result column="deleted" property="deleted" />
- <result column="created" property="created" />
- <result column="modified" property="modified" />
- <result column="major_production_id" property="majorProductionId" />
- <result column="user_id" property="userId" />
- <result column="ratio" property="ratio" />
- <result column="is_principal" property="isPrincipal" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id,
- deleted,
- created,
- modified,
- major_production_id, user_id, ratio, is_principal
- </sql>
- <select id="getList" parameterType="java.lang.Long" resultType="com.dayou.entity.MajorProductionAllot">
- SELECT
- mpa.id,
- mpa.major_production_id,
- mpa.user_id,
- mpa.ratio,
- mpa.is_principal,
- u.NAME AS userName
- FROM
- major_production_allot mpa
- LEFT JOIN user u ON u.id = mpa.user_id
- WHERE
- mpa.deleted = 0 and mpa.major_production_id = #{productionId}
- ORDER BY
- mpa.is_principal DESC
- </select>
- <select id="findMembers" parameterType="java.lang.Long" resultType="com.dayou.entity.Major">
- SELECT
- principal_id , members from major where id = (select major_id from major_production where id = #{productionId})
- </select>
- <select id="blankAllot" parameterType="java.util.List" resultType="com.dayou.entity.MajorProductionAllot">
- SELECT name as userName,id as userId from user where id in (
- <foreach collection="members" item="item" index="index" separator=",">
- #{item}
- </foreach>
- )
- </select>
- <delete id="deleteByMajorProductionId" parameterType="java.lang.Long">
- delete from major_production_allot where major_production_id = #{productionId}
- </delete>
- </mapper>
|