qxp 4 سال پیش
والد
کامیت
c5147d8655

+ 1 - 1
dgtly-admin/src/main/resources/templates/company/honour/add.html

@@ -41,8 +41,8 @@
         $("#form-company_honour-add").validate({
             focusCleanup: true
         });
+        /*选择后提交图片到服务器*******/
         $('.fileinput').on('change.bs.fileinput ', function (e) {
-            debugger
             if ($("#input-fileinput").val() == '') {
                 return;
             }var data = new FormData();

+ 38 - 14
dgtly-admin/src/main/resources/templates/company/honour/edit.html

@@ -2,6 +2,7 @@
 <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
 <head>
     <th:block th:include="include :: header('修改企业荣誉')" />
+    <th:block th:include="include :: jasny-bootstrap-css" />
 </head>
 <body class="white-bg">
     <div class="wrapper wrapper-content animated fadeInRight ibox-content">
@@ -17,19 +18,13 @@
             <div class="form-group">
                 <label class="col-sm-3 control-label">荣誉图片:</label>
                 <div class="col-sm-8">
-                    <input id="input-img" name="img"  type="hidden">
-                    <div class="fileinput fileinput-new" data-provides="fileinput">
-                        <div class="fileinput-preview thumbnail" style="width: 200px; height: 150px;">
-
-                        </div>
-                        <div>
-                            <span class="btn btn-white btn-file">
-                                <span class="fileinput-new">选择图片</span>
-                                <span class="fileinput-exists">更改</span>
-                                <input id="input-fileinput" type="file">
-                            </span>
-                            <a href="#" class="btn btn-white fileinput-exists" data-dismiss="fileinput">清除</a>
-                        </div>
+                    <input id="input-img" name="img"  type="hidden" th:field="*{img}">
+                    <img th:src="*{img}" id="img-img" style="max-width: 200px;max-height: 200px">
+                    <div>
+                        <span class="btn btn-white btn-file">
+                            <span class="fileinput-exists">更改</span>
+                            <input id="input-fileinput" type="file">
+                        </span>
                     </div>
                 </div>
             </div>
@@ -37,16 +32,45 @@
     </div>
     <th:block th:include="include :: footer" />
     <script type="text/javascript">
-        var prefix = ctx + "system/company_honour";
+        var prefix = ctx + "company/honour";
         $("#form-company_honour-edit").validate({
             focusCleanup: true
         });
 
         function submitHandler() {
+            if($("#input-img").val()==undefined||$("#input-img").val()==""){
+                $.modal.msgError("请选择荣誉图片")
+            }
             if ($.validate.form()) {
                 $.operate.save(prefix + "/edit", $('#form-company_honour-edit').serialize());
             }
         }
+        $('#input-fileinput').on('change.bs.fileinput ', function (e) {
+            if ($("#input-fileinput").val() == '') {
+                return;
+            }var data = new FormData();
+            data.append('file', document.getElementById('input-fileinput').files[0]);
+            $.ajax({
+                url:ctx+"common/upload",
+                type:"post",
+                data: data,
+                cache: false,
+                contentType: false,
+                processData: false,
+                dataType: 'json',
+                success: function(result) {
+                    if (result.code == web_status.SUCCESS) {
+                        $("#input-img").val(result.data.fileName);
+                        $("#img-img").attr('src',result.data.fileName);
+                    } else {
+                        $.modal.alertError(result.msg);
+                    }
+                },
+                error:function(result) {
+                    alert("上传失败")
+                }
+            });
+        })
     </script>
 </body>
 </html>

+ 5 - 5
dgtly-admin/src/main/resources/templates/company/honour/honour.html

@@ -11,13 +11,13 @@
             </div>
 
             <div class="btn-group-sm" id="toolbar" role="group">
-                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="compant:honout:add">
+                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="company:honour:add">
                     <i class="fa fa-plus"></i> 添加
                 </a>
-                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="compant:honout:edit">
+                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="company:honour:edit">
                     <i class="fa fa-edit"></i> 修改
                 </a>
-                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="compant:honout:remove">
+                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="company:honour:remove">
                     <i class="fa fa-remove"></i> 删除
                 </a>
             </div>
@@ -28,8 +28,8 @@
     </div>
     <th:block th:include="include :: footer" />
     <script th:inline="javascript">
-        var editFlag = [[${@permission.hasPermi('compant:honout:edit')}]];
-        var removeFlag = [[${@permission.hasPermi('compant:honout:remove')}]];
+        var editFlag = [[${@permission.hasPermi('company:honour:edit')}]];
+        var removeFlag = [[${@permission.hasPermi('company:honour:remove')}]];
         var prefix = ctx + "company/honour";
 
         $(function() {

+ 21 - 1
dgtly-api/src/main/java/com/dgtly/api/controller/SysCompanyController.java

@@ -7,7 +7,9 @@ import com.dgtly.common.core.controller.ApiBaseController;
 import com.dgtly.common.core.domain.AjaxResult;
 import com.dgtly.common.core.domain.ParameterObject;
 import com.dgtly.common.core.domain.ResultType;
+import com.dgtly.companyext.domain.CompanyHonour;
 import com.dgtly.companyext.domain.CompanyReviewed;
+import com.dgtly.companyext.service.ICompanyHonourService;
 import com.dgtly.companyext.service.ICompanyReviewedService;
 import com.dgtly.member.domain.MemberFollow;
 import com.dgtly.member.service.IMemberFollowService;
@@ -42,6 +44,8 @@ public class SysCompanyController extends ApiBaseController {
     @Autowired
     private ICompanyReviewedService companyReviewedService;
     @Autowired
+    private ICompanyHonourService companyHonourService;
+    @Autowired
     private ISysDictDataService dictDataService;
 
     @ApiOperation(value = "商家详情")
@@ -56,6 +60,9 @@ public class SysCompanyController extends ApiBaseController {
 
         String companyTypeName = dictDataService.selectDictLabel("company_type",sysCompany.getCompanyType());
 
+        CompanyHonour ch = new CompanyHonour();
+        ch.setCompanyId(companyId);
+        List<CompanyHonour> chs = companyHonourService.selectCompanyHonourList(ch);
 
 
         int isFollow = 0;
@@ -75,7 +82,7 @@ public class SysCompanyController extends ApiBaseController {
         }
         if(sysCompany!=null){
             return AjaxResult.success(sysCompany).putKV("isFollow",isFollow)
-                    .putKV("companyTypeName",companyTypeName);
+                    .putKV("companyTypeName",companyTypeName).putKV("companyHonours",chs);
         }else{
             return AjaxResult.error(ResultType.NUll);
         }
@@ -90,6 +97,17 @@ public class SysCompanyController extends ApiBaseController {
         return AjaxResult.success().putKV("list",goodsInfos);
     }
 
+    @ApiOperation(value = "商家列表")
+    @ApiImplicitParam(name = "params" , paramType = "body")
+    @PostMapping("/list")
+    public Object getList(){
+        ParameterObject obj =  getParameterObject();
+        startPage(obj);
+        SysCompany sc = obj.parseBean(SysCompany.class);
+        List<SysCompany> scs =  companyService.selectSysCompanyListExRoot(sc);
+        return AjaxResult.success(getDataTable(scs));
+    }
+
 
     @ApiOperation(value = "商家入驻")
     @ApiImplicitParam(name = "params" , paramType = "body")
@@ -117,4 +135,6 @@ public class SysCompanyController extends ApiBaseController {
         return toAjax(i);
     }
 
+
+
 }

+ 1 - 1
dgtly-system/src/main/resources/mapper/system/SysCompanyMapper.xml

@@ -148,7 +148,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectSysCompanyVo"/>
         <where>
             id !=1
-            <if test="companyName != null  and companyName != ''"> and company_name = #{companyName}</if>
+            <if test="companyName != null  and companyName != ''"> and company_name like concat('%',#{companyName},'%') </if>
         </where>
     </select>