| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377 |
- <?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.ProjectStaffRecordMapper">
- <resultMap id="BaseResultMap" type="com.ruoyi.project.domain.ProjectStaffRecord">
- <id property="id" column="id" jdbcType="BIGINT"/>
- <result property="pid" column="pid" jdbcType="BIGINT"/>
- <result property="aid" column="aid" jdbcType="BIGINT"/>
- <result property="name" column="name" jdbcType="VARCHAR"/>
- <result property="projectStatus" column="project_status" jdbcType="INTEGER"/>
- <result property="content" column="content" jdbcType="VARCHAR"/>
- <result property="annexUrl" column="annex_url" jdbcType="VARCHAR"/>
- <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
- <result property="processStatus" column="process_status" jdbcType="INTEGER"/>
- <result property="duration" column="duration" jdbcType="DOUBLE"/>
- <result property="examineId" column="examine_id" jdbcType="BIGINT"/>
- <result property="examineTime" column="examine_time" jdbcType="TIMESTAMP"/>
- <result property="examineName" column="examine_name" jdbcType="VARCHAR"/>
- <result property="recordTime" column="record_time" jdbcType="TIMESTAMP"/>
- <result property="examineContent" column="examine_content" jdbcType="VARCHAR"/>
- <result property="initDuration" column="init_duration" jdbcType="DOUBLE"/>
- <result property="checkDuration" column="check_duration" jdbcType="DOUBLE"/>
- <result property="checkStatus" column="check_status" jdbcType="INTEGER"/>
- <result property="tianheUrl" column="tianhe_url" jdbcType="VARCHAR"/>
- <result property="tianheType" column="tianhe_type" jdbcType="INTEGER"/>
- <result property="projectName" column="projectName" jdbcType="INTEGER"/>
- </resultMap>
- <sql id="Base_Column_List">
- id,pid,aid,
- name,project_status,content,
- annex_url,create_time,process_status,
- duration,examine_id,examine_time,
- examine_name,record_time,examine_content,
- init_duration,check_duration,check_status,
- tianhe_url,tianhe_type
- </sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from project_staff_record
- where id = #{id,jdbcType=BIGINT}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
- delete from project_staff_record
- where id = #{id,jdbcType=BIGINT}
- </delete>
- <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.ruoyi.project.domain.ProjectStaffRecord" useGeneratedKeys="true">
- insert into project_staff_record
- ( id,pid,aid
- ,name,project_status,content
- ,annex_url,create_time,process_status
- ,duration,examine_id,examine_time
- ,examine_name,record_time,examine_content
- ,init_duration,check_duration,check_status
- ,tianhe_url,tianhe_type)
- values (#{id,jdbcType=BIGINT},#{pid,jdbcType=BIGINT},#{aid,jdbcType=BIGINT}
- ,#{name,jdbcType=VARCHAR},#{projectStatus,jdbcType=INTEGER},#{content,jdbcType=VARCHAR}
- ,#{annexUrl,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{processStatus,jdbcType=INTEGER}
- ,#{duration,jdbcType=DOUBLE},#{examineId,jdbcType=BIGINT},#{examineTime,jdbcType=TIMESTAMP}
- ,#{examineName,jdbcType=VARCHAR},#{recordTime,jdbcType=TIMESTAMP},#{examineContent,jdbcType=VARCHAR}
- ,#{initDuration,jdbcType=DOUBLE},#{checkDuration,jdbcType=DOUBLE},#{checkStatus,jdbcType=INTEGER}
- ,#{tianheUrl,jdbcType=VARCHAR},#{tianheType,jdbcType=INTEGER})
- </insert>
- <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.ruoyi.project.domain.ProjectStaffRecord" useGeneratedKeys="true">
- insert into project_staff_record
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">id,</if>
- <if test="pid != null">pid,</if>
- <if test="aid != null">aid,</if>
- <if test="name != null">name,</if>
- <if test="projectStatus != null">project_status,</if>
- <if test="content != null">content,</if>
- <if test="annexUrl != null">annex_url,</if>
- <if test="createTime != null">create_time,</if>
- <if test="processStatus != null">process_status,</if>
- <if test="duration != null">duration,</if>
- <if test="examineId != null">examine_id,</if>
- <if test="examineTime != null">examine_time,</if>
- <if test="examineName != null">examine_name,</if>
- <if test="recordTime != null">record_time,</if>
- <if test="examineContent != null">examine_content,</if>
- <if test="initDuration != null">init_duration,</if>
- <if test="checkDuration != null">check_duration,</if>
- <if test="checkStatus != null">check_status,</if>
- <if test="tianheUrl != null">tianhe_url,</if>
- <if test="tianheType != null">tianhe_type,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">#{id,jdbcType=BIGINT},</if>
- <if test="pid != null">#{pid,jdbcType=BIGINT},</if>
- <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="content != null">#{content,jdbcType=VARCHAR},</if>
- <if test="annexUrl != null">#{annexUrl,jdbcType=VARCHAR},</if>
- <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
- <if test="processStatus != null">#{processStatus,jdbcType=INTEGER},</if>
- <if test="duration != null">#{duration,jdbcType=DOUBLE},</if>
- <if test="examineId != null">#{examineId,jdbcType=BIGINT},</if>
- <if test="examineTime != null">#{examineTime,jdbcType=TIMESTAMP},</if>
- <if test="examineName != null">#{examineName,jdbcType=VARCHAR},</if>
- <if test="recordTime != null">#{recordTime,jdbcType=TIMESTAMP},</if>
- <if test="examineContent != null">#{examineContent,jdbcType=VARCHAR},</if>
- <if test="initDuration != null">#{initDuration,jdbcType=DOUBLE},</if>
- <if test="checkDuration != null">#{checkDuration,jdbcType=DOUBLE},</if>
- <if test="checkStatus != null">#{checkStatus,jdbcType=INTEGER},</if>
- <if test="tianheUrl != null">#{tianheUrl,jdbcType=VARCHAR},</if>
- <if test="tianheType != null">#{tianheType,jdbcType=INTEGER},</if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.ruoyi.project.domain.ProjectStaffRecord">
- update project_staff_record
- <set>
- <if test="pid != null">
- pid = #{pid,jdbcType=BIGINT},
- </if>
- <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="content != null">
- content = #{content,jdbcType=VARCHAR},
- </if>
- <if test="annexUrl != null">
- annex_url = #{annexUrl,jdbcType=VARCHAR},
- </if>
- <if test="createTime != null">
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="processStatus != null">
- process_status = #{processStatus,jdbcType=INTEGER},
- </if>
- <if test="duration != null">
- duration = #{duration,jdbcType=DOUBLE},
- </if>
- <if test="examineId != null">
- examine_id = #{examineId,jdbcType=BIGINT},
- </if>
- <if test="examineTime != null">
- examine_time = #{examineTime,jdbcType=TIMESTAMP},
- </if>
- <if test="examineName != null">
- examine_name = #{examineName,jdbcType=VARCHAR},
- </if>
- <if test="recordTime != null">
- record_time = #{recordTime,jdbcType=TIMESTAMP},
- </if>
- <if test="examineContent != null">
- examine_content = #{examineContent,jdbcType=VARCHAR},
- </if>
- <if test="initDuration != null">
- init_duration = #{initDuration,jdbcType=DOUBLE},
- </if>
- <if test="checkDuration != null">
- check_duration = #{checkDuration,jdbcType=DOUBLE},
- </if>
- <if test="checkStatus != null">
- check_status = #{checkStatus,jdbcType=INTEGER},
- </if>
- <if test="tianheUrl != null">
- tianhe_url = #{tianheUrl,jdbcType=VARCHAR},
- </if>
- <if test="tianheType != null">
- tianhe_type = #{tianheType,jdbcType=INTEGER},
- </if>
- </set>
- where id = #{id,jdbcType=BIGINT}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.ruoyi.project.domain.ProjectStaffRecord">
- update project_staff_record
- set
- pid = #{pid,jdbcType=BIGINT},
- aid = #{aid,jdbcType=BIGINT},
- name = #{name,jdbcType=VARCHAR},
- project_status = #{projectStatus,jdbcType=INTEGER},
- content = #{content,jdbcType=VARCHAR},
- annex_url = #{annexUrl,jdbcType=VARCHAR},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- process_status = #{processStatus,jdbcType=INTEGER},
- duration = #{duration,jdbcType=DOUBLE},
- examine_id = #{examineId,jdbcType=BIGINT},
- examine_time = #{examineTime,jdbcType=TIMESTAMP},
- examine_name = #{examineName,jdbcType=VARCHAR},
- record_time = #{recordTime,jdbcType=TIMESTAMP},
- examine_content = #{examineContent,jdbcType=VARCHAR},
- init_duration = #{initDuration,jdbcType=DOUBLE},
- check_duration = #{checkDuration,jdbcType=DOUBLE},
- check_status = #{checkStatus,jdbcType=INTEGER},
- tianhe_url = #{tianheUrl,jdbcType=VARCHAR},
- tianhe_type = #{tianheType,jdbcType=INTEGER}
- where id = #{id,jdbcType=BIGINT}
- </update>
- <select id="selectList" resultType="com.ruoyi.project.bo.ProjectStaffRecordOut">
- select a.id,c.job_number jobNumber,a.name ,d.dept_id deptId ,d.dept_name deptName ,a.record_time createMonth,
- b.name projectName,b.admin_name adminName ,a.project_status projectStatus,a.content ,b.project_number projectNumber,
- a.pid ,a.aid ,a.examine_id examineId ,a.examine_name examineName ,a.examine_time examineTime,a.record_time recordTime,
- a.annex_url annexUrl,a.create_time createTime,a.process_status processStatus , a.duration,a.init_duration initDuration,
- a.check_duration checkDuration,a.tianhe_url tianheUrl,a.tianhe_type tianheType,b.tianhe_url projectTianheUrl
- from project_staff_record a left join project_task b on a.pid=b.id
- left join sys_user c on a.aid=c.user_id left join sys_dept d on c.dept_id =d.dept_id
- where 1=1
- <if test="roleType==0">
- and a.aid =#{aid}
- </if>
- <if test="roleType==1">
- and c.superior_id= #{aid}
- </if>
- <if test="processStatus !=null">
- and a.process_status= #{processStatus}
- </if>
- <if test="companyId !=null">
- and (d.dept_id= #{companyId} or find_in_set(#{companyId},d.ancestors))
- </if>
- <if test="adminName != null"> and a.name like concat ('%',#{adminName},'%')</if>
- <if test="projectStatus != null"> and a.project_status =#{projectStatus}</if>
- <if test="projectNumber != null"> and b.project_number like concat ('%',#{projectNumber},'%')</if>
- <if test="projectName != null"> and b.name like concat ('%',#{projectName},'%')</if>
- <if test="clockStatus ==1">
- and a.check_duration is not null
- and a.duration = a.check_duration
- </if>
- <if test="clockStatus ==2">
- and a.check_duration is not null
- and a.duration != a.check_duration
- </if>
- <if test="researchStart != null and researchEnd != null">
- and( #{researchStart} between b.start_time and b.end_time or #{researchEnd} between b.start_time and b.end_time)
- </if>
- <if test="startTime != null and endTime != null">
- and a.record_time between #{startTime} and #{endTime}
- </if>
- <if test="fullJob != null">and c.full_job= #{fullJob}</if>
- <if test="deptId != null">and (d.dept_id= #{deptId} or find_in_set(#{deptId},d.ancestors)) </if>
- order by a.record_time desc
- </select>
- <select id="selectById" resultType="java.lang.Integer">
- select count(*)
- from project_staff_record a left join project_staff ps on a.aid = ps.aid
- where a.pid=ps.pid
- and ps.id = #{id}
- </select>
- <select id="selectByPidAndAid" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from project_staff_record
- where 1=1
- <if test="pid !=null">
- and pid= #{pid}
- </if>
- <if test="aid != null">
- and aid = #{aid}
- </if>
- </select>
- <select id="myDurationMonth" resultType="com.ruoyi.project.bo.MyMonthDays">
- select x.dates dates,sum(x.duration)duration
- from (select a.duration ,date_format(a.record_time,'%Y-%m-%d')dates
- from project_staff_record a
- where a.pid = #{param1} and a.aid =#{param2}
- and a.record_time between #{param3} and #{param4}
- )x group by x.dates
- </select>
- <select id="selectDetailsById" resultType="com.ruoyi.project.bo.ProjectStaffRecordOut">
- select a.id,c.job_number jobNumber,a.name ,d.dept_id deptId ,d.dept_name deptName ,c.create_time createMonth,
- b.id projectId,b.name projectName,b.admin_name adminName ,a.project_status projectStatus,a.content ,
- a.pid ,a.aid ,a.examine_id examineId ,a.examine_name examineName ,a.examine_time examineTime,
- a.annex_url annexUrl,a.create_time createTime,a.process_status processStatus , a.duration,
- a.examine_content examineContent,a.record_time recordTime
- from project_staff_record a left join project_task b on a.pid=b.id
- left join sys_user c on a.aid=c.user_id left join sys_dept d on c.dept_id =d.dept_id
- where 1=1
- and a.id =#{id}
- </select>
- <select id="selectByAidAndTime" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from project_staff_record
- where aid = #{uid}
- and record_time between #{startTime} and #{endTime}
- </select>
- <update id="updateNameByAid" parameterType="com.ruoyi.common.core.domain.entity.SysUser">
- update project_staff_record
- set name= #{nickName}
- where aid= #{userId}
- </update>
- <update id="updateSumDurationProject">
- update project_task x,(select pid ,sum(duration)duration
- from project_staff_record where pid =#{pid} group by pid )y
- set x.duration =y.duration
- where x.id =y.pid
- </update>
- <update id="updateSumDurationStaff">
- update sys_user x,(select aid ,sum(duration)duration
- from project_staff_record where pid = #{pid} group by aid)y
- set x.duration=y.duration
- where x.user_id =y.aid
- </update>
- <select id="selectByDDUidAndTime" resultType="com.ruoyi.project.domain.ProjectStaffRecordOut">
- select
- b.id,b.duration,b.aid,b.pid,c.name projectName,b.check_duration checkDuration,
- date_format(b.record_time,'%Y-%m-%d')recordTime
- from sys_user a left join project_staff_record b on a.user_id=b.aid
- left join project_task c on b.pid=c.id
- where a.dd_user_id= #{ddUserId}
- and b.record_time = #{clockDate}
- </select>
- <update id="mateUserRecord">
- update project_staff_record
- set duration =check_duration,check_status=2
- where id in
- <foreach collection="collect" open="(" close=")" separator="," item="e">
- #{e}
- </foreach>
- </update>
- <update id="updateTianheType">
- update project_staff_record
- set tianhe_type=1
- where tianhe_type=0
- and id in
- <foreach collection="collect" open="(" close=")" separator="," item="e">
- #{e.id}
- </foreach>
- </update>
- <select id="getMonthClock" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from project_staff_record
- where process_status=2 and check_duration >=0
- and pid = #{id}
- and record_time between #{startDate} and #{endDate}
- </select>
- <select id="getCompanyClock" resultType="com.ruoyi.project.bo.PushRdDataListBo">
- select
- d.project_number projectNumber,
- b.ky_id adminKyId,
- date_format(a.record_time, '%Y-%m-%d') recordTime,
- a.duration duration
- from project_staff_record a
- left join sys_user b on a.aid = b.user_id
- left join sys_dept c on b.dept_id = c.dept_id
- left join project_task d on a.pid = d.id
- where a.process_status = 2
- and a.duration >= 0
- and (c.dept_id = #{deptId} or find_in_set(#{deptId}, c.ancestors))
- and a.record_time between #{startDate} and #{endDate}
- </select>
- <select id="selectByPidAndAidAndTime" resultType="com.ruoyi.project.domain.ProjectStaffRecord">
- select
- <include refid="Base_Column_List" />
- from project_staff_record
- where pid = #{pid}
- and aid = #{aid}
- and record_time = #{recordTime}
- </select>
- </mapper>
|