Commit a28b884f2aa3acee08cc578957ce05f78adda63a
Exists in
master
Merge branch 'master' of https://git.healthbaby.com.cn/jiangjiazhi/center
Showing 7 changed files
- center.manager/src/main/java/com/lyms/cm/controller/sys/SysOrganizationsController.java
- center.manager/src/main/webapp/WEB-INF/static/js/area.js
- center.manager/src/main/webapp/WEB-INF/views/common/base_list.html
- center.manager/src/main/webapp/WEB-INF/views/group/group_list.html
- center.manager/src/main/webapp/WEB-INF/views/organ/org_edit.html
- center.manager/src/main/webapp/WEB-INF/views/organ/org_list.html
- mybatis-plus/src/test/java/com/baomidou/mybatisplus/test/generator/MysqlGenerator.java
center.manager/src/main/java/com/lyms/cm/controller/sys/SysOrganizationsController.java
View file @
a28b884
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | import java.util.Map; |
| 4 | 4 | |
| 5 | +import org.apache.commons.lang3.StringUtils; | |
| 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | 7 | import org.springframework.stereotype.Controller; |
| 7 | 8 | import org.springframework.ui.Model; |
| 8 | 9 | |
| ... | ... | @@ -56,10 +57,23 @@ |
| 56 | 57 | */ |
| 57 | 58 | @RequestMapping(value = "/list", method = { RequestMethod.GET, RequestMethod.POST }) |
| 58 | 59 | @ResponseBody |
| 59 | - public Map<String, Object> list() { | |
| 60 | + public Map<String, Object> list(SysOrganizations organizations) { | |
| 60 | 61 | Page<SysOrganizations> page = getPage(); |
| 61 | 62 | EntityWrapper<SysOrganizations> ew = new EntityWrapper<SysOrganizations>(); |
| 62 | 63 | ew.where("ifDel=0"); |
| 64 | + | |
| 65 | + String provinceId = organizations.getProvinceId(); | |
| 66 | + String cityId = organizations.getCityId(); | |
| 67 | + String areaId = organizations.getAreaId(); | |
| 68 | + if (StringUtils.isNotBlank(provinceId)) { | |
| 69 | + ew.where("PROVINCE_ID={0}", provinceId); | |
| 70 | + } | |
| 71 | + if (StringUtils.isNotBlank(cityId)) { | |
| 72 | + ew.where("CITY_ID={0}", cityId); | |
| 73 | + } | |
| 74 | + if (StringUtils.isNotBlank(areaId)) { | |
| 75 | + ew.where("AREA_ID={0}", areaId); | |
| 76 | + } | |
| 63 | 77 | page = organService.selectPage(page, ew); |
| 64 | 78 | return toGridData(page); |
| 65 | 79 | } |
center.manager/src/main/webapp/WEB-INF/static/js/area.js
View file @
a28b884
| ... | ... | @@ -34,29 +34,22 @@ |
| 34 | 34 | |
| 35 | 35 | function handlerSelect(data,leveName,selectedId) { |
| 36 | 36 | //console.log(leveName,selectedId) |
| 37 | - if(selectedId===undefined)return; | |
| 37 | + //if(selectedId===undefined)return; | |
| 38 | 38 | var leve =data==null ? [] : data.records; |
| 39 | 39 | var nextLeveInt = nextLeve(leveName); |
| 40 | 40 | if(leve!=null && leve.length>0) { |
| 41 | 41 | remove(leveName); |
| 42 | 42 | for(var i=0;i<leve.length;i++) { |
| 43 | 43 | var tag = ""; |
| 44 | - if(leve[i].id===selectedId){ | |
| 44 | + if(leve[i].id==selectedId){ | |
| 45 | 45 | tag = "selected='selected'"; |
| 46 | 46 | } |
| 47 | + //console.log(tag,selectedId) | |
| 47 | 48 | //console.log(leve[i].id,selectedId,tag) |
| 48 | 49 | $("#leve"+nextLeveInt).append("<option "+tag+" value="+leve[i].id+">"+leve[i].name+"</option>") |
| 49 | 50 | } |
| 50 | 51 | } |
| 51 | 52 | } |
| 52 | - | |
| 53 | -//初始信息 | |
| 54 | -get("",function(data){ | |
| 55 | - handler(data,"leve0"); | |
| 56 | - //填充选择信息 | |
| 57 | -}); | |
| 58 | - | |
| 59 | - | |
| 60 | 53 | |
| 61 | 54 | $(function(){ |
| 62 | 55 |
center.manager/src/main/webapp/WEB-INF/views/common/base_list.html
View file @
a28b884
center.manager/src/main/webapp/WEB-INF/views/group/group_list.html
View file @
a28b884
| ... | ... | @@ -125,15 +125,16 @@ |
| 125 | 125 | chkboxType: { |
| 126 | 126 | 'Y': 's', |
| 127 | 127 | 'N': 's' |
| 128 | - } | |
| 128 | + }, | |
| 129 | + chkDisabled:true | |
| 129 | 130 | |
| 130 | 131 | }, |
| 131 | - async:{ | |
| 132 | + /* async:{ | |
| 132 | 133 | autoParam:["id"], |
| 133 | 134 | type:"get", |
| 134 | 135 | url:APP.PATH+"/sysRegions/find?_size=10000&_offset=0", |
| 135 | 136 | enable:true |
| 136 | - }, | |
| 137 | + }, */ | |
| 137 | 138 | view: { |
| 138 | 139 | dblClickExpand: false, |
| 139 | 140 | showIcon : false |
| 140 | 141 | |
| 141 | 142 | |
| 142 | 143 | |
| 143 | 144 | |
| ... | ... | @@ -148,22 +149,96 @@ |
| 148 | 149 | beforeClick: beforeClick_resources, |
| 149 | 150 | onCheck: onCheck_resources, |
| 150 | 151 | onNodeCreated: zTreeOnNodeCreated_resources, |
| 151 | - onAsyncSuccess: zTreeOnAsyncSuccess | |
| 152 | + //onAsyncSuccess: zTreeOnAsyncSuccess, | |
| 153 | + //onAsyncError: zTreeOnAsyncError, | |
| 154 | + //beforeAsync: zTreeBeforeAsync | |
| 152 | 155 | } |
| 153 | 156 | }; |
| 154 | 157 | |
| 155 | 158 | /** |
| 156 | - * 异步数据加载返回处理 | |
| 159 | + * 如果节点在3不加载上面的区域数据 | |
| 157 | 160 | */ |
| 158 | -function zTreeOnAsyncSuccess(event, treeId, treeNode, msg) { | |
| 159 | - console.log(msg) | |
| 161 | +function zTreeBeforeAsync(treeId, treeNode) { | |
| 162 | + //console.log(treeNode) | |
| 163 | + if(treeNode.level == "3")return false; | |
| 160 | 164 | }; |
| 161 | 165 | |
| 166 | +function zTreeOnAsyncError(event, treeId, treeNode, XMLHttpRequest, textStatus, errorThrown) { | |
| 167 | + alert("数据加载失败..."); | |
| 168 | +}; | |
| 169 | +/** | |
| 170 | + * 异步数据加载返回处理 | |
| 171 | + */ | |
| 172 | +/* function zTreeOnAsyncSuccess(event, treeId, treeNode, msg) { | |
| 173 | + var treeObj = $.fn.zTree.getZTreeObj(treeId); | |
| 174 | + if(msg!=null) { | |
| 175 | + var newNodes = []; | |
| 176 | + var datas = JSON.parse(msg).records; | |
| 177 | + if(datas!=null && datas.length>0) { | |
| 178 | + for(var i=0;i<datas.length;i++) { | |
| 179 | + newNodes.push({"id":datas[i].id,"name":datas[i].name,"pid":datas[i].parendId,"isParent":true}) | |
| 180 | + } | |
| 181 | + treeObj.addNodes(treeNode,newNodes) | |
| 182 | + } | |
| 183 | + } | |
| 184 | +}; */ | |
| 185 | + | |
| 186 | +function ajaxArea(treeId,treeNode) { | |
| 187 | + var treeObj = $.fn.zTree.getZTreeObj(treeId); | |
| 188 | + //treeObj.removeChildNodes(treeNode); | |
| 189 | + var newNodes = []; | |
| 190 | + | |
| 191 | + get(treeNode.id,function(data) { | |
| 192 | + var datas = data.records; | |
| 193 | + if(datas!=null && datas.length>0) { | |
| 194 | + for(var i=0;i<datas.length;i++) { | |
| 195 | + newNodes.push({"id":datas[i].id,"name":datas[i].name,"pid":datas[i].parendId,"isParent":true}) | |
| 196 | + } | |
| 197 | + treeObj.removeChildNodes(treeNode); | |
| 198 | + treeObj.addNodes(treeNode,newNodes) | |
| 199 | + } | |
| 200 | + }) | |
| 201 | +} | |
| 202 | + | |
| 203 | + | |
| 204 | +function ajaxOrgan(treeId,treeNode) { | |
| 205 | + var treeObj = $.fn.zTree.getZTreeObj(treeId); | |
| 206 | + var newNodes = []; | |
| 207 | + | |
| 208 | + //区 | |
| 209 | + var areaId = treeNode.id; | |
| 210 | + //市 | |
| 211 | + var cityId =treeNode.getParentNode().id; | |
| 212 | + //省 | |
| 213 | + var provinceId = treeNode.getParentNode().getParentNode().id; | |
| 214 | + | |
| 215 | + //console.log(treeNode); | |
| 216 | + $.get(APP.PATH+"/sysOrganizations/list?_size=100000&_offset=0&provinceId="+provinceId+"&cityId="+cityId+"&areaId="+areaId,function(data){ | |
| 217 | + var rows = data.rows; | |
| 218 | + if(rows!=null && rows.length>0) { | |
| 219 | + for(var i=0;i<rows.length;i++) { | |
| 220 | + newNodes.push({"id":rows[i].id,"name":rows[i].name,"isParent":false}) | |
| 221 | + } | |
| 222 | + treeObj.removeChildNodes(treeNode); | |
| 223 | + treeObj.addNodes(treeNode,newNodes) | |
| 224 | + } | |
| 225 | + }) | |
| 226 | + | |
| 227 | +} | |
| 228 | + | |
| 229 | + | |
| 162 | 230 | function beforeClick_resources(treeId, treeNode) { |
| 163 | 231 | var zTree = $.fn.zTree.getZTreeObj('tree_resources'); |
| 164 | 232 | zTree.expandNode(treeNode); |
| 165 | 233 | zTree.checkNode(treeNode, !treeNode.checked, null, true); |
| 166 | - //console.log(treeNode.type) | |
| 234 | + | |
| 235 | + //加载区域信息 | |
| 236 | + if(treeNode.level<3){ | |
| 237 | + ajaxArea(treeId,treeNode); | |
| 238 | + }else{ | |
| 239 | + //加载医院信息 | |
| 240 | + ajaxOrgan(treeId,treeNode); | |
| 241 | + } | |
| 167 | 242 | return false; |
| 168 | 243 | } |
| 169 | 244 | function selectTreeNode_resources(id) { |
| ... | ... | @@ -183,7 +258,7 @@ |
| 183 | 258 | if (pNode) { |
| 184 | 259 | return pNode; |
| 185 | 260 | } |
| 186 | - return null; | |
| 261 | + return null; | |
| 187 | 262 | } |
| 188 | 263 | function zTreeOnNodeCreated_resources(event, treeId, treeNode) { |
| 189 | 264 | var selectModels = 'leve1'; |
center.manager/src/main/webapp/WEB-INF/views/organ/org_edit.html
View file @
a28b884
| ... | ... | @@ -28,14 +28,6 @@ |
| 28 | 28 | </div> |
| 29 | 29 | |
| 30 | 30 | <div class="form-group"> |
| 31 | - <label class="col-sm-3 control-label">简码:</label> | |
| 32 | - <div class="col-sm-8"> | |
| 33 | - <input type="text" value="$!org.shortCode" placeholder="简码" aria-required="true" required="true" minlength="3" name="shortCode" class="form-control" id="shortCode"> | |
| 34 | - </div> | |
| 35 | - </div> | |
| 36 | - | |
| 37 | - | |
| 38 | - <div class="form-group"> | |
| 39 | 31 | <label class="col-sm-3 control-label">等级:</label> |
| 40 | 32 | <div class="col-sm-8"> |
| 41 | 33 | <!-- 1省,2市,3区县,4乡镇,5村,6其他 --> |
| 42 | 34 | |
| ... | ... | @@ -143,12 +135,13 @@ |
| 143 | 135 | //获取所有区县 |
| 144 | 136 | get("",function(data){ |
| 145 | 137 | handlerSelect(data,"leve0","$!org.provinceId"); |
| 146 | - get("$!org.provinceId",function(data){ | |
| 138 | + //console.log("省....",data,"$!org.provinceId") | |
| 139 | + get("$!org.provinceId",function(data){ | |
| 147 | 140 | handlerSelect(data,"leve1","$!org.cityId"); |
| 148 | 141 | get("$!org.cityId",function(data){ |
| 149 | 142 | handlerSelect(data,"leve2","$!org.areaId"); |
| 150 | 143 | }); |
| 151 | - }); | |
| 144 | + }); | |
| 152 | 145 | }); |
| 153 | 146 | |
| 154 | 147 | </script> |
center.manager/src/main/webapp/WEB-INF/views/organ/org_list.html
View file @
a28b884
| ... | ... | @@ -128,8 +128,16 @@ |
| 128 | 128 | field: 'address', |
| 129 | 129 | title: '地址' |
| 130 | 130 | }]; |
| 131 | + | |
| 131 | 132 | </script> |
| 132 | 133 | #end |
| 133 | 134 | #extends("/common/base_list.html") |
| 134 | 135 | <script src="${ctx}/static/js/area.js"></script> |
| 136 | +<script type="text/javascript"> | |
| 137 | +//初始信息 | |
| 138 | +get("",function(data){ | |
| 139 | + handler(data,"leve0"); | |
| 140 | + //填充选择信息 | |
| 141 | +}); | |
| 142 | +</script> |
mybatis-plus/src/test/java/com/baomidou/mybatisplus/test/generator/MysqlGenerator.java
View file @
a28b884
| ... | ... | @@ -39,38 +39,35 @@ |
| 39 | 39 | * @date 2016-12-01 |
| 40 | 40 | */ |
| 41 | 41 | public class MysqlGenerator { |
| 42 | - | |
| 43 | - private static void customSet(GlobalConfig gc,StrategyConfig strategy,PackageConfig pc){ | |
| 42 | + | |
| 43 | + private static void customSet(GlobalConfig gc, StrategyConfig strategy, PackageConfig pc) { | |
| 44 | 44 | gc.setOutputDir("E://mybatis-plus-generate"); |
| 45 | - gc.setAuthor("fangcheng"); | |
| 46 | - //strategy.setInclude(new String[] { "SYS_USERS","SYS_USER_ROLE_MAPS","SYS_ROLES" }); // 需要生成的表 | |
| 47 | - strategy.setInclude(new String[] { "SYS_USERS" }); // 需要生成的表 | |
| 48 | -// pc.setParent("com.lyms.hospital"); | |
| 45 | + gc.setAuthor("maliang"); | |
| 46 | + // strategy.setInclude(new String[] { | |
| 47 | + // "SYS_USERS","SYS_USER_ROLE_MAPS","SYS_ROLES" }); // 需要生成的表 | |
| 48 | + strategy.setInclude(new String[] { "SYS_ORGAN_GROUP" }); // 需要生成的表 | |
| 49 | + // pc.setParent("com.lyms.hospital"); | |
| 49 | 50 | pc.setParent("com.lyms.cm"); |
| 50 | - | |
| 51 | - pc.setFunctionName("sys"); //com.lyms.hospital.web.controller.sys 加在controller后面 | |
| 52 | -// pc.setModuleName("sys"); //com.lyms.hospital.sys.controller 加在controller前面 | |
| 53 | - | |
| 54 | - //以下基本不变 | |
| 55 | - pc.setServiceImpl(pc.getService()+".impl"); | |
| 51 | + | |
| 52 | + pc.setFunctionName("sys"); // com.lyms.hospital.web.controller.sys | |
| 53 | + // 加在controller后面 | |
| 54 | + // pc.setModuleName("sys"); //com.lyms.hospital.sys.controller | |
| 55 | + // 加在controller前面 | |
| 56 | + | |
| 57 | + // 以下基本不变 | |
| 58 | + pc.setServiceImpl(pc.getService() + ".impl"); | |
| 56 | 59 | pc.setMapper("dao"); |
| 57 | 60 | pc.setXml("dao"); |
| 58 | 61 | } |
| 59 | - | |
| 60 | - | |
| 61 | - | |
| 62 | + | |
| 62 | 63 | @Test |
| 63 | - public void entityWarpperTest(){ | |
| 64 | + public void entityWarpperTest() { | |
| 64 | 65 | EntityWrapper<Object> ew = new EntityWrapper<Object>(); |
| 65 | - ew.where("name={0}", "'zhangsan'").and("id=1") | |
| 66 | - .orNew("status={0}", "0").or("status=1") | |
| 67 | - .notLike("nlike", "notvalue") | |
| 68 | - .andNew("new=xx").like("hhh", "ddd") | |
| 69 | - .andNew("pwd=11").isNotNull("n1,n2").isNull("n3") | |
| 70 | - .groupBy("x1").groupBy("x2,x3") | |
| 71 | - .having("x1=11").having("x3=433") | |
| 72 | - .orderBy("dd").orderBy("d1,d2"); | |
| 73 | - System.out.println(ew.getSqlSegment()); | |
| 66 | + ew.where("name={0}", "'zhangsan'").and("id=1").orNew("status={0}", "0").or("status=1") | |
| 67 | + .notLike("nlike", "notvalue").andNew("new=xx").like("hhh", "ddd").andNew("pwd=11").isNotNull("n1,n2") | |
| 68 | + .isNull("n3").groupBy("x1").groupBy("x2,x3").having("x1=11").having("x3=433").orderBy("dd") | |
| 69 | + .orderBy("d1,d2"); | |
| 70 | + System.out.println(ew.getSqlSegment()); | |
| 74 | 71 | } |
| 75 | 72 | |
| 76 | 73 | /** |
| ... | ... | @@ -89,7 +86,7 @@ |
| 89 | 86 | gc.setEnableCache(false);// XML 二级缓存 |
| 90 | 87 | gc.setBaseResultMap(true);// XML ResultMap |
| 91 | 88 | gc.setBaseColumnList(true);// XML columList |
| 92 | - //gc.setAuthor("Yanghu"); | |
| 89 | + // gc.setAuthor("Yanghu"); | |
| 93 | 90 | |
| 94 | 91 | // 自定义文件命名,注意 %s 会自动填充表实体属性! |
| 95 | 92 | // gc.setMapperName("%sDao"); |
| ... | ... | @@ -110,7 +107,7 @@ |
| 110 | 107 | |
| 111 | 108 | // 策略配置 |
| 112 | 109 | StrategyConfig strategy = new StrategyConfig(); |
| 113 | - //strategy.setTablePrefix("bmd_");// 此处可以修改为您的表前缀 | |
| 110 | + // strategy.setTablePrefix("bmd_");// 此处可以修改为您的表前缀 | |
| 114 | 111 | strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略 |
| 115 | 112 | strategy.setInclude(new String[] { "user" }); // 需要生成的表 |
| 116 | 113 | // strategy.setExclude(new String[]{"test"}); // 排除生成的表 |
| ... | ... | @@ -127,7 +124,7 @@ |
| 127 | 124 | // 自定义 service 实现类父类 |
| 128 | 125 | // strategy.setSuperServiceImplClass("com.baomidou.demo.TestServiceImpl"); |
| 129 | 126 | // 自定义 controller 父类 |
| 130 | - strategy.setSuperControllerClass("com.lyms.web.controller.BaseController"); | |
| 127 | + strategy.setSuperControllerClass("com.lyms.web.controller.BaseController"); | |
| 131 | 128 | // 【实体】是否生成字段常量(默认 false) |
| 132 | 129 | // public static final String ID = "test_id"; |
| 133 | 130 | // strategy.setEntityColumnConstant(true); |
| ... | ... | @@ -139,7 +136,7 @@ |
| 139 | 136 | // 包配置 |
| 140 | 137 | PackageConfig pc = new PackageConfig(); |
| 141 | 138 | pc.setController("controller"); |
| 142 | - //pc.setModuleName("test"); | |
| 139 | + // pc.setModuleName("test"); | |
| 143 | 140 | mpg.setPackageInfo(pc); |
| 144 | 141 | |
| 145 | 142 | // 注入自定义配置,可以在 VM 中使用 cfg.abc 设置的值 |
| ... | ... | @@ -162,11 +159,9 @@ |
| 162 | 159 | // tc.setService("..."); |
| 163 | 160 | // tc.setServiceImpl("..."); |
| 164 | 161 | // mpg.setTemplate(tc); |
| 165 | - | |
| 166 | - | |
| 167 | - customSet(gc,strategy,pc);//自定义,一般清空修改这个就可以了 | |
| 168 | - | |
| 169 | - | |
| 162 | + | |
| 163 | + customSet(gc, strategy, pc);// 自定义,一般清空修改这个就可以了 | |
| 164 | + | |
| 170 | 165 | // 执行生成 |
| 171 | 166 | mpg.execute(); |
| 172 | 167 |