123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386 |
- <?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.jeeplus.modules.projectcontentinfo.dao.ProjectContentDataDao">
-
- <sql id="projectContentDataColumns">
- a.id AS "id",
- a.create_by AS "createBy.id",
- a.create_date AS "createDate",
- a.update_by AS "updateBy.id",
- a.update_date AS "updateDate",
- a.remarks AS "remarks",
- a.del_flag AS "delFlag",
- a.company_id AS "companyId",
- a.office_id AS "officeId",
- a.project_id AS "project.id",
- a.name AS "name",
- a.number AS "number",
- a.type AS "type",
- a.master AS "master.id",
- a.content_details_id AS "contentDetailsId",
- a.contract_id AS "contractId",
- su.name AS "master.name"
- </sql>
-
- <sql id="projectContentDataJoins">
- LEFT JOIN sys_user su ON su.id = a.master
- </sql>
-
-
- <select id="get" resultType="ProjectContentData" >
- SELECT
- <include refid="projectContentDataColumns"/>
- FROM project_content_data a
- <include refid="projectContentDataJoins"/>
- WHERE a.id = #{id}
- </select>
-
- <select id="findList" resultType="ProjectContentData" >
- SELECT
- <include refid="projectContentDataColumns"/>
- FROM project_content_data a
- <include refid="projectContentDataJoins"/>
- <where>
- <if test="name !=null and name != ''">
- AND a.name LIKE concat('%',#{name},'%')
- </if>
- <if test="number !=null and number != ''">
- AND a.number = #{number}
- </if>
- <if test="master !=null and master.name != null and master.name !=''">
- AND su.name LIKE concat('%',#{master.name},'%')
- </if>
- <if test="project!=null and project.id!=null and project.id!=''">
- AND a.project_id = #{project.id}
- </if>
- <if test="type!=null and type!=''">
- AND a.type = #{type}
- </if>
- <if test="parentType != null">
- AND a.type LIKE concat(#{parentType},'%')
- </if>
- <if test="startDate != null">
- AND a.create_date >= #{startDate}
- </if>
- <if test="endDate != null">
- AND a.create_date <= #{endDate}
- </if>
- <if test="extId !=null and extId!=''">
- AND a.id != #{extId}
- </if>
- AND a.del_flag = #{DEL_FLAG_NORMAL}
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.update_date DESC
- </otherwise>
- </choose>
- </select>
- <select id="findListOnRural" resultType="RuralProjectContentData" >
- SELECT
- <include refid="projectContentDataColumns"/>
- FROM project_content_data a
- <include refid="projectContentDataJoins"/>
- <where>
- <if test="name !=null and name != ''">
- AND a.name LIKE concat('%',#{name},'%')
- </if>
- <if test="number !=null and number != ''">
- AND a.number = #{number}
- </if>
- <if test="master !=null and master.name != null and master.name !=''">
- AND su.name LIKE concat('%',#{master.name},'%')
- </if>
- <if test="project!=null and project.id!=null and project.id!=''">
- AND a.project_id = #{project.id}
- </if>
- <if test="type!=null and type!=''">
- AND a.type = #{type}
- </if>
- <if test="parentType != null">
- AND a.type LIKE concat(#{parentType},'%')
- </if>
- <if test="startDate != null">
- AND a.create_date >= #{startDate}
- </if>
- <if test="endDate != null">
- AND a.create_date <= #{endDate}
- </if>
- <if test="extId !=null and extId!=''">
- AND a.id != #{extId}
- </if>
- AND a.del_flag = #{DEL_FLAG_NORMAL}
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.update_date DESC
- </otherwise>
- </choose>
- </select>
- <select id="findReportContent" resultType="ProjectContentData" >
- SELECT
- <include refid="projectContentDataColumns"/>
- FROM project_content_data a
- <include refid="projectContentDataJoins"/>
- JOIN project_report_content rc ON rc.content_id = a.id
- WHERE rc.report_id = #{reportId}
- AND rc.type = #{type}
- AND a.del_flag = '0'
- ORDER BY a.update_date DESC
- </select>
- <select id="findAllList" resultType="ProjectContentData" >
- SELECT
- <include refid="projectContentDataColumns"/>
- FROM project_content_data a
- <include refid="projectContentDataJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.update_date DESC
- </otherwise>
- </choose>
- </select>
- <select id="getNumber" resultType="ProjectContentData" >
- SELECT
- <include refid="projectContentDataColumns"/>
- FROM project_content_data a
- WHERE
- a.del_flag = #{DEL_FLAG_NORMAL}
- AND a.project_id = #{project.id}
- ORDER BY a.number DESC
- limit 1
- </select>
- <insert id="insert">
- INSERT INTO project_content_data(
- id,
- create_by,
- create_date,
- update_by,
- update_date,
- remarks,
- del_flag,
- company_id,
- office_id,
- project_id,
- name,
- number,
- type,
- master,
- content_details_id,
- contract_id
- ) VALUES (
- #{id},
- #{createBy.id},
- #{createDate},
- #{updateBy.id},
- #{updateDate},
- #{remarks},
- #{delFlag},
- #{companyId},
- #{officeId},
- #{project.id},
- #{name},
- #{number},
- #{type},
- #{master.id},
- #{contentDetailsId},
- #{contractId}
- )
- </insert>
- <insert id="saveReportContent">
- INSERT INTO project_report_content(
- report_id,
- content_id,
- type
- ) VALUES (
- #{reportId},
- #{contentId},
- #{type}
- )
- </insert>
- <update id="update">
- UPDATE project_content_data SET
- update_by = #{updateBy.id},
- update_date = #{updateDate},
- remarks = #{remarks},
- company_id = #{companyId},
- office_id = #{officeId},
- project_id = #{project.id},
- name = #{name},
- number = #{number},
- type = #{type},
- master = #{master.id},
- content_details_id = #{contentDetailsId}
- WHERE id = #{id}
- </update>
-
-
- <!--物理删除-->
- <update id="delete">
- UPDATE project_content_data SET
- del_flag = #{DEL_FLAG_DELETE}
- WHERE id = #{id}
- </update>
-
- <!--逻辑删除-->
- <update id="deleteByLogic">
- UPDATE project_content_data SET
- del_flag = #{DEL_FLAG_DELETE}
- WHERE id = #{id}
- </update>
-
-
- <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
- <select id="findUniqueByProperty" resultType="ProjectContentData" statementType="STATEMENT">
- select * FROM project_content_data where ${propertyName} = '${value}'
- </select>
- <select id="querySerialNum" resultType="int">
- SELECT MAX(cast(`number` as UNSIGNED INTEGER))
- from project_content_data pd LEFT JOIN work_content_type wt ON wt.type_id = pd.type
- WHERE pd.project_id = #{project.id} AND wt.parent_id = (SELECT parent_id from work_content_type where type_id = #{type})
- </select>
- <update id="deleteBasedByContentId">
- DELETE FROM project_content_based WHERE content_id = #{contentId}
- </update>
- <update id="deleteBasedData">
- DELETE FROM project_content_based WHERE content_id = #{contentId} and based_id = #{basedId}
- </update>
- <update id="deleteReportDataInfo">
- DELETE FROM project_report_content WHERE content_id = #{contentId} and report_id = #{reportId} AND type = #{type}
- </update>
- <update id="deleteReportDataMenu">
- DELETE FROM project_content_change WHERE info_id = #{reportId} and project_id = #{projectId} and link_id = #{linkId}
- </update>
- <insert id="batchInsertBaseData" parameterType="java.util.Map">
- INSERT INTO project_content_based
- (content_id ,based_id)
- VALUES
- <foreach collection="projectBasedDataList" item="projectBasedData" separator=",">
- ( #{contentId}, #{projectBasedData.id})
- </foreach>
- </insert>
- <select id="countByBaseId" resultType="int">
- SELECT count(*) FROM project_content_based WHERE based_id = #{basedId}
- </select>
- <select id="findByLinkId" resultType="java.lang.String">
- SELECT id FROM project_content_info WHERE info_id = #{contentId} and project_id = #{projectId}
- </select>
- <select id="getProjectContentDataList" resultType="com.jeeplus.modules.projectrecord.entity.ProjectRecordTreeData">
- select a.id as "id", a.create_by as "createBy.id", a.create_date as "createDate",
- a.project_id as "pid", a.name as "projectName", "" as projectId,
- "0" as projectStatus,su.name as "projectRegistrant" ,
- pt.type_name as projectLeader,
- ppt.type_name as clientName,prd.status as status
- from project_content_data a
- left join sys_user su on su.id = a.create_by
- left join project_type pt on a.type = pt.type_id
- left join project_type ppt on pt.parent_id = ppt.id
- left join project_content_report pcr on pcr.content_id = a.id
- left join project_report_data prd on prd.id = pcr.report_id
- where a.project_id = #{projectId} and pt.parent_id =#{projectTypeParentId} and a.del_flag = 0 order by a.update_date desc
- </select>
- <select id="getProjectContentDataListOnImplement" resultType="com.jeeplus.modules.projectrecord.entity.ProjectRecordTreeData">
- select a.id as "id", a.create_by as "createBy.id", a.create_date as "createDate",
- a.project_id as "pid", a.name as "projectName", "" as projectId,
- "0" as projectStatus,su.name as "projectRegistrant" ,
- pt.type_name as projectLeader,
- ppt.type_name as clientName,prd.status as status
- from project_content_data a
- left join sys_user su on su.id = a.create_by
- left join project_type pt on a.type = pt.type_id
- left join project_type ppt on pt.parent_id = ppt.id
- left join project_content_report pcr on pcr.content_id = a.id
- left join project_report_data prd on prd.id = pcr.report_id
- where a.project_id = #{projectId} and pt.parent_id =#{projectTypeParentId}
- and pt.type_id = #{typeId}
- <if test="contractId !=null and contractId!=''">
- and a.contract_id = #{contractId}
- </if>
- and a.del_flag = 0 order by a.update_date desc
- </select>
- <select id="getProjectContentReportDataList" resultType="com.jeeplus.modules.projectrecord.entity.ProjectRecordTreeData">
- select a.id as "id", a.create_by as "createBy.id", a.create_date as "createDate", a.project_id as "pid",
- a.name as "projectName", "" as projectId, "0" as projectStatus,su.name as "projectRegistrant" ,
- pt.type_name as projectLeader, ppt.type_name as clientName,ifnull(prd.status,'10') as status,prd.id as reportId,ifnull(prd.name,'') as reportName
- from project_content_data a
- left join sys_user su on su.id = a.create_by
- left join project_type pt on a.type = pt.type_id
- left join project_type ppt on pt.parent_id = ppt.id
- left join project_content_report pcr on pcr.content_id = a.id
- left join project_report_data prd on prd.id = pcr.report_id
- where a.project_id = #{projectId} and pt.parent_id =#{projectTypeParentId} and a.del_flag = 0 order by prd.status, a.update_date desc, prd.update_date desc
- </select>
- <select id="getProjectContentReportDataListOnImplement" resultType="com.jeeplus.modules.projectrecord.entity.ProjectRecordTreeData">
- select a.id as "id", a.create_by as "createBy.id", a.create_date as "createDate", a.project_id as "pid",
- a.name as "projectName", "" as projectId, "0" as projectStatus,su.name as "projectRegistrant" ,
- pt.type_name as projectLeader, ppt.type_name as clientName,ifnull(prd.status,'10') as status,prd.id as reportId,ifnull(prd.name,'') as reportName
- from project_content_data a
- left join sys_user su on su.id = a.create_by
- left join project_type pt on a.type = pt.type_id
- left join project_type ppt on pt.parent_id = ppt.id
- left join project_content_report pcr on pcr.content_id = a.id
- left join project_report_data prd on prd.id = pcr.report_id
- where a.project_id = #{projectId} and pt.parent_id =#{projectTypeParentId}
- and pt.type_id = #{typeId}
- and a.del_flag = 0 order by prd.status, a.update_date desc, prd.update_date desc
- </select>
- <select id="getProjectContentReportArchiveDataList" resultType="com.jeeplus.modules.projectrecord.entity.ProjectRecordTreeData">
- select a.id as "id", a.create_by as "createBy.id", a.create_date as "createDate", a.project_id as "pid",
- a.name as "projectName", "" as projectId, "0" as projectStatus,su.name as "projectRegistrant" ,
- pt.type_name as projectLeader, ppt.type_name as clientName,ifnull(prr.status,'10') as status,
- prd.id as reportId,ifnull(prr.id,'') as recordId,ifnull(prd.name,'') as reportName,
- ifnull(prr.record_num,'') as reportRecordName
- from project_content_data a
- left join sys_user su on su.id = a.create_by
- left join project_type pt on a.type = pt.type_id
- left join project_type ppt on pt.parent_id = ppt.id
- left join project_content_report pcr on pcr.content_id = a.id
- left join project_report_data prd on prd.id = pcr.report_id
- left join project_report_record prr on prd.id = prr.report_id
- where a.project_id = #{projectId} and pt.parent_id =#{projectTypeParentId}
- and a.del_flag = 0 and prd.status = 5 order by prr.update_date desc, a.update_date desc
- </select>
- <select id="getProjectContentData" resultType="ProjectContentData">
- select a.id,a.number,a.name,a.create_date as createDate,a.type ,su.name as masterName
- from project_content_data a
- left join sys_user su on su.id = a.master
- where a.id = #{id} and a.del_flag=0
- </select>
- <delete id="deleteProjectContentBased">
- delete from project_content_based
- where based_id = #{basedId}
- and content_id = #{contentId}
- </delete>
- </mapper>
|