浏览代码

字典键值查询需分页

yuejiaying 4 年之前
父节点
当前提交
300f920f23

+ 5 - 4
user_center/src/main/java/com/huaxu/controller/DictController.java

@@ -56,8 +56,8 @@ public class DictController {
     @RequestMapping(value = "insert", method = RequestMethod.POST)
     @ApiOperation(value = "插入数据字典配置列表")
     public AjaxMessage<Integer> insert(@ApiParam(value = "数据字典配置", required = true) @RequestBody Dict dict) {
-        int result = dictService.insert(dict);
-
+        dictService.insert(dict);
+        int result =dict.getId();//返回新增数据的id
         return new AjaxMessage<>(ResultStatus.OK, result);
     }
 
@@ -100,10 +100,11 @@ public class DictController {
     @ApiOperation(value = "查询数据字典配置列表")
     public AjaxMessage<Pagination<Dict>> selectPage(@ApiParam(value = "页数", required = true) @RequestParam Integer pageNum,
                                                     @ApiParam(value = "条数", required = true) @RequestParam Integer pageSize,
-                                                    @ApiParam(value = "查询关键字", required = false)@RequestParam(required = false) String keyWords) {
+                                                    @ApiParam(value = "查询关键字", required = false)@RequestParam(required = false) String keyWords,
+                                                    @ApiParam(value = "父配置ID", required = false)@RequestParam(required = false) Integer parentDictId) {
         Dict dict = new Dict();
-        dict.setDictName(keyWords);
         dict.setDictCode(keyWords);
+        dict.setParentDictId(parentDictId);
         IPage<Dict> iPage = new Page<>(pageNum, pageSize);
         iPage = dictService.selectPage(dict, iPage);
         Pagination<Dict> pages = new Pagination<>(iPage);

+ 5 - 0
user_center/src/main/java/com/huaxu/entity/Dict.java

@@ -42,6 +42,11 @@ public class Dict implements Serializable {
      */
     @ApiModelProperty(value = "父配置ID")
     private Integer parentDictId;
+    /**
+     * 父配置编码
+     */
+    @ApiModelProperty(value = "父配置编码")
+    private String parentDictCode;
    /**
     * 备注
     */

+ 4 - 4
user_center/src/main/java/com/huaxu/entity/UserRegister.java

@@ -29,19 +29,19 @@ public class UserRegister implements Serializable {
     /**
      * 用户名
      */
-    @ExcelProperty(value = {"注册申请列表","用户名"},index = 0)
+    @ExcelProperty(value = {"用户注册申请记录","姓名"},index = 0)
     @ApiModelProperty(value = "用户名")
     private String username;
     /**
      * 手机号
      */
-    @ExcelProperty(value = {"注册申请列表","手机号"},index = 1)
+    @ExcelProperty(value = {"用户注册申请记录","手机号"},index = 1)
     @ApiModelProperty(value = "手机号")
     private String phone;
     /**
      * 用户类型
      */
-    @ExcelProperty(value = {"注册申请列表","用户类型"},index = 2)
+    @ExcelProperty(value = {"用户注册申请记录","用户类型"},index = 2)
     @ApiModelProperty(value = "用户类型")
     private String userType;
    /**
@@ -65,7 +65,7 @@ public class UserRegister implements Serializable {
     /**
      * 创建时间
      */
-    @ExcelProperty(value = {"注册申请列表","注册时间"},index = 3)
+    @ExcelProperty(value = {"用户注册申请记录","注册时间"},index = 3)
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
     @ApiModelProperty(value = "创建时间")
     private Date dateCreate;

+ 12 - 45
user_center/src/main/resources/mapper/DictMapper.xml

@@ -50,30 +50,13 @@
             </if>
             <if test="dictCode != null and dictCode != ''">
                 and (DICT_CODE LIKE CONCAT('%',#{dictCode},'%')
-            </if>
-            <if test="dictValue != null and dictValue != ''">
-                or DICT_VALUE LIKE CONCAT('%',#{dictValue},'%'))
+                or DICT_VALUE LIKE CONCAT('%',#{dictCode},'%'))
             </if>
             <if test="parentDictId != null and parentDictId != ''">
                 and PARENT_DICT_ID = #{parentDictId}
             </if>
-            <if test="remark != null and remark != ''">
-                and REMARK = #{remark}
-            </if>
-            <if test="status != null">
-                and STATUS = #{status}
-            </if>
-            <if test="createBy != null and createBy != ''">
-                and CREATE_BY = #{createBy}
-            </if>
-            <if test="dateCreate != null">
-                and DATE_CREATE = #{dateCreate}
-            </if>
-            <if test="updateBy != null and updateBy != ''">
-                and UPDATE_BY = #{updateBy}
-            </if>
-            <if test="dateUpdate != null">
-                and DATE_UPDATE = #{dateUpdate}
+            <if test="parentDictCode != null and parentDictCode != ''">
+                and PARENT_DICT_ID in (select ID from uims_dict where DICT_CODE=#{parentDictCode})
             </if>
             and STATUS =1
         </where>
@@ -174,38 +157,22 @@
             <if test="dict.id != null">
                 and ID = #{dict.id}
             </if>
-            <if test="dict.dictName != null and dict.dictName != ''">
-                and (DICT_NAME LIKE CONCAT('%',#{dict.dictName},'%')
-            </if>
-            <if test="dict.dictCode != null and dict.dictCode != ''">
+            <if test="dict.parentDictId == null and dict.dictCode != null and dict.dictCode != ''">
+                and (DICT_NAME LIKE CONCAT('%',#{dict.dictCode},'%')
                 or DICT_CODE LIKE CONCAT('%',#{dict.dictCode},'%'))
             </if>
-            <if test="dict.dictValue != null and dict.dictValue != ''">
-                and DICT_VALUE = #{dict.dictValue}
+            <if test="dict.parentDictId != null and dict.dictCode != null and dict.dictCode != ''">
+                and (DICT_VALUE LIKE CONCAT('%',#{dict.dictCode},'%')
+                or DICT_CODE LIKE CONCAT('%',#{dict.dictCode},'%'))
             </if>
-            <if test="dict.parentDictId != null and dict.parentDictId != ''">
+            <if test="dict.parentDictId != null ">
                 and PARENT_DICT_ID = #{dict.parentDictId}
             </if>
-            <if test="dict.remark != null and dict.remark != ''">
-                and REMARK = #{dict.remark}
-            </if>
-            <if test="dict.status != null">
-                and STATUS = #{dict.status}
-            </if>
-            <if test="dict.createBy != null and dict.createBy != ''">
-                and CREATE_BY = #{dict.createBy}
-            </if>
-            <if test="dict.dateCreate != null">
-                and DATE_CREATE = #{dict.dateCreate}
-            </if>
-            <if test="dict.updateBy != null and dict.updateBy != ''">
-                and UPDATE_BY = #{dict.updateBy}
-            </if>
-            <if test="dict.dateUpdate != null">
-                and DATE_UPDATE = #{dict.dateUpdate}
+            <if test="dict.parentDictId == null">
+                and PARENT_DICT_ID IS NULL
             </if>
-            and PARENT_DICT_ID IS NULL
             and STATUS =1
+            order by DATE_CREATE desc
         </where>
     </select>
 </mapper>