123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652 |
- <?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.ProjectcontentinfoDao">
- <sql id="projectcontentinfoColumns">
- 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.parent_id AS "parent.id",
- a.parent_ids AS "parentIds",
- a.sort AS "sort",
- a.project_id AS "project.id",
- a.company_id AS "companyId",
- a.office_id AS "officeId",
- a.type AS "type",
- a.info_id AS "infoId",
- a.dict_type AS "dictType",
- a.name AS "name",
- a.link_id AS "linkId"
- </sql>
- <sql id="projectcontentinfoJoins">
- </sql>
- <delete id="deleteConsultant">
- delete from rural_report_consultant where projectId = #{projectId}
- </delete>
- <select id="get" resultType="com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo" >
- SELECT
- <include refid="projectcontentinfoColumns"/>
- FROM project_content_info a
- <include refid="projectcontentinfoJoins"/>
- WHERE a.id = #{id}
- </select>
- <select id="getByProjectId" resultType="com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo" >
- SELECT
- <include refid="projectcontentinfoColumns"/>
- FROM project_content_info a
- <include refid="projectcontentinfoJoins"/>
- WHERE a.project_id = #{projectId}
- order by update_date desc
- limit 1
- </select>
- <select id="getByInfoId" resultType="com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo" >
- SELECT
- <include refid="projectcontentinfoColumns"/>
- FROM project_content_info a
- <include refid="projectcontentinfoJoins"/>
- WHERE a.info_id = #{infoId} AND (a.link_id is null or a.link_id='')
- </select>
- <select id="findList" resultType="com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo" >
- SELECT
- <include refid="projectcontentinfoColumns"/>
- FROM project_content_info a
- <include refid="projectcontentinfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="name != null and name != ''">
- AND a.name = #{name}
- </if>
- <if test="type != null and type != ''">
- AND a.type = #{type}
- </if>
- <if test="parentIds != null and parentIds != ''">
- AND a.parent_ids = #{parentIds}
- </if>
- <if test="project != null and project.id != null and project.id != ''">
- AND a.project_id = #{project.id}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.sort ASC
- </otherwise>
- </choose>
- </select>
- <select id="findByParentIds" resultType="com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo" >
- SELECT
- <include refid="projectcontentinfoColumns"/>
- FROM project_content_info a
- <include refid="projectcontentinfoJoins"/>
- <where>
- a.del_flag = '0'
- AND a.project_id = #{projectId}
- AND a.parent_ids LIKE concat('%',#{parentId},'%')
- </where>
- ORDER BY a.sort ASC
- </select>
- <select id="findListByProject" resultType="com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo" >
- SELECT
- <include refid="projectcontentinfoColumns"/>
- FROM project_content_info a
- <include refid="projectcontentinfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- AND a.parent_ids = #{parentIds}
- AND a.project_id = #{project.id}
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.sort DESC
- </otherwise>
- </choose>
- </select>
- <select id="findListByProjectOnRural" resultType="com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectcontentinfo" >
- SELECT
- <include refid="projectcontentinfoColumns"/>
- FROM project_content_info a
- <include refid="projectcontentinfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- AND a.parent_ids = #{parentIds}
- AND a.project_id = #{project.id}
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.sort DESC
- </otherwise>
- </choose>
- </select>
- <select id="getProjectContentData" resultType="com.jeeplus.modules.projectcontentinfo.entity.ProjectContentTreeData" >
- select DISTINCT a.type as "type"
- from project_content_data a
- <where>
- a.del_flag = 0
- AND a.project_id = #{projectId}
- </where>
- </select>
- <select id="getProjectContentTreeDataOnLeft" resultType="com.jeeplus.modules.projectcontentinfo.entity.ProjectContentTreeData" >
- select distinct a.type as "type"
- from project_content_data a
- left join work_content_type wct on a.type = wct.type_id
- <where>
- a.del_flag = 0
- and a.project_id = #{projectId}
- and wct.parent_id =#{workContentType}
- <if test="dictType != null and dictType != ''">
- AND a.type = #{dictType}
- </if>
- </where>
- </select>
- <select id="getProjectContentTreeData" resultType="com.jeeplus.modules.projectcontentinfo.entity.ProjectContentTreeData" >
- select a.id as "id",
- a.create_date as "createDate",a.create_by as "createId",
- a.name as "name", a.number as "number", a.type as "type",a.type as "pid", su.name as "masterName"
- from project_content_data a
- left join sys_user su on su.id = a.master
- <where>
- a.del_flag = 0
- AND a.project_id = #{projectId}
- and a.type = #{type}
- </where>
- order by a.update_date desc
- </select>
- <select id="findByType" resultType="com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo" >
- SELECT
- <include refid="projectcontentinfoColumns"/>
- FROM project_content_info a
- <include refid="projectcontentinfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- AND a.project_id = #{project.id}
- AND a.type = #{type}
- AND a.dict_type = #{dictType}
- </where>
- ORDER BY a.create_date DESC
- limit 1
- </select>
- <select id="findByInfoId" resultType="com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo" >
- SELECT
- <include refid="projectcontentinfoColumns"/>
- FROM project_content_info a
- <include refid="projectcontentinfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- AND a.info_id = #{infoId}
- AND (a.link_id is null or a.link_id='')
- </where>
- ORDER BY a.create_date DESC
- </select>
- <select id="findListByProjectAndType" resultType="com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo" >
- SELECT
- <include refid="projectcontentinfoColumns"/>
- FROM project_content_info a
- <include refid="projectcontentinfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- AND a.type = #{type}
- AND a.parent_ids = #{parentIds}
- AND a.project_id = #{project.id}
- AND a.dict_type is NULL
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.sort DESC
- </otherwise>
- </choose>
- </select>
- <select id="findListByProjectAndTypes" resultType="com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo" >
- SELECT
- <include refid="projectcontentinfoColumns"/>
- FROM project_content_info a
- <include refid="projectcontentinfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- AND a.type = #{type}
- AND a.parent_ids = #{parentIds}
- AND a.project_id = #{project.id}
- AND a.dict_type is NOT NULL
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.sort DESC
- </otherwise>
- </choose>
- </select>
- <select id="findListByProjectAndDictType" resultType="com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo" >
- SELECT
- <include refid="projectcontentinfoColumns"/>
- FROM project_content_info a
- <include refid="projectcontentinfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- AND a.type = #{type}
- AND a.dict_type = #{dictType}
- AND a.parent_ids = #{parentIds}
- AND a.project_id = #{project.id}
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.sort DESC
- </otherwise>
- </choose>
- </select>
- <select id="findListByProjectType" resultType="com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo" >
- SELECT
- <include refid="projectcontentinfoColumns"/>
- FROM project_content_info a
- <include refid="projectcontentinfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- AND a.type = #{type}
- AND a.parent_ids = #{parentIds}
- AND a.project_id = #{project.id}
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.sort DESC
- </otherwise>
- </choose>
- </select>
- <select id="findAllList" resultType="com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo" >
- SELECT
- <include refid="projectcontentinfoColumns"/>
- FROM project_content_info a
- <include refid="projectcontentinfoJoins"/>
- <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>
- <insert id="insert">
- INSERT INTO project_content_info(
- id,
- create_by,
- create_date,
- update_by,
- update_date,
- remarks,
- del_flag,
- parent_id,
- parent_ids,
- sort,
- project_id,
- company_id,
- office_id,
- type,
- info_id,
- dict_type,
- name,
- link_id
- ) VALUES (
- #{id},
- #{createBy.id},
- #{createDate},
- #{updateBy.id},
- #{updateDate},
- #{remarks},
- #{delFlag},
- #{parent.id},
- #{parentIds},
- #{sort},
- #{project.id},
- #{companyId},
- #{officeId},
- #{type},
- #{infoId},
- #{dictType},
- #{name},
- #{linkId}
- )
- </insert>
- <insert id="insertOnRural">
- INSERT INTO project_content_info(
- id,
- create_by,
- create_date,
- update_by,
- update_date,
- remarks,
- del_flag,
- parent_id,
- parent_ids,
- sort,
- project_id,
- company_id,
- office_id,
- type,
- info_id,
- dict_type,
- name,
- link_id
- ) VALUES (
- #{id},
- #{createBy.id},
- #{createDate},
- #{updateBy.id},
- #{updateDate},
- #{remarks},
- #{delFlag},
- #{parent.id},
- #{parentIds},
- #{sort},
- #{projectOnRural.id},
- #{companyId},
- #{officeId},
- #{type},
- #{infoId},
- #{dictType},
- #{name},
- #{linkId}
- )
- </insert>
- <update id="update">
- UPDATE project_content_info SET
- update_by = #{updateBy.id},
- update_date = #{updateDate},
- remarks = #{remarks},
- type = #{type},
- info_id = #{infoId},
- dict_type = #{dictType},
- parent_id = #{parent.id},
- parent_ids = #{parentIds},
- sort = #{sort},
- project_id = #{project.id},
- name = #{name},
- link_id = #{linkId}
- WHERE id = #{id}
- </update>
- <update id="updateInfoId">
- UPDATE project_content_info SET
- info_id = #{infoId},
- dict_type = #{dictType}
- WHERE id = #{id}
- </update>
- <update id="updateByLinkId">
- UPDATE project_content_info SET
- name = #{dataName}
- WHERE link_id = #{linkId}
- </update>
- <!--物理删除-->
- <update id="delete">
- DELETE FROM project_content_info
- WHERE id = #{id}
- </update>
- <!--物理删除-->
- <update id="deleteInfoId">
- DELETE FROM project_content_info
- WHERE info_id = #{infoId}
- </update>
- <!--逻辑删除-->
- <update id="deleteByLogic">
- UPDATE project_content_info SET
- del_flag = #{DEL_FLAG_DELETE}
- WHERE id = #{id}
- </update>
- <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
- <select id="findUniqueByProperty" resultType="com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo" statementType="STATEMENT">
- select * FROM project_content_info where ${propertyName} = '${value}'
- </select>
- <select id="queryMaxSort" resultType="Integer">
- SELECT MAX(sort) FROM project_content_info a
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="parent!=null and parent.id!=null and parent.id!=''">
- AND a.parent_id = #{parent.id}
- </if>
- </where>
- </select>
- <select id="findListByParentSelective" resultType="com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo" >
- SELECT
- <include refid="projectcontentinfoColumns"/>
- FROM project_content_info a
- <include refid="projectcontentinfoJoins"/>
- <where>
- <if test="project!=null and project.id!=null and project.id!=''">
- AND a.project_id = #{project.id}
- </if>
- <if test="parent!=null and parent.id!=null and parent.id!=''">
- AND a.parent_id = #{parent.id}
- </if>
- <if test="name!=null and name!=''">
- AND a.name = #{name}
- </if>
- <if test="infoId!=null and infoId!=''">
- AND a.info_id = #{infoId}
- </if>
- <if test="linkId!=null and linkId!=''">
- AND a.link_id = #{linkId}
- </if>
- AND a.del_flag = #{DEL_FLAG_NORMAL}
- </where>
- </select>
- <update id="deleteByParentAndLinkId">
- DELETE FROM project_content_info
- <where>
- <if test="project!=null and project.id!=null and project.id!=''">
- AND project_id = #{project.id}
- </if>
- <if test="parent!=null and parent.id!=null and parent.id!=''">
- AND parent_id = #{parent.id}
- </if>
- <if test="name!=null and name!=''">
- AND name = #{name}
- </if>
- <if test="infoId!=null and infoId!=''">
- AND info_id = #{infoId}
- </if>
- <if test="linkId!=null and linkId!=''">
- AND link_id = #{linkId}
- </if>
- </where>
- </update>
- <update id="deleteInfosByParent">
- DELETE FROM project_content_info WHERE parent_ids LIKE concat(#{parentIds},'%');
- </update>
- <select id="findType" resultType="com.jeeplus.modules.projectcontentinfo.entity.Projectcontentinfo">
- SELECT id from project_content_info
- <where>
- project_id = #{projectId}
- and name = #{type} and info_id is null
- </where>
- </select>
- <insert id="saveBasedDataWorkAttachment">
- insert into based_data_and_work_attachment_info
- (
- based_data_id,
- work_attachment_id,
- create_date,
- create_by
- )
- values
- (
- #{attachmentId},
- #{quoteId},
- #{updateDate},
- #{updateBy.id}
- )
- </insert>
- <insert id="insertConsultant">
- insert into rural_report_consultant (
- id,
- create_by,
- create_date,
- update_by,
- update_date,
- del_flag,
- zixunyuan,
- zhucezigezhID,
- major,
- wordnr,
- projectId,
- auditOpinion
- )
- values
- (
- #{id},
- #{createBy.id},
- #{createDate},
- #{updateBy.id},
- #{updateDate},
- #{delFlag},
- #{zixunyuan},
- #{zhucezigezhKey},
- #{major},
- #{wordnr},
- #{projectId},
- #{auditOpinion}
- ) ;
- </insert>
- <select id="getWorkContentTypeByTypeId" resultType="java.lang.String">
- select type_name as typeName from work_content_type where type_id = #{typeId}
- </select>
- <select id="getTypeByProjectIdAndContentId" resultType="com.jeeplus.modules.workcontent.entity.WorkContentClaim">
- select wcc.project_id as projectId, wcc.review_amt as 'reviewAmt',wcc.set_amt as 'setAmt',wcc.content_id as 'contentId',pcd2.name as 'proConTentName',
- wcc.cont_id as 'contract.id',
- wct.type_name as 'typeName',wcc.create_date as 'createDate',wcc.update_date as 'updateDate', pcd.name as 'name',
- wct.type_name as 'typeName',su.name as 'createName'
- from (
- select id,create_by,create_date,update_by,update_date,remarks,del_flag,project_id,content_id,cont_id,alter_type,alter_date,review_amt,set_amt from work_content_altermanage
- union all
- select id,create_by,create_date,update_by,update_date,remarks,del_flag,project_id,content_id,cont_id,price_type,price_date,review_amt,set_amt from work_content_pricemanage
- union all
- select id,create_by,create_date,update_by,update_date,remarks,del_flag,project_id,content_id,contract_id,claim_type,claim_date,review_amt,set_amt from work_content_claim
- union all
- select id,create_by,create_date,update_by,update_date,remarks,del_flag,project_id,content_id,cont_id,visa_type,
- visa_date,review_amt,set_amt from work_content_visamanage) as wcc
- left join project_content_data pcd on wcc.cont_id = pcd.id
- left join project_content_data pcd2 on pcd2.id =wcc.content_id
- left join project_content_info pci on pci.info_id = wcc.content_id
- left join work_content_type wct on wct.type_id = pci.dict_type
- left join sys_user su on su.id = wcc.create_by
- where wcc.project_id = #{projectId} and wcc.content_id =#{contentId}
- order by wcc.update_date asc
- </select>
- <select id="findByProjectId"
- resultType="com.jeeplus.modules.ruralprojectrecords.entity.RuralReportConsultant">
- select id
- ,zixunyuan
- ,zhucezigezhID as 'zhucezigezhKey'
- ,major
- ,wordnr
- ,projectId
- ,auditOpinion
- from rural_report_consultant where projectId=#{projectId}
- order by major
- </select>
- <select id="getReportedConsultantsList"
- resultType="com.jeeplus.modules.ruralprojectrecords.entity.RuralReportConsultant">
- select id
- ,zixunyuan
- ,zhucezigezhID as 'zhucezigezhKey'
- ,wordnr
- ,wcyysrbl
- ,wcyysr
- ,reportedId
- ,role_flag as "roleFlag"
- from rural_reported_consultant where reportedId=#{reportedId}
- order by zixunyuan
- </select>
- <select id="getCertificateByUser" resultType="com.jeeplus.modules.workstaff.entity.WorkStaffCertificate">
- select a.name,a.num,a.major from work_staff_certificate a
- left join work_staff_achives wsa on a.staff_id = wsa.id
- where wsa.user_id = #{userId} and a.del_flag=0
- </select>
- <insert id="insertContentBasedInfo">
- insert into over_all_content_based_info (content_id, based_id)
- values
- (#{contentId}, #{basedId})
- </insert>
- <select id="getContentBasedCount" resultType="java.lang.Integer">
- select count(1) from over_all_content_based_info
- where content_id = #{contentId}
- and based_id = #{basedId}
- </select>
- <insert id="insertContentAchievementInfo">
- insert into over_all_content_achievement_info (content_id, achievement_id)
- values
- (#{contentId}, #{achievementId})
- </insert>
- <select id="getContentAchievementInfo" resultType="java.lang.Integer">
- select count(1) from over_all_content_achievement_info
- where content_id = #{contentId}
- and achievement_id = #{achievementId}
- </select>
- </mapper>
|