Files
faw-report-library-boot/adc-da-report/target/classes/mybatis/mapper/mysql/PowerApplyActMapper.xml
T

139 lines
6.1 KiB
XML

<?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.adc.da.report.dao.mysql.PowerApplyActDao">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.adc.da.report.eo.PowerApplyAct">
<result column="id" property="id" />
<result column="prc_id" property="prcId" />
<result column="task_id" property="taskId" />
<result column="data_id" property="dataId" />
<result column="report_id" property="reportId" />
<result column="user_id" property="userId" />
<result column="create_user_id" property="createUserId" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="update_user_id" property="updateUserId" />
<result column="del_flag" property="delFlag" />
<result column="power" property="power" />
<result column="apply_reason" property="applyReason" />
</resultMap>
<!--表名信息-->
<sql id="TableName">
power_apply_act
</sql>
<!-- 通用查询结果列 -->
<sql id="BaseColumnList">
id, prc_id, task_id, data_id, report_id, power, apply_reason, user_id, create_user_id, create_date, update_date, update_user_id, del_flag
</sql>
<!-- 查询条件 -->
<sql id="BaseQuerySql">
<where>
AND del_flag = '${@com.adc.da.sys.constant.YesOrNoEnum@NO.value}'
<if test="pageVO != null">
<if test="pageVO.prcId !=null and pageVO.prcId !=''">
AND prc_id LIKE CONCAT(CONCAT('%',#{pageVO.prcId}),'%')
</if>
<if test="pageVO.taskId !=null and pageVO.taskId !=''">
AND task_id LIKE CONCAT(CONCAT('%',#{pageVO.taskId}),'%')
</if>
<if test="pageVO.dataId !=null and pageVO.dataId !=''">
AND data_id LIKE CONCAT(CONCAT('%',#{pageVO.dataId}),'%')
</if>
<if test="pageVO.reportId !=null and pageVO.reportId !=''">
AND report_id LIKE CONCAT(CONCAT('%',#{pageVO.reportId}),'%')
</if>
<if test="pageVO.userId !=null and pageVO.userId !=''">
AND user_id LIKE CONCAT(CONCAT('%',#{pageVO.userId}),'%')
</if>
</if>
</where>
</sql>
<insert id="batchInsert" parameterType="java.util.List">
insert into power_apply_act (id, prc_id, task_id, data_id, report_id, power, apply_reason, user_id, create_user_id, create_date, update_date, update_user_id, del_flag)
values
<foreach collection="list" item="item" separator=",">
(#{item.id}, #{item.prcId}, #{item.taskId}, #{item.dataId}, #{item.reportId}, #{item.power}, #{item.applyReason}, #{item.userId}, #{item.createUserId}, #{item.createDate}, #{item.updateDate}, #{item.updateUserId}, #{item.delFlag})
</foreach>
</insert>
<update id="batchDel">
UPDATE power_apply_act set del_flag = 1
where id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<update id="deleteByDataId">
UPDATE power_apply_act set del_flag = 1
where data_id = #{dataId}
</update>
<!-- 根据查询VO进行分页查询 -->
<select id="selectPage" resultMap="BaseResultMap">
SELECT
<include refid="BaseColumnList"/>
FROM <include refid="TableName"/>
<include refid="BaseQuerySql"/>
ORDER BY create_time DESC
</select>
<!-- 根据查询VO进行分页查询总数 -->
<select id="selectPageCount" resultType="java.lang.Long">
SELECT
COUNT(1)
FROM (
SELECT
<include refid="BaseColumnList"/>
FROM <include refid="TableName"/>
<include refid="BaseQuerySql"/>
)a
</select>
<!-- 根据查询VO进行列表查询 -->
<select id="queryList" resultMap="BaseResultMap">
SELECT
<include refid="BaseColumnList"/>
FROM <include refid="TableName"/>
<include refid="BaseQuerySql"/>
ORDER BY create_time DESC
</select>
<select id="selectListBydataId" resultType="com.adc.da.report.vo.PowerApplyActPageVO">
select a.*,
rep.name,rep.keycontent,rep.maincontent,rep.DEPARTMENT,rep.year,rep.fileid,rep.confidentialLevel,rep.privacyLevel
from <include refid="TableName"/> a
left join TT_REPORT_MANAGE rep on a.report_id = rep.id
where a.data_id = #{dataId} and a.del_flag = 0
</select>
<select id="selectListBydataIdNodel" resultType="com.adc.da.report.vo.PowerApplyActPageVO">
select a.*,
rep.name,rep.keycontent,rep.maincontent,rep.DEPARTMENT,rep.year,rep.fileid,rep.confidentialLevel,rep.privacyLevel
from <include refid="TableName"/> a
left join TT_REPORT_MANAGE rep on a.report_id = rep.id
where a.data_id = #{dataId}
</select>
<select id="selectActListBydataId" resultType="com.adc.da.report.eo.PowerApplyAct">
select a.*,
rep.name,rep.keycontent,rep.maincontent,rep.DEPARTMENT,rep.year,rep.fileid,rep.confidentialLevel,rep.privacyLevel,
rep.createUserId , u.usname as createUserName
from <include refid="TableName"/> a
left join TT_REPORT_MANAGE rep on a.report_id = rep.id
left join ts_user u on u.usid = rep.createUserId
where a.data_id = #{dataId} and a.del_flag = 0
</select>
<select id="selectListByPrcId" resultType="com.adc.da.report.vo.PowerApplyActPageVO">
select a.*,
rep.name,rep.keycontent,rep.maincontent,rep.DEPARTMENT,rep.year,rep.fileid,rep.confidentialLevel,rep.privacyLevel,
rep.createUserId , u.usname as createUserName
from <include refid="TableName"/> a
left join TT_REPORT_MANAGE rep on a.report_id = rep.id
left join ts_user u on u.usid = rep.createUserId
where a.prc_id = #{prcId} and a.del_flag = 0
</select>
</mapper>