Browse Source

add web乐器维护列表

周箭河 4 năm trước cách đây
mục cha
commit
da4da3fa20

+ 33 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentInstrument.java

@@ -70,6 +70,15 @@ public class StudentInstrument {
     @ApiModelProperty(value = "乐器图片")
     private String goodsImg;
 
+    @ApiModelProperty(value = "学生姓名")
+    private String studentName;
+
+    @ApiModelProperty(value = "联系电话")
+    private String phone;
+
+    @ApiModelProperty(value = "分部")
+    private String organName;
+
     public Long getId() {
         return id;
     }
@@ -174,4 +183,28 @@ public class StudentInstrument {
     public void setOrganId(Integer organId) {
         this.organId = organId;
     }
+
+    public String getStudentName() {
+        return studentName;
+    }
+
+    public void setStudentName(String studentName) {
+        this.studentName = studentName;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getOrganName() {
+        return organName;
+    }
+
+    public void setOrganName(String organName) {
+        this.organName = organName;
+    }
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentInstrumentQueryInfo.java

@@ -14,6 +14,9 @@ public class StudentInstrumentQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "学生id", required = true)
     private Integer studentId;
 
+    @ApiModelProperty(value = "分部ids", required = true)
+    private String organId;
+
     public Integer getStudentId() {
         return studentId;
     }
@@ -21,4 +24,12 @@ public class StudentInstrumentQueryInfo extends QueryInfo {
     public void setStudentId(Integer studentId) {
         this.studentId = studentId;
     }
+
+    public String getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(String organId) {
+        this.organId = organId;
+    }
 }

+ 21 - 3
mec-biz/src/main/resources/config/mybatis/StudentInstrumentMapper.xml

@@ -94,7 +94,9 @@
 
   <!-- 分页查询 -->
   <select id="queryPage" resultMap="StudentInstrument" parameterType="map">
-    SELECT * FROM student_instrument
+    SELECT si.*,su.username_ studentName,su.phone_ phone,o.name_ organName FROM student_instrument si
+    LEFT JOIN sys_user su ON su.id_ = si.student_id_
+    LEFT JOIN organization o ON o.id_ = si.organ_id_
     <include refid="queryPageSql"/>
     <include refid="global.limit"/>
   </select>
@@ -102,14 +104,30 @@
   <!-- 查询当前表的总记录数 -->
   <select id="queryCount" resultType="int">
     SELECT COUNT(*)
-    FROM student_instrument
+    FROM student_instrument si
+    LEFT JOIN sys_user su ON su.id_ = si.student_id_
     <include refid="queryPageSql"/>
   </select>
 
   <sql id="queryPageSql">
     <where>
       <if test="studentId != null">
-        AND student_id_ = #{studentId}
+        AND si.student_id_ = #{studentId}
+      </if>
+      <if test="organId != null">
+        AND FIND_IN_SET(si.organ_id_,#{organId})
+      </if>
+      <if test="goodsId != null">
+        AND si.goods_id_ = #{goodsId}
+      </if>
+      <if test="goodsBrand != null">
+        AND si.goods_brand_ LIKE CONCAT('%',#{goodsBrand},'%')
+      </if>
+      <if test="specification != null">
+        AND si.specification_ LIKE CONCAT('%',#{specification},'%')
+      </if>
+      <if test="search != null">
+        AND (si.student_id_ = #{search} OR su.phone_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%'))
       </if>
     </where>
   </sql>

+ 10 - 10
mec-web/src/main/java/com/ym/mec/web/controller/SporadicChargeInfoController.java

@@ -43,17 +43,17 @@ public class SporadicChargeInfoController extends BaseController {
 		if (sysUser == null) {
 			return failed("用户信息获取失败");
 		}
-			Employee employee = employeeDao.get(sysUser.getId());
-			if (StringUtils.isEmpty(queryInfo.getOrganId())) {
-				queryInfo.setOrganId(employee.getOrganIdList());
-			}else if(StringUtils.isEmpty(employee.getOrganIdList())){
-				return failed("用户所在分部异常");
-			}else {
-				List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-				if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){
-					return failed("非法请求");
-				}
+		Employee employee = employeeDao.get(sysUser.getId());
+		if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+			queryInfo.setOrganId(employee.getOrganIdList());
+		}else if(StringUtils.isEmpty(employee.getOrganIdList())){
+			return failed("用户所在分部异常");
+		}else {
+			List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+			if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){
+				return failed("非法请求");
 			}
+		}
 		queryInfo.setSort("id_");
 		return succeed(sporadicChargeInfoService.queryDetailPage(queryInfo));
 	}

+ 21 - 4
mec-web/src/main/java/com/ym/mec/web/controller/StudentInstrumentController.java

@@ -3,6 +3,8 @@ package com.ym.mec.web.controller;
 
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.EmployeeDao;
+import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.entity.StudentInstrument;
 import com.ym.mec.biz.dal.page.StudentInstrumentQueryInfo;
 import com.ym.mec.biz.service.StudentInstrumentService;
@@ -13,6 +15,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -21,6 +24,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.math.BigDecimal;
+import java.util.Arrays;
+import java.util.List;
 
 @RequestMapping("studentInstrument")
 @Api(tags = "乐器与月保服务")
@@ -30,16 +35,28 @@ public class StudentInstrumentController extends BaseController {
     private StudentInstrumentService studentInstrumentService;
     @Autowired
     private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private EmployeeDao employeeDao;
 
 
     @ApiOperation(value = "获取乐器与月保列表")
     @GetMapping("/getList")
     public HttpResponseResult<PageInfo<StudentInstrument>> getList(StudentInstrumentQueryInfo queryInfo) {
-        SysUser user = sysUserFeignService.queryUserInfo();
-        if (user == null || user.getId() == null) {
-            return failed(HttpStatus.FORBIDDEN, "请登录");
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
+            return failed("用户所在分部异常");
+        } else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
+                return failed("非法请求");
+            }
         }
-        queryInfo.setStudentId(user.getId());
         return succeed(studentInstrumentService.queryPage(queryInfo));
     }