main
tamguo 7 years ago
parent a81d4929fa
commit 0ac287738d

@ -4,6 +4,10 @@ import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
import com.tamguo.modules.sys.model.enums.SysPostStatusEnum; import com.tamguo.modules.sys.model.enums.SysPostStatusEnum;
@ -13,9 +17,10 @@ import com.tamguo.modules.sys.model.enums.SysPostStatusEnum;
* *
*/ */
@TableName(value="sys_post") @TableName(value="sys_post")
public class SysPostEntity implements Serializable { public class SysPostEntity extends Model<SysPostEntity> implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId
private String postCode; private String postCode;
private String corpCode; private String corpCode;
private String corpName; private String corpName;
@ -25,6 +30,8 @@ public class SysPostEntity implements Serializable {
private BigDecimal postSort; private BigDecimal postSort;
private String postType; private String postType;
private String remarks; private String remarks;
@JSONField(serialzeFeatures= SerializerFeature.WriteEnumUsingToString)
private SysPostStatusEnum status; private SysPostStatusEnum status;
private String updateBy; private String updateBy;
private Date updateDate; private Date updateDate;
@ -128,4 +135,9 @@ public class SysPostEntity implements Serializable {
this.updateDate = updateDate; this.updateDate = updateDate;
} }
@Override
protected Serializable pkVal() {
return getPostCode();
}
} }

