package com.jsl.oa.mapper; import com.jsl.oa.model.dodata.ProjectChildDO; import com.jsl.oa.model.dodata.ProjectDO; import com.jsl.oa.model.dodata.ProjectModuleDO; import com.jsl.oa.model.vodata.ProjectInfoVO; import com.jsl.oa.model.vodata.ProjectWorkSimpleVO; import com.jsl.oa.model.vodata.ProjectWorkVO; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; import java.time.LocalDateTime; import java.util.List; @Mapper public interface ProjectMapper { @Insert("insert into organize_oa.oa_project " + "(name, description, principal_id, cycle,files,complete_time," + "dead_line,status,tags,work_load) " + "value (#{name},#{description},#{principalId},#{cycle},#{files}" + ",#{completeTime},#{deadLine},#{status},#{tags},#{workLoad})") void projectAdd(ProjectInfoVO projectAdd); @Insert("insert into organize_oa.oa_project_work (project_id, pid, name, principal_id," + " work_load, description, cycle, complete_time, type, is_finish,status) " + "value (#{projectId},#{pid},#{name},#{principalId},#{workLoad}," + "#{description},#{cycle},#{completeTime},#{type},#{isFinish},#{status})") void projectWorkAdd(ProjectWorkVO projectWorkVO); void projectEdit(ProjectDO projectEdit); @Select("select * from organize_oa.oa_project where id=#{id}") ProjectDO getProjectById(Long id); @Select("select * from organize_oa.oa_project where id=#{id}") ProjectDO tgetProjectById(Integer id); @Select("select * from organize_oa.oa_project where is_delete=false") List getAllProject(); @Select("select data from organize_oa.oa_config where value='project_show'") String getHeader(); @Insert("insert into organize_oa.oa_config(value, data, created_at)value ('project_show',null,NOW())") void insertProjectShow(); @Update("UPDATE organize_oa.oa_config SET data = #{setProjectShow}," + " updated_at = CURRENT_TIMESTAMP WHERE value = 'project_show'") boolean setProjectShow(String setProjectShow); List getByIsfinish(Long userId, List isFinish); List getByTags(Long userId, List tags, List isFinish); @Select("select * from organize_oa.oa_project where is_delete=false and principal_id=#{userId}") List get(Long userId); @Select("select * from organize_oa.oa_project where status =1 and principal_id=#{userId}") List get1(Long userId); @Select("select * from organize_oa.oa_project where name=#{name}") ProjectDO getByName(String name); @Update("UPDATE organize_oa.oa_project SET is_delete = 1 where id=#{id}") boolean deleteProject(Long id); List workgetByIsfinish(Long userId, List isFinish, Integer is); List workgetByTags(Long userId, List tags, Integer is, List isFinish); //@Select("select * from organize_oa.oa_project where id in(select project_id from " + //"organize_oa.oa_project_work where is_delete=false and status =1 and principal_id=#{userId} and type=0)") List workget(Long userId, Integer is); //@Select("select * from organize_oa.oa_project_work where status=1 and principal_id=#{userId}") List workget1(Long userId, Integer is); List tget(Integer id); List tgetByIsfinish(List isFinish); List tgetBytags(List tags, List isFinish); @Select("select * from organize_oa.oa_project_child where id=#{id}") ProjectWorkSimpleVO getWorkById(Integer id); @Select("select * from organize_oa.oa_project_modules where id=#{id}") ProjectModuleDO getModuleById(Integer id); @Select("select principal_id from organize_oa.oa_project where id=" + "(select project_id from organize_oa.oa_project_child where id=#{id})") Long getPirIdbyId(Long id); @Select("select principal_id from organize_oa.oa_project_child where id=" + "(select project_child_id from organize_oa.oa_project_modules where id=#{id})") Long getPirTdByModuleId(Long id); @Select("select principal_id from organize_oa.oa_project_modules where id=#{id} ") Long getPid(Integer id); @Select("select * from organize_oa.oa_project_child where id=#{id} " + "AND is_delete = 0") ProjectModuleDO getProjectWorkById(Long id); @Select("select principal_id from organize_oa.oa_project_child where project_id=#{id}") List getMemberByProjectId(Integer id); @Select("select principal_id from organize_oa.oa_project_modules where project_child_id=#{id}") List getMemberBySystemId(Integer id); @Select("select * from organize_oa.oa_project_modules " + "where DATE(dead_line) = DATE(#{threeDayLater}) and status != 'complete' ") List getProjectWorkByTime(LocalDateTime threeDayLater); @Select("select * from organize_oa.oa_project_modules " + "where is_delete = 0 and principal_id = #{uid}") List getAllModuleByUserId(Long uid); @Select("select * from organize_oa.oa_project_child " + "where project_id = #{pid} and is_delete = 0 ") List getAllChildProjectByUserId(Long uid); @Select("select * from organize_oa.oa_project " + "where is_delete = 0 and principal_id = #{uid}") List getAllProjectByUserId(Long uid); @Select("select * from organize_oa.oa_project_child where " + "DATE (dead_line) = DATE (#{threeDaysLater}) and status != 'complete' ") List getProjectChildByTime(LocalDateTime threeDaysLater); @Select("select * from organize_oa.oa_project_child where " + "id = #{id} and is_delete = 0") ProjectChildDO getProjectChildById(Integer id); List getParticipateProject(Long userId); void deleteProjectChild(Long id1); void deleteProjectModule(Long id1); }