This commit is contained in:
20932067@zju.edu.cn 2021-01-22 21:01:14 +08:00
parent 3b4192b848
commit eb5f3e8884
7 changed files with 209 additions and 175 deletions

View File

@ -55,8 +55,7 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['test:stu:add']" v-hasPermi="['test:stu:add']"
>新增 >新增</el-button>
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -67,8 +66,7 @@
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['test:stu:edit']" v-hasPermi="['test:stu:edit']"
>修改 >修改</el-button>
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -79,8 +77,7 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['test:stu:remove']" v-hasPermi="['test:stu:remove']"
>删除 >删除</el-button>
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -90,8 +87,7 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['test:stu:export']" v-hasPermi="['test:stu:export']"
>导出 >导出</el-button>
</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
@ -110,16 +106,14 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['test:stu:edit']" v-hasPermi="['test:stu:edit']"
>修改 >修改</el-button>
</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['test:stu:remove']" v-hasPermi="['test:stu:remove']"
>删除 >删除</el-button>
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -158,7 +152,8 @@
export default { export default {
name: "Stu", name: "Stu",
components: {}, components: {
},
data() { data() {
return { return {
// //
@ -188,7 +183,7 @@
name: null, name: null,
tel: null, tel: null,
email: null, email: null,
createTime: null createTime: null,
}, },
// //
form: {}, form: {},
@ -203,11 +198,7 @@
], ],
email: [ email: [
{ required: true, message: "电子邮件不能为空}", trigger: "blur" }, { required: true, message: "电子邮件不能为空}", trigger: "blur" },
{ { pattern: /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/, message: '电子邮件格式有误', trigger:"blur"},
pattern: /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/,
message: '电子邮件格式有误',
trigger: "blur"
},
], ],
} }
}; };
@ -237,7 +228,10 @@
name: null, name: null,
tel: null, tel: null,
email: null, email: null,
createTime: null createTime: null,
createBy: null,
updateTime: null,
updateBy: null
}; };
this.resetForm("form"); this.resetForm("form");
}, },

View File