@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.enums.IEnum;
*/ */
public enum SysPostStatusEnum implements IEnum { public enum SysPostStatusEnum implements IEnum {
NORMAL("normal", "正常"), NORMAL("normal", "正常"),
DISABLED("disable" , "用"); DISABLED("disable" , "用");
private String value; private String value;
private String desc; private String desc;

@ -13,6 +13,7 @@ import com.tamguo.modules.sys.model.SysPostEntity;
import com.tamguo.modules.sys.model.condition.SysPostCondition; import com.tamguo.modules.sys.model.condition.SysPostCondition;
import com.tamguo.modules.sys.model.enums.SysPostStatusEnum; import com.tamguo.modules.sys.model.enums.SysPostStatusEnum;
import com.tamguo.modules.sys.service.ISysPostService; import com.tamguo.modules.sys.service.ISysPostService;
import com.tamguo.modules.sys.utils.ShiroUtils;
@Service @Service
public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPostEntity> implements ISysPostService{ public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPostEntity> implements ISysPostService{
@ -30,6 +31,8 @@ public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPostEntity
@Override @Override
public void add(SysPostEntity post) { public void add(SysPostEntity post) {
post.setCreateDate(new Date()); post.setCreateDate(new Date());
post.setCreateBy(ShiroUtils.getUserCode());
post.setUpdateBy(ShiroUtils.getUserCode());
post.setUpdateDate(new Date()); post.setUpdateDate(new Date());
post.setStatus(SysPostStatusEnum.NORMAL); post.setStatus(SysPostStatusEnum.NORMAL);
sysPostMapper.insert(post); sysPostMapper.insert(post);
@ -38,8 +41,16 @@ public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPostEntity
@Transactional(readOnly=false) @Transactional(readOnly=false)
@Override @Override
public void update(SysPostEntity post) { public void update(SysPostEntity post) {
post.setUpdateDate(new Date()); SysPostEntity entity = sysPostMapper.selectById(post.getPostCode());
sysPostMapper.updateById(post); entity.setUpdateDate(new Date());
entity.setUpdateBy(ShiroUtils.getUserCode());
entity.setPostName(post.getPostName());
entity.setPostCode(post.getPostCode());
entity.setPostType(post.getPostType());
entity.setPostSort(post.getPostSort());
entity.setRemarks(post.getRemarks());
sysPostMapper.updateById(entity);
} }
} }

@ -35,8 +35,8 @@ content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/>
<label class="control-label col-sm-4">上级公司:</label> <label class="control-label col-sm-4">上级公司:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<div class="input-group treeselect" id="parentDiv" data-url="sys/company/treeData?excludeCode=SD"> <div class="input-group treeselect" id="parentDiv" data-url="sys/company/treeData?excludeCode=SD">
<input id="parentCode" type="hidden" name="parentCode" th:value="${parentCompany.companyCode}" class="isReset"/> <input id="parentCode" type="hidden" name="parentCode" th:value="${parentCompany == null} ? '' : ${parentCompany.companyCode}" class="isReset"/>
<input id="parentName" type="text" name="parentName" th:value="${parentCompany.companyName}" <input id="parentName" type="text" name="parentName" th:value="${parentCompany == null} ? '' : ${parentCompany.companyName}"
class="form-control " readonly="readonly" class="form-control " readonly="readonly"
/><span class="input-group-btn"><a id="parentButton" href="javascript:" /><span class="input-group-btn"><a id="parentButton" href="javascript:"
class="btn btn-default "><i class="fa fa-search"></i></a> class="btn btn-default "><i class="fa fa-search"></i></a>

@ -35,8 +35,7 @@ content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/>
<label class="control-label col-sm-4" title=""> <label class="control-label col-sm-4" title="">
<span class="required ">*</span> 岗位名称:<i class="fa icon-question hide"></i></label> <span class="required ">*</span> 岗位名称:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8"> <div class="col-sm-8">
<input type="hidden" id="id" name="id" value=""/> <input type="text" id="postName" name="postName" value="" maxlength="100" class="form-control required "/>
<input type="text" id="name" name="name" value="" maxlength="100" class="form-control required "/>
</div> </div>
</div> </div>
</div> </div>
@ -46,7 +45,7 @@ content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/>
<span class="required ">*</span> 岗位编码:<i class="fa icon-question hide"></i></label> <span class="required ">*</span> 岗位编码:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8"> <div class="col-sm-8">
<input type="hidden" id="isNewRecord" name="isNewRecord" value="true"/> <input type="hidden" id="isNewRecord" name="isNewRecord" value="true"/>
<input type="text" id="code" name="code" value="" maxlength="64" class="form-control required abc"/> <input type="text" id="postCode" name="postCode" value="" maxlength="64" class="form-control required abc"/>
</div> </div>
</div> </div>
</div> </div>
@ -72,7 +71,7 @@ content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/>
<label class="control-label col-sm-4" title=""> <label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 排序号:<i class="fa icon-question hide"></i></label> <span class="required hide">*</span> 排序号:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8"> <div class="col-sm-8">
<input type="text" id="sorts" name="sorts" value="" maxlength="10" class="form-control digits"/> <input type="text" id="postSorts" name="postSorts" value="" maxlength="10" class="form-control digits"/>
</div> </div>
</div> </div>
</div> </div>

@ -116,15 +116,15 @@ $('#dataGrid').dataGrid({
{header:'状态', name:'status', index:'a.status', width:80, align:"center", formatter: function(val, obj, row, act){ {header:'状态', name:'status', index:'a.status', width:80, align:"center", formatter: function(val, obj, row, act){
if(val == "normal"){ if(val == "normal"){
return '正常'; return '正常';
}else if(val == "disabled"){ }else if(val == "disable"){
return '用'; return '用';
}else{ }else{
return '未知'; return '未知';
} }
}}, }},
{header:'操作', name:'actions', width:130, sortable:false, title:false, formatter: function(val, obj, row, act){ {header:'操作', name:'actions', width:130, sortable:false, title:false, formatter: function(val, obj, row, act){
var actions = []; var actions = [];
actions.push('<a href="'+ctx+'sys/post/update?id='+row.id+'" class="btnList" title="编辑岗位"><i class="fa fa-pencil"></i></a>&nbsp;'); actions.push('<a href="'+ctx+'sys/post/update?id='+row.postCode+'" class="btnList" title="编辑岗位"><i class="fa fa-pencil"></i></a>&nbsp;');
if (row.status == "normal"){ if (row.status == "normal"){
actions.push('<a href="'+ctx+'sys/post/detail?id='+row.id+'" class="btnList" title="停用岗位" data-confirm="确认要停用该岗位吗?"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;'); actions.push('<a href="'+ctx+'sys/post/detail?id='+row.id+'" class="btnList" title="停用岗位" data-confirm="确认要停用该岗位吗?"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
} }

@ -35,8 +35,8 @@ content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/>
<label class="control-label col-sm-4" title=""> <label class="control-label col-sm-4" title="">
<span class="required ">*</span> 岗位名称:<i class="fa icon-question hide"></i></label> <span class="required ">*</span> 岗位名称:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8"> <div class="col-sm-8">
<input type="hidden" id="id" name="id" th:value="${post.id}"/> <input type="hidden" id="postCode" name="postCode" th:value="${post.postCode}"/>
<input type="text" id="name" name="name" th:value="${post.name}" maxlength="100" class="form-control required "/> <input type="text" id="name" name="name" th:value="${post.postName}" maxlength="100" class="form-control required "/>
</div> </div>
</div> </div>
</div> </div>
@ -46,7 +46,7 @@ content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/>
<span class="required ">*</span> 岗位编码:<i class="fa icon-question hide"></i></label> <span class="required ">*</span> 岗位编码:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8"> <div class="col-sm-8">
<input type="hidden" id="isNewRecord" name="isNewRecord" value="true"/> <input type="hidden" id="isNewRecord" name="isNewRecord" value="true"/>
<input type="text" id="code" name="code" th:value="${post.code}" maxlength="64" class="form-control required abc"/> <input type="text" id="code" name="code" th:value="${post.postCode}" maxlength="64" class="form-control required abc"/>
</div> </div>
</div> </div>
</div> </div>
@ -59,10 +59,10 @@ content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/>
<div class="col-sm-8"> <div class="col-sm-8">
<select id="postType" name="postType" class="form-control "> <select id="postType" name="postType" class="form-control ">
<option value="">&nbsp;</option> <option value="">&nbsp;</option>
<option value="gaoguan" th:selected="${post.postType.value=='gaoguan'}? true : false">高管</option> <option value="gaoguan" th:selected="${post.postType=='gaoguan'}? true : false">高管</option>
<option value="zhongceng" th:selected="${post.postType.value=='zhongceng'}? true : false">中层</option> <option value="zhongceng" th:selected="${post.postType=='zhongceng'}? true : false">中层</option>
<option value="jiceng" th:selected="${post.postType.value=='jiceng'}? true : false">基层</option> <option value="jiceng" th:selected="${post.postType=='jiceng'}? true : false">基层</option>
<option value="qita" th:selected="${post.postType.value=='qita'}? true : false">其它</option> <option value="qita" th:selected="${post.postType=='qita'}? true : false">其它</option>
</select> </select>
</div> </div>
</div> </div>
@ -72,7 +72,7 @@ content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/>
<label class="control-label col-sm-4" title=""> <label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 排序号:<i class="fa icon-question hide"></i></label> <span class="required hide">*</span> 排序号:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8"> <div class="col-sm-8">
<input type="text" id="sorts" name="sorts" th:value="${post.sorts}" maxlength="10" class="form-control digits"/> <input type="text" id="sorts" name="sorts" th:value="${post.postSort}" maxlength="10" class="form-control digits"/>
</div> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save