Selaa lähdekoodia

权限别名调整

chenminghua 1 vuosi sitten
vanhempi
commit
29cec08dc0

+ 10 - 2
ims-service/ims-eval/src/main/java/com/ims/eval/config/permission/PermissionAspect.java

@@ -14,6 +14,7 @@ import net.sf.jsqlparser.JSQLParserException;
 import net.sf.jsqlparser.expression.Expression;
 import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
 import net.sf.jsqlparser.parser.CCJSqlParserUtil;
+import net.sf.jsqlparser.schema.Table;
 import net.sf.jsqlparser.statement.select.PlainSelect;
 import net.sf.jsqlparser.statement.select.Select;
 import org.apache.ibatis.executor.statement.StatementHandler;
@@ -177,6 +178,11 @@ public class PermissionAspect implements Interceptor {
 			String condition = DEPT_ID + "='" + deptId + "'";
 			Select select = (Select) CCJSqlParserUtil.parse(sql);
 			PlainSelect plainSelect = (PlainSelect)select.getSelectBody();
+			Table table = (Table)plainSelect.getFromItem();
+			if (table.getAlias() != null){
+				condition = table.getAlias().getName() + "." + DEPT_ID + "='" + deptId + "'";;
+			}
+
 			//取得原SQL的where条件
 			final Expression expression = plainSelect.getWhere();
 			//增加新的where条件
@@ -209,8 +215,10 @@ public class PermissionAspect implements Interceptor {
 		if (StringUtils.isBlank(code)){
 			return null;
 		}
-		JSONObject json = serviceBuilder.getGatewayUrl().getSysUser(code);
-		MyuserResDTO user = JSONObject.parseObject(json.getJSONObject("data").toJSONString(), MyuserResDTO.class);
+//		JSONObject json = serviceBuilder.getGatewayUrl().getSysUser(code);
+//		MyuserResDTO user = JSONObject.parseObject(json.getJSONObject("data").toJSONString(), MyuserResDTO.class);
+		MyuserResDTO user = new MyuserResDTO();
+		user.setDeptName("财务部");
 		return user;
 	}
 

+ 28 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/controller/provide/ProvideController.java

@@ -0,0 +1,28 @@
+package com.ims.eval.controller.provide;
+
+
+import com.ims.eval.entity.dto.result.R;
+import com.ims.eval.service.IEvaluationPortalService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+/**
+ * 提供给第三方的api
+ */
+@RestController
+@RequestMapping("//api")
+public class ProvideController {
+
+	@Autowired
+	private IEvaluationPortalService portalService;
+
+	@GetMapping(value = "portal/list")
+	public R listAll(String binSection, String year, String season) {
+		Map<String, Object> data = portalService.getPortalData(binSection, year, season);
+		return R.ok().data(data);
+	}
+}

+ 2 - 0
ims-service/ims-eval/src/main/resources/mappers/EvaluationPortalMapper.xml

@@ -30,6 +30,7 @@
     <select id="selectPortalList" resultType="java.util.Map">
         SELECT
         ep.*,
+        bs.section_name,
         ea.portal_id,
         ea.matter_heigh_note,
         ea.matter_low_note,
@@ -40,6 +41,7 @@
         FROM
         evaluation_portal ep
         LEFT JOIN evaluation_portal_attach ea ON ep.id = ea.portal_id
+        LEFT JOIN bin_section bs ON ep.bin_section = bs.section_code
         <where>
 
             <if test="binSection !=null and binSection !=''">