提交 4b9bc6a1 authored 作者: 吴德鹏's avatar 吴德鹏

国家管理

上级 99dec99f
package com.platform.controller; package com.platform.controller;
import com.platform.annotation.IgnoreAuth;
import com.platform.entity.CountryEntity; import com.platform.entity.CountryEntity;
import com.platform.service.CountryService; import com.platform.service.CountryService;
import com.platform.utils.PageUtils; import com.platform.utils.PageUtils;
...@@ -62,6 +63,7 @@ public class CountryController { ...@@ -62,6 +63,7 @@ public class CountryController {
/** /**
* 保存 * 保存
*/ */
@IgnoreAuth
@RequestMapping("/save") @RequestMapping("/save")
@RequiresPermissions("country:save") @RequiresPermissions("country:save")
@ResponseBody @ResponseBody
......
...@@ -8,7 +8,7 @@ import java.util.Date; ...@@ -8,7 +8,7 @@ import java.util.Date;
* 表名 country * 表名 country
* *
* @author lipengjun * @author lipengjun
* @date 2020-08-27 19:16:32 * @date 2021-01-14 08:18:53
*/ */
public class CountryEntity implements Serializable { public class CountryEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -21,6 +21,18 @@ public class CountryEntity implements Serializable { ...@@ -21,6 +21,18 @@ public class CountryEntity implements Serializable {
* 国家名称 * 国家名称
*/ */
private String countryName; private String countryName;
/**
* 国家(中文)
*/
private String countryCname;
/**
* 区号
*/
private String areaCode;
/**
* 国旗
*/
private String nationalFlag;
/** /**
* 状态 0:删除 1:正常 * 状态 0:删除 1:正常
*/ */
...@@ -60,6 +72,45 @@ public class CountryEntity implements Serializable { ...@@ -60,6 +72,45 @@ public class CountryEntity implements Serializable {
public String getCountryName() { public String getCountryName() {
return countryName; return countryName;
} }
/**
* 设置:国家(中文)
*/
public void setCountryCname(String countryCname) {
this.countryCname = countryCname;
}
/**
* 获取:国家(中文)
*/
public String getCountryCname() {
return countryCname;
}
/**
* 设置:区号
*/
public void setAreaCode(String areaCode) {
this.areaCode = areaCode;
}
/**
* 获取:区号
*/
public String getAreaCode() {
return areaCode;
}
/**
* 设置:国旗
*/
public void setNationalFlag(String nationalFlag) {
this.nationalFlag = nationalFlag;
}
/**
* 获取:国旗
*/
public String getNationalFlag() {
return nationalFlag;
}
/** /**
* 设置:状态 0:删除 1:正常 * 设置:状态 0:删除 1:正常
*/ */
......
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
<resultMap type="com.platform.entity.CountryEntity" id="countryMap"> <resultMap type="com.platform.entity.CountryEntity" id="countryMap">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="countryName" column="country_name"/> <result property="countryName" column="country_name"/>
<result property="countryCname" column="country_cname"/>
<result property="areaCode" column="area_code"/>
<result property="nationalFlag" column="national_flag"/>
<result property="status" column="status"/> <result property="status" column="status"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/> <result property="updateTime" column="update_time"/>
...@@ -15,6 +18,9 @@ ...@@ -15,6 +18,9 @@
select select
`id`, `id`,
`country_name`, `country_name`,
`country_cname`,
`area_code`,
`national_flag`,
`status`, `status`,
`create_time`, `create_time`,
`update_time` `update_time`
...@@ -26,20 +32,23 @@ ...@@ -26,20 +32,23 @@
select select
`id`, `id`,
`country_name`, `country_name`,
`country_cname`,
`area_code`,
`national_flag`,
`status`, `status`,
`create_time`, `create_time`,
`update_time` `update_time`
from country from country
WHERE 1=1 WHERE 1=1
<if test="name != null and name.trim() != ''"> <if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%') AND (country_name LIKE concat('%',#{name},'%') or country_cname LIKE concat('%',#{name},'%'))
</if> </if>
<choose> <choose>
<when test="sidx != null and sidx.trim() != ''"> <when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order} order by ${sidx} ${order}
</when> </when>
<otherwise> <otherwise>
order by id desc order by isnull(sort), sort asc ,country_name asc
</otherwise> </otherwise>
</choose> </choose>
<if test="offset != null and limit != null"> <if test="offset != null and limit != null">
...@@ -51,7 +60,7 @@ ...@@ -51,7 +60,7 @@
select count(*) from country select count(*) from country
WHERE 1=1 WHERE 1=1
<if test="name != null and name.trim() != ''"> <if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%') AND (country_name LIKE concat('%',#{name},'%') or country_cname LIKE concat('%',#{name},'%'))
</if> </if>
</select> </select>
...@@ -59,12 +68,18 @@ ...@@ -59,12 +68,18 @@
insert into country( insert into country(
`id`, `id`,
`country_name`, `country_name`,
`country_cname`,
`area_code`,
`national_flag`,
`status`, `status`,
`create_time`, `create_time`,
`update_time`) `update_time`)
values( values(
#{id}, #{id},
#{countryName}, #{countryName},
#{countryCname},
#{areaCode},
#{nationalFlag},
#{status}, #{status},
#{createTime}, #{createTime},
#{updateTime}) #{updateTime})
...@@ -73,9 +88,12 @@ ...@@ -73,9 +88,12 @@
<update id="update" parameterType="com.platform.entity.CountryEntity"> <update id="update" parameterType="com.platform.entity.CountryEntity">
update country update country
<set> <set>
<if test="countryName != null">`country_name` = #{countryName}, </if> <if test="countryName != null">`country_name` = #{countryName},</if>
<if test="status != null">`status` = #{status}, </if> <if test="countryCname != null">`country_cname` = #{countryCname},</if>
<if test="createTime != null">`create_time` = #{createTime}, </if> <if test="areaCode != null">`area_code` = #{areaCode},</if>
<if test="nationalFlag != null">`national_flag` = #{nationalFlag},</if>
<if test="status != null">`status` = #{status},</if>
<if test="createTime != null">`create_time` = #{createTime},</if>
<if test="updateTime != null">`update_time` = #{updateTime}</if> <if test="updateTime != null">`update_time` = #{updateTime}</if>
</set> </set>
where id = #{id} where id = #{id}
......
...@@ -33,8 +33,35 @@ ...@@ -33,8 +33,35 @@
<Card v-show="!showList"> <Card v-show="!showList">
<p slot="title">{{title}}</p> <p slot="title">{{title}}</p>
<i-form ref="formValidate" :model="country" :rules="ruleValidate" :label-width="80"> <i-form ref="formValidate" :model="country" :rules="ruleValidate" :label-width="80">
<Form-item label="国家名称" prop="countryName"> <Form-item label="国家(英文)" prop="countryName" style="width: 800px">
<i-input v-model="country.countryName" placeholder="国家名称"/> <i-input v-model="country.countryName" placeholder="国家(英文)"/>
</Form-item>
<Form-item label="国家(中文)" prop="countryCname" style="width: 800px">
<i-input v-model="country.countryCname" placeholder="国家(中文)" />
</Form-item>
<Form-item label="区号" prop="areaCode" style="width: 800px">
<i-input v-model="country.areaCode" placeholder="区号"/>
</Form-item>
<!-- <Form-item label="国旗" prop="nationalFlag" style="width: 800px">-->
<!-- <i-input v-model="country.nationalFlag" placeholder="国旗"/>-->
<!-- </Form-item>-->
<Form-item label="国旗" prop="nationalFlag" >
<!-- <i-input v-model="xPicture.pictureUrl" placeholder="图片地址"/> -->
<upload
multiple
action="../api/osstest/uploadtest"
:before-upload="handleBeforeUpload"
:on-success="vhandleSuccess" :show-upload-list="false" accept="image/jpeg, image/png">
<i-button icon="ios-cloud-upload-outline">请选择图片</i-button>
</upload>
<div id="imgWrapper" style="display: flex;position: relative;">
<div v-for="item in uploadList" style="margin-left: 5px;" :data-img-path="item">
<img :src="item" width="100" height="100" id="itemImg">
<i class="ivu-icon ivu-icon-ios-trash-outline"
style="cursor:pointer;display: flex;font-size: 24px;position: relative;left:11px"
@click="delImg1(item)"></i>
</div>
</div>
</Form-item> </Form-item>
<Form-item> <Form-item>
<i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button> <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
......
...@@ -3,8 +3,11 @@ $(function () { ...@@ -3,8 +3,11 @@ $(function () {
url: '../country/list', url: '../country/list',
colModel: [ colModel: [
{label: 'id', name: 'id', index: 'id', key: true, hidden: true}, {label: 'id', name: 'id', index: 'id', key: true, hidden: true},
{label: '国家名称', name: 'countryName', index: 'country_name', width: 80}, {label: '国旗', name: 'nationalFlag', index: 'national_flag', width: 80, formatter: imageFormat},
{label: '状态', name: 'status', index: 'status', width: 80,formatter:statusFormat1}, {label: '国家(英文)', name: 'countryName', index: 'country_name', width: 80},
{label: '国家(中文)', name: 'countryCname', index: 'country_cname', width: 80},
{label: '区号', name: 'areaCode', index: 'area_code', width: 80},
{label: '状态', name: 'status', index: 'status', width: 80, formatter: statusFormat1},
{label: '创建时间', name: 'createTime', index: 'create_time', width: 80} {label: '创建时间', name: 'createTime', index: 'create_time', width: 80}
] ]
}); });
...@@ -13,6 +16,7 @@ $(function () { ...@@ -13,6 +16,7 @@ $(function () {
let vm = new Vue({ let vm = new Vue({
el: '#rrapp', el: '#rrapp',
data: { data: {
uploadList: [],
showList: true, showList: true,
title: null, title: null,
country: {}, country: {},
...@@ -46,6 +50,7 @@ let vm = new Vue({ ...@@ -46,6 +50,7 @@ let vm = new Vue({
}, },
saveOrUpdate: function (event) { saveOrUpdate: function (event) {
let url = vm.country.id == null ? "../country/save" : "../country/update"; let url = vm.country.id == null ? "../country/save" : "../country/update";
vm.country.nationalFlag = vm.uploadList[0];
Ajax.request({ Ajax.request({
url: url, url: url,
params: JSON.stringify(vm.country), params: JSON.stringify(vm.country),
...@@ -60,7 +65,7 @@ let vm = new Vue({ ...@@ -60,7 +65,7 @@ let vm = new Vue({
}, },
del: function (event) { del: function (event) {
let ids = getSelectedRows("#jqGrid"); let ids = getSelectedRows("#jqGrid");
if (ids == null){ if (ids == null) {
return; return;
} }
...@@ -78,12 +83,89 @@ let vm = new Vue({ ...@@ -78,12 +83,89 @@ let vm = new Vue({
}); });
}); });
}, },
getInfo: function(id){ vhandleSuccess(response, file, fileList) {
// "http://diaosaas-prod.oss-cn-shenzhen.aliyuncs.com/education/155728894307110106.jpg"
console.log('shangchuan', response)
vm.uploadList.push(response);
$("#itemImg").show();
},
handleSuccess(response, file, fileList) {
// "http://diaosaas-prod.oss-cn-shenzhen.aliyuncs.com/education/155728894307110106.jpg"
vm.uploadList1.push(response);
$("#skuImg").show();
},
handleBeforeUpload(file) {
// 上传图片大小不超过5M
if (file.size > 5 * 1024 * 1024) {
alert('请上传不超过5M的图片');
return false;
}
// const check = this.uploadList.length < 1;
// if (!check) {
// this.$Notice.warning({
// title: '最多只能上传一张图片'
// });
// return false;
// }
// 限制上传文件的宽高
// return this.checkImageWH(file,750,320);
},
// 限制上传图片的宽高
checkImageWH: function (file, width, height) {
let self = this;
return new Promise(function (resolve, reject) {
let filereader = new FileReader();
filereader.onload = e => {
let src = e.target.result;
const image = new Image();
image.onload = function () {
if (width && image.width != width) {
self.$Notice.error({
title: '请上传宽为' + width + "的图片",
});
reject();
} else if (height && image.height != height) {
self.$Notice.error({
title: '请上传高为' + height + "的图片",
});
reject();
} else {
resolve();
}
};
image.onerror = reject;
image.src = src;
};
filereader.readAsDataURL(file);
});
},
// 删除上传图片
delImg1: function (url) {
if (vm.title != "详情") {
vm.uploadList.remove(url);
console.log(url);
Ajax.request({
url: "../api/upload/delFile?url=" + url,
async: false,
type: "POST",
contentType: "application/json",
successCallback: function (resultData) {
// console.log(resultData);
iview.Message.success(resultData.success);
}
});
}
},
getInfo: function (id) {
vm.uploadList=[];
Ajax.request({ Ajax.request({
url: "../country/info/"+id, url: "../country/info/" + id,
async: true, async: true,
successCallback: function (r) { successCallback: function (r) {
vm.country = r.country; vm.country = r.country;
vm.uploadList.push(vm.country.nationalFlag);
} }
}); });
}, },
...@@ -96,7 +178,7 @@ let vm = new Vue({ ...@@ -96,7 +178,7 @@ let vm = new Vue({
}).trigger("reloadGrid"); }).trigger("reloadGrid");
vm.handleReset('formValidate'); vm.handleReset('formValidate');
}, },
reloadSearch: function() { reloadSearch: function () {
vm.q = { vm.q = {
name: '' name: ''
}; };
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论