| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- <?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.ruoyi.project.mapper.ProjectTaskMapper">
- <resultMap id="BaseResultMap" type="com.ruoyi.project.domain.ProjectTask">
- <id column="id" jdbcType="BIGINT" property="id" />
- <result column="aid" jdbcType="BIGINT" property="aid" />
- <result column="name" jdbcType="VARCHAR" property="name" />
- <result column="project_status" jdbcType="INTEGER" property="projectStatus" />
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
- <result column="remark" jdbcType="VARCHAR" property="remark" />
- <result column="admin_name" jdbcType="VARCHAR" property="adminName" />
- <result column="staff_name" jdbcType="VARCHAR" property="staffName" />
- <result column="project_number" jdbcType="VARCHAR" property="projectNumber" />
- <result column="project_year" jdbcType="OTHER" property="projectYear" />
- <result column="create_year" jdbcType="OTHER" property="createYear" />
- <result column="cross_year" jdbcType="INTEGER" property="crossYear" />
- <result column="duration" jdbcType="DOUBLE" property="duration" />
- </resultMap>
- <sql id="Base_Column_List">
- id, aid, `name`, project_status, create_time, remark, admin_name, staff_name, project_number,
- project_year, create_year, cross_year, duration
- </sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from project_task
- where id = #{id,jdbcType=BIGINT}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
- delete from project_task
- where id = #{id,jdbcType=BIGINT}
- </delete>
- <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.ruoyi.project.domain.ProjectTask" useGeneratedKeys="true">
- insert into project_task (aid, `name`, project_status,
- create_time, remark, admin_name,
- staff_name, project_number, project_year,
- create_year, cross_year, duration
- )
- values (#{aid,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{projectStatus,jdbcType=INTEGER},
- #{createTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, #{adminName,jdbcType=VARCHAR},
- #{staffName,jdbcType=VARCHAR}, #{projectNumber,jdbcType=VARCHAR}, #{projectYear,jdbcType=OTHER},
- #{createYear,jdbcType=OTHER}, #{crossYear,jdbcType=INTEGER}, #{duration,jdbcType=DOUBLE}
- )
- </insert>
- <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.ruoyi.project.domain.ProjectTask" useGeneratedKeys="true">
- insert into project_task
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="aid != null">
- aid,
- </if>
- <if test="name != null">
- `name`,
- </if>
- <if test="projectStatus != null">
- project_status,
- </if>
- <if test="createTime != null">
- create_time,
- </if>
- <if test="remark != null">
- remark,
- </if>
- <if test="adminName != null">
- admin_name,
- </if>
- <if test="staffName != null">
- staff_name,
- </if>
- <if test="projectNumber != null">
- project_number,
- </if>
- <if test="projectYear != null">
- project_year,
- </if>
- <if test="createYear != null">
- create_year,
- </if>
- <if test="crossYear != null">
- cross_year,
- </if>
- <if test="duration != null">
- duration,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="aid != null">
- #{aid,jdbcType=BIGINT},
- </if>
- <if test="name != null">
- #{name,jdbcType=VARCHAR},
- </if>
- <if test="projectStatus != null">
- #{projectStatus,jdbcType=INTEGER},
- </if>
- <if test="createTime != null">
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="remark != null">
- #{remark,jdbcType=VARCHAR},
- </if>
- <if test="adminName != null">
- #{adminName,jdbcType=VARCHAR},
- </if>
- <if test="staffName != null">
- #{staffName,jdbcType=VARCHAR},
- </if>
- <if test="projectNumber != null">
- #{projectNumber,jdbcType=VARCHAR},
- </if>
- <if test="projectYear != null">
- #{projectYear,jdbcType=OTHER},
- </if>
- <if test="createYear != null">
- #{createYear,jdbcType=OTHER},
- </if>
- <if test="crossYear != null">
- #{crossYear,jdbcType=INTEGER},
- </if>
- <if test="duration != null">
- #{duration,jdbcType=DOUBLE},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.ruoyi.project.domain.ProjectTask">
- update project_task
- <set>
- <if test="aid != null">
- aid = #{aid,jdbcType=BIGINT},
- </if>
- <if test="name != null">
- `name` = #{name,jdbcType=VARCHAR},
- </if>
- <if test="projectStatus != null">
- project_status = #{projectStatus,jdbcType=INTEGER},
- </if>
- <if test="createTime != null">
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="remark != null">
- remark = #{remark,jdbcType=VARCHAR},
- </if>
- <if test="adminName != null">
- admin_name = #{adminName,jdbcType=VARCHAR},
- </if>
- <if test="staffName != null">
- staff_name = #{staffName,jdbcType=VARCHAR},
- </if>
- <if test="projectNumber != null">
- project_number = #{projectNumber,jdbcType=VARCHAR},
- </if>
- <if test="projectYear != null">
- project_year = #{projectYear,jdbcType=OTHER},
- </if>
- <if test="createYear != null">
- create_year = #{createYear,jdbcType=OTHER},
- </if>
- <if test="crossYear != null">
- cross_year = #{crossYear,jdbcType=INTEGER},
- </if>
- <if test="duration != null">
- duration = #{duration,jdbcType=DOUBLE},
- </if>
- </set>
- where id = #{id,jdbcType=BIGINT}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.ruoyi.project.domain.ProjectTask">
- update project_task
- set aid = #{aid,jdbcType=BIGINT},
- `name` = #{name,jdbcType=VARCHAR},
- project_status = #{projectStatus,jdbcType=INTEGER},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- remark = #{remark,jdbcType=VARCHAR},
- admin_name = #{adminName,jdbcType=VARCHAR},
- staff_name = #{staffName,jdbcType=VARCHAR},
- project_number = #{projectNumber,jdbcType=VARCHAR},
- project_year = #{projectYear,jdbcType=OTHER},
- create_year = #{createYear,jdbcType=OTHER},
- cross_year = #{crossYear,jdbcType=INTEGER},
- duration = #{duration,jdbcType=DOUBLE}
- where id = #{id,jdbcType=BIGINT}
- </update>
- <update id="updateStaffName">
- update project_task a left join (select pid ,group_concat(name)name from project_staff
- where pid = #{pid} group by pid) b on a.id=b.pid set a.staff_name =b.name
- where a.id = #{pid}
- </update>
- <resultMap id="BaseResultOutMap" type="com.ruoyi.project.bo.ProjectTaskListOut">
- <id column="id" jdbcType="BIGINT" property="id" />
- <result column="aid" jdbcType="BIGINT" property="aid" />
- <result column="name" jdbcType="VARCHAR" property="name" />
- <result column="project_status" jdbcType="INTEGER" property="projectStatus" />
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
- <result column="remark" jdbcType="VARCHAR" property="remark" />
- <result column="admin_name" jdbcType="VARCHAR" property="adminName" />
- <result column="staff_name" jdbcType="VARCHAR" property="staffName" />
- <result column="project_number" jdbcType="VARCHAR" property="projectNumber" />
- <result column="project_year" jdbcType="OTHER" property="projectYear" />
- <result column="create_year" jdbcType="OTHER" property="createYear" />
- <result column="cross_year" jdbcType="INTEGER" property="crossYear" />
- </resultMap>
- <select id="selectList" resultMap="BaseResultOutMap">
- select
- a.id, a.aid, a.`name`, a.project_status , a.create_time, a.remark, a.admin_name, a.staff_name, a.project_number,
- a.project_year, a.create_year, a.cross_year
- from project_task a
- <if test="companyId !=null">
- left join sys_user c on a.aid=c.user_id
- left join sys_dept d on c.dept_id=d.dept_id
- </if>
- where 1=1
- <if test="roleType ==0">
- and (a.aid =#{uid} or a.id in (select pid from project_staff where aid= #{uid}))
- </if>
- <if test="headId !=null">
- and a.aid= #{headId}
- </if>
- <if test="staffId !=null">
- and a.id in (select pid from project_staff where aid= #{staffId})
- </if>
- <if test="name !=null">
- and a.name like concat('%',#{name},'%')
- </if>
- <if test="startTime !=null and endTime !=null">
- and a.create_time between #{startTime} and #{endTime}
- </if>
- <if test="projectNumber !=null ">
- and a.project_number like concat('%',#{projectNumber},'%')
- </if>
- <if test="projectYear !=null ">
- and a.project_year =#{projectYear}
- </if>
- <if test="crossYear !=null ">
- and a.cross_year =#{crossYear}
- </if>
- <if test="projectStatus !=null ">
- and a.project_status =#{projectStatus}
- </if>
- <if test="companyId !=null">
- and (d.dept_id= #{companyId} or find_in_set(#{companyId},d.ancestors))
- </if>
- </select>
- <select id="projectAddDuration">
- update project_task
- set duration=duration+#{duration}
- where id =#{pid}
- </select>
- </mapper>
|