123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582 |
- <?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.caseinfo.dao.CaseInfoDao">
-
- <sql id="caseInfoColumns">
- 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.class_id AS "caseCategory.id",
- a.name AS "name",
- a.source AS "source",
- a.companyName AS "companyName",
- a.start_date AS "startDate",
- a.end_date AS "endDate",
- a.area_id AS "area.id",
- area.name AS "area.name",
- a.price AS "price",
- project.project_name AS "project.projectName",
- a.project_id AS "project.id",
- a.feature AS "feature",
- a.record AS "record",
- a.ext AS "ext",
- a.contractName AS "contractName",
- a.peculiarity AS "peculiarity",
- a.unit AS "unit",
- a.status AS "status",
- a.userids AS "userids",
- a.share_status AS "shareStatus",
- a.company_id AS "companyId",
- a.process_instance_id AS "processInstanceId",
- a.office_id AS "officeId",
- u.name AS "createBy.name",
- u2.name AS "updateBy.name",
- o.name AS "officeName",
- c.name AS "caseCategory.name"
- </sql>
-
- <sql id="caseInfoJoins">
- LEFT JOIN case_category c ON c.id = a.class_id
- left join sys_user u on a.create_by = u.id
- left join sys_user u2 on a.update_by = u2.id
- LEFT JOIN sys_area area ON area.id = a.area_id
- LEFT JOIN project_records project ON project.id = a.project_id
- JOIN sys_office o ON o.id = a.office_id
- JOIN sys_office s ON s.id = a.company_id
- </sql>
-
-
- <select id="get" resultType="CaseInfo" >
- SELECT
- <include refid="caseInfoColumns"/>
- FROM case_info a
- <include refid="caseInfoJoins"/>
- WHERE a.id = #{id}
- </select>
- <select id="findListme" resultType="CaseInfo" >
- SELECT
- <include refid="caseInfoColumns"/>
- FROM case_info a
- <include refid="caseInfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="caseCategory != null and caseCategory.id != null and caseCategory.id != ''">
- AND a.class_id = #{caseCategory.id}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="area != null and area.id != null and area.id != ''">
- AND a.area_id = #{area.id}
- </if>
- <if test="createBy != null and createBy.id != null and createBy.id != ''">
- AND a.create_by = #{createBy.id}
- </if>
- <if test="id != null and id != ''">
- AND a.id = #{id}
- </if>
- </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="findListoffice" resultType="CaseInfo" >
- SELECT
- <include refid="caseInfoColumns"/>
- FROM case_info a
- <include refid="caseInfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL} and a.status in('2','5')
- <if test="caseCategory != null and caseCategory.id != null and caseCategory.id != ''">
- AND a.class_id = #{caseCategory.id}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="area != null and area.id != null and area.id != ''">
- AND a.area_id = #{area.id}
- </if>
- <if test="officeId != null and officeId != ''">
- AND a.office_id = #{officeId}
- </if>
- </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="findListoffice2" resultType="CaseInfo" >
- SELECT
- <include refid="caseInfoColumns"/>
- FROM case_info a
- <include refid="caseInfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL} and a.status =5
- <if test="caseCategory != null and caseCategory.id != null and caseCategory.id != ''">
- AND a.class_id = #{caseCategory.id}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="area != null and area.id != null and area.id != ''">
- AND a.area_id = #{area.id}
- </if>
- <if test="officeId != null and officeId != ''">
- AND a.office_id = #{officeId}
- </if>
- </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="findList" resultType="CaseInfo" >
- SELECT
- <include refid="caseInfoColumns"/>
- FROM case_info a
- <include refid="caseInfoJoins"/>
- <where>
- (a.share_status = '1' and
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="caseCategory != null and caseCategory.id != null and caseCategory.id != ''">
- AND a.class_id = #{caseCategory.id}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="id != null and id != ''">
- AND a.id = #{id}
- </if>
- ) or
- (
- (a.del_flag = #{DEL_FLAG_NORMAL} AND a.status = '4'
- <if test="caseCategory != null and caseCategory.id != null and caseCategory.id != ''">
- AND a.class_id = #{caseCategory.id}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="area != null and area.id != null and area.id != ''">
- AND a.area_id = #{area.id}
- </if>
- <if test="id != null and id != ''">
- AND a.id = #{id}
- </if>
- ${sqlMap.dsf})
- or(
- (a.status != '4'
- <if test="createBy != null and createBy.id != null and createBy.id != ''">
- AND a.create_by = #{createBy.id}
- </if>
- <if test="caseCategory != null and caseCategory.id != null and caseCategory.id != ''">
- AND a.class_id = #{caseCategory.id}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="area != null and area.id != null and area.id != ''">
- AND a.area_id = #{area.id}
- </if>
- <if test="id != null and id != ''">
- AND a.id = #{id}
- </if>
- ) or (a.status in('2','3','4')
- <if test="createBy != null and createBy.id != null and createBy.id != ''">
- and find_in_set(#{createBy.id},a.userids)
- </if>
- <if test="caseCategory != null and caseCategory.id != null and caseCategory.id != ''">
- AND a.class_id = #{caseCategory.id}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="area != null and area.id != null and area.id != ''">
- AND a.area_id = #{area.id}
- </if>
- <if test="id != null and id != ''">
- AND a.id = #{id}
- </if>
- )
- )
- )
- </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="findByAllList" resultType="CaseInfo" >
- SELECT
- <include refid="caseInfoColumns"/>
- FROM case_info a
- <include refid="caseInfoJoins"/>
- <where>
- a.status = '5'
- AND
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="caseCategory != null and caseCategory.id != null and caseCategory.id != ''">
- AND a.class_id = #{caseCategory.id}
- </if>
- <if test="shareStatus != null and shareStatus != ''">
- AND a.share_status = #{shareStatus}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="area != null and area.id != null and area.id != ''">
- AND a.area_id = #{area.id}
- </if>
- </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="findByAllLists" resultType="CaseInfo" >
- SELECT
- <include refid="caseInfoColumns"/>
- FROM case_info a
- <include refid="caseInfoJoins"/>
- <where>
- a.status = '5' and a.share_status is not null
- AND
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="caseCategory != null and caseCategory.id != null and caseCategory.id != ''">
- AND a.class_id = #{caseCategory.id}
- </if>
- <if test="shareStatus != null and shareStatus != ''">
- AND a.share_status = #{shareStatus}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="area != null and area.id != null and area.id != ''">
- AND a.area_id = #{area.id}
- </if>
- </where>
- <choose>
- <when test="dateOrder == 1">
- order by a.start_date desc
- </when>
- <when test="dateOrder == 2">
- order by a.start_date asc
- </when>
- <!--<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="findBuyCase" resultType="CaseInfo" >
- SELECT
- DISTINCT
- <include refid="caseInfoColumns"/>
- FROM case_info a
- <include refid="caseInfoJoins"/>
- LEFT join case_member cm on cm.case_id = a.id
- <where>
- a.status = '5' and a.share_status is not null
- AND
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="caseCategory != null and caseCategory.id != null and caseCategory.id != ''">
- AND a.class_id = #{caseCategory.id}
- </if>
- <if test="memberId != null and memberId != ''">
- AND cm.member_id = #{memberId}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="area != null and area.id != null and area.id != ''">
- AND a.area_id = #{area.id}
- </if>
- </where>
- <choose>
- <when test="dateOrder == 1">
- order by a.start_date desc
- </when>
- <when test="dateOrder == 2">
- order by a.start_date asc
- </when>
- <!--<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="findCompanyList" resultType="CaseInfo" >
- SELECT
- <include refid="caseInfoColumns"/>
- FROM case_info a
- <include refid="caseInfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL} AND a.status = '5'
- <if test="caseCategory != null and caseCategory.id != null and caseCategory.id != ''">
- AND a.class_id = #{caseCategory.id}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="createBy != null and createBy != null and createBy.name != ''">
- AND u.name LIKE
- <if test="dbName == 'oracle'">'%'||#{createBy.name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{createBy.name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{createBy.name},'%')</if>
- </if>
- <if test="area != null and area.id != null and area.id != ''">
- AND a.area_id = #{area.id}
- </if>
- <if test="startDate != null and startDate != ''">
- AND a.start_date = #{startDate}
- </if>
- <if test="shareStatus != null and shareStatus != ''">
- AND a.share_status = #{shareStatus}
- </if>
- <if test="officeId != null and officeId != ''">
- AND a.office_id = #{officeId}
- </if>
- <if test="companyId != null and companyId != ''">
- AND a.company_id = #{companyId}
- </if>
- <if test="companyId != null and companyId != ''">
- AND find_in_set(a.company_id,#{companyId})
- </if>
- </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="findAllList" resultType="CaseInfo" >
- SELECT
- <include refid="caseInfoColumns"/>
- FROM case_info a
- <include refid="caseInfoJoins"/>
- <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 case_info(
- id,
- create_by,
- create_date,
- update_by,
- update_date,
- remarks,
- del_flag,
- class_id,
- name,
- start_date,
- end_date,
- area_id,
- price,
- project_id,
- feature,
- source,
- companyName,
- ext,
- contractName,
- peculiarity,
- unit,
- status,
- userids,
- share_status,
- company_id,
- office_id,
- record
- ) VALUES (
- #{id},
- #{createBy.id},
- #{createDate},
- #{updateBy.id},
- #{updateDate},
- #{remarks},
- #{delFlag},
- #{caseCategory.id},
- #{name},
- #{startDate},
- #{endDate},
- #{area.id},
- #{price},
- #{project.id},
- #{feature},
- #{source},
- #{companyName},
- #{ext},
- #{contractName},
- #{peculiarity},
- #{unit},
- #{status},
- #{userids},
- #{shareStatus},
- #{companyId},
- #{officeId},
- #{record}
- )
- </insert>
-
- <update id="update">
- UPDATE case_info SET
- update_by = #{updateBy.id},
- update_date = #{updateDate},
- remarks = #{remarks},
- class_id = #{caseCategory.id},
- name = #{name},
- start_date = #{startDate},
- end_date = #{endDate},
- area_id = #{area.id},
- price = #{price},
- project_id = #{project.id},
- feature = #{feature},
- source = #{source},
- ext = #{ext},
- contractName = #{contractName},
- peculiarity = #{peculiarity},
- unit = #{unit},
- status = #{status},
- userids = #{userids},
- share_status = #{shareStatus},
- company_id = #{companyId},
- office_id = #{officeId},
- record = #{record}
- WHERE id = #{id}
- </update>
-
-
- <!--物理删除-->
- <update id="delete">
- DELETE FROM case_info
- WHERE id = #{id}
- </update>
-
- <!--逻辑删除-->
- <update id="deleteByLogic">
- UPDATE case_info SET
- del_flag = #{DEL_FLAG_DELETE}
- WHERE id = #{id}
- </update>
-
-
- <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
- <select id="findUniqueByProperty" resultType="CaseInfo" statementType="STATEMENT">
- select * FROM case_info where ${propertyName} = '${value}'
- </select>
-
- <select id="findListByproject" resultType="WorkProject">
- SELECT
- *
- FROM work_project a
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="id != null and id != ''">
- AND a.id LIKE
- <if test="dbName == 'oracle'">#{id}||'%'</if>
- <if test="dbName == 'mssql'">#{id}+'%'</if>
- <if test="dbName == 'mysql'">concat(#{id},'%')</if>
- </if>
- </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>
- <update id="updateProcessInstanceId">
- UPDATE case_info SET
- process_instance_id = #{processInstanceId}
- WHERE id = #{id}
- </update>
- <select id="getByProcessInstanceId" resultType="CaseInfo">
- SELECT
- <include refid="caseInfoColumns"/>
- FROM case_info a
- <include refid="caseInfoJoins"/>
- WHERE a.process_instance_id = #{processInstanceId}
- </select>
- </mapper>
|