Prechádzať zdrojové kódy

装置信息 - 导出功能列排序修改为与页面顺序一致

wangggziwen 8 mesiacov pred
rodič
commit
65fb2ec019

+ 6 - 0
rc-admin/src/main/java/com/ruoyi/web/controller/rc/TDeptInfoController.java

@@ -78,6 +78,12 @@ public class TDeptInfoController extends BaseController
     public void export(HttpServletResponse response, TDeptInfo tDeptInfo)
     {
         List<TDeptInfo> list = tDeptInfoService.selectTDeptInfoList(tDeptInfo);
+        for (TDeptInfo deptInfo : list) {
+            String year = deptInfo.getYear();
+            if (year.length() > 4) {
+                deptInfo.setYear(year.substring(0, year.indexOf("-")));
+            }
+        }
         ExcelUtil<TDeptInfo> util = new ExcelUtil<TDeptInfo>(TDeptInfo.class);
         util.exportExcel(response, list, "装置信息数据");
     }

+ 8 - 9
rc-buisness/src/main/java/com/ruoyi/rc/domain/TDeptInfo.java

@@ -20,22 +20,21 @@ public class TDeptInfo extends BaseEntity
     /** id */
     private Long id;
 
+    /** 装置 */
+    @Excel(name = "装置")
+    private String deptName;
+
+    /** 年份 */
+    @Excel(name = "年份", width = 30)
+    private String year;
+
     /** 装置信息 */
     @Excel(name = "装置信息")
     private String deptInfo;
 
     /** 装置id */
-    @Excel(name = "装置id")
     private String deptId;
 
-    /** 年份 */
-    @Excel(name = "年份", width = 30)
-    private String year;
-
-    /** 装置 */
-    @Excel(name = "装置")
-    private String deptName;
-
     public String getDeptName() {
         return deptName;
     }

+ 9 - 7
rc-buisness/src/main/resources/mapper/rc/TDeptInfoMapper.xml

@@ -9,25 +9,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="deptInfo"    column="dept_info"    />
         <result property="deptId"    column="dept_id"    />
         <result property="year"    column="year"    />
+        <result property="deptName"    column="dept_name"    />
     </resultMap>
 
     <sql id="selectTDeptInfoVo">
-        select id, dept_info, dept_id, year from t_dept_info
+        select d.id, d.dept_info, d.dept_id, sd.dept_name , d.year from t_dept_info d
+        left join sys_dept sd on d.dept_id = sd.dept_id
     </sql>
 
     <select id="selectTDeptInfoList" parameterType="TDeptInfo" resultMap="TDeptInfoResult">
         <include refid="selectTDeptInfoVo"/>
         <where>
-            <if test="year != null  and year != ''"> and year = #{year}</if>
+            <if test="year != null  and year != ''"> and d.year = #{year}</if>
 
-            <if test="deptInfo != null  and deptInfo != ''"> and dept_info = #{deptInfo}</if>
-            <if test="deptId != null "> and dept_id like concat(concat('%', #{deptId}), '%')</if>
+            <if test="deptInfo != null  and deptInfo != ''"> and d.dept_info = #{deptInfo}</if>
+            <if test="deptId != null "> and d.dept_id like concat(concat('%', #{deptId}), '%')</if>
         </where>
     </select>
     
     <select id="selectTDeptInfoById" parameterType="Long" resultMap="TDeptInfoResult">
         <include refid="selectTDeptInfoVo"/>
-        where id = #{id}
+        where d.id = #{id}
     </select>
 
     <insert id="insertTDeptInfo" parameterType="TDeptInfo" useGeneratedKeys="true" keyProperty="id">
@@ -55,11 +57,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <delete id="deleteTDeptInfoById" parameterType="Long">
-        delete from t_dept_info where id = #{id}
+        delete from t_dept_info where d.id = #{id}
     </delete>
 
     <delete id="deleteTDeptInfoByIds" parameterType="String">
-        delete from t_dept_info where id in 
+        delete from t_dept_info where d.id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>