123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <?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.example.nngkxxdp.dao.ElkDao">
- <update id="updateDocumentById">
- UPDATE question_article_remark
- SET is_reply = #{isReply},
- update_time = now()
- WHERE id = #{id}
- </update>
- <select id="deptAll" resultType="java.lang.String">
- SELECT IF(new_dept_name IS NULL, old_dept_name, new_dept_name) AS deptName
- FROM question_article_dept
- GROUP BY deptName
- ORDER BY new_dept_name DESC
- </select>
- <select id="getAnswerCount" resultType="java.lang.Integer">
- SELECT count(1)
- FROM question_article
- </select>
- <select id="getDeptName" resultType="java.lang.String">
- SELECT old_dept_name
- FROM question_article_dept
- WHERE new_dept_name = #{dept}
- </select>
- <select id="getCountSub" resultType="java.lang.Integer">
- SELECT COUNT(*) FROM question_article_remark
- <where>
- <if test="search != null and search != ''">
- AND (phone LIKE CONCAT('%',#{search},'%') OR phone LIKE CONCAT('%',#{remark},'%'))
- </if>
- <if test="dept != null and dept != ''">
- AND dept_name = #{dept}
- </if>
- <if test="time != null and time != ''">
- AND DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(#{time}, '%Y-%m-%d')
- </if>
- </where>
- ORDER BY create_time DESC
- </select>
- <select id="getPageSub" resultType="java.util.Map">
- SELECT *,DATE_FORMAT(create_time, '%Y-%m-%d') as time FROM question_article_remark
- <where>
- <if test="search != null and search != ''">
- AND (phone LIKE CONCAT('%',#{search},'%') OR phone LIKE CONCAT('%',#{remark},'%'))
- </if>
- <if test="dept != null and dept != ''">
- AND dept_name = #{dept}
- </if>
- <if test="time != null and time != ''">
- AND DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(#{time}, '%Y-%m-%d')
- </if>
- </where>
- ORDER BY create_time DESC
- LIMIT #{page}, #{limit}
- </select>
- <select id="getSubDeptAll" resultType="java.lang.String">
- SELECT new_dept_name
- FROM question_article_dept
- WHERE new_dept_name IS NOT NULL
- </select>
- <!--获取所有的发文机关-->
- <select id="getPubs" resultType="java.util.Map">
- SELECT DISTINCT (substring_index(substring_index(pa.puborg, ' ', b.help_topic_id + 1), ' ', - 1)) AS puborg
- FROM policy_article pa
- JOIN mysql.help_topic b
- ON b.help_topic_id < (length(pa.puborg) - length(REPLACE(pa.puborg, ' ', '')) + 1)
- WHERE pa.puborg != ' ';
- </select>
- <!--获取第一级主题分类-->
- <select id="getFirstChildType" resultType="java.util.Map">
- SELECT id,
- pid,
- child_type as title
- FROM `policy_article_type`
- WHERE pid = -1
- </select>
- <!--获取第二级主题分类-->
- <select id="getSecondChildType" resultType="java.util.Map">
- SELECT id,
- pid,
- child_type as title
- FROM `policy_article_type`
- WHERE pid = #{id}
- </select>
- <!--获取主题分类条数-->
- <select id="getChildTypeCount" resultType="java.lang.Integer">
- SELECT count(1) AS count
- FROM
- `policy_article`
- where
- childtype != " "
- </select>
- <select id="getQuestionRemarkCount" resultType="java.lang.Integer">
- SELECT count(1)
- FROM question_article_remark
- <where>
- 1=1
- <if test="phone != null">
- AND phone LIKE CONCAT('%', #{phone}, '%')
- </if>
- <if test="deptName != null">
- AND dept_name LIKE CONCAT('%', #{deptName}, '%')
- </if>
- <if test="remark != null">
- AND remark LIKE CONCAT('%', #{remark}, '%')
- </if>
- </where>
- </select>
- <select id="getQuestionRemarkPage" resultType="java.util.Map">
- SELECT id,
- phone,
- dept_name,
- remark,
- create_time,
- is_reply,
- update_time
- FROM question_article_remark
- <where>
- 1=1
- <if test="phone != null">
- AND phone LIKE CONCAT('%', #{phone}, '%')
- </if>
- <if test="deptName != null">
- AND dept_name LIKE CONCAT('%', #{deptName}, '%')
- </if>
- <if test="remark != null">
- AND remark LIKE CONCAT('%', #{remark}, '%')
- </if>
- </where>
- ORDER BY
- is_reply,
- create_time DESC
- limit #{startRows},#{rows}
- </select>
- <select id="domainAll" resultType="java.lang.String">
- select distinct(domain_type)
- from question_article
- WHERE domain_type IS NOT NULL
- </select>
- <insert id="saveSub">
- insert into question_article_remark(phone, dept_name, remark, is_reply)
- values (#{phone}, #{dept}, #{remark}, 0)
- </insert>
- </mapper>
|