Browse Source

国别代码和会员管理绑定商户

zhang 6 years ago
parent
commit
31c472adda

+ 2 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/AddressController.java

@@ -2,6 +2,7 @@ package com.kmall.admin.controller;
 
 import com.kmall.admin.entity.AddressEntity;
 import com.kmall.admin.service.AddressService;
+import com.kmall.admin.utils.ParamUtils;
 import com.kmall.common.utils.PageUtils;
 import com.kmall.common.utils.Query;
 import com.kmall.common.utils.R;
@@ -31,6 +32,7 @@ public class AddressController {
     @RequestMapping("/list")
     @RequiresPermissions("address:list")
     public R list(@RequestParam Map<String, Object> params) {
+        ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", false);
         //查询列表数据
         Query query = new Query(params);
 

+ 2 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/CartController.java

@@ -2,6 +2,7 @@ package com.kmall.admin.controller;
 
 import com.kmall.admin.entity.CartEntity;
 import com.kmall.admin.service.CartService;
+import com.kmall.admin.utils.ParamUtils;
 import com.kmall.common.utils.PageUtils;
 import com.kmall.common.utils.Query;
 import com.kmall.common.utils.R;
@@ -32,6 +33,7 @@ public class CartController {
 	@RequestMapping("/list")
 	@RequiresPermissions("cart:list")
 	public R list(@RequestParam Map<String, Object> params){
+		ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", false);
 		//查询列表数据
         Query query = new Query(params);
 

+ 3 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/CollectController.java

@@ -2,6 +2,7 @@ package com.kmall.admin.controller;
 
 import com.kmall.admin.entity.CollectEntity;
 import com.kmall.admin.service.CollectService;
+import com.kmall.admin.utils.ParamUtils;
 import com.kmall.common.utils.PageUtils;
 import com.kmall.common.utils.Query;
 import com.kmall.common.utils.R;
@@ -32,6 +33,8 @@ public class CollectController {
 	@RequestMapping("/list")
 	@RequiresPermissions("collect:list")
 	public R list(@RequestParam Map<String, Object> params){
+
+		ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", false);
 		//查询列表数据
         Query query = new Query(params);
 

+ 2 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/FootprintController.java

@@ -2,6 +2,7 @@ package com.kmall.admin.controller;
 
 import com.kmall.admin.entity.FootprintEntity;
 import com.kmall.admin.service.FootprintService;
+import com.kmall.admin.utils.ParamUtils;
 import com.kmall.common.utils.PageUtils;
 import com.kmall.common.utils.Query;
 import com.kmall.common.utils.R;
@@ -30,6 +31,7 @@ public class FootprintController {
     @RequestMapping("/list")
     @RequiresPermissions("footprint:list")
     public R list(@RequestParam Map<String, Object> params) {
+        ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", false);
         //查询列表数据
         Query query = new Query(params);
 

+ 2 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/SearchHistoryController.java

@@ -2,6 +2,7 @@ package com.kmall.admin.controller;
 
 import com.kmall.admin.entity.SearchHistoryEntity;
 import com.kmall.admin.service.SearchHistoryService;
+import com.kmall.admin.utils.ParamUtils;
 import com.kmall.common.utils.PageUtils;
 import com.kmall.common.utils.Query;
 import com.kmall.common.utils.R;
@@ -30,6 +31,7 @@ public class SearchHistoryController {
     @RequestMapping("/list")
     @RequiresPermissions("searchhistory:list")
     public R list(@RequestParam Map<String, Object> params) {
+        ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", false);
         //查询列表数据
         Query query = new Query(params);
 

+ 13 - 1
kmall-admin/src/main/java/com/kmall/admin/controller/SysCusNationCodeController.java

@@ -1,13 +1,16 @@
 package com.kmall.admin.controller;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
 import com.kmall.admin.entity.SysCusNationCodeEntity;
 import com.kmall.admin.service.SysCusNationCodeService;
+import com.kmall.common.entity.SysUserEntity;
 import com.kmall.common.utils.PageUtils;
 import com.kmall.common.utils.Query;
 import com.kmall.common.utils.R;
+import com.kmall.common.utils.ShiroUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -52,7 +55,6 @@ public class SysCusNationCodeController {
     @ResponseBody
     public R info(@PathVariable("sn") String sn) {
         SysCusNationCodeEntity sysCusNationCode = sysCusNationCodeService.queryObject(sn);
-
         return R.ok().put("sysCusNationCode", sysCusNationCode);
     }
 
@@ -63,6 +65,13 @@ public class SysCusNationCodeController {
     @RequiresPermissions("syscusnationcode:save")
     @ResponseBody
     public R save(@RequestBody SysCusNationCodeEntity sysCusNationCode) {
+
+        SysUserEntity user = ShiroUtils.getUserEntity();
+        sysCusNationCode.setCreaterSn(user.getUserId().toString());
+        sysCusNationCode.setCreateTime(new Date());
+        sysCusNationCode.setModerSn(user.getUserId().toString());
+        sysCusNationCode.setModTime(new Date());
+
         sysCusNationCodeService.save(sysCusNationCode);
 
         return R.ok();
@@ -75,6 +84,9 @@ public class SysCusNationCodeController {
     @RequiresPermissions("syscusnationcode:update")
     @ResponseBody
     public R update(@RequestBody SysCusNationCodeEntity sysCusNationCode) {
+        SysUserEntity user = ShiroUtils.getUserEntity();
+        sysCusNationCode.setModerSn(user.getUserId().toString());
+        sysCusNationCode.setModTime(new Date());
         sysCusNationCodeService.update(sysCusNationCode);
 
         return R.ok();

+ 36 - 2
kmall-admin/src/main/java/com/kmall/admin/service/impl/SysCusNationCodeServiceImpl.java

@@ -1,13 +1,18 @@
 package com.kmall.admin.service.impl;
 
+import com.google.common.collect.ImmutableBiMap;
 import com.kmall.admin.dao.SysCusNationCodeDao;
 import com.kmall.admin.entity.SysCusNationCodeEntity;
 import com.kmall.admin.service.SysCusNationCodeService;
+import com.kmall.common.constant.TablePrimaryKeyPrefix;
+import com.kmall.common.utils.*;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
 import java.util.Map;
+import java.util.Random;
 
 
 /**
@@ -18,7 +23,8 @@ import java.util.Map;
  * @date 2018-11-10 15:26:44
  */
 @Service("sysCusNationCodeService")
-public class SysCusNationCodeServiceImpl implements SysCusNationCodeService {
+public class SysCusNationCodeServiceImpl
+        implements SysCusNationCodeService {
     @Autowired
     private SysCusNationCodeDao sysCusNationCodeDao;
 
@@ -39,11 +45,39 @@ public class SysCusNationCodeServiceImpl implements SysCusNationCodeService {
 
     @Override
     public int save(SysCusNationCodeEntity sysCusNationCode) {
+        SysCusNationCodeEntity SysCusNationCodeTemp = sysCusNationCodeDao.queryObjectByName(sysCusNationCode.getName());
+        if (SysCusNationCodeTemp != null) {
+            throw new RRException("名称已经存在");
+        }
+
+        if (sysCusNationCode.getCode().length() > 3) {
+            throw new RRException("代码长度有误");
+        }
+
+        if (StringUtils.isNotEmpty(sysCusNationCode.getDiscountsTaxType()) &&
+            sysCusNationCode.getDiscountsTaxType().length() > 1) {
+            throw new RRException("优普税率类型有误");
+        }
+
+        sysCusNationCode.setSn(TablePrimaryKeyPrefix.sys_cus_nation_code + RandomUtils.getNum(18));
         return sysCusNationCodeDao.save(sysCusNationCode);
     }
 
     @Override
     public int update(SysCusNationCodeEntity sysCusNationCode) {
+        SysCusNationCodeEntity SysCusNationCodeTemp = sysCusNationCodeDao.queryObjectByName(sysCusNationCode.getName());
+        if (SysCusNationCodeTemp != null && !SysCusNationCodeTemp.getSn().equals(sysCusNationCode.getSn())) {
+            throw new RRException("名称编号已经存在");
+        }
+
+        if (sysCusNationCode.getCode().length() > 3) {
+            throw new RRException("代码长度有误");
+        }
+
+        if (StringUtils.isNotEmpty(sysCusNationCode.getDiscountsTaxType()) &&
+            sysCusNationCode.getDiscountsTaxType().length() > 1) {
+            throw new RRException("优普税率类型有误");
+        }
         return sysCusNationCodeDao.update(sysCusNationCode);
     }
 
@@ -53,7 +87,7 @@ public class SysCusNationCodeServiceImpl implements SysCusNationCodeService {
     }
 
     @Override
-    public int deleteBatch(String[]sns) {
+    public int deleteBatch(String[] sns) {
         return sysCusNationCodeDao.deleteBatch(sns);
     }
 }

+ 20 - 4
kmall-admin/src/main/resources/mybatis/mapper/AddressDao.xml

@@ -36,7 +36,7 @@
     </select>
 
     <select id="queryList" resultType="com.kmall.admin.entity.AddressEntity">
-        select
+        select distinct
         mall_address.id,
         mall_address.user_id,
         mall_address.user_name,
@@ -49,8 +49,16 @@
         mall_address.detail_Info,
         mall_address.is_default,
         mall_user.nickname shop_user_name
-        from mall_address LEFT JOIN mall_user ON mall_address.user_id = mall_user.id
+        from mall_address
+        LEFT JOIN mall_user ON mall_address.user_id = mall_user.id
+        LEFT JOIN mall_merch_user d ON mall_address.user_id=d.user_id
         WHERE 1=1
+        <if test="storeId != null">
+            and d.store_id = #{storeId}
+        </if>
+        <if test="merchSn != null and merchSn.trim() != ''">
+            and d.merch_sn = #{merchSn}
+        </if>
         <if test="userId != null">
             AND mall_address.user_id = #{userId}
         </if>
@@ -74,8 +82,16 @@
     </select>
 
     <select id="queryTotal" resultType="int">
-        select count(*) from mall_address
-        WHERE 1=1
+        select count(distinct a.id)
+        from mall_address a
+        LEFT JOIN mall_merch_user d ON a.user_id=d.user_id
+        where 1=1
+        <if test="storeId != null">
+            and d.store_id = #{storeId}
+        </if>
+        <if test="merchSn != null and merchSn.trim() != ''">
+            and d.merch_sn = #{merchSn}
+        </if>
         <if test="userId != null">
             AND mall_address.user_id = #{userId}
         </if>

+ 18 - 2
kmall-admin/src/main/resources/mybatis/mapper/CartDao.xml

@@ -35,10 +35,17 @@
 	</select>
 
     <select id="queryList" resultMap="cartMap">
-        select a.* ,b.nickname as user_name
+        select distinct a.* ,b.nickname as user_name
         from mall_cart a
         left join mall_user b on a.user_id = b.id
+        LEFT JOIN mall_merch_user d ON a.user_id=d.user_id
         where 1=1
+        <if test="storeId != null">
+            and d.store_id = #{storeId}
+        </if>
+        <if test="merchSn != null and merchSn.trim() != ''">
+            and d.merch_sn = #{merchSn}
+        </if>
         <if test="userId != null">
             AND a.user_id = #{userId}
         </if>
@@ -59,7 +66,16 @@
     </select>
 
     <select id="queryTotal" resultType="int">
-		select count(*) from mall_cart where 1=1
+		select count(distinct a.id)
+        from mall_cart a
+        LEFT JOIN mall_merch_user d ON a.user_id=d.user_id
+        where 1=1
+        <if test="storeId != null">
+            and d.store_id = #{storeId}
+        </if>
+        <if test="merchSn != null and merchSn.trim() != ''">
+            and d.merch_sn = #{merchSn}
+        </if>
         <if test="userId != null">
             AND mall_cart.user_id = #{userId}
         </if>

+ 17 - 2
kmall-admin/src/main/resources/mybatis/mapper/CollectDao.xml

@@ -20,11 +20,19 @@
 	</select>
 
     <select id="queryList" resultType="com.kmall.admin.entity.CollectEntity">
-        select a.* , b.nickname as user_name,c.name as value_name
+        select distinct
+          a.* , b.nickname as user_name,c.name as value_name
         from mall_collect a
         left join mall_user b on a.user_id = b.id
         left join mall_goods c on a.value_id = c.id
+        LEFT JOIN mall_merch_user d ON a.user_id=d.user_id
         WHERE 1=1
+        <if test="storeId != null">
+            and d.store_id = #{storeId}
+        </if>
+        <if test="merchSn != null and merchSn.trim() != ''">
+            and d.merch_sn = #{merchSn}
+        </if>
         <if test="name != null and name != ''">
             AND b.username LIKE concat('%',#{name},'%')
         </if>
@@ -42,9 +50,16 @@
     </select>
 
     <select id="queryTotal" resultType="int">
-		select count(a.id) from mall_collect a
+		select count(distinct a.id) from mall_collect a
         left join mall_user b on a.user_id = b.id
+        LEFT JOIN mall_merch_user d ON a.user_id=d.user_id
         WHERE 1=1
+        <if test="storeId != null">
+            and d.store_id = #{storeId}
+        </if>
+        <if test="merchSn != null and merchSn.trim() != ''">
+            and d.merch_sn = #{merchSn}
+        </if>
         <if test="name != null and name != ''">
             AND b.username LIKE concat('%',#{name},'%')
         </if>

+ 17 - 2
kmall-admin/src/main/resources/mybatis/mapper/FootprintDao.xml

@@ -18,11 +18,19 @@
 	</select>
 
     <select id="queryList" resultMap="footprintMap">
-        select a.* ,b.nickname as user_name,c.name as goods_name
+        select distinct
+          a.* ,b.nickname as user_name,c.name as goods_name
         from mall_footprint a
         left join mall_user b on a.user_id = b.id
         left join mall_goods c on a.goods_id = c.id
+        LEFT JOIN mall_merch_user d ON a.user_id=d.user_id
         WHERE 1=1
+        <if test="storeId != null">
+            and d.store_id = #{storeId}
+        </if>
+        <if test="merchSn != null and merchSn.trim() != ''">
+            and d.merch_sn = #{merchSn}
+        </if>
         <if test="name != null and name != ''">
             AND b.username LIKE concat('%',#{name},'%')
         </if>
@@ -40,9 +48,16 @@
     </select>
 
     <select id="queryTotal" resultType="int">
-		select count(a.id) from mall_footprint a
+		select count(distinct a.id) from mall_footprint a
         left join mall_user b on a.user_id = b.id
+        LEFT JOIN mall_merch_user d ON a.user_id=d.user_id
         WHERE 1=1
+        <if test="storeId != null">
+            and d.store_id = #{storeId}
+        </if>
+        <if test="merchSn != null and merchSn.trim() != ''">
+            and d.merch_sn = #{merchSn}
+        </if>
         <if test="name != null and name != ''">
             AND b.username LIKE concat('%',#{name},'%')
         </if>

+ 19 - 2
kmall-admin/src/main/resources/mybatis/mapper/SearchHistoryDao.xml

@@ -18,9 +18,17 @@
 	</select>
 
     <select id="queryList" resultMap="searchHistoryMap">
-        select a.* ,b.nickname as user_name
+        select distinct a.* ,b.nickname as user_name
         from mall_search_history a
         left join mall_user b on a.user_id = b.id
+        LEFT JOIN mall_merch_user d ON a.user_id=d.user_id
+        where 1=1
+        <if test="storeId != null">
+            and d.store_id = #{storeId}
+        </if>
+        <if test="merchSn != null and merchSn.trim() != ''">
+            and d.merch_sn = #{merchSn}
+        </if>
         <choose>
             <when test="sidx != null and sidx.trim() != ''">
                 order by ${sidx} ${order}
@@ -35,7 +43,16 @@
     </select>
 
     <select id="queryTotal" resultType="int">
-		select count(*) from mall_search_history
+		select count(distinct a.id)
+		from mall_search_history a
+        LEFT JOIN mall_merch_user d ON a.user_id=d.user_id
+        where 1=1
+        <if test="storeId != null">
+            and d.store_id = #{storeId}
+        </if>
+        <if test="merchSn != null and merchSn.trim() != ''">
+            and d.merch_sn = #{merchSn}
+        </if>
 	</select>
 
     <insert id="save" parameterType="com.kmall.admin.entity.SearchHistoryEntity" useGeneratedKeys="true" keyProperty="id">

+ 3 - 6
kmall-admin/src/main/resources/mybatis/mapper/SysCusNationCodeDao.xml

@@ -106,8 +106,7 @@
 			`creater_sn`,
 			`create_time`,
 			`moder_sn`,
-			`mod_time`,
-			`tstm`)
+			`mod_time`)
 		values(
 			#{sn},
 			#{code},
@@ -119,8 +118,7 @@
 			#{createrSn},
 			#{createTime},
 			#{moderSn},
-			#{modTime},
-			#{tstm})
+			#{modTime})
 	</insert>
 	 
 	<update id="update" parameterType="com.kmall.admin.entity.SysCusNationCodeEntity">
@@ -135,8 +133,7 @@
 			<if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
 			<if test="createTime != null">`create_time` = #{createTime}, </if>
 			<if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
-			<if test="modTime != null">`mod_time` = #{modTime}, </if>
-			<if test="tstm != null">`tstm` = #{tstm}</if>
+			<if test="modTime != null">`mod_time` = #{modTime}</if>
 		</set>
 		where sn = #{sn}
 	</update>

+ 74 - 0
kmall-admin/src/main/webapp/WEB-INF/page/shop/syscusnationcode.html

@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>国别地区代码</title>
+    #parse("sys/header.html")
+</head>
+<body>
+<div id="rrapp" v-cloak>
+	<div v-show="showList">
+        <Row :gutter="16">
+            <div class="search-group">
+                <i-col span="4">
+                    <i-input v-model="q.name" @on-enter="query" placeholder="名称"/>
+                </i-col>
+                <i-button @click="query">查询</i-button>
+                <i-button @click="reloadSearch">重置</i-button>
+            </div>
+            <div class="buttons-group">
+                #if($shiro.hasPermission("syscusnationcode:save"))
+                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
+                #end
+                #if($shiro.hasPermission("syscusnationcode:update"))
+                <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
+                #end
+                #if($shiro.hasPermission("syscusnationcode:delete"))
+                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
+                #end
+            </div>
+        </Row>
+	    <table id="jqGrid"></table>
+	    <div id="jqGridPager"></div>
+    </div>
+
+    <Card v-show="!showList">
+        <p slot="title">{{title}}</p>
+		<i-form ref="formValidate" :model="sysCusNationCode" :rules="ruleValidate" :label-width="80">
+            <Form-item label="代码" prop="code">
+                <i-input v-model="sysCusNationCode.code" placeholder="代码"/>
+            </Form-item>
+            <Form-item label="名称(简称)" prop="name">
+                <i-input v-model="sysCusNationCode.name" placeholder="名称(简称)"/>
+            </Form-item>
+            <Form-item label="英文名(简称)" prop="ename">
+                <i-input v-model="sysCusNationCode.ename" placeholder="英文名(简称)"/>
+            </Form-item>
+            <Form-item label="优普税率类型" prop="discountsTaxType">
+                <i-input v-model="sysCusNationCode.discountsTaxType" placeholder="优普税率类型"/>
+            </Form-item>
+            <Form-item label="是否有效" prop="isValid">
+                <Radio-group v-model="sysCusNationCode.isValid">
+                    <Radio label="1">
+                        <span>无效</span>
+                    </Radio>
+                    <Radio label="0">
+                        <span>有效</span>
+                    </Radio>
+                </Radio-group>
+            </Form-item>
+            <Form-item label="备注" prop="remark">
+                <i-input v-model="sysCusNationCode.remark" placeholder="备注"/>
+            </Form-item>
+
+            <Form-item>
+                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
+                <i-button type="warning" @click="reload" style="margin-left: 8px"/>返回</i-button>
+                <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
+            </Form-item>
+        </i-form>
+	</Card>
+</div>
+
+<script src="${rc.contextPath}/js/shop/syscusnationcode.js?_${date.systemTime}"></script>
+</body>
+</html>

+ 164 - 0
kmall-admin/src/main/webapp/js/shop/syscusnationcode.js

@@ -0,0 +1,164 @@
+$(function () {
+    $("#jqGrid").jqGrid({
+        url: '../syscusnationcode/list',
+        datatype: "json",
+        colModel: [
+			{label: 'sn', name: 'sn', index: 'sn', key: true, hidden: true},
+			{label: '代码', name: 'code', index: 'code', width: 80},
+			{label: '名称(简称)', name: 'name', index: 'name', width: 80},
+			{label: '英文名(简称)', name: 'ename', index: 'ename', width: 80},
+			{label: '优普税率类型', name: 'discountsTaxType', index: 'discounts_tax_type', width: 80},
+            {
+                label: '是否有效',
+                name: 'isValid',
+                align: 'center',
+                index: 'is_valid',
+                width: '50px',
+                formatter: function (value) {
+                    if(value == 0){
+                        value = 1;
+                    }else if(value == 1){
+                        value = 0;
+                    }
+                    return transIsNot(value);
+                }
+            },
+            {label: '备注', name: 'remark', index: 'remark', width: 80}],
+		viewrecords: true,
+        height: 385,
+        rowNum: 10,
+        rowList: [10, 30, 50],
+        rownumbers: true,
+        rownumWidth: 25,
+        autowidth: true,
+        multiselect: true,
+        pager: "#jqGridPager",
+        jsonReader: {
+            root: "page.list",
+            page: "page.currPage",
+            total: "page.totalPage",
+            records: "page.totalCount"
+        },
+        prmNames: {
+            page: "page",
+            rows: "limit",
+            order: "order"
+        },
+        gridComplete: function () {
+            $("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
+        }
+    });
+});
+
+let vm = new Vue({
+	el: '#rrapp',
+	data: {
+        showList: true,
+        title: null,
+        sysCusNationCode: {code:'',name:'',ename:'',discountsTaxType:'',isValid:'',remark:''},
+		ruleValidate: {
+            code: [
+				{required: true, message: '代码不能为空', trigger: 'blur'}
+			],
+            name: [
+                {required: true, message: '名称(简称)不能为空', trigger: 'blur'}
+            ],
+            ename: [
+                {required: true, message: '英文名(简称)不能为空', trigger: 'blur'}
+            ]
+		},
+		q: {
+		    name: ''
+		}
+	},
+	methods: {
+		query: function () {
+			vm.reload();
+		},
+		add: function () {
+			vm.showList = false;
+			vm.title = "新增";
+			vm.sysCusNationCode = {};
+		},
+		update: function (event) {
+            let sn = getSelectedRow();
+			if (sn == null) {
+				return;
+			}
+			vm.showList = false;
+            vm.title = "修改";
+
+            vm.getInfo(sn)
+		},
+		saveOrUpdate: function (event) {
+            let url = vm.sysCusNationCode.sn == null ? "../syscusnationcode/save" : "../syscusnationcode/update";
+			$.ajax({
+				type: "POST",
+			    url: url,
+			    contentType: "application/json",
+			    data: JSON.stringify(vm.sysCusNationCode),
+                success: function (r) {
+                    if (r.code === 0) {
+                        alert('操作成功', function (index) {
+                            vm.reload();
+                        });
+                    } else {
+                        alert(r.msg);
+                    }
+                }
+			});
+		},
+		del: function (event) {
+            let sns = getSelectedRows();
+			if (sns == null){
+				return;
+			}
+
+			confirm('确定要删除选中的记录?', function () {
+				$.ajax({
+					type: "POST",
+				    url: "../syscusnationcode/delete",
+				    contentType: "application/json",
+				    data: JSON.stringify(sns),
+				    success: function (r) {
+						if (r.code == 0) {
+							alert('操作成功', function (index) {
+								$("#jqGrid").trigger("reloadGrid");
+							});
+						} else {
+							alert(r.msg);
+						}
+					}
+				});
+			});
+		},
+		getInfo: function(sn){
+			$.get("../syscusnationcode/info/"+sn, function (r) {
+                vm.sysCusNationCode = r.sysCusNationCode;
+            });
+		},
+        reloadSearch: function() {
+            vm.q = {
+                name: ''
+            }
+            vm.reload();
+		},
+		reload: function (event) {
+			vm.showList = true;
+            let page = $("#jqGrid").jqGrid('getGridParam', 'page');
+			$("#jqGrid").jqGrid('setGridParam', {
+                postData: {'name': vm.q.name},
+                page: page
+            }).trigger("reloadGrid");
+            vm.handleReset('formValidate');
+		},
+        handleSubmit: function (name) {
+            handleSubmitValidate(this, name, function () {
+                vm.saveOrUpdate()
+            });
+        },
+        handleReset: function (name) {
+            handleResetForm(this, name);
+        }
+	}
+});

+ 13 - 0
kmall-common/src/main/java/com/kmall/common/constant/TablePrimaryKeyPrefix.java

@@ -0,0 +1,13 @@
+package com.kmall.common.constant;
+
+/**
+ * 表主键前缀
+ *
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-09-19 15:09
+ */
+public class TablePrimaryKeyPrefix {
+    //国别地区代码
+    public static final String sys_cus_nation_code = "scnc";
+}

+ 31 - 0
kmall-common/src/main/java/com/kmall/common/utils/RandomUtils.java

@@ -0,0 +1,31 @@
+package com.kmall.common.utils;
+
+import java.util.Random;
+
+/**
+ * /**
+ * 随机数工具类
+ *
+ * @author zhangjun
+ * @version 1.0.0
+ * 2018-12-07 16:00
+ */
+public class RandomUtils {
+
+    /**
+     * 获取一个指定位数的随机数
+     *
+     * @param bit 指定位数
+     * @return 随机数
+     */
+    public static String getNum(int bit) {
+        if (bit > 0) {
+            StringBuffer sb = new StringBuffer();
+            for (int i = 0; i < bit; i++) {
+                sb.append(new Random().nextInt(10));
+            }
+            return sb.toString();
+        }
+        return null;
+    }
+}