@ -5,6 +5,7 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
@ -48,6 +49,11 @@ public class BaseEntity implements Serializable {
*/ */
private String remark; private String remark;
/**
* 参数
*/
private String parameter;
/** /**
* 开始时间 * 开始时间
*/ */
@ -65,6 +71,15 @@ public class BaseEntity implements Serializable {
*/ */
private Map<String, Object> params; private Map<String, Object> params;
public void setParameter(String parameter) {
if (parameter != null || parameter.equals("")) {
this.parameter = parameter;
JSONObject jsonObject = JSONObject.parseObject(parameter);
params = new HashMap<>();
params.put("",jsonObject.get(""));
}
}
public String getSearchValue() { public String getSearchValue() {
return searchValue; return searchValue;
} }

View File

@ -9,6 +9,10 @@ import com.hchyun.common.constant.ReturnConstants;
import com.hchyun.common.utils.DateUtils; import com.hchyun.common.utils.DateUtils;
#break #break
#end #end
#if($column.javaField == 'updateBy' || $column.javaField == 'createBy')
import com.hchyun.common.utils.SecurityUtils;
#break
#end
#end #end
import com.hchyun.common.utils.ServerResult; import com.hchyun.common.utils.ServerResult;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -134,8 +138,8 @@ public class ${ClassName}ServiceImpl implements ${ClassName}Service {
#if($column.javaField == 'updateTime') #if($column.javaField == 'updateTime')
${className}.setUpdateTime(DateUtils.getNowDate()); ${className}.setUpdateTime(DateUtils.getNowDate());
#end #end
#if($column.javaField == 'createBy') #if($column.javaField == 'updateBy')
${className}.setCreateBy(SecurityUtils.getUserId()); ${className}.setUpdateBy(SecurityUtils.getUserId());
#end #end
#end #end
#if($table.sub) #if($table.sub)

View File

@ -399,7 +399,7 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.query) #if($column.query && $column.htmlType != "datetime" && $column.queryType != "BETWEEN")
$column.javaField: null#if($velocityCount != $columns.size()),#end $column.javaField: null#if($velocityCount != $columns.size()),#end
#end #end
@ -488,6 +488,7 @@ export default {
reset() { reset() {
this.form = { this.form = {
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType != "datetime" && $column.queryType != "BETWEEN")
#if($column.htmlType == "radio") #if($column.htmlType == "radio")
$column.javaField: #if($column.javaType == "Integer" || $column.javaType == "Long")0#else"0"#end#if($velocityCount != $columns.size()),#end $column.javaField: #if($column.javaType == "Integer" || $column.javaType == "Long")0#else"0"#end#if($velocityCount != $columns.size()),#end
@ -497,6 +498,7 @@ export default {
#else #else
$column.javaField: null#if($velocityCount != $columns.size()),#end $column.javaField: null#if($velocityCount != $columns.size()),#end
#end
#end #end
#end #end
}; };

View File

@ -75,6 +75,9 @@ public class Stu extends BaseEntity
.append("tel", getTel()) .append("tel", getTel())
.append("email", getEmail()) .append("email", getEmail())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.append("updateTime", getUpdateTime())
.append("updateBy", getUpdateBy())
.toString(); .toString();
} }
} }

View File

@ -5,6 +5,7 @@ import java.util.List;
import com.hchyun.common.constant.ReturnConstants; import com.hchyun.common.constant.ReturnConstants;
import com.hchyun.common.utils.DateUtils; import com.hchyun.common.utils.DateUtils;
import com.hchyun.common.utils.SecurityUtils;
import com.hchyun.common.utils.ServerResult; import com.hchyun.common.utils.ServerResult;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -79,6 +80,7 @@ public class StuServiceImpl implements StuService {
public ServerResult<Integer> insertStu(Stu stu) { public ServerResult<Integer> insertStu(Stu stu) {
try { try {
stu.setCreateTime(DateUtils.getNowDate()); stu.setCreateTime(DateUtils.getNowDate());
stu.setCreateBy(SecurityUtils.getUserId());
Integer renewal = stuDao.insertStu(stu); Integer renewal = stuDao.insertStu(stu);
if (renewal >0){ if (renewal >0){
return new ServerResult<Integer>(true,renewal); return new ServerResult<Integer>(true,renewal);
@ -100,6 +102,8 @@ public class StuServiceImpl implements StuService {
@Override @Override
public ServerResult<Integer> updateStu(Stu stu) { public ServerResult<Integer> updateStu(Stu stu) {
try { try {
stu.setUpdateTime(DateUtils.getNowDate());
stu.setUpdateBy(SecurityUtils.getUserId());
Integer renewal = stuDao.updateStu(stu); Integer renewal = stuDao.updateStu(stu);
if (renewal >0){ if (renewal >0){
return new ServerResult<Integer>(true,renewal); return new ServerResult<Integer>(true,renewal);

View File

@ -10,18 +10,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="tel" column="tel" /> <result property="tel" column="tel" />
<result property="email" column="email" /> <result property="email" column="email" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
</resultMap> </resultMap>
<sql id="selectStuVo"> <sql id="selectStuVo">
select id, name, tel, email, create_time from sys_stu select id, name, tel, email, create_time, create_by, update_time, update_by from sys_stu
</sql> </sql>
<select id="selectStuList" parameterType="Stu" resultMap="StuResult"> <select id="selectStuList" parameterType="Stu" resultMap="StuResult">
<include refid="selectStuVo"/> <include refid="selectStuVo"/>
<where> <where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="tel != null "> and tel = #{tel}</if> <if test="tel != null "> and tel like concat('%', #{tel}, '%')</if>
<if test="email != null and email != ''"> and email = #{email}</if> <if test="email != null and email != ''"> and email like concat('%', #{email}, '%')</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if> <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
</where> </where>
</select> </select>
@ -38,12 +41,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="tel != null">tel,</if> <if test="tel != null">tel,</if>
<if test="email != null and email != ''">email,</if> <if test="email != null and email != ''">email,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if> <if test="name != null and name != ''">#{name},</if>
<if test="tel != null">#{tel},</if> <if test="tel != null">#{tel},</if>
<if test="email != null and email != ''">#{email},</if> <if test="email != null and email != ''">#{email},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim> </trim>
</insert> </insert>
@ -54,6 +63,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="tel != null">tel = #{tel},</if> <if test="tel != null">tel = #{tel},</if>
<if test="email != null and email != ''">email = #{email},</if> <if test="email != null and email != ''">email = #{email},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>