springmvc映射的牛头不对马嘴的原因
来源:互联网 发布:日语汉字注音软件 编辑:程序博客网 时间:2024/06/15 01:36
我要实现的一个需求是 实体类里面
/**
* 队伍类型
*/
private DictData teamType;
/**
* 队伍所属单位
*/
private Unit unit;
不管该队友所属的单位是什么 只要队伍类型 是2的话 就让页面上对应的显示国家队 话不多说看代码
实体类里面
public Unit getUnit() {
if(teamType!=null&&"2".equals(this.teamType.getCode())){
if(this.unit == null)
this.unit = new Unit();
this.unit.setName("国家队");
}
return unit;
}
因为队伍类型是数据字典 又与性别的重复了 因此单独写出来
<association column="a_t_ranking_team_type_" property="teamType" columnPrefix="tt_"
resultMap="teamTypeDictDataResultMap" />
<association column="a_t_ranking_gender_" property="gender"
resultMap="com.jiuhua.smjFrame.system.dao.DictDataMapper.DictDataResultMap" />
1 <!-- 队伍类型 的数据字典-->
<resultMap id="teamTypeDictDataResultMap" type="com.jiuhua.smjFrame.system.entity.DictData">
<id column="dictData1_id_" jdbcType="VARCHAR" property="id" />
<result column="dictData1_code_" jdbcType="VARCHAR" property="code" />
<result column="dictData1_name_" jdbcType="VARCHAR" property="name" />
<result column="dictData1_index_" jdbcType="INTEGER" property="index" />
</resultMap>
上面加粗的字段会直接给<result column 加上前缀
2 <!-- teamTypeDictDataResultMap -->
<sql id="DictData_Column_List1">
t_dict_data1.ID_ tt_dictData1_id_, t_dict_data1.CODE_ tt_dictData1_code_, t_dict_data1.NAME_ tt_dictData1_name_, t_dict_data1.INDEX_ tt_dictData1_index_,
</sql>
1和2 是对应者着的
这个与上面也是对应者的
left join sys_dict_data t_dict_data1 on t_athlete_ranking.team_type_ = t_dict_data1.id_
好了至此已经写完了 写程序要讲究有头有尾巴
- springmvc映射的牛头不对马嘴的原因
- springmvc的出现原因
- SpringMVC的参数映射问题
- springmvc 事务不起作用的原因
- 非注解的SpringMVC的映射器
- 可能产生映射混乱的原因
- SpringMVC路径映射的四种做法
- SpringMVC的Handler处理及url映射
- SpringMVC的Handler处理及url映射
- SpringMVC的Handler处理及url映射
- SpringMVC的Handler处理及url映射
- SpringMVC+WebSocket的通用接口映射实现
- SpringMVC注解的映射器和适配器
- springmvc默认忽视后缀的映射规则
- 关于springmvc的静态资源映射问题
- SpringMVC三种映射处理器的用法
- SpringMVC的处理映射器使用
- springMVC的dispatcherServlet访问路径映射问题
- SpringBoot添加freemarker模板引擎
- 文本操作类SpannableString的使用
- 喵星球上的点名
- SQLite学习手册(锁和并发控制)
- n皇后问题
- springmvc映射的牛头不对马嘴的原因
- Mac系统安装Lua
- 000032:将两个数相加的结果输出
- 两个有序链表序列的合并 PAT
- Xcode下载低版本iOS系统模拟器进行调试
- 恶补系列之操作系统——内核态与用户态
- c语言数据类型及printf
- 图邻接表数组存储
- SQLite学习手册(实例代码<一>)